1
2
3
4
5
6
7
8
9
10
11
12
13
14#include <unistd.h>
15#include <sys/types.h>
16#include <limits.h>
17
18typedef struct V9fsSynthNode V9fsSynthNode;
19typedef ssize_t (*v9fs_synth_read)(void *buf, int len, off_t offset,
20 void *arg);
21typedef ssize_t (*v9fs_synth_write)(void *buf, int len, off_t offset,
22 void *arg);
23typedef struct V9fsSynthNodeAttr {
24 int mode;
25 int inode;
26 int nlink;
27 v9fs_synth_read read;
28 v9fs_synth_write write;
29} V9fsSynthNodeAttr;
30
31struct V9fsSynthNode {
32 QLIST_HEAD(, V9fsSynthNode) child;
33 QLIST_ENTRY(V9fsSynthNode) sibling;
34 char name[NAME_MAX];
35 V9fsSynthNodeAttr *attr;
36 V9fsSynthNodeAttr actual_attr;
37 void *private;
38 int open_count;
39};
40
41typedef struct V9fsSynthOpenState {
42 off_t offset;
43 V9fsSynthNode *node;
44} V9fsSynthOpenState;
45
46extern int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mode,
47 const char *name, V9fsSynthNode **result);
48extern int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int mode,
49 const char *name, v9fs_synth_read read,
50 v9fs_synth_write write, void *arg);
51