aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.h
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-03-07 16:02:47 -0600
committerRob Landley <rob@landley.net>2016-03-07 16:02:47 -0600
commit8d95074b7d034188af8542aaea0306d3670d71be (patch)
treef2cc98fa718becc2b6379dc7c724ea35f266cd6a /lib/lib.h
parent2a26ba451a605c185242de50e1d91eeac0a2430e (diff)
downloadtoybox-8d95074b7d034188af8542aaea0306d3670d71be.tar.gz
Cleanup pass on the dirtree infrastructure, in preparation for making rm -r
handle infinite depth. Fix docs, tweak dirtree_handle_callback() semantics, remove dirtree_start() and don't export dirtree_handle_callback(), instead offer dirtree_flagread(). (dirtree_read() is a wrapper around dirtree_flagread passing 0 for flags.)
Diffstat (limited to 'lib/lib.h')
-rw-r--r--lib/lib.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/lib.h b/lib/lib.h
index c8cff6ef..917be0c1 100644
--- a/lib/lib.h
+++ b/lib/lib.h
@@ -62,6 +62,8 @@ void get_optflags(void);
#define DIRTREE_SYMFOLLOW 8
// Don't warn about failure to stat
#define DIRTREE_SHUTUP 16
+// Breadth first traversal, conserves filehandles at the expense of memory
+#define DIRTREE_BREADTH 32
// Don't look at any more files in this directory.
#define DIRTREE_ABORT 256
@@ -77,15 +79,14 @@ struct dirtree {
char name[];
};
-struct dirtree *dirtree_start(char *name, int symfollow);
struct dirtree *dirtree_add_node(struct dirtree *p, char *name, int flags);
char *dirtree_path(struct dirtree *node, int *plen);
int dirtree_notdotdot(struct dirtree *catch);
int dirtree_parentfd(struct dirtree *node);
-struct dirtree *dirtree_handle_callback(struct dirtree *new,
- int (*callback)(struct dirtree *node));
int dirtree_recurse(struct dirtree *node, int (*callback)(struct dirtree *node),
int symfollow);
+struct dirtree *dirtree_flagread(char *path, int flags,
+ int (*callback)(struct dirtree *node));
struct dirtree *dirtree_read(char *path, int (*callback)(struct dirtree *node));
// help.c