diff options
author | Karel Zak | 2013-06-25 14:40:34 +0200 |
---|---|---|
committer | Karel Zak | 2013-09-16 16:47:03 +0200 |
commit | 21fe3dde849c59a54641f43cbea2eafdf4d07acf (patch) | |
tree | 8837f15625af39295e75e6a2b006e7d881717fcb /libfdisk/src/label.c | |
parent | fdisk: (gpt) enlarge columns in list output (diff) | |
download | kernel-qcow2-util-linux-21fe3dde849c59a54641f43cbea2eafdf4d07acf.tar.gz kernel-qcow2-util-linux-21fe3dde849c59a54641f43cbea2eafdf4d07acf.tar.xz kernel-qcow2-util-linux-21fe3dde849c59a54641f43cbea2eafdf4d07acf.zip |
libfdisk: add generic function to get disklabel ID
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/label.c')
-rw-r--r-- | libfdisk/src/label.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libfdisk/src/label.c b/libfdisk/src/label.c index 32af51f88..e39a543c8 100644 --- a/libfdisk/src/label.c +++ b/libfdisk/src/label.c @@ -236,6 +236,24 @@ int fdisk_create_disklabel(struct fdisk_context *cxt, const char *name) } /** + * fdisk_get_disklabel_id: + * @cxt: fdisk context + * @id: returns pointer to allocated string + * + * Returns 0 on success, otherwise, a corresponding error. + */ +int fdisk_get_disklabel_id(struct fdisk_context *cxt, char **id) +{ + if (!cxt || !cxt->label) + return -EINVAL; + if (!cxt->label->op->get_id) + return -ENOSYS; + + DBG(LABEL, dbgprint("asking for %s ID", cxt->label->name)); + return cxt->label->op->get_id(cxt, id); +} + +/** * fdisk_get_partition_type: * @cxt: fdisk context * @partnum: partition number |