--- util-linux-2.12r/fdisk/fdisk.c.old 2006-05-11 19:20:15.000000000 -0400 +++ util-linux-2.12r/fdisk/fdisk.c 2006-05-11 19:33:44.000000000 -0400 @@ -1916,6 +1916,16 @@ total_number_of_sectors - total); } +static unsigned long long +roundup_to_cylinder_boundary(unsigned long long offset) { + if (units_per_sector) { + unsigned long long extra_sectors = offset % units_per_sector; + if (extra_sectors != 0) + offset += (units_per_sector - extra_sectors) - 1; + } + return offset; +} + static void add_partition(int n, int sys) { char mesg[256]; /* 48 does not suffice in Japanese */ @@ -1951,8 +1961,10 @@ limit = get_start_sect(q) + get_nr_sects(q) - 1; } if (display_in_cyl_units) - for (i = 0; i < partitions; i++) + for (i = 0; i < partitions; i++) { first[i] = (cround(first[i]) - 1) * units_per_sector; + last[i] = roundup_to_cylinder_boundary(last[i]); + } snprintf(mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR)); do {