Remove <sys/statvfs.h> inlines for API level 19.
API level 19 is no longer supported by the NDK.
While I'm here, let's remove the duplicated structure defintion (as
we've already done for `struct stat`).
Test: treehugger
Change-Id: I9d8286f9e7ba803f3131b6dcb0486ff1b0f9d5d1
diff --git a/libc/include/sys/statvfs.h b/libc/include/sys/statvfs.h
index 93fa3d7..793ee13 100644
--- a/libc/include/sys/statvfs.h
+++ b/libc/include/sys/statvfs.h
@@ -27,63 +27,39 @@
__BEGIN_DECLS
-struct statvfs {
- /** Block size. */
- unsigned long f_bsize;
- /** Fragment size. */
- unsigned long f_frsize;
- /** Total size of filesystem in `f_frsize` blocks. */
- fsblkcnt_t f_blocks;
- /** Number of free blocks. */
- fsblkcnt_t f_bfree;
- /** Number of free blocks for non-root. */
- fsblkcnt_t f_bavail;
- /** Number of inodes. */
- fsfilcnt_t f_files;
- /** Number of free inodes. */
- fsfilcnt_t f_ffree;
- /** Number of free inodes for non-root. */
- fsfilcnt_t f_favail;
- /** Filesystem id. */
- unsigned long f_fsid;
- /** Mount flags. (See `ST_` constants.) */
- unsigned long f_flag;
- /** Maximum filename length. */
- unsigned long f_namemax;
+#define __STATVFS64_BODY \
+ /** Block size. */ \
+ unsigned long f_bsize; \
+ /** Fragment size. */ \
+ unsigned long f_frsize; \
+ /** Total size of filesystem in `f_frsize` blocks. */ \
+ fsblkcnt_t f_blocks; \
+ /** Number of free blocks. */ \
+ fsblkcnt_t f_bfree; \
+ /** Number of free blocks for non-root. */ \
+ fsblkcnt_t f_bavail; \
+ /** Number of inodes. */ \
+ fsfilcnt_t f_files; \
+ /** Number of free inodes. */ \
+ fsfilcnt_t f_ffree; \
+ /** Number of free inodes for non-root. */ \
+ fsfilcnt_t f_favail; \
+ /** Filesystem id. */ \
+ unsigned long f_fsid; \
+ /** Mount flags. (See `ST_` constants.) */ \
+ unsigned long f_flag; \
+ /** Maximum filename length. */ \
+ unsigned long f_namemax; \
#if defined(__LP64__)
- uint32_t __f_reserved[6];
+#define __STATVFS64_CODA uint32_t __f_reserved[6];
+#else
+#define __STATVFS64_CODA
#endif
-};
-struct statvfs64 {
- /** Block size. */
- unsigned long f_bsize;
- /** Fragment size. */
- unsigned long f_frsize;
- /** Total size of filesystem in `f_frsize` blocks. */
- fsblkcnt_t f_blocks;
- /** Number of free blocks. */
- fsblkcnt_t f_bfree;
- /** Number of free blocks for non-root. */
- fsblkcnt_t f_bavail;
- /** Number of inodes. */
- fsfilcnt_t f_files;
- /** Number of free inodes. */
- fsfilcnt_t f_ffree;
- /** Number of free inodes for non-root. */
- fsfilcnt_t f_favail;
- /** Filesystem id. */
- unsigned long f_fsid;
- /** Mount flags. (See `ST_` constants.) */
- unsigned long f_flag;
- /** Maximum filename length. */
- unsigned long f_namemax;
+struct statvfs { __STATVFS64_BODY __STATVFS64_CODA };
-#if defined(__LP64__)
- uint32_t __f_reserved[6];
-#endif
-};
+struct statvfs64 { __STATVFS64_BODY __STATVFS64_CODA };
/** Flag for `f_flag` in `struct statvfs`: mounted read-only. */
#define ST_RDONLY 0x0001
@@ -112,14 +88,13 @@
/** Flag for `f_flag` in `struct statvfs`: see `MS_RELATIME`. */
#define ST_RELATIME 0x1000
-#if __ANDROID_API__ >= 19
-// These functions are implemented as static inlines before API level 19.
-
/**
* [statvfs(3)](http://man7.org/linux/man-pages/man3/statvfs.3.html)
* queries filesystem statistics for the given path.
*
* Returns 0 on success, and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 19.
*/
int statvfs(const char* __path, struct statvfs* __buf) __INTRODUCED_IN(19);
@@ -128,22 +103,15 @@
* queries filesystem statistics for the given file descriptor.
*
* Returns 0 on success, and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 19.
*/
int fstatvfs(int __fd, struct statvfs* __buf) __INTRODUCED_IN(19);
-#endif
-
-#if __ANDROID_API__ >= 21
-// These functions are implemented as static inlines before API level 21.
-
-/** Equivalent to statvfs(). */
+/** Equivalent to statvfs() . */
int statvfs64(const char* __path, struct statvfs64* __buf) __INTRODUCED_IN(21);
/** Equivalent to fstatvfs(). */
int fstatvfs64(int __fd, struct statvfs64* __buf) __INTRODUCED_IN(21);
-#endif
-
__END_DECLS
-
-#include <android/legacy_sys_statvfs_inlines.h>