aboutsummaryrefslogtreecommitdiff
path: root/include/base
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-12-05 16:53:55 -0800
committerNicholas Noll <nbnoll@eml.cc>2021-12-05 16:53:55 -0800
commitb4cb7c06f94e2e91b22b7d82efd7943a82331d86 (patch)
tree99fa7085855875efa7422ee58f322f8c94bda860 /include/base
parent07e77936d535e58b0aeb4f2a11400c1050556739 (diff)
Chore: updated fs·walk to use new data structures
Completes the port to our standard library (up to malloc).
Diffstat (limited to 'include/base')
-rw-r--r--include/base/fs.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/include/base/fs.h b/include/base/fs.h
index 0c77f3a..bc639f8 100644
--- a/include/base/fs.h
+++ b/include/base/fs.h
@@ -1,5 +1,20 @@
#pragma once
+/* directories */
+typedef sys·DirEntry fs·DirEntry;
+typedef sys·Directory fs·Directory;
+
+int fs·open(char *path, fs·Directory *dir);
+int fs·openfd(int fd, fs·Directory *dir);
+int fs·close(fs·Directory *dir);
+
+int fs·read(fs·Directory *, fs·DirEntry **);
+
+/* small utilities */
+int fs·access(byte *path, int flag);
+byte *fs·dirname(byte *path);
+byte *fs·basename(byte *path);
+
#define iota(x) 1 << (x)
enum
{
@@ -12,9 +27,6 @@ enum
typedef struct fs·Walker fs·Walker;
typedef struct fs·History fs·History;
-typedef sys·DirEntry fs·DirEntry;
-typedef sys·Directory fs·Directory;
-
/* node in filesystem */
// XXX: simplify with our newer code
@@ -26,7 +38,7 @@ struct fs·Walker
fs·History *hist;
struct {
void *data;
- int (*func)(void *data, char *relp, char *absp, struct stat *info);
+ int (*func)(void *data, char *relp, char *absp, sys·Info *info);
};
char *base, *end, path[4096];
};
@@ -34,8 +46,3 @@ struct fs·Walker
int fs·init(fs·Walker *, char *path);
void fs·fini(fs·Walker *);
void fs·walk(fs·Walker *);
-
-/* small utilities */
-int fs·access(byte *path, int flag);
-byte *fs·dirname(byte *path);
-byte *fs·basename(byte *path);