From 0b1f769f281ac2feb21b8a52af3fe999922c8833 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 15 Jun 2010 13:13:05 +0200 Subject: [PATCH] fdisk: disable DOS mode and cylinders by default Signed-off-by: Karel Zak --- docs/v2.18-ReleaseNotes | 4 ++++ fdisk/fdisk.8 | 4 ++-- fdisk/fdisk.c | 22 +++++++++++----------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/docs/v2.18-ReleaseNotes b/docs/v2.18-ReleaseNotes index 4a7f9202..c208b303 100644 --- a/docs/v2.18-ReleaseNotes +++ b/docs/v2.18-ReleaseNotes @@ -4,6 +4,10 @@ Util-linux-ng 2.18 Release Notes The util-linux-ng package does not contain rdev(8), ramsize(8), vidmode(8) and rootflags(8) anymore. +The fdisk(8) command does not use DOS-compatible mode and cylinders as +display units by default. The old deprecated DOS behavior could be enabled +by 'c' and 'u' fdisk commands. + Release highlights ------------------ diff --git a/fdisk/fdisk.8 b/fdisk/fdisk.8 index 30dc9678..bd94a020 100644 --- a/fdisk/fdisk.8 +++ b/fdisk/fdisk.8 @@ -190,7 +190,7 @@ between logical and physical sector size. This option changes both sector sizes Print help and then exit. .TP .BI \-c -Switch off DOS-compatible mode. (Recommended) +Switch off DOS-compatible mode. (Default) .TP .BI "\-C " cyls Specify the number of cylinders of the disk. @@ -215,7 +215,7 @@ If no devices are given, those mentioned in .TP .B \-u When listing partition tables, give sizes in sectors instead -of cylinders. +of cylinders. (Default) .TP .BI "\-s " partition The diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index 26bc19e1..f1392e7b 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -204,7 +204,7 @@ int fd, /* the disk */ ext_index, /* the prime extended partition */ listing = 0, /* no aborts for fdisk -l */ nowarn = 0, /* no warnings for fdisk -l/-s */ - dos_compatible_flag = ~0, + dos_compatible_flag = 0, /* disabled by default */ dos_changed = 0, partitions = 4; /* maximum partition + 1 */ @@ -220,7 +220,7 @@ unsigned int heads, sector_factor = 1, user_set_sector_size = 0, units_per_sector = 1, - display_in_cyl_units = 1; + display_in_cyl_units = 0; unsigned long long total_number_of_sectors; /* (!) 512-byte sectors */ unsigned long grain = DEFAULT_SECTOR_SIZE, @@ -259,14 +259,14 @@ void fatal(enum failure why) { " fdisk [options] -l list partition table(s)\n" " fdisk -s give partition size(s) in blocks\n" "\nOptions:\n" -" -b sector size (512, 1024, 2048 or 4096)\n" -" -c switch off DOS-compatible mode\n" -" -h print this help text\n" -" -u show sizes in sectors instead of cylinders\n" -" -v print program version\n" -" -C specify the number of cylinders\n" -" -H specify the number of heads\n" -" -S specify the number of sectors per track\n" +" -b sector size (512, 1024, 2048 or 4096)\n" +" -c switch off DOS-compatible mode (default)\n" +" -h print this help text\n" +" -u show sizes in sectors instead of cylinders (default)\n" +" -v print program version\n" +" -C specify the number of cylinders\n" +" -H specify the number of heads\n" +" -S specify the number of sectors per track\n" "\n"); break; case unable_to_open: @@ -764,7 +764,7 @@ void update_units(void) if (display_in_cyl_units && cyl_units) units_per_sector = cyl_units; else - units_per_sector = 1; /* in sectors */ + units_per_sector = 1; /* in sectors */ } static void -- 2.39.5