diff options
author | Mikhail Vorobyov | 2017-11-09 04:37:28 +0100 |
---|---|---|
committer | Karel Zak | 2017-11-16 14:11:10 +0100 |
commit | 45ce1487787c12228873e3c401be0a9c770c2956 (patch) | |
tree | 5698dd02578a71c1477fd14e0c2afb8b1390208b /libfdisk | |
parent | libmount: minimize utimensat() write test usage (diff) | |
download | kernel-qcow2-util-linux-45ce1487787c12228873e3c401be0a9c770c2956.tar.gz kernel-qcow2-util-linux-45ce1487787c12228873e3c401be0a9c770c2956.tar.xz kernel-qcow2-util-linux-45ce1487787c12228873e3c401be0a9c770c2956.zip |
libfdisk: (sun) move aligning of the first sector before availability check
So it will check a sector which would be actualy used as the first sector
of the partition.
Diffstat (limited to 'libfdisk')
-rw-r--r-- | libfdisk/src/sun.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/libfdisk/src/sun.c b/libfdisk/src/sun.c index d10fea0d7..7ffd364f4 100644 --- a/libfdisk/src/sun.c +++ b/libfdisk/src/sun.c @@ -566,6 +566,19 @@ static int sun_add_partition( if (fdisk_use_cylinders(cxt)) first *= fdisk_get_units_per_sector(cxt); + if (!fdisk_use_cylinders(cxt)) { + /* Starting sector has to be properly aligned */ + int cs = cxt->geom.heads * cxt->geom.sectors; + int x = first % cs; + + if (x) { + fdisk_info(cxt, _("Aligning the first sector from %u to %u " + "to be on cylinder boundary."), + first, first + cs - x); + first += cs - x; + } + } + /* ewt asks to add: "don't start a partition at cyl 0" However, edmundo@rano.demon.co.uk writes: "In addition to having a Sun partition table, to be able to @@ -593,20 +606,6 @@ static int sun_add_partition( } } - - if (!fdisk_use_cylinders(cxt)) { - /* Starting sector has to be properly aligned */ - int cs = cxt->geom.heads * cxt->geom.sectors; - int x = first % cs; - - if (x) { - fdisk_info(cxt, _("Aligning the first sector from %u to %u " - "to be on cylinder boundary."), - first, first + cs - x); - first += cs - x; - } - } - stop = cxt->geom.cylinders * cxt->geom.heads * cxt->geom.sectors; /* ancient */ stop2 = stop; for (i = 0; i < cxt->label->nparts_max; i++) { |