From: Mikhail Vorobyov <vorobyov.mikhail@gmail.com>
To: util-linux@vger.kernel.org
Subject: [PATCH 1/2] libfdisk: (sun) move aligning of the first sector before availability check
Date: Thu, 9 Nov 2017 06:32:18 +0300 [thread overview]
Message-ID: <2cdd22e9-0767-372b-bd14-bb6084266cb0@gmail.com> (raw)
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@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++) {
--
2.13.6
reply other threads:[~2017-11-09 3:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2cdd22e9-0767-372b-bd14-bb6084266cb0@gmail.com \
--to=vorobyov.mikhail@gmail.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).