summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/label.c
diff options
context:
space:
mode:
authorKarel Zak2014-04-18 13:26:08 +0200
committerKarel Zak2014-04-18 13:26:08 +0200
commitdd7ba604631ce57f194f56dfb71414e42d914a21 (patch)
tree180cd564eb416092521b48da0c06c24e2a6e8de4 /libfdisk/src/label.c
parentnsenter: add + to getopt_long() (diff)
downloadkernel-qcow2-util-linux-dd7ba604631ce57f194f56dfb71414e42d914a21.tar.gz
kernel-qcow2-util-linux-dd7ba604631ce57f194f56dfb71414e42d914a21.tar.xz
kernel-qcow2-util-linux-dd7ba604631ce57f194f56dfb71414e42d914a21.zip
libfdisk: add partitions reorder operation to label API
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/label.c')
-rw-r--r--libfdisk/src/label.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libfdisk/src/label.c b/libfdisk/src/label.c
index 9c6fcc5b3..3881a2713 100644
--- a/libfdisk/src/label.c
+++ b/libfdisk/src/label.c
@@ -372,6 +372,24 @@ int fdisk_partition_toggle_flag(struct fdisk_context *cxt,
return rc;
}
+/**
+ * fdisk_reorder_partitions
+ * @cxt: fdisk context
+ *
+ * Sort partitions according to the partition start sector.
+ *
+ * Returns 0 on success, otherwise, a corresponding error.
+ */
+int fdisk_reorder_partitions(struct fdisk_context *cxt)
+{
+ if (!cxt || !cxt->label)
+ return -EINVAL;
+ if (!cxt->label->op->reorder)
+ return -ENOSYS;
+
+ return cxt->label->op->reorder(cxt);
+}
+
/*
* Resets the current used label driver to initial state
*/