diff options
author | Karel Zak | 2013-03-05 11:15:54 +0100 |
---|---|---|
committer | Karel Zak | 2013-03-11 13:00:57 +0100 |
commit | 225592d4a38b118328a1975e315897edd43ec703 (patch) | |
tree | 8972e2234756dfdaaba33f40d1b86ef72640a77d /fdisks/fdisk.c | |
parent | fdisk: (sun) cleanup header file (diff) | |
download | kernel-qcow2-util-linux-225592d4a38b118328a1975e315897edd43ec703.tar.gz kernel-qcow2-util-linux-225592d4a38b118328a1975e315897edd43ec703.tar.xz kernel-qcow2-util-linux-225592d4a38b118328a1975e315897edd43ec703.zip |
libfdisk: add disk_partition_is_used()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks/fdisk.c')
-rw-r--r-- | fdisks/fdisk.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c index 179b905b2..31a7e50ba 100644 --- a/fdisks/fdisk.c +++ b/fdisks/fdisk.c @@ -543,24 +543,15 @@ read_int(struct fdisk_context *cxt, } int -get_partition_dflt(struct fdisk_context *cxt, int warn, int max, int dflt) { - struct pte *pe; +get_partition_dflt(struct fdisk_context *cxt, int warn, int max, int dflt) +{ int i; i = read_int(cxt, 1, dflt, max, 0, _("Partition number")) - 1; - pe = &ptes[i]; - - if (warn && !fdisk_is_disklabel(cxt, GPT)) { - if ((!fdisk_is_disklabel(cxt, SUN) && - !fdisk_is_disklabel(cxt, SGI) && !pe->part_table->sys_ind) - || (fdisk_is_disklabel(cxt, SUN) && - sun_is_empty_type(cxt, i)) - || (fdisk_is_disklabel(cxt, SGI) && - (!sgi_get_num_sectors(cxt, i)))) - fprintf(stderr, - _("Warning: partition %d has empty type\n"), - i+1); - } + + if (warn && !fdisk_partition_is_used(cxt, i)) + fdisk_warnx(cxt, _("Warning: partition %d is unused"), i + 1); + return i; } |