* commit '1a46de67b3f78ce44ddf622bcf5918fe758dd4d4': Better statfs/fstatfs glibc compatibility.
This commit is contained in:
commit
d4e6961041
@ -23,10 +23,6 @@ extern "C" int __fstatfs64(int, size_t, struct statfs*);
|
|||||||
|
|
||||||
#define ST_VALID 0x0020
|
#define ST_VALID 0x0020
|
||||||
|
|
||||||
#if !defined(__arm__)
|
|
||||||
#define __val val
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void __statfs_to_statvfs(const struct statfs& in, struct statvfs* out) {
|
static void __statfs_to_statvfs(const struct statfs& in, struct statvfs* out) {
|
||||||
out->f_bsize = in.f_bsize;
|
out->f_bsize = in.f_bsize;
|
||||||
out->f_frsize = in.f_frsize;
|
out->f_frsize = in.f_frsize;
|
||||||
|
@ -34,7 +34,10 @@
|
|||||||
|
|
||||||
__BEGIN_DECLS
|
__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__
|
#ifdef __mips__
|
||||||
struct statfs {
|
struct statfs {
|
||||||
uint32_t f_type;
|
uint32_t f_type;
|
||||||
@ -46,7 +49,7 @@ struct statfs {
|
|||||||
uint64_t f_files;
|
uint64_t f_files;
|
||||||
uint64_t f_ffree;
|
uint64_t f_ffree;
|
||||||
uint64_t f_bavail;
|
uint64_t f_bavail;
|
||||||
__kernel_fsid_t f_fsid;
|
__fsid_t f_fsid;
|
||||||
uint32_t f_namelen;
|
uint32_t f_namelen;
|
||||||
uint32_t f_flags;
|
uint32_t f_flags;
|
||||||
uint32_t f_spare[5];
|
uint32_t f_spare[5];
|
||||||
@ -60,7 +63,7 @@ struct statfs {
|
|||||||
uint64_t f_bavail;
|
uint64_t f_bavail;
|
||||||
uint64_t f_files;
|
uint64_t f_files;
|
||||||
uint64_t f_ffree;
|
uint64_t f_ffree;
|
||||||
__kernel_fsid_t f_fsid;
|
__fsid_t f_fsid;
|
||||||
uint32_t f_namelen;
|
uint32_t f_namelen;
|
||||||
uint32_t f_frsize;
|
uint32_t f_frsize;
|
||||||
uint32_t f_flags;
|
uint32_t f_flags;
|
||||||
@ -68,6 +71,14 @@ struct statfs {
|
|||||||
};
|
};
|
||||||
#endif
|
#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 ADFS_SUPER_MAGIC 0xadf5
|
||||||
#define AFFS_SUPER_MAGIC 0xADFF
|
#define AFFS_SUPER_MAGIC 0xADFF
|
||||||
#define BEFS_SUPER_MAGIC 0x42465331
|
#define BEFS_SUPER_MAGIC 0x42465331
|
||||||
@ -113,8 +124,8 @@ struct statfs {
|
|||||||
#define XFS_SUPER_MAGIC 0x58465342
|
#define XFS_SUPER_MAGIC 0x58465342
|
||||||
#define _XIAFS_SUPER_MAGIC 0x012FD16D
|
#define _XIAFS_SUPER_MAGIC 0x012FD16D
|
||||||
|
|
||||||
extern int statfs(const char *, struct statfs *);
|
extern int statfs(const char*, struct statfs*) __nonnull((1, 2));
|
||||||
extern int fstatfs(int, struct statfs *);
|
extern int fstatfs(int, struct statfs*) __nonnull((2));
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user