aboutsummaryrefslogtreecommitdiff
path: root/tests/mknode_dir.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-12-18 17:40:49 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-12-18 17:40:49 +0100
commit19b98cf450220b742987e7f0599ae284e93f8e54 (patch)
tree8845d9bae7f99920dd01ba7e7c52ee4baecf02d9 /tests/mknode_dir.c
parent5dc3ab23d0552dc9460152f8a9089f25c8572d90 (diff)
Add an explicit link count to the fstree nodes
Gets initialized to 2 for directories, 1 for all other types. The count of the parent node is automatically incremented. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/mknode_dir.c')
-rw-r--r--tests/mknode_dir.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/mknode_dir.c b/tests/mknode_dir.c
index 3b6aeda..8f2131c 100644
--- a/tests/mknode_dir.c
+++ b/tests/mknode_dir.c
@@ -30,6 +30,7 @@ int main(void)
assert(root->uid == sb.st_uid);
assert(root->gid == sb.st_gid);
assert(root->mode == sb.st_mode);
+ assert(root->link_count == 2);
assert((char *)root->name >= (char *)root->payload);
assert(root->name >= (char *)root->payload);
assert(strcmp(root->name, "rootdir") == 0);
@@ -40,6 +41,8 @@ int main(void)
a = fstree_mknode(root, "adir", 4, NULL, &sb);
assert(a->parent == root);
assert(a->next == NULL);
+ assert(a->link_count == 2);
+ assert(root->link_count == 3);
assert(root->data.dir.children == a);
assert(root->parent == NULL);
assert(root->next == NULL);
@@ -47,7 +50,9 @@ int main(void)
b = fstree_mknode(root, "bdir", 4, NULL, &sb);
assert(a->parent == root);
assert(b->parent == root);
+ assert(b->link_count == 2);
assert(root->data.dir.children == b);
+ assert(root->link_count == 4);
assert(b->next == a);
assert(a->next == NULL);
assert(root->parent == NULL);