From d40691e31e2674d7d95ec9160b9897805ce3f43b Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 4 May 2019 11:51:56 -0400 Subject: stat: Unify the flags arguments --- stat.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'stat.h') diff --git a/stat.h b/stat.h index 59a9712..6c915da 100644 --- a/stat.h +++ b/stat.h @@ -63,8 +63,12 @@ const char *bfs_stat_field_name(enum bfs_stat_field field); * bfs_stat() flags. */ enum bfs_stat_flag { - /** Fall back to the link itself on broken symlinks. */ - BFS_STAT_BROKEN_OK = 1 << 0, + /** Follow symlinks (the default). */ + BFS_STAT_FOLLOW = 0, + /** Never follow symlinks. */ + BFS_STAT_NOFOLLOW = 1 << 0, + /** Try to follow symlinks, but fall back to the link itself if broken. */ + BFS_STAT_TRYFOLLOW = 1 << 1, }; #ifdef DEV_BSIZE @@ -113,8 +117,19 @@ struct bfs_stat { /** * Facade over fstatat(). + * + * @param at_fd + * The base file descriptor for the lookup. + * @param at_path + * The path to stat, relative to at_fd. + * @param flags + * Flags that affect the lookup. + * @param[out] buf + * A place to store the stat buffer, if successful. + * @return + * 0 on success, -1 on error. */ -int bfs_stat(int at_fd, const char *at_path, int at_flags, enum bfs_stat_flag flags, struct bfs_stat *buf); +int bfs_stat(int at_fd, const char *at_path, enum bfs_stat_flag flags, struct bfs_stat *buf); /** * Facade over fstat(). -- cgit v1.2.3