diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-02-14 10:58:04 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-02-14 10:58:18 -0500 |
commit | d59d9acbe3c458f240fc3fb406f5bd1dcd38a1c8 (patch) | |
tree | dbc8d14b85f4ee2c72f9fde2f568cce9d6d15e29 /src/stat.c | |
parent | 1a6e712246d01fd7e68b81116bfdae52026b4cd4 (diff) | |
download | bfs-d59d9acbe3c458f240fc3fb406f5bd1dcd38a1c8.tar.xz |
stat: Pack struct bfs_stat a bit
Diffstat (limited to 'src/stat.c')
-rw-r--r-- | src/stat.c | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -21,14 +21,12 @@ const char *bfs_stat_field_name(enum bfs_stat_field field) { switch (field) { + case BFS_STAT_MODE: + return "mode"; case BFS_STAT_DEV: return "device number"; case BFS_STAT_INO: return "inode nunmber"; - case BFS_STAT_TYPE: - return "type"; - case BFS_STAT_MODE: - return "mode"; case BFS_STAT_NLINK: return "link count"; case BFS_STAT_GID: @@ -74,15 +72,15 @@ int bfs_fstatat_flags(enum bfs_stat_flags flags) { void bfs_stat_convert(struct bfs_stat *dest, const struct stat *src) { dest->mask = 0; + dest->mode = src->st_mode; + dest->mask |= BFS_STAT_MODE; + dest->dev = src->st_dev; dest->mask |= BFS_STAT_DEV; dest->ino = src->st_ino; dest->mask |= BFS_STAT_INO; - dest->mode = src->st_mode; - dest->mask |= BFS_STAT_TYPE | BFS_STAT_MODE; - dest->nlink = src->st_nlink; dest->mask |= BFS_STAT_NLINK; @@ -173,16 +171,15 @@ int bfs_statx_convert(struct bfs_stat *dest, const struct statx *src) { dest->mask = 0; + dest->mode = src->stx_mode; + dest->mask |= BFS_STAT_MODE; + dest->dev = xmakedev(src->stx_dev_major, src->stx_dev_minor); dest->mask |= BFS_STAT_DEV; dest->ino = src->stx_ino; dest->mask |= BFS_STAT_INO; - dest->mode = src->stx_mode; - dest->mask |= BFS_STAT_TYPE; - dest->mask |= BFS_STAT_MODE; - dest->nlink = src->stx_nlink; dest->mask |= BFS_STAT_NLINK; |