summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/sun.c
diff options
context:
space:
mode:
authorMikhail Vorobyov2017-11-02 02:04:42 +0100
committerKarel Zak2017-11-02 10:43:27 +0100
commit27895be26074780aac5a849514b2a6f8560adfcd (patch)
treec2590cbf1e60dd0669109cc6121ace6994495f08 /libfdisk/src/sun.c
parentdmesg: Add --force-prefix option (diff)
downloadkernel-qcow2-util-linux-27895be26074780aac5a849514b2a6f8560adfcd.tar.gz
kernel-qcow2-util-linux-27895be26074780aac5a849514b2a6f8560adfcd.tar.xz
kernel-qcow2-util-linux-27895be26074780aac5a849514b2a6f8560adfcd.zip
libfdisk: (sun) fix creation of whole disk partition
sun_add_partition() allowed the 1st sector to be 0 for the 3rd partition only if that sector was free or if other partitions covered the whole disk. Now it's always allowed for the 1st sector to be set to 0 for the 3rd partition. [kzak@redhat.com: - print info about "wholedisk" before "First sector" dialog for 3rd partition - default to 0 for 3rd partition start sector] Signed-off-by: Mikhail Vorobyov <m.vorobyov@cs.msu.ru> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/sun.c')
-rw-r--r--libfdisk/src/sun.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libfdisk/src/sun.c b/libfdisk/src/sun.c
index 0526227ce..d10fea0d7 100644
--- a/libfdisk/src/sun.c
+++ b/libfdisk/src/sun.c
@@ -529,6 +529,11 @@ static int sun_add_partition(
} else {
struct fdisk_ask *ask;
+ if (n == 2)
+ fdisk_info(cxt, _("It is highly recommended that the "
+ "third partition covers the whole disk "
+ "and is of type `Whole disk'"));
+
snprintf(mesg, sizeof(mesg), _("First %s"),
fdisk_get_unit(cxt, FDISK_SINGULAR));
for (;;) {
@@ -543,6 +548,10 @@ static int sun_add_partition(
fdisk_ask_number_set_low(ask, 0); /* minimal */
fdisk_ask_number_set_default(ask, 0); /* default */
fdisk_ask_number_set_high(ask, 0); /* maximal */
+ } else if (n == 2) {
+ fdisk_ask_number_set_low(ask, 0); /* minimal */
+ fdisk_ask_number_set_default(ask, 0); /* default */
+ fdisk_ask_number_set_high(ask, fdisk_scround(cxt, stop)); /* maximal */
} else {
fdisk_ask_number_set_low(ask, fdisk_scround(cxt, start)); /* minimal */
fdisk_ask_number_set_default(ask, fdisk_scround(cxt, start)); /* default */
@@ -584,10 +593,6 @@ static int sun_add_partition(
}
}
- if (n == 2 && first != 0)
- fdisk_warnx(cxt, _("It is highly recommended that the "
- "third partition covers the whole disk "
- "and is of type `Whole disk'"));
if (!fdisk_use_cylinders(cxt)) {
/* Starting sector has to be properly aligned */