Implement some of the missing LFS64 support.
This gives us: * <dirent.h> struct dirent64 readdir64, readdir64_r, alphasort64, scandir64 * <fcntl.h> creat64, openat64, open64. * <sys/stat.h> struct stat64 fstat64, fstatat64, lstat64, stat64. * <sys/statvfs.h> struct statvfs64 statvfs64, fstatvfs64. * <sys/vfs.h> struct statfs64 statfs64, fstatfs64. This also removes some of the incorrect #define hacks we've had in the past (for stat64, for example, which we promised to clean up way back in bug 8472078). Bug: 11865851 Bug: 8472078 Change-Id: Ia46443521918519f2dfa64d4621027dfd13ac566
This commit is contained in:
@@ -39,73 +39,73 @@ typedef struct { int __val[2]; } __fsid_t;
|
||||
typedef __fsid_t fsid_t;
|
||||
|
||||
#if defined(__aarch64__) || defined(__x86_64__)
|
||||
struct statfs {
|
||||
uint64_t f_type;
|
||||
uint64_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;
|
||||
uint64_t f_namelen;
|
||||
uint64_t f_frsize;
|
||||
uint64_t f_flags;
|
||||
uint64_t f_spare[4];
|
||||
};
|
||||
#define __STATFS64_BODY \
|
||||
uint64_t f_type; \
|
||||
uint64_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; \
|
||||
uint64_t f_namelen; \
|
||||
uint64_t f_frsize; \
|
||||
uint64_t f_flags; \
|
||||
uint64_t f_spare[4]; \
|
||||
|
||||
#elif defined(__mips__) && defined(__LP64__)
|
||||
/* 64-bit MIPS. */
|
||||
struct statfs {
|
||||
uint64_t f_type;
|
||||
uint64_t f_bsize;
|
||||
uint64_t f_frsize; /* Fragment size - unsupported. */
|
||||
uint64_t f_blocks;
|
||||
uint64_t f_bfree;
|
||||
uint64_t f_files;
|
||||
uint64_t f_ffree;
|
||||
uint64_t f_bavail;
|
||||
fsid_t f_fsid;
|
||||
uint64_t f_namelen;
|
||||
uint64_t f_flags;
|
||||
uint64_t f_spare[5];
|
||||
};
|
||||
#define __STATFS64_BODY \
|
||||
uint64_t f_type; \
|
||||
uint64_t f_bsize; \
|
||||
uint64_t f_frsize; /* Fragment size - unsupported. */ \
|
||||
uint64_t f_blocks; \
|
||||
uint64_t f_bfree; \
|
||||
uint64_t f_files; \
|
||||
uint64_t f_ffree; \
|
||||
uint64_t f_bavail; \
|
||||
fsid_t f_fsid; \
|
||||
uint64_t f_namelen; \
|
||||
uint64_t f_flags; \
|
||||
uint64_t f_spare[5]; \
|
||||
|
||||
#elif defined(__mips__)
|
||||
/* 32-bit MIPS (corresponds to the kernel's statfs64 type). */
|
||||
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;
|
||||
fsid_t f_fsid;
|
||||
uint32_t f_namelen;
|
||||
uint32_t f_flags;
|
||||
uint32_t f_spare[5];
|
||||
};
|
||||
#define __STATFS64_BODY \
|
||||
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
|
||||
/* 32-bit ARM or x86 (corresponds to the kernel's statfs64 type). */
|
||||
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;
|
||||
fsid_t f_fsid;
|
||||
uint32_t f_namelen;
|
||||
uint32_t f_frsize;
|
||||
uint32_t f_flags;
|
||||
uint32_t f_spare[4];
|
||||
};
|
||||
#define __STATFS64_BODY \
|
||||
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
|
||||
struct statfs { __STATFS64_BODY };
|
||||
struct statfs64 { __STATFS64_BODY };
|
||||
|
||||
/* Declare that we have the f_namelen, f_frsize, and f_flags fields. */
|
||||
#define _STATFS_F_NAMELEN
|
||||
@@ -158,7 +158,9 @@ struct statfs {
|
||||
#define _XIAFS_SUPER_MAGIC 0x012FD16D
|
||||
|
||||
extern int statfs(const char*, struct statfs*) __nonnull((1, 2));
|
||||
extern int statfs64(const char*, struct statfs64*) __nonnull((1, 2));
|
||||
extern int fstatfs(int, struct statfs*) __nonnull((2));
|
||||
extern int fstatfs64(int, struct statfs64*) __nonnull((2));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
Reference in New Issue
Block a user