summaryrefslogtreecommitdiff
path: root/include/qntan/Qntan.h
diff options
context:
space:
mode:
authorAndreas Fankhauser hiddenalpha.ch2026-01-06 01:14:10 +0100
committerAndreas Fankhauser hiddenalpha.ch2026-01-06 01:14:10 +0100
commitdaf31149e5c63028d6401e843115ddc343741d3f (patch)
treeb044370b32a607b001be73b3ff1acd3f29e7d9b4 /include/qntan/Qntan.h
parent31f7f1db984eefb67be19e6e7fe68102147337bb (diff)
downloadQntan-daf31149e5c63028d6401e843115ddc343741d3f.tar.gz
Qntan-daf31149e5c63028d6401e843115ddc343741d3f.zip
Draft FileSystem.listDir(). Add some missing macros.
Diffstat (limited to 'include/qntan/Qntan.h')
-rw-r--r--include/qntan/Qntan.h50
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.
+ */
};