about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorнаб <nabijaczleweli@nabijaczleweli.xyz>2023-08-17 22:05:14 +0200
committerRich Felker <dalias@aerifal.cx>2023-08-19 14:46:20 -0400
commit7291c6c66a8d033bb487e6d8c8b003c8a7b6a550 (patch)
tree57ae71aa246bd948d2ae65f22caac009cc8e663e /include
parent39e43f0881b12d602ddcb8a9e9295456354b765b (diff)
downloadmusl-7291c6c66a8d033bb487e6d8c8b003c8a7b6a550.tar.gz
musl-7291c6c66a8d033bb487e6d8c8b003c8a7b6a550.tar.xz
musl-7291c6c66a8d033bb487e6d8c8b003c8a7b6a550.zip
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 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.

Since commit 6567db65f495cf7c11f5c1e60a3e54543d5a69bc (prior to
1.0.0), the spare slots have been zero-filled, so on all versions that
may be reasonably be encountered in the wild, applications can rely on
a nonzero f_type as indication that the new field has been filled in.
Diffstat (limited to 'include')
-rw-r--r--include/sys/statvfs.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/sys/statvfs.h b/include/sys/statvfs.h
index 57a6b806..71d9d1f9 100644
--- a/include/sys/statvfs.h
+++ b/include/sys/statvfs.h
@@ -23,7 +23,8 @@ struct statvfs {
 	unsigned long f_fsid;
 #endif
 	unsigned long f_flag, f_namemax;
-	int __reserved[6];
+	unsigned int f_type;
+	int __reserved[5];
 };
 
 int statvfs (const char *__restrict, struct statvfs *__restrict);