Merge branch 'master' of github.com:Minep/lunaix-os
[lunaix-os.git] / lunaix-os / includes / lunaix / fs / twifs.h
index 2ee5390b65cfe240e787fcfc53d22dbee5714797..50579aeed5d6eb580a3af755cfd98116eb785e62 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __LUNAIX_TWIFS_H
 #define __LUNAIX_TWIFS_H
 
+#include <lunaix/ds/ldga.h>
 #include <lunaix/fs.h>
 #include <lunaix/fs/twimap.h>
 #include <lunaix/spike.h>
@@ -34,6 +35,12 @@ struct twifs_node
         (type) twinode->data;                                                  \
     })
 
+#define EXPORT_TWIFS_PLUGIN(label, plg_init)                                   \
+    export_ldga_el(twiplugin_inits, label, ptr_t, plg_init)
+
+void
+twifs_register_plugins();
+
 void
 twifs_init();
 
@@ -52,4 +59,11 @@ twifs_rm_node(struct twifs_node* node);
 struct twimap*
 twifs_mapping(struct twifs_node* parent, void* data, const char* fmt, ...);
 
+#define twimap_entry_simple(parent, name, data, read_cb)                       \
+    ({                                                                         \
+        struct twimap* map = twifs_mapping((parent), (data), (name));          \
+        map->read = (read_cb);                                                 \
+        map;                                                                   \
+    })
+
 #endif /* __LUNAIX_TWIFS_H */