aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-07-20 08:40:34 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-08-18 18:31:28 +0200
commit3a0ee386184093a130d6c61c3eeb1d5a65bdd167 (patch)
treecd1861a6c5dc913eb0d9364e6c20341a0f70455d
parent5a3b741b92b793be7221a481efca316aec208ebe (diff)
Add an inode fieled to sqfs_dir_entry_t
This might be needed externally for things like hard link detection. For the unix implementation, store the actual inode number here. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--include/sqfs/dir_entry.h5
-rw-r--r--lib/sqfs/src/io/dir_unix.c1
2 files changed, 6 insertions, 0 deletions
diff --git a/include/sqfs/dir_entry.h b/include/sqfs/dir_entry.h
index cb13f4f..4db13cf 100644
--- a/include/sqfs/dir_entry.h
+++ b/include/sqfs/dir_entry.h
@@ -69,6 +69,11 @@ struct sqfs_dir_entry_t {
sqfs_u64 rdev;
/**
+ * @brief Device and filesystem specific inode number.
+ */
+ sqfs_u64 inode;
+
+ /**
* @brief ID of the user that owns the entry.
*/
sqfs_u64 uid;
diff --git a/lib/sqfs/src/io/dir_unix.c b/lib/sqfs/src/io/dir_unix.c
index 83127ec..efc9a2a 100644
--- a/lib/sqfs/src/io/dir_unix.c
+++ b/lib/sqfs/src/io/dir_unix.c
@@ -114,6 +114,7 @@ static int dir_next(sqfs_dir_iterator_t *base, sqfs_dir_entry_t **out)
(*out)->rdev = it->sb.st_rdev;
(*out)->uid = it->sb.st_uid;
(*out)->gid = it->sb.st_gid;
+ (*out)->inode = it->sb.st_ino;
if (S_ISREG(it->sb.st_mode))
(*out)->size = it->sb.st_size;