diff options
-rw-r--r-- | libc/bionic/statvfs.cpp | 4 | ||||
-rw-r--r-- | libc/include/sys/vfs.h | 67 |
2 files changed, 39 insertions, 32 deletions
diff --git a/libc/bionic/statvfs.cpp b/libc/bionic/statvfs.cpp index 743e4fd..5d58281 100644 --- a/libc/bionic/statvfs.cpp +++ b/libc/bionic/statvfs.cpp @@ -23,10 +23,6 @@ extern "C" int __fstatfs64(int, size_t, struct statfs*); #define ST_VALID 0x0020 -#if !defined(__arm__) -#define __val val -#endif - static void __statfs_to_statvfs(const struct statfs& in, struct statvfs* out) { out->f_bsize = in.f_bsize; out->f_frsize = in.f_frsize; diff --git a/libc/include/sys/vfs.h b/libc/include/sys/vfs.h index 6a55c99..6fce3b4 100644 --- a/libc/include/sys/vfs.h +++ b/libc/include/sys/vfs.h @@ -34,40 +34,51 @@ __BEGIN_DECLS -/* These correspond to the kernel's statfs64 type. */ +/* The kernel's __kernel_fsid_t has a 'val' member but glibc uses '__val'. */ +typedef struct { int __val[2]; } __fsid_t; + +/* Our struct statfs corresponds to the kernel's statfs64 type. */ #ifdef __mips__ struct statfs { - uint32_t f_type; - uint32_t f_bsize; - uint32_t f_frsize; - uint32_t __pad; - uint64_t f_blocks; - uint64_t f_bfree; - uint64_t f_files; - uint64_t f_ffree; - uint64_t f_bavail; - __kernel_fsid_t f_fsid; - uint32_t f_namelen; - uint32_t f_flags; - uint32_t f_spare[5]; + uint32_t f_type; + uint32_t f_bsize; + uint32_t f_frsize; + uint32_t __pad; + uint64_t f_blocks; + uint64_t f_bfree; + uint64_t f_files; + uint64_t f_ffree; + uint64_t f_bavail; + __fsid_t f_fsid; + uint32_t f_namelen; + uint32_t f_flags; + uint32_t f_spare[5]; }; #else struct statfs { - uint32_t f_type; - uint32_t f_bsize; - uint64_t f_blocks; - uint64_t f_bfree; - uint64_t f_bavail; - uint64_t f_files; - uint64_t f_ffree; - __kernel_fsid_t f_fsid; - uint32_t f_namelen; - uint32_t f_frsize; - uint32_t f_flags; - uint32_t f_spare[4]; + uint32_t f_type; + uint32_t f_bsize; + uint64_t f_blocks; + uint64_t f_bfree; + uint64_t f_bavail; + uint64_t f_files; + uint64_t f_ffree; + __fsid_t f_fsid; + uint32_t f_namelen; + uint32_t f_frsize; + uint32_t f_flags; + uint32_t f_spare[4]; }; #endif +/* Source compatibility with glibc. */ +#define statfs64 statfs + +/* Declare that we have the f_namelen, f_frsize, and f_flags fields. */ +#define _STATFS_F_NAMELEN +#define _STATFS_F_FRSIZE +#define _STATFS_F_FLAGS + #define ADFS_SUPER_MAGIC 0xadf5 #define AFFS_SUPER_MAGIC 0xADFF #define BEFS_SUPER_MAGIC 0x42465331 @@ -113,8 +124,8 @@ struct statfs { #define XFS_SUPER_MAGIC 0x58465342 #define _XIAFS_SUPER_MAGIC 0x012FD16D -extern int statfs(const char *, struct statfs *); -extern int fstatfs(int, struct statfs *); +extern int statfs(const char*, struct statfs*) __nonnull((1, 2)); +extern int fstatfs(int, struct statfs*) __nonnull((2)); __END_DECLS |