summaryrefslogtreecommitdiffstats
path: root/src/storage-mmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/storage-mmap.h')
-rw-r--r--src/storage-mmap.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/storage-mmap.h b/src/storage-mmap.h
new file mode 100644
index 0000000..c05bbd0
--- /dev/null
+++ b/src/storage-mmap.h
@@ -0,0 +1,47 @@
+
+#ifndef STORAGE_MMAP_H
+#define STORAGE_MMAP_H
+
+struct tsnif_storage_header_mmap {
+ struct tsnif_storage_header common;
+ uint32_t size_max;
+ uint32_t cnt;
+};
+
+struct tsnif_storage_rec_mmap {
+ uint32_t len;
+ uint32_t flags;
+ unsigned char data[];
+};
+
+struct tsnif_storage_chunk_header {
+ uint32_t free;
+ uint32_t cnt;
+ unsigned char rec0[];
+};
+
+struct tsnif_storage_opts {
+ int size_max;
+ uint flags;
+ int chunk_size;
+};
+
+struct tsnif_storage_chunk {
+ struct tsnif_storage_chunk_header *header;
+ off_t offset;
+ void *current_data;
+ uint32_t *current_index;
+};
+
+struct tsnif_storage_handle {
+ int fd;
+ struct tsnif_storage_opts *opts;
+
+ /* file header */
+ struct tsnif_storage_header_mmap *header;
+
+ /* active chunk */
+ struct tsnif_storage_chunk active_chunk;
+};
+
+#endif /* STORAGE_MMAP_H */