aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/bits
diff options
context:
space:
mode:
authorнаб <nabijaczleweli@nabijaczleweli.xyz>2023-08-06 22:23:36 +0200
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-08-08 09:29:06 -0300
commit92861d93cdad13834f4d8f39504b550a80ad8200 (patch)
tree93dfac605a0267b3990f65d343c9998a43e840ac /sysdeps/unix/sysv/linux/bits
parenta9847e2c66b351c9abc1676b31871ac9c5555ab4 (diff)
downloadglibc-92861d93cdad13834f4d8f39504b550a80ad8200.zip
glibc-92861d93cdad13834f4d8f39504b550a80ad8200.tar.gz
glibc-92861d93cdad13834f4d8f39504b550a80ad8200.tar.bz2
linux: statvfs: allocate spare for f_type
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 glibc extension to the standard interface on Linux and the Hurd, 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. We don't lose any generality by using u32, and by doing so we both make the API consistent with the Hurd, and allow C++ switch(f_type) { case RAMFS_MAGIC: ...; } Also fix tst-statvfs so that it actually fails; as it stood, all it did was return 0 always. Test statfs()' and statvfs()' f_types are the same. Link: https://lore.kernel.org/linux-man/f54kudgblgk643u32tb6at4cd3kkzha6hslahv24szs4raroaz@ogivjbfdaqtb/t/#u Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/unix/sysv/linux/bits')
-rw-r--r--sysdeps/unix/sysv/linux/bits/statvfs.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/bits/statvfs.h b/sysdeps/unix/sysv/linux/bits/statvfs.h
index 8dfb5ce..cf98460 100644
--- a/sysdeps/unix/sysv/linux/bits/statvfs.h
+++ b/sysdeps/unix/sysv/linux/bits/statvfs.h
@@ -51,7 +51,8 @@ struct statvfs
#endif
unsigned long int f_flag;
unsigned long int f_namemax;
- int __f_spare[6];
+ unsigned int f_type;
+ int __f_spare[5];
};
#ifdef __USE_LARGEFILE64
@@ -71,7 +72,8 @@ struct statvfs64
#endif
unsigned long int f_flag;
unsigned long int f_namemax;
- int __f_spare[6];
+ unsigned int f_type;
+ int __f_spare[5];
};
#endif