-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #1999 - Jakob-Naucke:fix-statfs-magic-s390x, r=JohnTitor
Declare statfs MAGIC constants as c_uint on s390x Hi, I work in container development on Linux on Z at IBM. On s390x (IBM Z) in GNU/Linux, a statfs `f_type` is 4 bytes wide, contrary to 8 bytes on most architectures. This is already implemented in libc: ```sh $ grep -r f_type src/unix/linux_like/linux/gnu/b64 | uniq src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs: pub f_type: ::__fsword_t, src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs: pub f_type: ::__fsword_t, src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs: pub f_type: ::__fsword_t, src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs: pub f_type: ::c_long, src/unix/linux_like/linux/gnu/b64/mips64/mod.rs: pub f_type: ::c_long, src/unix/linux_like/linux/gnu/b64/s390x.rs: pub f_type: ::c_uint, # s390x is uint src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs: pub f_type: ::__fsword_t, ``` However, the `*_MAGIC` constants (such as `EXT4_SUPER_MAGIC`) in `src/unix/linux_like/linux/gnu/mod.rs` are defined as `c_long`, when they should be `c_uint` on s390x. This ends up biting me [here](https://github.com/kata-containers/cgroups-rs/blob/master/src/hierarchies.rs#L231). Thus, I suggest the attached change to only define these constants for architectures other than s390x and instead define them as uint for s390x. This is safe since none of the constants are any wider than 32bit. Please let me know if you think this could be done more elegantly.
- Loading branch information
Showing
1 changed file
with
105 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters