diff options
author | Karel Zak | 2014-04-18 13:26:08 +0200 |
---|---|---|
committer | Karel Zak | 2014-04-18 13:26:08 +0200 |
commit | dd7ba604631ce57f194f56dfb71414e42d914a21 (patch) | |
tree | 180cd564eb416092521b48da0c06c24e2a6e8de4 /libfdisk/src/label.c | |
parent | nsenter: add + to getopt_long() (diff) | |
download | kernel-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.c | 18 |
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 */ |