diff options
author | Karel Zak | 2014-02-03 12:19:38 +0100 |
---|---|---|
committer | Karel Zak | 2014-03-11 11:35:13 +0100 |
commit | e5c93999e664a5c534b047de3ea6fb8030958dd3 (patch) | |
tree | 23dccabc49c84284f72653705c15e9a9816e50fb /libfdisk/src/partition.c | |
parent | include/list: add void data to the sort cmp function (diff) | |
download | kernel-qcow2-util-linux-e5c93999e664a5c534b047de3ea6fb8030958dd3.tar.gz kernel-qcow2-util-linux-e5c93999e664a5c534b047de3ea6fb8030958dd3.tar.xz kernel-qcow2-util-linux-e5c93999e664a5c534b047de3ea6fb8030958dd3.zip |
libfdisk: add table sort function, use it in get_freespace
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/partition.c')
-rw-r--r-- | libfdisk/src/partition.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libfdisk/src/partition.c b/libfdisk/src/partition.c index 65a284e75..da5e75c25 100644 --- a/libfdisk/src/partition.c +++ b/libfdisk/src/partition.c @@ -66,6 +66,12 @@ uint64_t fdisk_partition_get_start(struct fdisk_partition *pa) return pa ? pa->start : 0; } +int fdisk_partition_cmp_start(struct fdisk_partition *a, + struct fdisk_partition *b) +{ + return a->start - b->start; +} + int fdisk_partition_set_end(struct fdisk_partition *pa, uint64_t off, int isrel) { if (!pa) @@ -109,6 +115,12 @@ size_t fdisk_partition_get_partno(struct fdisk_partition *pa) return pa ? pa->partno : (size_t) -1; } +int fdisk_partition_cmp_partno(struct fdisk_partition *a, + struct fdisk_partition *b) +{ + return a->partno - b->partno; +} + int fdisk_partition_set_type(struct fdisk_partition *pa, struct fdisk_parttype *type) { if (!pa) |