Statistics
| Branch: | Revision:

root / hw / 9pfs / virtio-9p-synth.h @ 3871481c

History | View | Annotate | Download (1.4 kB)

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