summaryrefslogtreecommitdiffstats
path: root/fdisks
diff options
context:
space:
mode:
authorKarel Zak2013-01-22 18:18:29 +0100
committerKarel Zak2013-03-11 13:00:54 +0100
commitbaa7cccc3a9bff1a9a99a9232deac994f811785c (patch)
tree9102642e2028ec713a9ceee0960e0d75c4d55942 /fdisks
parentfdisk: remove fdisk_label from API functions, add asserts, use size_t (diff)
downloadkernel-qcow2-util-linux-baa7cccc3a9bff1a9a99a9232deac994f811785c.tar.gz
kernel-qcow2-util-linux-baa7cccc3a9bff1a9a99a9232deac994f811785c.tar.xz
kernel-qcow2-util-linux-baa7cccc3a9bff1a9a99a9232deac994f811785c.zip
libfdisk: add FDISK_LABEL_FL_ADDPART_NOPARTNO
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks')
-rw-r--r--fdisks/fdisk.c5
-rw-r--r--fdisks/fdiskbsdlabel.c3
-rw-r--r--fdisks/fdiskdoslabel.c3
3 files changed, 7 insertions, 4 deletions
diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c
index d091a5d51..094b7e0f6 100644
--- a/fdisks/fdisk.c
+++ b/fdisks/fdisk.c
@@ -760,10 +760,7 @@ static void new_partition(struct fdisk_context *cxt)
if (warn_geometry(cxt))
return;
- if (fdisk_is_disklabel(cxt, SUN) ||
- fdisk_is_disklabel(cxt, SGI) ||
- fdisk_is_disklabel(cxt, GPT))
-
+ if (!(cxt->label->flags & FDISK_LABEL_FL_ADDPART_NOPARTNO))
partnum = get_partition_dflt(cxt, 0, cxt->label->nparts_max,
cxt->label->nparts_cur + 1);
diff --git a/fdisks/fdiskbsdlabel.c b/fdisks/fdiskbsdlabel.c
index 5ef49cddb..060852bc3 100644
--- a/fdisks/fdiskbsdlabel.c
+++ b/fdisks/fdiskbsdlabel.c
@@ -972,5 +972,8 @@ struct fdisk_label *fdisk_new_bsd_label(struct fdisk_context *cxt)
lb->parttypes = xbsd_fstypes;
lb->nparttypes = ARRAY_SIZE(xbsd_fstypes);
+ /* don't ask for partition number for op->part_add() */
+ lb->flags = FDISK_LABEL_FL_ADDPART_NOPARTNO;
+
return lb;
}
diff --git a/fdisks/fdiskdoslabel.c b/fdisks/fdiskdoslabel.c
index e622ac517..a65466bac 100644
--- a/fdisks/fdiskdoslabel.c
+++ b/fdisks/fdiskdoslabel.c
@@ -1501,6 +1501,9 @@ struct fdisk_label *fdisk_new_dos_label(struct fdisk_context *cxt)
lb->parttypes = dos_parttypes;
lb->nparttypes = ARRAY_SIZE(dos_parttypes);
+ /* don't ask for partition number for op->part_add() */
+ lb->flags = FDISK_LABEL_FL_ADDPART_NOPARTNO;
+
return lb;
}