diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2023-06-01 14:55:58 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2023-06-01 17:28:39 +0200 |
commit | 3f7f3654d243275332d964f9ecbb79f9eb83a5d1 (patch) | |
tree | e46bfea72edff431092bb124bff948976358918a /lib/fstree/test | |
parent | 665221e904df597925fc411d443802b20758b71f (diff) |
libio: split dir_entry_t from dir_iterator_t, add create helper
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/fstree/test')
-rw-r--r-- | lib/fstree/test/add_by_path.c | 3 | ||||
-rw-r--r-- | lib/fstree/test/fstree_sort.c | 3 | ||||
-rw-r--r-- | lib/fstree/test/gen_inode_numbers.c | 3 | ||||
-rw-r--r-- | lib/fstree/test/get_path.c | 4 | ||||
-rw-r--r-- | lib/fstree/test/mknode_dir.c | 4 | ||||
-rw-r--r-- | lib/fstree/test/mknode_simple.c | 4 |
6 files changed, 6 insertions, 15 deletions
diff --git a/lib/fstree/test/add_by_path.c b/lib/fstree/test/add_by_path.c index 7fb9d37..4fd7d3d 100644 --- a/lib/fstree/test/add_by_path.c +++ b/lib/fstree/test/add_by_path.c @@ -13,10 +13,9 @@ static dir_entry_t *mkentry(const char *name, sqfs_u16 mode, sqfs_u32 uid, sqfs_u32 gid) { - dir_entry_t *ent = calloc(1, sizeof(*ent) + strlen(name) + 1); + dir_entry_t *ent = dir_entry_create(name); TEST_NOT_NULL(ent); - strcpy(ent->name, name); ent->mode = mode; ent->uid = uid; ent->gid = gid; diff --git a/lib/fstree/test/fstree_sort.c b/lib/fstree/test/fstree_sort.c index 82d6e9d..7bce367 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) { - dir_entry_t *ent = calloc(1, sizeof(*ent) + strlen(name) + 1); + dir_entry_t *ent = dir_entry_create(name); tree_node_t *out; TEST_NOT_NULL(ent); - strcpy(ent->name, name); ent->mode = S_IFBLK | 0600; ent->rdev = 1337; diff --git a/lib/fstree/test/gen_inode_numbers.c b/lib/fstree/test/gen_inode_numbers.c index ae7198e..ea310a4 100644 --- a/lib/fstree/test/gen_inode_numbers.c +++ b/lib/fstree/test/gen_inode_numbers.c @@ -12,11 +12,10 @@ static tree_node_t *gen_node(fstree_t *fs, const char *path) { - dir_entry_t *ent = calloc(1, sizeof(*ent) + strlen(path) + 1); + dir_entry_t *ent = dir_entry_create(path); tree_node_t *ret; TEST_NOT_NULL(ent); - strcpy(ent->name, path); ent->mode = S_IFDIR | 0755; ret = fstree_add_generic(fs, ent, NULL); diff --git a/lib/fstree/test/get_path.c b/lib/fstree/test/get_path.c index a158764..50faeb4 100644 --- a/lib/fstree/test/get_path.c +++ b/lib/fstree/test/get_path.c @@ -12,10 +12,8 @@ static dir_entry_t *mkentry(const char *name) { - dir_entry_t *ent = calloc(1, sizeof(*ent) + strlen(name) + 1); + dir_entry_t *ent = dir_entry_create(name); TEST_NOT_NULL(ent); - - strcpy(ent->name, name); ent->mode = S_IFDIR | 0750; ent->uid = 1000; ent->gid = 100; diff --git a/lib/fstree/test/mknode_dir.c b/lib/fstree/test/mknode_dir.c index 20cba45..080cc0e 100644 --- a/lib/fstree/test/mknode_dir.c +++ b/lib/fstree/test/mknode_dir.c @@ -11,10 +11,8 @@ static dir_entry_t *mkentry(const char *name) { - dir_entry_t *ent = calloc(1, sizeof(*ent) + strlen(name) + 1); - + dir_entry_t *ent = dir_entry_create(name); TEST_NOT_NULL(ent); - strcpy(ent->name, name); ent->mode = S_IFDIR | 0654; ent->uid = 123; ent->gid = 456; diff --git a/lib/fstree/test/mknode_simple.c b/lib/fstree/test/mknode_simple.c index 2a18121..0e7c872 100644 --- a/lib/fstree/test/mknode_simple.c +++ b/lib/fstree/test/mknode_simple.c @@ -11,10 +11,8 @@ static dir_entry_t *mkentry(const char *name, sqfs_u16 mode) { - dir_entry_t *ent = calloc(1, sizeof(*ent) + strlen(name) + 1); - + dir_entry_t *ent = dir_entry_create(name); TEST_NOT_NULL(ent); - strcpy(ent->name, name); ent->mode = mode | 0654; ent->uid = 123; ent->gid = 456; |