Merge branch 'master' into isa/arm64
[lunaix-os.git] / lunaix-os / includes / lunaix / fs / twimap.h
1 #ifndef __LUNAIX_TWIMAP_H
2 #define __LUNAIX_TWIMAP_H
3
4 #include <lunaix/types.h>
5
6 #define twimap_index(twimap, type) ((type)__ptr((twimap)->index))
7 #define twimap_data(twimap, type) ((type)__ptr((twimap)->data))
8
9 extern struct v_file_ops twimap_file_ops;
10
11 struct twimap
12 {
13     void* index;
14     void* buffer;
15     void* data;
16     size_t size_acc;
17     void (*read)(struct twimap* mapping);
18     int (*go_next)(struct twimap* mapping);
19     void (*reset)(struct twimap* mapping);
20 };
21
22 int
23 twimap_read(struct twimap* map, void* buffer, size_t len, size_t fpos);
24
25 void
26 twimap_printf(struct twimap* mapping, const char* fmt, ...);
27
28 int
29 twimap_memcpy(struct twimap* mapping, const void* src, const size_t len);
30
31 int
32 twimap_memappend(struct twimap* mapping, const void* src, const size_t len);
33
34 struct twimap*
35 twimap_create(void* data);
36
37 #endif /* __LUNAIX_TWIMAP_H */