summaryrefslogtreecommitdiff
path: root/bch_bindgen/src/libbcachefs_wrapper.h
diff options
context:
space:
mode:
authorThomas Bertschinger <tahbertschinger@gmail.com>2024-02-20 20:24:20 -0700
committerKent Overstreet <kent.overstreet@linux.dev>2024-02-20 22:27:19 -0500
commit25e84a9917fc8c2f1c7d2976e946c5e5a22b3589 (patch)
tree8a649d705fe1988f3d68ba5c9e0c17874e024afb /bch_bindgen/src/libbcachefs_wrapper.h
parentde9c798382da3ccb1cb5f0427bb5912d01ab66be (diff)
rust: use libc::Ioctl type for ioctl() request argument
The second argument to ioctl() can be defined as a different type by different libc implementations, and can be a different size on different architectures depending on what type it is defined as. For example, glibc defines it as `unsigned long` which may have a different size on 32-bit vs. 64-bit architectures, and musl libc defines it as `int`. The Rust libc crate exposes a type `libc::Ioctl` which is defined as the appropriate integer type for the given libc implementation. Using this type for the request argument to `libc::ioctl()` ensures code will compile correctly regardless of architecture and libc implementation. Also, because ioctl request numbers are defined to be 32 bits (regardless of the fact that `unsigned long` might sometimes take 64 bits on some architectures), this patch changes the Rust representation of the bcachefs ioctl numbers to u32 instead of u64. Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'bch_bindgen/src/libbcachefs_wrapper.h')
-rw-r--r--bch_bindgen/src/libbcachefs_wrapper.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/bch_bindgen/src/libbcachefs_wrapper.h b/bch_bindgen/src/libbcachefs_wrapper.h
index bc4658fb..128592c3 100644
--- a/bch_bindgen/src/libbcachefs_wrapper.h
+++ b/bch_bindgen/src/libbcachefs_wrapper.h
@@ -33,5 +33,5 @@ MARK_FIX_753(blk_mode_t, BLK_OPEN_READ);
MARK_FIX_753(blk_mode_t, BLK_OPEN_WRITE);
MARK_FIX_753(blk_mode_t, BLK_OPEN_EXCL);
-MARK_FIX_753(__u64, BCH_IOCTL_SUBVOLUME_CREATE);
-MARK_FIX_753(__u64, BCH_IOCTL_SUBVOLUME_DESTROY);
+MARK_FIX_753(__u32, BCH_IOCTL_SUBVOLUME_CREATE);
+MARK_FIX_753(__u32, BCH_IOCTL_SUBVOLUME_DESTROY);