summaryrefslogtreecommitdiff
path: root/bch_bindgen/src/libbcachefs_wrapper.h
AgeCommit message (Collapse)Author
2024-02-20rust: use libc::Ioctl type for ioctl() request argumentThomas Bertschinger
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>
2024-01-26feat(bindgen): expose `BCH_IOCTL_SUBVOLUME_*` on Rust sideRaito Bezarius
As they are functional macro, they need help from our side.
2024-01-26fix(bindgen): expand the Fix753 workaround for any type and document itRaito Bezarius
Offer documentation to the poor people who stumble on this and look for a macro generation mechanism on the Rust side.
2024-01-16move Rust sources to top level, C sources into c_srcThomas Bertschinger
This moves the Rust sources out of rust_src/ and into the top level. Running the bcachefs executable out of the development tree is now: $ ./target/release/bcachefs command or $ cargo run --profile release -- command instead of "./bcachefs command". Building and installing is still: $ make && make install Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>