Age | Commit message (Collapse) | Author |
|
|
|
equivalent 'update' editing command already is.
Avoids the destruction of the GPT when the preventative MBR
is overwritten with the default MBR.
ok deraadt@
|
|
protective EFI GPT partition to be in MBR partitions 0-3, not
just the default partition 0.
|
|
obvious "> 1". Use easier to spot 'ask_yn() == 0' instead of
'!ask_yn()'.
No functional change.
|
|
#define GTATTR_PROTECT and GTATTR_PROTECT_EFISYS as bits in it.
Use GTATTR_PROTECT to replace the magic value of '1' indicating
the partition is protected. Use GTATTR_PROTECT_EFISYS to replace
hack of checking for "APFS" string in the names of partitions
that want the EFI System (a.k.a. 0xEF) partition to be preserved.
More flexible and easier to extend protections to new partition
types or add new attributes to partition types.
No intentional functional change.
|
|
one easy to find spot. Wrap the long lines of gpt_types[] to
make room for future expansion.
No functional change.
|
|
simplify PRT_protected_guid() by comparing GUID's with
uuid_compare() rather than converting them to strings and using
strncmp().
Further clarify logic by doing the EFI Sys dance only if
the GUID being tested is not marked as protected.
No intentional functional change.
|
|
and PRT_type_to_uuid() to PRT_type_to_guid() so the names clearly match
the field names being searched for.
No intentional functional change.
|
|
"FAT12" for partition types that are mapped to GPT_UUID_MSDOS.
No intentional functional change.
|
|
blanks in the arrays of type names, simplifying the code and
making better use of printf().
Along the way discover that "APFS Recovery" fits, so nuke the
annoying "AFPS Recovry" contraction.
No intentional functional change.
Some "APFS Recovery" nits pointed out by jsg@
|
|
on input/initialization and back to little-endian when writing to
disk.
Easier to read the code when letoh*() and uuid_[enc|dec]_*
invocations are minimized.
No intentional functional change.
ok jmatthew@
|
|
and expose new DISK_[read|write]bytes() functions.
Eliminates many bytes <-> sector i/o dances and makes the code
much easier to understand.
Be a bit more careful to consistently write only bytes that
checksums are calculated over.
No intentional functional change.
|
|
the GPT and calculating them when writing the GPT to disk.
No need to update them in add_partition().
Pointed out by jmatthew@
|
|
interest is checked, not before.
Less confusing error messages.
|
|
big-endian architectures too.
|
|
that the partition entry table associated with the primary GPT
header at sector 1 doesn't overwrite the header or intrude into
the sectors available for partitions.
Similarly ensure that the partition entry table associated with
the alternate header does not overwrite that header or intrude
into the sectors available for partitions.
|
|
|
|
|
|
logic into GPT_get_name(), string_to_name() and name_to_string()
functions. Remove unnecessarily abstract functions ask_string(),
utf16le_to_string() and string_to_utf16le().
No intentional functional change.
|
|
Fix some whitespace and memset() parameters in passing.
No intentional functional change.
|
|
No functional change.
|
|
an index to the gp[] array by calling said parameter 'pn' and making it
const unsigned int.
No functional change.
|
|
No functional change.
|
|
gh.gh_part_num does not need a letoh32().
No functional change.
|
|
and then back to little-endian when writing to disk.
Reduces the number of invocations of the letoh*() and htole*()
functions by 90 or so. Also makes that code much easier to read.
No intentional functional change.
|
|
to get_header() with the rest of the header validity
checks.
No functional change.
|
|
Always calculate the GPT partition entries checksum over
gh_part_num * gh_part_size bytes, not the maximal size of the
internal partition entries array.
No functional change.
|
|
Always calculate the GPT header checksum over gh_size bytes
(a.k.a. 92), not sizeof(struct gpt_header). Compilers in their
wisdom may pad the struct to a nice round size, e.g. 96 bytes.
No functional change.
|
|
number of sectors a given number of GPT partition entries
require.
No intentional functional change.
|
|
jmc@ dislikes a comma before "then" in a conditional, so leave those
untouched.
ok jmc@
|
|
No intentional functional change.
|
|
scanning the GPT partition table. gh.gh_part_num reflects the actual
size of the table read from/written to the disk and scanning
possible entries between this value and the maximum allowed size
of a partition table is pointless.
No intentional functional change.
|
|
function find_gpt_type().
Use find_gpt_type() to simplify the functions obtaining
information from gpt_types[]. Add not yet used
PRT_uuid_to_protection() to allow simplification of GPT partition
protection code..
No intentional functional change.
|
|
|
|
|
|
|
|
Pointed out by jmc@
|
|
auto-allocating the space on a disk whose GPT contains
any of the magic Apple partitions.
One step towards saving the firmware files on Apple
M1 machines when installing OpenBSD.
Tested & ok kettenis@
|
|
|
|
uint64_t values.
|
|
CHS information as required when writing MBR to disk, editing a partition in CHS
mode or printing MBR.
No intentional functional change.
|
|
On PolarFire SoC, the HSS firmware loads HSS payload from BIOS boot
partition. Typically the payload carries second-stage low-level boot
code, such as U-Boot. If the payload is missing, the SoC is not able
to boot normally. Hence automatic disk formatting should not delete
the partition.
OK krw@
|
|
conversion formula
LBA = (C Ã HPC + H) Ã SPT + (S â 1)
instead of the equivalent tortuous arithmetic used in PRT_fix_BN().
No intentional functional change.
|
|
|
|
to align with GPT functions. Simplifies logic and eliminates the
magic invocations to print the header.
No functional change.
|
|
source prt has prt_ns == 0 or prt_id == DOSPTYP_UNUSED.
No functional change.
|
|
header fields gh_csum and gh_part_csum.
Constrain kernel to accepting only correct little-endian
checksums.
Temporarily allow fdisk(8) to read either endian GPTs so that
big-endian GPTs can be made correct by a simple 'fdisk -e' &&
'w'.
Fixes inter-architecture, inter-OS GPT portability and GPT
fdisk(8) on big-endian architectures. Broken since initial GPT
implementation.
Suggestions and ok kettenis@
|
|
Always put '0x' prefix in front of displayed hex values,
i.e. the checksums.
Add missing letoh32() so bad endian checksum is clear.
Be consistent when displaying 'expected' and 'got' checksums,
i.e. 'expected' == calculated checksum and 'got' == checksum
found in GPT.
|
|
'EFI PART' reads better than "TRAP IFE" and
checksums are easier to read/compare when shown
in hex rather than decimal.
Prompted by recent GPT vs disklabel misc@ thread
concerning Rob Whitlock's problematic GPT.
|
|
any boot partition specified via '-b' or /usr/mdec/mbr; at the
power of 2 block after the first track; or immediately following
the MBR if there is only one track.
Mark any non-EFISYS boot partition created by -b as DOSACTIVE.
Suggested by kettenis@, better than a separate new option.
Brings -b behaviour into line with many uses of -e to create boot
partitions, allowing for the eventual elimination of said -e uses
in the creation of the various boot media and in the install
scripts.
|