Framework for exporting system header to user space (#59)
[lunaix-os.git] / lunaix-os / includes / lunaix / fs / twimap.h
index 7adbc535e0212464bba188a487be43bf2de4ab85..3086c633c44d41b46be2e7ffadd9cd8a9f60a76b 100644 (file)
@@ -3,20 +3,34 @@
 
 #include <lunaix/types.h>
 
-#define twimap_index(twimap, type) ((type)((twimap)->index))
-#define twimap_data(twimap, type) ((type)((twimap)->data))
+#define twimap_index(twimap, type) ((type)__ptr((twimap)->index))
+#define twimap_data(twimap, type) ((type)__ptr((twimap)->data))
 
 extern struct v_file_ops twimap_file_ops;
 
+#define __TWIMAP_OPS    \
+        void (*read)(struct twimap* mapping);   \
+        int (*go_next)(struct twimap* mapping); \
+        void (*reset)(struct twimap* mapping);
+
+struct twimap;
+struct twimap_ops
+{
+    __TWIMAP_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);
+    union
+    {
+        struct twimap_ops ops;
+        struct { __TWIMAP_OPS };
+    };
+    
 };
 
 int