summaryrefslogtreecommitdiff
path: root/libfdisk/src/label.c
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2013-09-03 17:35:15 +0200
committerKarel Zak <kzak@redhat.com>2013-09-16 16:47:09 +0200
commitc0d20aae6fb4fe5dfdb314ff11858ba2afadab67 (patch)
tree409cb3cf16765ce13831b96441a6025501c93984 /libfdisk/src/label.c
parent513d546289500da75d9e14a933509b7c58b1554e (diff)
downloadutil-linux-c0d20aae6fb4fe5dfdb314ff11858ba2afadab67.tar.gz
libfdisk: add fdisk_locate_disklabel()
The function returns offset and size of disklabel elements. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/label.c')
-rw-r--r--libfdisk/src/label.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libfdisk/src/label.c b/libfdisk/src/label.c
index 147918e0..95a0abfb 100644
--- a/libfdisk/src/label.c
+++ b/libfdisk/src/label.c
@@ -245,6 +245,20 @@ int fdisk_create_disklabel(struct fdisk_context *cxt, const char *name)
return cxt->label->op->create(cxt);
}
+
+int fdisk_locate_disklabel(struct fdisk_context *cxt, int n, const char **name,
+ off_t *offset, size_t *size)
+{
+ if (!cxt || !cxt->label)
+ return -EINVAL;
+ if (!cxt->label->op->locate)
+ return -ENOSYS;
+
+ DBG(LABEL, dbgprint("locating %d chunk of %s.", n, cxt->label->name));
+ return cxt->label->op->locate(cxt, n, name, offset, size);
+}
+
+
/**
* fdisk_get_disklabel_id:
* @cxt: fdisk context