|
Message-ID: <20240824150050.GC10433@brightrain.aerifal.cx> Date: Sat, 24 Aug 2024 11:00:50 -0400 From: Rich Felker <dalias@...c.org> To: наб <nabijaczleweli@...ijaczleweli.xyz> Cc: Szabolcs Nagy <nsz@...t70.net>, musl@...ts.openwall.com Subject: Re: [PATCH v2] [f]statvfs: allocate spare for f_type On Thu, Aug 17, 2023 at 10:05:14PM +0200, наб wrote: > This is the only missing part in struct statvfs. > The LSB calls [f]statfs() deprecated, and its weird types are definitely > off-putting. However, its use is required to get f_type. > > Instead, allocate one of the six spares to f_type, > copied directly from struct statfs. > This then becomes a small extension to the standard interface on Linux, > instead of two different interfaces, one of which is quite odd due to > being an ABI type, and there no longer is any reason to use statfs(). > > The underlying kernel type is a mess, but all architectures agree on u32 > (or more) for the ABI, and all filesystem magicks are 32-bit integers. Revisiting this, the commit message was incorrect, particularly the wording: "This is the only missing part in struct statvfs." struct statvfs has unsigned long f_fsid, which is only a 32-bit field and does not represent the full (total 64-bit) pair fsid_t from struct statfs that Linux provides. I did some digging into what this actually is, and on filesystems that have a uuid in the superblock, it's a very basic hash (xor of upper and lower half) of the uuid into a 64-bit value. glibc combines the upper and lower half to a single 64-bit unsigned long on 64-bit archs, but uses only the first 32-bit part on 32-bit archs. On musl, I intentionally only used the first part to avoid a functionality discrepancy between 32- and 64-bit archs. Since then, gnu coreutils has switched from using statfs to statvfs, producing a "regression" on musl and 32-bit glibc archs. Arguably this "regression" does not matter, since the value itself is not meaningful and there's really nothing useful you can do with it, but it's probably worth noting. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.