From: Karel Zak Date: Mon, 17 Jul 2017 07:47:42 +0000 (+0200) Subject: libfdisk: use BLKPG_* ioctls on linux only X-Git-Tag: v2.31-rc1~197 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5ecd61851115a62064dd233c870a76fc26e007d7;p=thirdparty%2Futil-linux.git libfdisk: use BLKPG_* ioctls on linux only Signed-off-by: Karel Zak --- diff --git a/libfdisk/src/context.c b/libfdisk/src/context.c index fce740e150..54e43192ed 100644 --- a/libfdisk/src/context.c +++ b/libfdisk/src/context.c @@ -3,7 +3,9 @@ #endif #include "blkdev.h" -#include "partx.h" +#ifdef __linux__ +# include "partx.h" +#endif #include "loopdev.h" #include "fdiskP.h" @@ -759,8 +761,12 @@ static inline int add_to_partitions_array( * partition table. The BLKPG_* ioctls are used for individual partitions. The * advantage is that unmodified partitions maybe mounted. * + * The function behavies like fdisk_reread_partition_table() on systems where + * are no avaialble BLKPG_* ioctls. + * * Returns: <0 on error, or 0. */ +#ifdef __linux__ int fdisk_reread_changes(struct fdisk_context *cxt, struct fdisk_table *org) { struct fdisk_table *tb = NULL; @@ -836,6 +842,12 @@ done: fdisk_unref_table(tb); return rc; } +#else +int fdisk_reread_changes(struct fdisk_context *cxt, + struct fdisk_table *org __attribute__((__unused__))) { + return fdisk_reread_partition_table(cxt); +} +#endif /** * fdisk_device_is_used: