am 1a46de67: am f281fd02: Merge "Better statfs/fstatfs glibc compatibility."

* commit '1a46de67b3f78ce44ddf622bcf5918fe758dd4d4':
  Better statfs/fstatfs glibc compatibility.
This commit is contained in:
Elliott Hughes 2013-10-01 10:04:30 -07:00 committed by Android Git Automerger
commit d4e6961041
2 changed files with 39 additions and 32 deletions

View File

@ -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;

View File

@ -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