blob: 2099059abb1cd402d56b5ce67a66905eed374e9e (
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
|
#ifndef STORAGE_H
#define STORAGE_H
#include <stdlib.h>
#include <stdint.h>
#include <sys/ioctl.h>
struct tsnif_storage_handle;
struct tsnif_storage_opts;
enum {
TSNIF_STORAGE_TYPE_MMAP,
};
#define TSNIF_HEADER_MAGIC 0xdeadfeed
struct tsnif_storage_header {
uint32_t magic;
uint32_t type;
};
enum {
TSNIF_STORAGE_OPT_READ = 0x1,
TSNIF_STORAGE_OPT_WRITE = 0x2,
};
enum {
TSNIF_STORAGE_READ_NEXT = 0x1,
TSNIF_STORAGE_READ_PREV = 0x2,
TSNIF_STORAGE_READ_EOF = 0x3,
};
struct tsnif_storage_rec {
void *ptr;
int len;
uint flags;
struct timespec time;
struct winsize ws;
};
int tsnif_storage_init(struct tsnif_storage_handle *h,
struct tsnif_storage_opts *ops, char *name);
int tsnif_storage_close(struct tsnif_storage_handle *h);
int tsnif_storage_write(struct tsnif_storage_handle *h,
struct tsnif_storage_rec *rec);
int tsnif_storage_read(struct tsnif_storage_handle *h, int what,
struct tsnif_storage_rec *rec);
/* TODO make CONFIG option and ifdef this place */
#include "storage-mmap.h"
#endif /* STORAGE_H */
|