diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/qntan/Qntan.h | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/include/qntan/Qntan.h b/include/qntan/Qntan.h index f28d19a..b7e9d72 100644 --- a/include/qntan/Qntan.h +++ b/include/qntan/Qntan.h @@ -19,6 +19,10 @@ #endif +#ifdef Qntan_USERCONFIG +Qntan_USERCONFIG +#endif + #include <stddef.h> /* size_t */ #include <stdint.h> /* uintptr_t */ @@ -221,6 +225,10 @@ struct Qntan_MemArena { +#ifndef Qntan_Executor_enque +# define Qntan_Executor_enque(A, ...) (*A)->enque(A, __VA_ARGS__) +#endif + struct Qntan_Executor { /**/ void (*enque)( struct Qntan_Executor**, void(*fn)(Qntan_Cls), Qntan_Cls ); @@ -479,9 +487,25 @@ struct Qntan_File { -#ifndef Qntan_Executor_enque -# define Qntan_Executor_enque(A, ...) (*A)->enque(A, __VA_ARGS__) +#ifndef Qntan_FileSystem_rename +# define Qntan_FileSystem_rename(A, ...) (*A)->rename(A, __VA_ARGS__) #endif +#ifndef Qntan_FileSystem_listDir +# define Qntan_FileSystem_listDir(A, ...) (*A)->listDir(A, __VA_ARGS__) +#endif + +struct Qntan_FileSystem_Dirent { + /**/ + char const *name; + /**/ + char const *type; + /* f=File, d=Directory, b=BlockDev, c=CharDev, p=Pipe, l=Link, s=Socket. + * WARN: This field may not available on all systems! Be prepared for NULL. + */ +// uint64_t size; +// /* File size +// */ +}; struct Qntan_FileSystem { /* VFS (VirtualFileSystem) @@ -531,6 +555,28 @@ struct Qntan_FileSystem { // void (*fsync)( struct Qntan_FileSystem**, char const*path, int isdatasync, // struct fuse_file_info*, void(*onDone)(int, Qntan_Cls), Qntan_Cls); // /**/ + void (*listDir)( + struct Qntan_FileSystem**, + char const*path, + int flgA, + void(*fn)( + int cnt, + struct Qntan_FileSystem_Dirent*dirents, + int flgB, + Qntan_Cls a, + void(*onFnDone)(Qntan_Cls b), + Qntan_Cls b ), + Qntan_Cls a ); + /* `flgA` MUST be zero. + * On error, `cnt` will hold a negative value. + * `fn` gets (probably several times) called with `dirents` holding + * `cnt` number of entries. + * On the last call to `fn`, `flgB & 4` will be set. + * `a` a context passed to `fn`. + * `b` a context that MUST be passed to `onFnDone`. + * `onFnDone` MUST be called exactly once, as soon `fn` has + * completed its work. + */ }; |
