#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>
struct twifs_node
struct hstr name;
inode_t ino_id;
void* data;
- uint32_t itype;
+ u32_t itype;
char name_val[VFS_NAME_MAXLEN];
struct llist_header children;
struct llist_header siblings;
} ops;
};
-struct twimap
-{
- void* index;
- void* buffer;
- void* data;
- size_t size_acc;
- void (*read)(struct twimap* mapping);
- int (*go_next)(struct twimap* mapping);
- void (*reset)(struct twimap* mapping);
-};
-
#define twinode_getdata(inode, type) \
({ \
struct twifs_node* twinode = (struct twifs_node*)(inode)->data; \
(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();
int
twifs_rm_node(struct twifs_node* node);
-#define twimap_index(twimap, type) ((type)((twimap)->index))
-#define twimap_data(twimap, type) ((type)((twimap)->data))
-
struct twimap*
twifs_mapping(struct twifs_node* parent, void* data, const char* fmt, ...);
-void
-twimap_printf(struct twimap* mapping, const char* fmt, ...);
-
-int
-twimap_memcpy(struct twimap* mapping, const void* src, const size_t len);
-
-int
-twimap_memappend(struct twimap* mapping, const void* src, const size_t len);
+#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 */