summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/stat.c19
-rw-r--r--src/stat.h33
2 files changed, 24 insertions, 28 deletions
diff --git a/src/stat.c b/src/stat.c
index 4e7e7e2..36222cb 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -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;
diff --git a/src/stat.h b/src/stat.h
index 17b7fe1..856a2ca 100644
--- a/src/stat.h
+++ b/src/stat.h
@@ -45,21 +45,20 @@
* bfs_stat field bitmask.
*/
enum bfs_stat_field {
- BFS_STAT_DEV = 1 << 0,
- BFS_STAT_INO = 1 << 1,
- BFS_STAT_TYPE = 1 << 2,
- BFS_STAT_MODE = 1 << 3,
- BFS_STAT_NLINK = 1 << 4,
- BFS_STAT_GID = 1 << 5,
- BFS_STAT_UID = 1 << 6,
- BFS_STAT_SIZE = 1 << 7,
- BFS_STAT_BLOCKS = 1 << 8,
- BFS_STAT_RDEV = 1 << 9,
- BFS_STAT_ATTRS = 1 << 10,
- BFS_STAT_ATIME = 1 << 11,
- BFS_STAT_BTIME = 1 << 12,
- BFS_STAT_CTIME = 1 << 13,
- BFS_STAT_MTIME = 1 << 14,
+ BFS_STAT_MODE = 1 << 0,
+ BFS_STAT_DEV = 1 << 1,
+ BFS_STAT_INO = 1 << 2,
+ BFS_STAT_NLINK = 1 << 3,
+ BFS_STAT_GID = 1 << 4,
+ BFS_STAT_UID = 1 << 5,
+ BFS_STAT_SIZE = 1 << 6,
+ BFS_STAT_BLOCKS = 1 << 7,
+ BFS_STAT_RDEV = 1 << 8,
+ BFS_STAT_ATTRS = 1 << 9,
+ BFS_STAT_ATIME = 1 << 10,
+ BFS_STAT_BTIME = 1 << 11,
+ BFS_STAT_CTIME = 1 << 12,
+ BFS_STAT_MTIME = 1 << 13,
};
/**
@@ -88,12 +87,12 @@ struct bfs_stat {
/** Bitmask indicating filled fields. */
enum bfs_stat_field mask;
+ /** File type and access mode. */
+ mode_t mode;
/** Device ID containing the file. */
dev_t dev;
/** Inode number. */
ino_t ino;
- /** File type and access mode. */
- mode_t mode;
/** Number of hard links. */
nlink_t nlink;
/** Owner group ID. */