diff options
author | Karel Zak | 2006-12-07 00:26:33 +0100 |
---|---|---|
committer | Karel Zak | 2006-12-07 00:26:33 +0100 |
commit | bf3baa99075f6df0bea4cd857aa340694339dd9d (patch) | |
tree | 9dba6996348ddc430c30fb9fa0737963c25f283b /fdisk | |
parent | Imported from util-linux-2.12o tarball. (diff) | |
download | kernel-qcow2-util-linux-bf3baa99075f6df0bea4cd857aa340694339dd9d.tar.gz kernel-qcow2-util-linux-bf3baa99075f6df0bea4cd857aa340694339dd9d.tar.xz kernel-qcow2-util-linux-bf3baa99075f6df0bea4cd857aa340694339dd9d.zip |
Imported from util-linux-2.12p tarball.
Diffstat (limited to 'fdisk')
-rw-r--r-- | fdisk/cfdisk.c | 34 | ||||
-rw-r--r-- | fdisk/fdisksunlabel.c | 11 |
2 files changed, 30 insertions, 15 deletions
diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c index 9c0e7875c..46bc494e1 100644 --- a/fdisk/cfdisk.c +++ b/fdisk/cfdisk.c @@ -405,8 +405,10 @@ fdexit(int ret) { if (changed) { fprintf(stderr, _("Disk has been changed.\n")); +#if 0 fprintf(stderr, _("Reboot the system to ensure the partition " "table is correctly updated.\n")); +#endif fprintf( stderr, _("\nWARNING: If you have created or modified any\n" "DOS 6.x partitions, please see the cfdisk manual\n" @@ -958,6 +960,8 @@ add_part(int num, int id, int flags, long long first, long long last, p_info[i].first_sector + p_info[i].offset <= last) *errmsg = _("logical partitions overlap"); else + /* the enlarged logical partition starts at the + partition table sector that defines it */ *errmsg = _("enlarged logical partitions overlap"); return -1; } @@ -1087,16 +1091,10 @@ find_logical(int i) { return num; } -static void -inc_logical(int i) { - int j; - - for (j = i; j < num_parts; j++) - if (p_info[j].id > 0 && IS_LOGICAL(p_info[j].num)) - p_info[j].num++; -} - -/* Command menu support by Janne Kukonlehto <jtklehto@phoenix.oulu.fi> September 1994 */ +/* + * Command menu support by Janne Kukonlehto <jtklehto@phoenix.oulu.fi> + * September 1994 + */ /* Constants for menuType parameter of menuSelect function */ #define MENU_HORIZ 1 @@ -1500,8 +1498,20 @@ new_part(int i) { first = ext_info.first_sector + ext_info.offset; } - if (IS_LOGICAL(num)) - inc_logical(i); + /* increment number of all partitions past this one */ + if (IS_LOGICAL(num)) { +#if 0 + /* original text - ok, but fails when partitions not in disk order */ + for (j = i; j < num_parts; j++) + if (p_info[j].id > 0 && IS_LOGICAL(p_info[j].num)) + p_info[j].num++; +#else + /* always ok */ + for (j = 0; j < num_parts; j++) + if (p_info[j].id > 0 && p_info[j].num >= num) + p_info[j].num++; +#endif + } /* Now we have a complete partition to ourselves */ if (first == 0 || IS_LOGICAL(num)) diff --git a/fdisk/fdisksunlabel.c b/fdisk/fdisksunlabel.c index f4a67bd92..eab67c015 100644 --- a/fdisk/fdisksunlabel.c +++ b/fdisk/fdisksunlabel.c @@ -524,9 +524,14 @@ add_sun_partition(int n, int sys) { scround(stop), 0, mesg); if (display_in_cyl_units) first *= units_per_sector; - else + else { /* Starting sector has to be properly aligned */ - first = (first + heads * sectors - 1) / (heads * sectors); + int cs = heads * sectors; + int x = first % cs; + + if (x) + first += cs - x; + } if (n == 2 && first != 0) printf ("\ It is highly recommended that the third partition covers the whole disk\n\ @@ -560,7 +565,7 @@ and is of type `Whole disk'\n"); } else break; } - stop = cylinders * heads * sectors; + stop = cylinders * heads * sectors; /* ancient */ stop2 = stop; for (i = 0; i < partitions; i++) { if (starts[i] > first && starts[i] < stop) |