]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: add FDISK_LABEL_FL_ADDPART_NOPARTNO
authorKarel Zak <kzak@redhat.com>
Tue, 22 Jan 2013 17:18:29 +0000 (18:18 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 11 Mar 2013 12:00:54 +0000 (13:00 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/fdisk.c
fdisks/fdiskbsdlabel.c
fdisks/fdiskdoslabel.c
libfdisk/src/fdiskP.h

index d091a5d5178f3d849a3d4a152abf837466eb15d0..094b7e0f6056ebc65ecccd3e2fdaf9047088f74b 100644 (file)
@@ -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);
 
index 5ef49cddb8939dea23f49856bca828d06a06deea..060852bc35c6a50ea46fef77aeb21027a4011ecc 100644 (file)
@@ -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;
 }
index e622ac51769a70b496cd06a40fbda7bb7ee2ed91..a65466bac1489d89156294270e75ff751d20c18e 100644 (file)
@@ -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;
 }
 
index 1301695a6bdb306450a6f8889db80e17449e8761..cef03fc203ca5ea15009bd7c78e22bd7e6336d05 100644 (file)
@@ -172,11 +172,18 @@ struct fdisk_label {
        size_t                  nparts_max;     /* maximal number of partitions */
        size_t                  nparts_cur;     /* number of currently used partitions */
 
+       int                     flags;          /* FDISK_LABEL_FL_* flags */
+
        unsigned int            changed:1;      /* label has been modified */
 
        const struct fdisk_label_operations *op;
 };
 
+/* label driver flags */
+enum {
+       FDISK_LABEL_FL_ADDPART_NOPARTNO = (1 << 1)
+};
+
 /* label allocators */
 extern struct fdisk_label *fdisk_new_gpt_label(struct fdisk_context *cxt);
 extern struct fdisk_label *fdisk_new_dos_label(struct fdisk_context *cxt);