summaryrefslogtreecommitdiffstats
path: root/lib/loopdev.c
diff options
context:
space:
mode:
authorKarel Zak2017-10-04 10:08:08 +0200
committerKarel Zak2017-10-04 10:08:08 +0200
commitc4e60bc0807b04ab104594abc83301481d5d5995 (patch)
treed49363aedcf99aa5cb220d65bcf536010ab43ab3 /lib/loopdev.c
parentbuild-sys: release++ (v2.31-rc2) (diff)
downloadkernel-qcow2-util-linux-c4e60bc0807b04ab104594abc83301481d5d5995.tar.gz
kernel-qcow2-util-linux-c4e60bc0807b04ab104594abc83301481d5d5995.tar.xz
kernel-qcow2-util-linux-c4e60bc0807b04ab104594abc83301481d5d5995.zip
losetup: fix conflicting types for ‘loopcxt_set_blocksize’
Reported-by: Lars Wendler <polynomial-c@gentoo.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib/loopdev.c')
-rw-r--r--lib/loopdev.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/loopdev.c b/lib/loopdev.c
index 66fa4f669..819aada32 100644
--- a/lib/loopdev.c
+++ b/lib/loopdev.c
@@ -1430,7 +1430,11 @@ int loopcxt_set_dio(struct loopdev_cxt *lc, unsigned long use_dio)
return 0;
}
-int loopcxt_set_blocksize(struct loopdev_cxt *lc, unsigned long blocksize)
+/*
+ * Kernel uses "unsigned long" as ioctl arg, but we use u64 for all sizes to
+ * keep loopdev internal API simple.
+ */
+int loopcxt_set_blocksize(struct loopdev_cxt *lc, uint64_t blocksize)
{
int fd = loopcxt_get_fd(lc);
@@ -1438,7 +1442,7 @@ int loopcxt_set_blocksize(struct loopdev_cxt *lc, unsigned long blocksize)
return -EINVAL;
/* Kernels prior to v4.14 don't support this ioctl */
- if (ioctl(fd, LOOP_SET_BLOCK_SIZE, blocksize) < 0) {
+ if (ioctl(fd, LOOP_SET_BLOCK_SIZE, (unsigned long) blocksize) < 0) {
int rc = -errno;
DBG(CXT, ul_debugobj(lc, "LOOP_SET_BLOCK_SIZE failed: %m"));
return rc;