fdisk: util-linux compat wrt meaning of -u

function                                             old     new   delta
menu                                                 261     282     +21
.rodata                                           104779  104787      +8
packed_usage                                       36390   36379     -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 29/-11)             Total: 18 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko committed 2026-09-28 18:07:32 +02:00
1 parent c1289d58d5
commit e8cb0a1d14
2 files changed
+12 -9

No files matched your search

+3 -4
View File
@@ -7,11 +7,10 @@
# testing "description" "command" "result" "infile" "stdin"
# We require -u for this test to disable use of incorrectly guessed
# With -u (use cyinder units) this wouldn't work: incorrectly guessed
# sectors-per-track (15, should be 16).
# utili-linux 2.41.1 does not - did they change the default?
testing 'fdisk -u fdisk_8k_parts1_5-11_ext14.raw add primary' \
'fdisk -u fdisk_8k_parts1_5-11_ext14.raw 2>&1' \
testing 'fdisk fdisk_8k_parts1_5-11_ext14.raw add primary' \
'fdisk fdisk_8k_parts1_5-11_ext14.raw 2>&1' \
"\
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
+9 -5
View File
@@ -80,8 +80,8 @@
//usage: "[-C CYLINDERS] [-H HEADS] [-S SECTORS] [-b SSZ] [-t PARTTYPE] DISK"
//usage:#define fdisk_full_usage "\n\n"
//usage: IF_FEATURE_FDISK_WRITABLE("Change")IF_NOT_FEATURE_FDISK_WRITABLE("Show")" partition table\n"
//usage: "\n -u Start and End are in sectors (instead of cylinders)"
//usage: "\n Also disable rounding of sizes to cylinders"
//usage: "\n -u Start and End are in cylinders (instead of sectors)"
//usage: "\n Also enable rounding of sizes to cylinders"
//usage: "\n -l Show partition table for each DISK and exit"
//usage: IF_FEATURE_FDISK_BLKSIZE(
//usage: "\n -s Show size in kb for each DISK and exit"
@@ -183,7 +183,12 @@ enum {
};
#define USER_SET_SECTOR_SIZE (option_mask32 & OPT_b)
#define NOWARN_OPT_ls (!ENABLE_FEATURE_FDISK_WRITABLE || (option_mask32 & (OPT_l|OPT_s)))
#define DISPLAY_IN_CYL_UNITS (!(option_mask32 & OPT_u))
// The meaning of -u was inverted in its meaning in util-linux by:
// commit 0b1f769f281ac2feb21b8a52af3fe999922c8833
// Date: Tue Jun 15 13:13:05 2010 +0200
// fdisk: disable DOS mode and cylinders by default
// Now it also takes an optional parameter, "cylinder[s]"/"sector[s]" (we don't do that):
#define DISPLAY_IN_CYL_UNITS (option_mask32 & OPT_u)
#define TOGGLE_DISPLAY_IN_CYL_UNITS (option_mask32 ^= OPT_u)
#define SUPPORT_DISKLABELS (0 \
@@ -1506,7 +1511,6 @@ choose_free_primary_partition(void)
return input_partition_number(/*warn*/ 0, 4);
}
static void
change_units(void)
{
@@ -2659,7 +2663,7 @@ menu(void)
puts("q\tquit without saving changes");
//deleted: puts("s\tcreate a new empty Sun disklabel"); /* sun */
puts("t\tchange a partition's system id");
puts("u\tchange display/entry units");
printf("u\tchange display/entry units to %ss\n", DISPLAY_IN_CYL_UNITS ? "sector" : "cylinder");
puts("v\tverify partition table");
puts("w\twrite table to disk and exit");
# if ENABLE_FEATURE_FDISK_ADVANCED