diff options
author | Karel Zak | 2012-12-11 18:04:25 +0100 |
---|---|---|
committer | Karel Zak | 2013-03-11 12:47:29 +0100 |
commit | 8a95621d30c4e4c3e279246f80ef4aeed4f5d71c (patch) | |
tree | bf7beca183e58ed7e4c358acd9072007a31a12cc /fdisks/gpt.c | |
parent | libfdisk: improve label deinitialization (diff) | |
download | kernel-qcow2-util-linux-8a95621d30c4e4c3e279246f80ef4aeed4f5d71c.tar.gz kernel-qcow2-util-linux-8a95621d30c4e4c3e279246f80ef4aeed4f5d71c.tar.xz kernel-qcow2-util-linux-8a95621d30c4e4c3e279246f80ef4aeed4f5d71c.zip |
libfdisk: add fdisk_label to driver API
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks/gpt.c')
-rw-r--r-- | fdisks/gpt.c | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/fdisks/gpt.c b/fdisks/gpt.c index f9ba9f072..0dd8ebe13 100644 --- a/fdisks/gpt.c +++ b/fdisks/gpt.c @@ -1012,7 +1012,8 @@ static void gpt_init(struct fdisk_context *cxt) } -static int gpt_probe_label(struct fdisk_context *cxt) +static int gpt_probe_label(struct fdisk_context *cxt, + struct fdisk_label *lb __attribute__((__unused__))) { int mbr_type; @@ -1239,7 +1240,8 @@ fail: * Returns 0 if successful write, otherwise, a corresponding error. * Any indication of error will abort the operation. */ -static int gpt_write_disklabel(struct fdisk_context *cxt) +static int gpt_write_disklabel(struct fdisk_context *cxt, + struct fdisk_label *lb __attribute__((__unused__))) { if (!cxt) goto err0; @@ -1297,7 +1299,8 @@ err1: * - primary and backup header validations * - paritition validations */ -static int gpt_verify_disklabel(struct fdisk_context *cxt) +static int gpt_verify_disklabel(struct fdisk_context *cxt, + struct fdisk_label *lb __attribute__((__unused__))) { int nerror = 0, ptnum; @@ -1394,7 +1397,9 @@ static int gpt_verify_disklabel(struct fdisk_context *cxt) } /* Delete a single GPT partition, specified by partnum. */ -static int gpt_delete_partition(struct fdisk_context *cxt, int partnum) +static int gpt_delete_partition(struct fdisk_context *cxt, + struct fdisk_label *lb __attribute__((__unused__)), + int partnum) { if (!cxt || partition_unused(&ents[partnum]) || partnum < 0) return -EINVAL; @@ -1478,8 +1483,11 @@ static int gpt_create_new_partition(int partnum, uint64_t fsect, uint64_t lsect, } /* Performs logical checks to add a new partition entry */ -static int gpt_add_partition(struct fdisk_context *cxt, int partnum, - struct fdisk_parttype *t) +static int gpt_add_partition( + struct fdisk_context *cxt, + struct fdisk_label *lb __attribute__((__unused__)), + int partnum, + struct fdisk_parttype *t) { uint64_t user_f, user_l; /* user input ranges for first and last sectors */ uint64_t disk_f, disk_l; /* first and last available sector ranges on device*/ @@ -1563,7 +1571,8 @@ static int gpt_add_partition(struct fdisk_context *cxt, int partnum, /* * Create a new GPT disklabel - destroys any previous data. */ -static int gpt_create_disklabel(struct fdisk_context *cxt) +static int gpt_create_disklabel(struct fdisk_context *cxt, + struct fdisk_label *lb __attribute__((__unused__))) { int rc = 0; ssize_t entry_sz = 0; @@ -1612,8 +1621,10 @@ done: return rc; } -static struct fdisk_parttype *gpt_get_partition_type(struct fdisk_context *cxt, - int i) +static struct fdisk_parttype *gpt_get_partition_type( + struct fdisk_context *cxt, + struct fdisk_label *lb __attribute__((__unused__)), + int i) { struct fdisk_parttype *t; struct gpt_guid uuid; @@ -1634,8 +1645,11 @@ static struct fdisk_parttype *gpt_get_partition_type(struct fdisk_context *cxt, } -static int gpt_set_partition_type(struct fdisk_context *cxt, int i, - struct fdisk_parttype *t) +static int gpt_set_partition_type( + struct fdisk_context *cxt, + struct fdisk_label *lb __attribute__((__unused__)), + int i, + struct fdisk_parttype *t) { struct gpt_guid uuid; @@ -1652,7 +1666,7 @@ static int gpt_set_partition_type(struct fdisk_context *cxt, int i, /* * Deinitialize fdisk-specific variables */ -static void gpt_deinit(struct fdisk_label *lb) +static void gpt_deinit(struct fdisk_label *lb __attribute__((unused))) { free(ents); free(pheader); @@ -1661,10 +1675,6 @@ static void gpt_deinit(struct fdisk_label *lb) ents = NULL; pheader = NULL; bheader = NULL; - - if (lb->cxt && lb->cxt->disklabel == FDISK_DISKLABEL_GPT) - lb->cxt->disklabel = FDISK_DISKLABEL_ANY; - partitions = 0; } |