summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/label.c
diff options
context:
space:
mode:
authorKarel Zak2014-09-17 13:14:01 +0200
committerKarel Zak2014-10-07 14:55:32 +0200
commitb305ad406555c7b478fb00f5e649dd1b12ba1c1e (patch)
treef7cdf4ae5b38b2fcf8372955ef4a8346e78e1bdd /libfdisk/src/label.c
parentlibfdisk: (gpt) check string_to_guid() (diff)
downloadkernel-qcow2-util-linux-b305ad406555c7b478fb00f5e649dd1b12ba1c1e.tar.gz
kernel-qcow2-util-linux-b305ad406555c7b478fb00f5e649dd1b12ba1c1e.tar.xz
kernel-qcow2-util-linux-b305ad406555c7b478fb00f5e649dd1b12ba1c1e.zip
libfdisk: use new set_part API in fdisk_set_partition_type()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/label.c')
-rw-r--r--libfdisk/src/label.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libfdisk/src/label.c b/libfdisk/src/label.c
index 8104d5429..5ae67856b 100644
--- a/libfdisk/src/label.c
+++ b/libfdisk/src/label.c
@@ -406,11 +406,17 @@ int fdisk_set_partition_type(struct fdisk_context *cxt,
{
if (!cxt || !cxt->label)
return -EINVAL;
- if (!cxt->label->op->part_set_type)
- return -ENOSYS;
DBG(CXT, ul_debugobj(cxt, "partition: %zd: set type", partnum));
- return cxt->label->op->part_set_type(cxt, partnum, t);
+
+ if (cxt->label->op->set_part) {
+ struct fdisk_partition pa = { .type = t };
+ return cxt->label->op->set_part(cxt, partnum, &pa);
+
+ } else if (cxt->label->op->part_set_type)
+ return cxt->label->op->part_set_type(cxt, partnum, t);
+
+ return -ENOSYS;
}