From f7b03c0695b313a0ddd527d4bbd6c50c010bd7e4 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 29 Jul 2020 22:44:53 -0400 Subject: bftw: Rename bftw_typeflag to bftw_type, and make it not a bitmask --- bftw.h | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'bftw.h') diff --git a/bftw.h b/bftw.h index 4aecaf7..4bd9811 100644 --- a/bftw.h +++ b/bftw.h @@ -29,37 +29,37 @@ /** * Possible file types. */ -enum bftw_typeflag { +enum bftw_type { + /** An error occurred for this file. */ + BFTW_ERROR = -1, /** Unknown type. */ - BFTW_UNKNOWN = 0, + BFTW_UNKNOWN, /** Block device. */ - BFTW_BLK = 1 << 0, + BFTW_BLK, /** Character device. */ - BFTW_CHR = 1 << 1, + BFTW_CHR, /** Directory. */ - BFTW_DIR = 1 << 2, + BFTW_DIR, /** Solaris door. */ - BFTW_DOOR = 1 << 3, + BFTW_DOOR, /** Pipe. */ - BFTW_FIFO = 1 << 4, + BFTW_FIFO, /** Symbolic link. */ - BFTW_LNK = 1 << 5, + BFTW_LNK, /** Solaris event port. */ - BFTW_PORT = 1 << 6, + BFTW_PORT, /** Regular file. */ - BFTW_REG = 1 << 7, + BFTW_REG, /** Socket. */ - BFTW_SOCK = 1 << 8, + BFTW_SOCK, /** BSD whiteout. */ - BFTW_WHT = 1 << 9, - /** An error occurred for this file. */ - BFTW_ERROR = 1 << 10, + BFTW_WHT, }; /** - * Convert a bfs_stat() mode to a bftw() typeflag. + * Convert a bfs_stat() mode to a bftw_type. */ -enum bftw_typeflag bftw_mode_typeflag(mode_t mode); +enum bftw_type bftw_mode_to_type(mode_t mode); /** * Possible visit occurrences. @@ -100,8 +100,8 @@ struct BFTW { enum bftw_visit visit; /** The file type. */ - enum bftw_typeflag typeflag; - /** The errno that occurred, if typeflag == BFTW_ERROR. */ + enum bftw_type type; + /** The errno that occurred, if type == BFTW_ERROR. */ int error; /** A parent file descriptor for the *at() family of calls. */ @@ -142,7 +142,7 @@ const struct bfs_stat *bftw_stat(const struct BFTW *ftwbuf, enum bfs_stat_flag f * @return * The type of the file, or BFTW_ERROR if an error occurred. */ -enum bftw_typeflag bftw_typeflag(const struct BFTW *ftwbuf, enum bfs_stat_flag flags); +enum bftw_type bftw_type(const struct BFTW *ftwbuf, enum bfs_stat_flag flags); /** * Walk actions returned by the bftw() callback. -- cgit v1.2.3