]> git.proxmox.com Git - qemu.git/blame - hw/9pfs/virtio-9p-synth.h
ne2000-isa: QOM'ify
[qemu.git] / hw / 9pfs / virtio-9p-synth.h
CommitLineData
9db221ae
AK
1/*
2 * Virtio 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 */
cb9c377f
PB
13#ifndef HW_9PFS_VIRTIO9P_SYNTH_H
14#define HW_9PFS_VIRTIO9P_SYNTH_H 1
9db221ae
AK
15
16#include <unistd.h>
17#include <sys/types.h>
18#include <limits.h>
19
20typedef struct V9fsSynthNode V9fsSynthNode;
21typedef ssize_t (*v9fs_synth_read)(void *buf, int len, off_t offset,
22 void *arg);
23typedef ssize_t (*v9fs_synth_write)(void *buf, int len, off_t offset,
24 void *arg);
25typedef struct V9fsSynthNodeAttr {
26 int mode;
27 int inode;
28 int nlink;
29 v9fs_synth_read read;
30 v9fs_synth_write write;
31} V9fsSynthNodeAttr;
32
33struct V9fsSynthNode {
34 QLIST_HEAD(, V9fsSynthNode) child;
35 QLIST_ENTRY(V9fsSynthNode) sibling;
36 char name[NAME_MAX];
37 V9fsSynthNodeAttr *attr;
38 V9fsSynthNodeAttr actual_attr;
39 void *private;
40 int open_count;
41};
42
43typedef struct V9fsSynthOpenState {
44 off_t offset;
45 V9fsSynthNode *node;
46} V9fsSynthOpenState;
47
48extern int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mode,
49 const char *name, V9fsSynthNode **result);
50extern int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int mode,
51 const char *name, v9fs_synth_read read,
52 v9fs_synth_write write, void *arg);
cb9c377f
PB
53
54#endif