From 80ee280003aa5d2e2888e4b881321c335d8e90e2 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Fri, 16 Nov 2007 11:37:43 +0100 Subject: [PATCH] cfdisk: display cylinders beyond 1024 There is absolutely no reason why cfdisk should not display cylinders beyond 1024. The number of cylinders needs to be truncated only for the CHS field. Signed-off-by: Peter Breitenlohner --- fdisk/cfdisk.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c index 7ed11ea1..0c341bd4 100644 --- a/fdisk/cfdisk.c +++ b/fdisk/cfdisk.c @@ -181,8 +181,6 @@ int pt_heads = 0, pt_sectors = 0; static void set_hsc0(unsigned char *h, unsigned char *s, int *c, long long sector) { - if (sector >= 1024*cylinder_size) - sector = 1024*cylinder_size - 1; *s = sector % sectors + 1; sector /= sectors; *h = sector % heads; @@ -195,6 +193,8 @@ set_hsc(unsigned char *h, unsigned char *s, unsigned char *c, long long sector) { int cc; + if (sector >= 1024*cylinder_size) + sector = 1024*cylinder_size - 1; set_hsc0(h, s, &cc, sector); *c = cc & 0xFF; *s |= (cc >> 2) & 0xC0; @@ -2164,7 +2164,7 @@ print_part_entry(FILE *fp, int num, partition_info *pi) { set_hsc0(&eh, &es, &ec, end); } - fp_printf(fp, "%2d 0x%02X %4d %4d %4d 0x%02X %4d %4d %4d %11lld %11lld\n", + fp_printf(fp, "%2d 0x%02X %4d %4d %5d 0x%02X %4d %4d %5d %11lld %11lld\n", num+1, flags, sh, ss, sc, id, eh, es, ec, first, size); } @@ -2202,9 +2202,9 @@ print_part_table(void) { fp_printf(fp, _("Partition Table for %s\n"), disk_device); fp_printf(fp, "\n"); /* Three-line heading. Read "Start Sector" etc vertically. */ - fp_printf(fp, _(" ---Starting--- ----Ending---- Start Number of\n")); - fp_printf(fp, _(" # Flags Head Sect Cyl ID Head Sect Cyl Sector Sectors\n")); - fp_printf(fp, _("-- ----- ---- ---- ---- ---- ---- ---- ---- ----------- -----------\n")); + fp_printf(fp, _(" ---Starting---- ----Ending----- Start Number of\n")); + fp_printf(fp, _(" # Flags Head Sect Cyl ID Head Sect Cyl Sector Sectors\n")); + fp_printf(fp, _("-- ----- ---- ---- ----- ---- ---- ---- ----- ----------- -----------\n")); for (i = 0; i < 4; i++) { for (j = 0; -- 2.39.5