blob: db45cb03fc0fe5cb8c4231b628d2a3e47bf37394 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#ifndef STORAGE_MMAP_H
#define STORAGE_MMAP_H
struct tsnif_storage_header_mmap {
struct tsnif_storage_header common;
/* max size of the file */
uint32_t size_max;
/* number of records stored */
uint32_t cnt;
/* offset of the first chunk */
uint32_t offset_start;
};
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;
/* for read interface only */
int read_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;
/* for READ mode only */
off_t file_size;
};
#endif /* STORAGE_MMAP_H */
|