|
Message-ID: <asc2xecbzzsppxz2lixxhdu4cklfroel4ep34uxlsc7jfyrqii@gfhzy4jgsf6u>
Date: Thu, 17 Aug 2023 22:05:14 +0200
From: наб <nabijaczleweli@...ijaczleweli.xyz>
To: Szabolcs Nagy <nsz@...t70.net>
Cc: musl@...ts.openwall.com
Subject: [PATCH v2] [f]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.
Link: https://lore.kernel.org/linux-man/f54kudgblgk643u32tb6at4cd3kkzha6hslahv24szs4raroaz@ogivjbfdaqtb/t/#u
Link: https://sourceware.org/git/?p=glibc.git;a=commit;h=92861d93cdad13834f4d8f39504b550a80ad8200
---
Applied in glibc for 2.39, so resending rebased.
include/sys/statvfs.h | 3 ++-
src/stat/statvfs.c | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
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);
diff --git a/src/stat/statvfs.c b/src/stat/statvfs.c
index bfbb5fee..bc12da8b 100644
--- a/src/stat/statvfs.c
+++ b/src/stat/statvfs.c
@@ -39,6 +39,7 @@ static void fixup(struct statvfs *out, const struct statfs *in)
out->f_fsid = in->f_fsid.__val[0];
out->f_flag = in->f_flags;
out->f_namemax = in->f_namelen;
+ out->f_type = in->f_type;
}
int statvfs(const char *restrict path, struct statvfs *restrict buf)
--
2.39.2
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
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.