These changes are the raw update to qemu-2.6.
[kvmfornfv.git] / qemu / hw / 9pfs / 9p-synth.h
1 /*
2  * 9p
3  *
4  * Copyright IBM, Corp. 2011
5  *
6  * Authors:
7  *  Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2.  See
10  * the COPYING file in the top-level directory.
11  *
12  */
13 #ifndef HW_9PFS_SYNTH_H
14 #define HW_9PFS_SYNTH_H 1
15
16
17 typedef struct V9fsSynthNode V9fsSynthNode;
18 typedef ssize_t (*v9fs_synth_read)(void *buf, int len, off_t offset,
19                                    void *arg);
20 typedef ssize_t (*v9fs_synth_write)(void *buf, int len, off_t offset,
21                                     void *arg);
22 typedef struct V9fsSynthNodeAttr {
23     int mode;
24     int inode;
25     int nlink;
26     v9fs_synth_read read;
27     v9fs_synth_write write;
28 } V9fsSynthNodeAttr;
29
30 struct V9fsSynthNode {
31     QLIST_HEAD(, V9fsSynthNode) child;
32     QLIST_ENTRY(V9fsSynthNode) sibling;
33     char name[NAME_MAX];
34     V9fsSynthNodeAttr *attr;
35     V9fsSynthNodeAttr actual_attr;
36     void *private;
37     int open_count;
38 };
39
40 typedef struct V9fsSynthOpenState {
41     off_t offset;
42     V9fsSynthNode *node;
43 } V9fsSynthOpenState;
44
45 extern int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mode,
46                                  const char *name, V9fsSynthNode **result);
47 extern int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int mode,
48                                     const char *name, v9fs_synth_read read,
49                                     v9fs_synth_write write, void *arg);
50
51 #endif