summaryrefslogtreecommitdiff
path: root/sbin/fdisk
AgeCommit message (Collapse)Author
2023-11-18Scan past whitespace before checking if flag string startsKenneth R Westerback
with "0x". Pointed out by Philippe Meunier.
2023-11-10GPT partitions have many attributes. Don't stomp on them all whenKenneth R Westerback
using 'flag <part #>' to make a partition the only bootable partition. Just turn off the bootable bit in the other partitions. ok dlg@
2023-11-10Enhance 'flag' to accept hex values in addition to the current 0Kenneth R Westerback
.. INT64_MAX decimal values.. Easier to specify the 64 bits of GPT partition attributes and 0x8000000000000000 (a.k.a. MS_NOAUTOMOUNT, a.k.a. 1 << 63) becomes accessable. Prompted by bug report and testing by Philippe Meunier. Thanks! ok dlg@
2023-06-20Take more care to ensure name_to_string() always returns a properKenneth R Westerback
string. Don't rely on GPT partition name containing a terminating zero or the reserved bytes beyond gp_name being properly initialized to zero.
2023-06-19"%-Ns\n" is more appropriately "%s\n" to avoid adding extraneousKenneth R Westerback
blanks to the end of the line. Unexpected line wrapping noticed by kettenis@, cause spotted by deraadt@ Nuke an unused variable in passing.
2023-05-21If an MBR partition start or end can be represented by CHS, setKenneth R Westerback
both CHS and LBA values in the MBR partition. Restores pre-7.0 initialization of MBR partition start/end, using slightly less opaque code that retains the slightly different initialization required by GPT protective MBR's. Fixes booting from disks >8G on systems where the BIOS uses CHS. Encountered by Paul de Weerd on his Alix.2 using BIOS 0.99. Much diagnosis and testing by Paul of various iterations. Thanks!
2023-05-17Make function and symmetry obvious by renaming PRT_make() toKenneth R Westerback
PRT_prt_to_dp() and PRT_parse() to PRT_dp_to_prt(). No functional change.
2023-05-10Display correct type name for Microsoft basic data GPTKenneth R Westerback
partitions. Inadvertantly lost in transition to new menu logic.
2023-05-10Microsoft GPT partition attributes can appear on partitions otherKenneth R Westerback
than Basic Data partitions. e.g. Windows Recovery and Windows Reserved partitions. So tweak verbiage to make clear they are MS attributes by prepending 'MS' and always display them. No functional change other than modified fdisk -v output.
2023-05-07GPT partitions with the 'Required' attribute are not deleted by -A.Kenneth R Westerback
2023-04-12Simplify code by folding uuid_attr() into PRT_protected_uuid().Kenneth R Westerback
No functional change.
2023-04-12Clarify logic in PRT_uuid_to_menudflt() by using find_gpt_menuitem().Kenneth R Westerback
No functional change.
2023-04-11Abstract find_[gpt|mbr]_menuitem() to simplify code andKenneth R Westerback
prepare for future uses. No functional change.
2023-04-11Simplify code by passing pointers to the appropriate type toKenneth R Westerback
find_gpt_desc() and find_mbr_desc(). No functional change.
2023-04-11Shuffle mbr and gpt function prototypes and declarations together.Kenneth R Westerback
No functional change.
2023-04-10Make GPT display of menu hex octet the same as the MBR display.Kenneth R Westerback
i.e. two digits.
2023-04-09Refactor and simplify GPT menu selection logic.Kenneth R Westerback
No intentional functional change.
2023-04-08A bit more guid vs uuid naming consistency.Kenneth R Westerback
No functional change.
2023-04-07Oops. Missed files in last commit.Kenneth R Westerback
2023-04-07Add helper functions find_mbr_desc() and find_gpt_desc() to allowKenneth R Westerback
checking mbr_type[N].mt_desc and gpt_type[N].gt_desc before using name on menu when printing out partition tables. Tweak logic in find_mbr_type() and find_gpt_type() to be a bit more paranoid. Tweak function/variable names to be more in line to usage. No functional change as all mt_desc and gt_desc are currently NULL.
2023-04-05Add (inside #if 0 blocks) #define's and gpt_types[] entries forKenneth R Westerback
all the GPT partition types known to mankind. a.k.a. Wikipedia, Linux, and various BSD's. Makes it easier to discuss/add/remove/check GUID's known to fdisk(8). No functional change.
2023-04-04Adopt a more compact idiom when initializing gpt_types[]. GroupKenneth R Westerback
entries with attributes together. No intentional functional change.
2023-04-02Use #define instead of `char * const' for the repeated GUID strings. Ugly,Miod Vallat
but restores compilability with older compilers such as gcc. No intentional functional change.
2023-04-01Use char * const for the rest of the repeated GUID strings. MoreKenneth R Westerback
readable, less prone to typos. No intentional functional change.
2023-03-31Refactor partition type menu code, disentangling mbr and gptKenneth R Westerback
partition types from menu building and display. Some GPT partition names change to match their MBR bretheren. No intentional functional change.
2023-03-31Oops. Missed eliminating unneeded double quotes in previous.Kenneth R Westerback
2023-03-31Be more consistent in function naming. Functions taking orKenneth R Westerback
returning struct uuid's use 'uuid' in their names. Lengthen a pointlessly short line. No functional change.
2023-03-30Use 'char * const' instead of #define for repeatedKenneth R Westerback
GUID strings. Consistently use strcasecmp() when comparing GUID's, allowing use of simple 'char *' for gt_guid. No intentional functional change.
2023-03-30Remove needless memset() call, 'entries' variable andKenneth R Westerback
limit check in PRT_menuid_to_guid(). No functional change.
2023-03-29Change 'type' to 'menuid' in various struct's, functions andKenneth R Westerback
variables related to gpt partitions. Makes it clear that there is no required tie between mbr partition types and gpt partition types. No functional change.
2023-03-29No need to assume a nil GUID can be found at gpt_types[0]. JustKenneth R Westerback
use uuid_create_nil(). No functional change.
2023-03-29Simplify code by having PRT_uuid_to_type() return -1 whenKenneth R Westerback
no type can be found. 0 is a valid type! No functional change.
2023-03-26Pass lbuf/lbuflen to PRT_print_[mbr|gpt]_menu() to allow changesKenneth R Westerback
to the original input. Just zap it for now. No functional change.
2023-03-26Add EFI_SYSTEM_PARTITION_GUID #define and use it to check forKenneth R Westerback
protection. No functional change.
2023-03-26Add MICROSOFT_BASIC_DATA_GUID #define to make clear what menuKenneth R Westerback
items result in the same GUID. Easier to spot and more resistant to simple typos in a 36 character hex string. No functional change.
2023-03-25Add comments documenting possible sources for MBR partition typesKenneth R Westerback
and GPT partition GUIDs. No functional change.
2023-03-25Move LINEBUFSZ to be with its friends in misc.h.Kenneth R Westerback
Nuke unused HELPBUFSZ. No functional change.
2023-03-25Rename ascii_id() find_mbr_type(), make it a bit more like itsKenneth R Westerback
sibling find_gpt_type(), tweaking PRT_print_part() as needed. No functional change.
2023-03-25Make *_name fields char * instead of char[]. Specify desiredKenneth R Westerback
width of output in printf() rather than "%-*s" and sizeof(name) + 1. Clearer, may even save some bytes as many names are shorter than the max. Rename PRT_print_mbrtypes() to PRT_print_mbrmenu() and PRT_print_gpttypes() to PRT_print_gptmenu() to remove implied completeness of list presented in menu. No functional change.
2023-03-25Rename *_sname fields/functions to *_name to remove impliedKenneth R Westerback
shortness of the names. No functional change.
2023-03-06Use GPT_UUID_NBSD_UFS, not GPT_UUID_FBSD_DATA, for NetBSD GPTKenneth R Westerback
partition entries. Add GPT_UUID_LEGACY_MBR entry to list of known partition id's as it is defined in the UEFI Standard.
2023-03-06Use nitems() of source and destination partition arraysKenneth R Westerback
rather than assuming they are the same size. Zero destination entries when no source partition available. No intentional functional change.
2023-03-04Don't whine about invalid start/end values whenKenneth R Westerback
starting to edit an unused GPT partition.
2023-03-04Use nitems() in the simple iterations over mbr->mbr_prt[].Kenneth R Westerback
No intentional functional change.
2023-03-04Toss in some const's to ensure that static data pointed toKenneth R Westerback
by function return values is not fiddled with. No intentional functional change.
2022-09-15Short names make for shorter and prettier lines.Kenneth R Westerback
2022-09-15Add GPTPARTATTR_MS_* defines for Microsoft basic data attributesKenneth R Westerback
and make 'fdisk -v' display their names (NoAutoMount, Hidden, Shadow, ReadOnly). Shift 1ULL instead of 1 to make it clear these are uint64_t flags. Makes clang happier.
2022-09-11Add #define's for GPT partition attribute bits REQUIRED, IGNOREKenneth R Westerback
and BOOTABLE, set BOOTABLE attribute bit instead of using the incorrect GPTDOSACTIVE value, have 'fdisk -v' print out GPT partition attributes if any of the 64 bits are set, don't spoof any partition with REQUIRED bit set. Prompted by kettenis@ stumbling across a machine with 40+ (!!) REQUIRED GPT partitions. Tested & ok kettenis@
2022-08-29Print warning when a GPT partition start or end is outside theKenneth R Westerback
usable LBA area of the device the GPT is currently inhabiting. Makes GPT display as informative as MBR display. In passing, eliminate possible underflow in partition size calculation. ok deraadt@
2022-08-29Print warning when an MBR partition starts or extends past theKenneth R Westerback
end of the device the MBR is currently inhabiting. Prompted by some interesting MBR's from France, verbiage suggestion from deraadt@, ok miod@