summaryrefslogtreecommitdiffstats
path: root/src/stat.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-06-24 12:00:22 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-06-24 12:06:12 -0400
commit5c3572dc323527a5c168cc12a31b730e0749002d (patch)
tree9430894bcd1759823b956515b8397294f984c1f5 /src/stat.c
parent93749993508eaa9035dbcb005f960bc0b64752f0 (diff)
downloadbfs-5c3572dc323527a5c168cc12a31b730e0749002d.tar.xz
Unify macro naming conventions
In particular, macros that decide whether to use a particular API/ dependency should be spelled BFS_USE_*, and should be configurable.
Diffstat (limited to 'src/stat.c')
-rw-r--r--src/stat.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/stat.c b/src/stat.c
index e3e5aaa..7a413cd 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -14,15 +14,17 @@
#include <sys/stat.h>
#if defined(STATX_BASIC_STATS) && (!__ANDROID__ || __ANDROID_API__ >= 30)
-# define BFS_LIBC_STATX true
+# define BFS_HAS_LIBC_STATX true
#elif __linux__
# include <linux/stat.h>
# include <sys/syscall.h>
# include <unistd.h>
#endif
-#if BFS_LIBC_STATX || defined(SYS_statx)
-# define BFS_STATX true
+#ifndef BFS_USE_STATX
+# if BFS_HAS_LIBC_STATX || defined(SYS_statx)
+# define BFS_USE_STATX true
+# endif
#endif
const char *bfs_stat_field_name(enum bfs_stat_field field) {
@@ -128,13 +130,13 @@ static int bfs_stat_impl(int at_fd, const char *at_path, int at_flags, struct bf
return ret;
}
-#if BFS_STATX
+#if BFS_USE_STATX
/**
* Wrapper for the statx() system call, which had no glibc wrapper prior to 2.28.
*/
static int bfs_statx(int at_fd, const char *at_path, int at_flags, unsigned int mask, struct statx *buf) {
-#if BFS_LIBC_STATX
+#if BFS_HAS_LIBC_STATX
int ret = statx(at_fd, at_path, at_flags, mask, buf);
#else
int ret = syscall(SYS_statx, at_fd, at_path, at_flags, mask, buf);
@@ -242,13 +244,13 @@ static int bfs_statx_impl(int at_fd, const char *at_path, int at_flags, struct b
return ret;
}
-#endif // BFS_STATX
+#endif // BFS_USE_STATX
/**
* Calls the stat() implementation with explicit flags.
*/
static int bfs_stat_explicit(int at_fd, const char *at_path, int at_flags, int x_flags, struct bfs_stat *buf) {
-#if BFS_STATX
+#if BFS_USE_STATX
static atomic bool has_statx = true;
if (load(&has_statx, relaxed)) {