diff options
author | Karel Zak | 2013-01-18 12:05:40 +0100 |
---|---|---|
committer | Karel Zak | 2013-03-11 12:47:30 +0100 |
commit | acf263d5924c75e7aa7409ad64b64f4ec8863262 (patch) | |
tree | 4e5324cb6302e447b16700b6879bed5370bc1224 /fdisks/fdiskbsdlabel.c | |
parent | fdisk: (aix) remove unuused variable 'partitions' (diff) | |
download | kernel-qcow2-util-linux-acf263d5924c75e7aa7409ad64b64f4ec8863262.tar.gz kernel-qcow2-util-linux-acf263d5924c75e7aa7409ad64b64f4ec8863262.tar.xz kernel-qcow2-util-linux-acf263d5924c75e7aa7409ad64b64f4ec8863262.zip |
fdisk: (bsd) add partitions counters
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks/fdiskbsdlabel.c')
-rw-r--r-- | fdisks/fdiskbsdlabel.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/fdisks/fdiskbsdlabel.c b/fdisks/fdiskbsdlabel.c index e1955e32c..3788b2b02 100644 --- a/fdisks/fdiskbsdlabel.c +++ b/fdisks/fdiskbsdlabel.c @@ -165,7 +165,7 @@ static int xbsd_write_disklabel (struct fdisk_context *cxt, } static int xbsd_add_part (struct fdisk_context *cxt, - struct fdisk_label *lb __attribute__((__unused__)), + struct fdisk_label *lb, int partnum __attribute__((__unused__)), struct fdisk_parttype *t __attribute__((__unused__))) { @@ -204,11 +204,13 @@ static int xbsd_add_part (struct fdisk_context *cxt, xbsd_dlabel.d_partitions[i].p_offset = begin; xbsd_dlabel.d_partitions[i].p_fstype = BSD_FS_UNUSED; + lb->nparts_cur = xbsd_dlabel.d_npartitions; + return 0; } -static int xbsd_create_disklabel (struct fdisk_context *cxt, - struct fdisk_label *lb __attribute__((__unused__))) +static int xbsd_create_disklabel(struct fdisk_context *cxt, + struct fdisk_label *lb) { char c; @@ -231,6 +233,8 @@ static int xbsd_create_disklabel (struct fdisk_context *cxt, #endif ) == 1) { xbsd_print_disklabel (cxt, 1); + lb->nparts_cur = xbsd_dlabel.d_npartitions; + lb->nparts_max = BSD_MAXPARTITIONS; return 1; } else return 0; @@ -331,7 +335,7 @@ bsd_command_prompt (struct fdisk_context *cxt) static int xbsd_delete_part( struct fdisk_context *cxt __attribute__((__unused__)), - struct fdisk_label *lb __attribute__((__unused__)), + struct fdisk_label *lb, int partnum) { xbsd_dlabel.d_partitions[partnum].p_size = 0; @@ -341,6 +345,7 @@ static int xbsd_delete_part( while (!xbsd_dlabel.d_partitions[xbsd_dlabel.d_npartitions-1].p_size) xbsd_dlabel.d_npartitions--; + lb->nparts_cur = xbsd_dlabel.d_npartitions; return 0; } @@ -730,6 +735,9 @@ xbsd_readlabel (struct fdisk_context *cxt, struct partition *p, struct xbsd_disk { int t, sector; + assert(cxt); + assert(cxt->label); + /* p is used only to get the starting sector */ #if !defined (__alpha__) sector = (p ? get_start_sect(p) : 0); @@ -759,6 +767,10 @@ xbsd_readlabel (struct fdisk_context *cxt, struct partition *p, struct xbsd_disk fprintf (stderr, _("Warning: too many partitions " "(%d, maximum is %d).\n"), d -> d_npartitions, BSD_MAXPARTITIONS); + + cxt->label->nparts_cur = d->d_npartitions; + cxt->label->nparts_max = BSD_MAXPARTITIONS; + return 1; } |