diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-12-18 17:40:49 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-12-18 17:40:49 +0100 |
commit | 19b98cf450220b742987e7f0599ae284e93f8e54 (patch) | |
tree | 8845d9bae7f99920dd01ba7e7c52ee4baecf02d9 /tests/fstree_from_file.c | |
parent | 5dc3ab23d0552dc9460152f8a9089f25c8572d90 (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/fstree_from_file.c')
-rw-r--r-- | tests/fstree_from_file.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/fstree_from_file.c b/tests/fstree_from_file.c index e9b56be..34215c9 100644 --- a/tests/fstree_from_file.c +++ b/tests/fstree_from_file.c @@ -45,9 +45,12 @@ int main(void) fstree_post_process(&fs); n = fs.root->data.dir.children; + assert(fs.root->link_count == 9); + assert(n->mode == (S_IFBLK | 0600)); assert(n->uid == 8); assert(n->gid == 9); + assert(n->link_count == 1); assert(strcmp(n->name, "blkdev") == 0); assert(n->data.devno == makedev(42, 21)); @@ -55,6 +58,7 @@ int main(void) assert(n->mode == (S_IFCHR | 0600)); assert(n->uid == 6); assert(n->gid == 7); + assert(n->link_count == 1); assert(strcmp(n->name, "chardev") == 0); assert(n->data.devno == makedev(13, 37)); @@ -62,6 +66,7 @@ int main(void) assert(n->mode == (S_IFDIR | 0755)); assert(n->uid == 4); assert(n->gid == 5); + assert(n->link_count == 2); assert(strcmp(n->name, "dir") == 0); assert(n->data.dir.children == NULL); @@ -69,6 +74,7 @@ int main(void) assert(n->mode == (S_IFDIR | 0755)); assert(n->uid == 0); assert(n->gid == 0); + assert(n->link_count == 3); assert(strcmp(n->name, "foo bar") == 0); assert(n->data.dir.children != NULL); @@ -76,6 +82,7 @@ int main(void) assert(n->data.dir.children->mode == (S_IFDIR | 0755)); assert(n->data.dir.children->uid == 0); assert(n->data.dir.children->gid == 0); + assert(n->data.dir.children->link_count == 2); assert(strcmp(n->data.dir.children->name, " test \"") == 0); assert(n->data.dir.children->data.dir.children == NULL); @@ -83,12 +90,14 @@ int main(void) assert(n->mode == (S_IFIFO | 0644)); assert(n->uid == 10); assert(n->gid == 11); + assert(n->link_count == 1); assert(strcmp(n->name, "pipe") == 0); n = n->next; assert(n->mode == (S_IFLNK | 0777)); assert(n->uid == 2); assert(n->gid == 3); + assert(n->link_count == 1); assert(strcmp(n->name, "slink") == 0); fprintf(stderr, "'%s'\n", n->data.target); assert(strcmp(n->data.target, "slinktarget") == 0); @@ -97,6 +106,7 @@ int main(void) assert(n->mode == (S_IFSOCK | 0555)); assert(n->uid == 12); assert(n->gid == 13); + assert(n->link_count == 1); assert(strcmp(n->name, "sock") == 0); assert(n->next == NULL); |