diff options
author | Davidlohr Bueso | 2012-07-23 18:15:57 +0200 |
---|---|---|
committer | Karel Zak | 2012-07-23 18:15:57 +0200 |
commit | 61c4cb85309a62f343a74175b06984e0111f3fd8 (patch) | |
tree | 75b90d2eac1f98fde3dfda53101512c3c5d7aeff /fdisks/fdisk.c | |
parent | fdisk: set label pointer in fdisk_create_default_disklabel() (diff) | |
download | kernel-qcow2-util-linux-61c4cb85309a62f343a74175b06984e0111f3fd8.tar.gz kernel-qcow2-util-linux-61c4cb85309a62f343a74175b06984e0111f3fd8.tar.xz kernel-qcow2-util-linux-61c4cb85309a62f343a74175b06984e0111f3fd8.zip |
fdisk: API: add delete partition to label operations
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks/fdisk.c')
-rw-r--r-- | fdisks/fdisk.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c index 0c837a315..ec31b14d8 100644 --- a/fdisks/fdisk.c +++ b/fdisks/fdisk.c @@ -818,25 +818,14 @@ toggle_dos_compatibility_flag(struct fdisk_context *cxt) { update_sector_offset(cxt); } -static void -delete_partition(struct fdisk_context *cxt, int i) +static void delete_partition(struct fdisk_context *cxt, int partnum) { - if (i < 0) + if (partnum < 0 || warn_geometry(cxt)) return; - if (warn_geometry(cxt)) - return; /* C/H/S not set */ - - ptes[i].changed = 1; - - if (disklabel == DOS_LABEL) - dos_delete_partition(i); - else if (disklabel == SUN_LABEL) - sun_delete_partition(cxt, i); - else if (disklabel == SGI_LABEL) - sgi_delete_partition(cxt, i); - - printf(_("Partition %d is deleted\n"), i + 1); + ptes[partnum].changed = 1; + fdisk_delete_partition(cxt, partnum); + printf(_("Partition %d is deleted\n"), partnum + 1); } static void change_sysid(struct fdisk_context *cxt) |