diff options
Diffstat (limited to 'include/base/fs.h')
-rw-r--r-- | include/base/fs.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/base/fs.h b/include/base/fs.h new file mode 100644 index 0000000..6852a84 --- /dev/null +++ b/include/base/fs.h @@ -0,0 +1,29 @@ +#pragma once + +#define iota(x) 1 << (x) +enum +{ + fs·preorder = iota(0), + fs·nolinks = iota(1), + fs·verbose = iota(2), +}; +#undef iota + +typedef struct fs·Walker fs·Walker; +typedef struct fs·History fs·History; + +struct fs·Walker +{ + int fd, lev, max, err; + uchar flags : 4; + fs·History *hist; + struct { + void *data; + int (*func)(void *data, char *relp, char *absp, io·Stat* info); + }; + char *base, *end, path[4096]; +}; + +int fs·init(fs·Walker *, char *path); +void fs·fini(fs·Walker *); +void fs·walk(fs·Walker *); |