aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-12-18 19:57:22 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-12-19 16:34:10 +0100
commit0a6c5d7fa2f276b8e155d69bea17650bad46f089 (patch)
treece9129012b5c8461dbdeaf797aa53b92e33778f5 /include
parentcaa34ed48ba55a50a4187cd1ae307c09c6b75311 (diff)
Split the libfstree add_by_path tree traversal function out
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/fstree.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/fstree.h b/include/fstree.h
index 9d0d045..aff3952 100644
--- a/include/fstree.h
+++ b/include/fstree.h
@@ -173,6 +173,20 @@ void fstree_post_process(fstree_t *fs);
char *fstree_get_path(tree_node_t *node);
/*
+ Resolve a path to a tree node. Returns NULL on failure and sets errno.
+
+ If "create_implicitly" is set to true, the function acts essentially like
+ mkdir_p if part of the path doesn't exist yet.
+
+ If "stop_at_parent" is true, the function stops at the last component and
+ returns the parent or would-be-parent of the last path component, but doesn't
+ check if the last path component exists or not.
+ */
+tree_node_t *fstree_get_node_by_path(fstree_t *fs, tree_node_t *root,
+ const char *path, bool create_implicitly,
+ bool stop_at_parent);
+
+/*
Convert back to forward slashed, remove all preceeding and trailing slashes,
collapse all sequences of slashes, remove all path components that are '.'
and returns failure state if one of the path components is '..'.