Merge remote-tracking branch 'aneesh/for-upstream' into staging
[qemu-kvm.git] / hw / 9pfs / virtio-9p-synth.h
blobe03f43463364c2e4487a724996c149dec74904c0
1 /*
2 * Virtio 9p
4 * Copyright IBM, Corp. 2011
6 * Authors:
7 * Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
14 #include <unistd.h>
15 #include <sys/types.h>
16 #include <limits.h>
18 typedef struct V9fsSynthNode V9fsSynthNode;
19 typedef ssize_t (*v9fs_synth_read)(void *buf, int len, off_t offset,
20 void *arg);
21 typedef ssize_t (*v9fs_synth_write)(void *buf, int len, off_t offset,
22 void *arg);
23 typedef struct V9fsSynthNodeAttr {
24 int mode;
25 int inode;
26 int nlink;
27 v9fs_synth_read read;
28 v9fs_synth_write write;
29 } V9fsSynthNodeAttr;
31 struct 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;
41 typedef struct V9fsSynthOpenState {
42 off_t offset;
43 V9fsSynthNode *node;
44 } V9fsSynthOpenState;
46 extern int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mode,
47 const char *name, V9fsSynthNode **result);
48 extern 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);