rustix
rustix copied to clipboard
About `statfs.f_fsid`
statfs in rustix 0.38 returned the raw linux-raw-sys statfs64 struct. rustix 1.0 changed this to a rustix StatFs struct that uses a Fsid struct for the f_fsid field. For the libc backend this is a alias to libc::fsid_t, the linux_raw backend defines the Fsid struct by itself.
The problem is that this struct is completely useless. Although this is also (kind of) true at the kernel level:
Nobody knows what
f_fsidis supposed to contain (but see below).
, the situation in rustix is even more useless.
While you can not be rely on the meaning and ABI of f_fsid across different operating systems, you can use it within one operating system where it has the same meaning and ABI. However this is not really possible with rustix because there are no methods to access the value or do basic operations on it like compare for equality.
Ideas on getting out of this:
- derive
PartialEqinlinux_raw(forlibcbackend this is already derived ifextra_traitsis used) to support comparing of twoFsidinstances.- This does not fix the problem that you can not create a
Fsidwithouttransmute_copy(which should be same because ofrepr(C)withCopy).
- This does not fix the problem that you can not create a
- add a function to expose "the raw value" (for all(?) operating systems "the raw value" can be transmuted to an
u64?).- Likely impossible for
libcbackend withouttransmute(_copy).
- Likely impossible for