summaryrefslogtreecommitdiff
path: root/lib/fstree
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-20 03:52:49 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-20 18:34:17 +0200
commitc106a290ed07fa89b39072925b1a2258071511a8 (patch)
tree973dc9a4d7eceec0925ee9196d7683cb396d83f2 /lib/fstree
parent9486151f186e3664c8dd429fba94f9e539377d87 (diff)
Large round of dead code removal
Remove all the library functions that no longer have any users. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/fstree')
-rw-r--r--lib/fstree/Makemodule.am4
-rw-r--r--lib/fstree/node_from_path.c46
-rw-r--r--lib/fstree/node_stat.c49
3 files changed, 2 insertions, 97 deletions
diff --git a/lib/fstree/Makemodule.am b/lib/fstree/Makemodule.am
index d282de7..6d3498a 100644
--- a/lib/fstree/Makemodule.am
+++ b/lib/fstree/Makemodule.am
@@ -1,9 +1,9 @@
libfstree_a_SOURCES = lib/fstree/fstree.c lib/fstree/fstree_from_file.c
libfstree_a_SOURCES += lib/fstree/fstree_sort.c lib/fstree/fstree_from_dir.c
libfstree_a_SOURCES += lib/fstree/gen_inode_table.c lib/fstree/get_path.c
-libfstree_a_SOURCES += lib/fstree/node_stat.c lib/fstree/mknode.c
+libfstree_a_SOURCES += lib/fstree/mknode.c
libfstree_a_SOURCES += lib/fstree/add_by_path.c lib/fstree/xattr.c
-libfstree_a_SOURCES += lib/fstree/node_from_path.c include/fstree.h
+libfstree_a_SOURCES += include/fstree.h
libfstree_a_SOURCES += lib/fstree/gen_file_list.c
libfstree_a_SOURCES += lib/fstree/source_date_epoch.c
libfstree_a_CFLAGS = $(AM_CFLAGS) $(LIBSELINUX_CFLAGS)
diff --git a/lib/fstree/node_from_path.c b/lib/fstree/node_from_path.c
deleted file mode 100644
index 9140b2d..0000000
--- a/lib/fstree/node_from_path.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
-/*
- * node_from_path.c
- *
- * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
- */
-#include "config.h"
-
-#include "fstree.h"
-
-#include <string.h>
-#include <errno.h>
-
-tree_node_t *fstree_node_from_path(fstree_t *fs, const char *path)
-{
- tree_node_t *n = fs->root;
- const char *end;
- size_t len;
-
- while (path != NULL && *path != '\0') {
- if (!S_ISDIR(n->mode)) {
- errno = ENOTDIR;
- return NULL;
- }
-
- end = strchrnul(path, '/');
- len = end - path;
-
- for (n = n->data.dir->children; n != NULL; n = n->next) {
- if (strncmp(path, n->name, len) != 0)
- continue;
- if (n->name[len] != '\0')
- continue;
- break;
- }
-
- if (n == NULL) {
- errno = ENOENT;
- return NULL;
- }
-
- path = *end ? (end + 1) : end;
- }
-
- return n;
-}
diff --git a/lib/fstree/node_stat.c b/lib/fstree/node_stat.c
deleted file mode 100644
index d17d244..0000000
--- a/lib/fstree/node_stat.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
-/*
- * node_stat.c
- *
- * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
- */
-#include "config.h"
-
-#include "fstree.h"
-
-#include <string.h>
-
-void fstree_node_stat(fstree_t *fs, tree_node_t *node, struct stat *sb)
-{
- tree_node_t *n;
-
- *sb = fs->defaults;
- sb->st_ino = node->inode_num;
- sb->st_mode = node->mode;
- sb->st_nlink = 1;
- sb->st_uid = node->uid;
- sb->st_gid = node->gid;
- sb->st_mtime = node->mod_time;
- sb->st_atime = node->mod_time;
- sb->st_ctime = node->mod_time;
-
- switch (node->mode & S_IFMT) {
- case S_IFDIR:
- sb->st_nlink = 2;
-
- for (n = node->data.dir->children; n != NULL; n = n->next)
- sb->st_nlink += 1;
-
- sb->st_size = node->data.dir->size;
- break;
- case S_IFREG:
- sb->st_size = node->data.file->size;
- break;
- case S_IFLNK:
- sb->st_size = strlen(node->data.slink_target);
- break;
- case S_IFBLK:
- case S_IFCHR:
- sb->st_rdev = node->data.devno;
- break;
- }
-
- sb->st_blocks = sb->st_size / fs->block_size;
-}