[PATCH v2 1/2] libfdisk: (sun) move aligning of the first sector before availability check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So it will check a sector which would be actualy used as the first sector
of the partition.
---
 libfdisk/src/sun.c | 27 +++++++++++++--------------
 1 file 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@xxxxxxxxxxxxxxxx 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++) {
-- 
2.13.6
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux