aboutsummaryrefslogtreecommitdiff
path: root/lib/fstree
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-07-02 19:50:05 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-07-10 09:22:04 +0200
commite7ecb1f92ae618a56ee8eabb6cbf98365de3695a (patch)
tree8d6d53df2c1654ecf5f4c587d8b7b2592a68c4f2 /lib/fstree
parentec593e0b94656a5481f82ee0f33728ced297ac48 (diff)
Move sqfs_dir_entry_t code from libio into libsquashfs
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/fstree')
-rw-r--r--lib/fstree/Makemodule.am15
-rw-r--r--lib/fstree/src/fstree.c6
-rw-r--r--lib/fstree/test/add_by_path.c3
-rw-r--r--lib/fstree/test/fstree_sort.c3
-rw-r--r--lib/fstree/test/gen_inode_numbers.c4
-rw-r--r--lib/fstree/test/get_path.c3
-rw-r--r--lib/fstree/test/mknode_dir.c3
-rw-r--r--lib/fstree/test/mknode_simple.c3
8 files changed, 18 insertions, 22 deletions
diff --git a/lib/fstree/Makemodule.am b/lib/fstree/Makemodule.am
index 8eeaa86..2ce43d7 100644
--- a/lib/fstree/Makemodule.am
+++ b/lib/fstree/Makemodule.am
@@ -5,23 +5,26 @@ libfstree_a_SOURCES = include/fstree.h lib/fstree/src/fstree.c \
noinst_LIBRARIES += libfstree.a
test_mknode_simple_SOURCES = lib/fstree/test/mknode_simple.c
-test_mknode_simple_LDADD = libfstree.a libio.a libutil.a libcompat.a
+test_mknode_simple_LDADD = libfstree.a libsquashfs.la libutil.a libcompat.a
test_mknode_dir_SOURCES = lib/fstree/test/mknode_dir.c
-test_mknode_dir_LDADD = libfstree.a libio.a libutil.a libcompat.a
+test_mknode_dir_LDADD = libfstree.a libsquashfs.la libutil.a libcompat.a
test_gen_inode_numbers_SOURCES = lib/fstree/test/gen_inode_numbers.c
-test_gen_inode_numbers_LDADD = libcommon.a libfstree.a libio.a \
+test_gen_inode_numbers_LDADD = libcommon.a libfstree.a libsquashfs.la \
libutil.a libcompat.a
test_add_by_path_SOURCES = lib/fstree/test/add_by_path.c
-test_add_by_path_LDADD = libcommon.a libfstree.a libio.a libutil.a libcompat.a
+test_add_by_path_LDADD = libcommon.a libfstree.a libsquashfs.la \
+ libutil.a libcompat.a
test_get_path_SOURCES = lib/fstree/test/get_path.c
-test_get_path_LDADD = libcommon.a libfstree.a libio.a libutil.a libcompat.a
+test_get_path_LDADD = libcommon.a libfstree.a libsquashfs.la \
+ libutil.a libcompat.a
test_fstree_sort_SOURCES = lib/fstree/test/fstree_sort.c
-test_fstree_sort_LDADD = libcommon.a libfstree.a libio.a libutil.a libcompat.a
+test_fstree_sort_LDADD = libcommon.a libfstree.a libsquashfs.la \
+ libutil.a libcompat.a
FSTREE_TESTS = \
test_mknode_simple test_mknode_dir test_gen_inode_numbers \
diff --git a/lib/fstree/src/fstree.c b/lib/fstree/src/fstree.c
index 432a380..225fcf0 100644
--- a/lib/fstree/src/fstree.c
+++ b/lib/fstree/src/fstree.c
@@ -102,7 +102,7 @@ static tree_node_t *mknode(fstree_t *fs, tree_node_t *parent, const char *name,
ptr = n->name + name_len + 1;
strcpy(ptr, extra);
- if (ent->flags & DIR_ENTRY_FLAG_HARD_LINK) {
+ if (ent->flags & SQFS_DIR_ENTRY_FLAG_HARD_LINK) {
if (canonicalize_name(ptr)) {
free(n);
errno = EINVAL;
@@ -113,7 +113,7 @@ static tree_node_t *mknode(fstree_t *fs, tree_node_t *parent, const char *name,
ptr = NULL;
}
- if (ent->flags & DIR_ENTRY_FLAG_HARD_LINK) {
+ if (ent->flags & SQFS_DIR_ENTRY_FLAG_HARD_LINK) {
n->mode = S_IFLNK | 0777;
n->flags |= FLAG_LINK_IS_HARD;
}
@@ -143,7 +143,7 @@ static tree_node_t *mknode(fstree_t *fs, tree_node_t *parent, const char *name,
return NULL;
}
- if (ent->flags & DIR_ENTRY_FLAG_HARD_LINK) {
+ if (ent->flags & SQFS_DIR_ENTRY_FLAG_HARD_LINK) {
n->next_by_type = fs->links_unresolved;
fs->links_unresolved = n;
}
diff --git a/lib/fstree/test/add_by_path.c b/lib/fstree/test/add_by_path.c
index b9f4b75..d59467c 100644
--- a/lib/fstree/test/add_by_path.c
+++ b/lib/fstree/test/add_by_path.c
@@ -13,10 +13,9 @@
static sqfs_dir_entry_t *mkentry(const char *name, sqfs_u16 mode, sqfs_u32 uid,
sqfs_u32 gid)
{
- sqfs_dir_entry_t *ent = dir_entry_create(name);
+ sqfs_dir_entry_t *ent = sqfs_dir_entry_create(name, mode, 0);
TEST_NOT_NULL(ent);
- ent->mode = mode;
ent->uid = uid;
ent->gid = gid;
return ent;
diff --git a/lib/fstree/test/fstree_sort.c b/lib/fstree/test/fstree_sort.c
index 6f20ce7..a5f83ac 100644
--- a/lib/fstree/test/fstree_sort.c
+++ b/lib/fstree/test/fstree_sort.c
@@ -12,11 +12,10 @@
static tree_node_t *mkentry(fstree_t *fs, const char *name)
{
- sqfs_dir_entry_t *ent = dir_entry_create(name);
+ sqfs_dir_entry_t *ent = sqfs_dir_entry_create(name, S_IFBLK | 0600, 0);
tree_node_t *out;
TEST_NOT_NULL(ent);
- ent->mode = S_IFBLK | 0600;
ent->rdev = 1337;
out = fstree_add_generic(fs, ent, NULL);
diff --git a/lib/fstree/test/gen_inode_numbers.c b/lib/fstree/test/gen_inode_numbers.c
index 34d8322..1a3ec4c 100644
--- a/lib/fstree/test/gen_inode_numbers.c
+++ b/lib/fstree/test/gen_inode_numbers.c
@@ -12,12 +12,10 @@
static tree_node_t *gen_node(fstree_t *fs, const char *path)
{
- sqfs_dir_entry_t *ent = dir_entry_create(path);
+ sqfs_dir_entry_t *ent = sqfs_dir_entry_create(path, S_IFDIR | 0755, 0);
tree_node_t *ret;
TEST_NOT_NULL(ent);
- ent->mode = S_IFDIR | 0755;
-
ret = fstree_add_generic(fs, ent, NULL);
free(ent);
return ret;
diff --git a/lib/fstree/test/get_path.c b/lib/fstree/test/get_path.c
index f248c79..57eb5ab 100644
--- a/lib/fstree/test/get_path.c
+++ b/lib/fstree/test/get_path.c
@@ -12,9 +12,8 @@
static sqfs_dir_entry_t *mkentry(const char *name)
{
- sqfs_dir_entry_t *ent = dir_entry_create(name);
+ sqfs_dir_entry_t *ent = sqfs_dir_entry_create(name, S_IFDIR | 0750, 0);
TEST_NOT_NULL(ent);
- ent->mode = S_IFDIR | 0750;
ent->uid = 1000;
ent->gid = 100;
return ent;
diff --git a/lib/fstree/test/mknode_dir.c b/lib/fstree/test/mknode_dir.c
index f852706..08a1b13 100644
--- a/lib/fstree/test/mknode_dir.c
+++ b/lib/fstree/test/mknode_dir.c
@@ -11,9 +11,8 @@
static sqfs_dir_entry_t *mkentry(const char *name)
{
- sqfs_dir_entry_t *ent = dir_entry_create(name);
+ sqfs_dir_entry_t *ent = sqfs_dir_entry_create(name, S_IFDIR | 0654, 0);
TEST_NOT_NULL(ent);
- ent->mode = S_IFDIR | 0654;
ent->uid = 123;
ent->gid = 456;
ent->rdev = 789;
diff --git a/lib/fstree/test/mknode_simple.c b/lib/fstree/test/mknode_simple.c
index d871c5a..5af6d5f 100644
--- a/lib/fstree/test/mknode_simple.c
+++ b/lib/fstree/test/mknode_simple.c
@@ -11,9 +11,8 @@
static sqfs_dir_entry_t *mkentry(const char *name, sqfs_u16 mode)
{
- sqfs_dir_entry_t *ent = dir_entry_create(name);
+ sqfs_dir_entry_t *ent = sqfs_dir_entry_create(name, mode | 0654, 0);
TEST_NOT_NULL(ent);
- ent->mode = mode | 0654;
ent->uid = 123;
ent->gid = 456;
ent->rdev = 789;