From 4d6cb488084388c90f3f45a0eaf3db83c764e0fb Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 26 Feb 2010 16:06:18 +0100 Subject: [PATCH] fdisk: fix 'p' output for sun label Signed-off-by: Karel Zak --- TODO | 5 +++++ fdisk/fdisksunlabel.c | 18 +++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/TODO b/TODO index d802bfb8..b9786f92 100644 --- a/TODO +++ b/TODO @@ -39,6 +39,11 @@ wipefs fdisk(s) -------- + * Sun label support is completely useless for large disks, it uses number of + cylinders from on-disk-label where the geometry is stored by int16 values. + It seems better to completely ignore this stuff from the label and always + use geometry + BLKGETSIZE64 from kernel. + * use off_t instead "long long" * catch SIGINT (Ctrl-C) and return to main menu. diff --git a/fdisk/fdisksunlabel.c b/fdisk/fdisksunlabel.c index fad9d4f3..68596eea 100644 --- a/fdisk/fdisksunlabel.c +++ b/fdisk/fdisksunlabel.c @@ -186,8 +186,8 @@ void create_sunlabel(void) { struct hd_geometry geometry; unsigned long long llsectors, llcyls; - unsigned int ndiv; - int res, sec_fac; + unsigned int ndiv, sec_fac; + int res; fprintf(stderr, _("Building a new sun disklabel. Changes will remain in memory only,\n" @@ -573,8 +573,8 @@ void sun_list_table(int xtra) w = strlen(disk_device); if (xtra) printf( - _("\nDisk %s (Sun disk label): %d heads, %llu sectors, %d rpm\n" - "%d cylinders, %d alternate cylinders, %d physical cylinders\n" + _("\nDisk %s (Sun disk label): %u heads, %llu sectors, %d rpm\n" + "%u cylinders, %d alternate cylinders, %d physical cylinders\n" "%d extra sects/cyl, interleave %d:1\n" "Label ID: %s\n" "Volume ID: %s\n" @@ -589,7 +589,7 @@ void sun_list_table(int xtra) str_units(PLURAL), units_per_sector); else printf( - _("\nDisk %s (Sun disk label): %d heads, %llu sectors, %d cylinders\n" + _("\nDisk %s (Sun disk label): %u heads, %llu sectors, %u cylinders\n" "Units = %s of %d * 512 bytes\n\n"), disk_device, heads, sectors, cylinders, str_units(PLURAL), units_per_sector); @@ -604,13 +604,13 @@ void sun_list_table(int xtra) uint32_t start = SSWAP32(part->start_cylinder) * heads * sectors; uint32_t len = SSWAP32(part->num_sectors); printf( - "%s %c%c %9ld %9ld %9ld%c %2x %s\n", + "%s %c%c %9lu %9lu %9lu%c %2x %s\n", /* device */ partname(disk_device, i+1, w), /* flags */ (tag->flag & SSWAP16(SUN_FLAG_UNMNT)) ? 'u' : ' ', (tag->flag & SSWAP16(SUN_FLAG_RONLY)) ? 'r' : ' ', -/* start */ (long) scround(start), -/* end */ (long) scround(start+len), -/* odd flag on end */ (long) len / 2, len & 1 ? '+' : ' ', +/* start */ (unsigned long) scround(start), +/* end */ (unsigned long) scround(start+len), +/* odd flag on end */ (unsigned long) len / 2, len & 1 ? '+' : ' ', /* type id */ SSWAP16(tag->tag), /* type name */ (type = partition_type(SSWAP16(tag->tag))) ? type : _("Unknown")); -- 2.39.5