1 #ifndef _QEMU_VIRTIO_9P_H
2 #define _QEMU_VIRTIO_9P_H
9 #include "file-op-9p.h"
11 /* The feature bitmap for virtio 9P */
12 /* The mount point is specified in a config variable */
13 #define VIRTIO_9P_MOUNT_TAG 0
64 enum p9_proto_version
{
65 V9FS_PROTO_2000U
= 0x01,
66 V9FS_PROTO_2000L
= 0x02,
69 #define P9_NOTAG (u16)(~0)
70 #define P9_NOFID (u32)(~0)
71 #define P9_MAXWELEM 16
73 typedef struct V9fsPDU V9fsPDU
;
80 VirtQueueElement elem
;
81 QLIST_ENTRY(V9fsPDU
) next
;
86 * 1) change user needs to set groups and stuff
89 /* from Linux's linux/virtio_9p.h */
91 /* The ID for virtio console */
92 #define VIRTIO_ID_9P 9
94 #define MAX_TAG_LEN 32
96 #define BUG_ON(cond) assert(!(cond))
98 typedef struct V9fsFidState V9fsFidState
;
100 typedef struct V9fsString
106 typedef struct V9fsQID
113 typedef struct V9fsStat
128 V9fsString extension
;
144 typedef struct V9fsState
148 V9fsPDU pdus
[MAX_REQ
];
149 QLIST_HEAD(, V9fsPDU
) free_list
;
150 V9fsFidState
*fid_list
;
156 enum p9_proto_version proto_version
;
159 typedef struct V9fsCreateState
{
168 V9fsString extension
;
172 typedef struct V9fsStatState
{
180 typedef struct V9fsWalkState
{
187 V9fsFidState
*newfidp
;
193 typedef struct V9fsOpenState
{
202 typedef struct V9fsReadState
{
209 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
221 typedef struct V9fsWriteState
{
229 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
234 typedef struct V9fsRemoveState
{
240 typedef struct V9fsWstatState
251 struct virtio_9p_config
253 /* number of characters in tag */
255 /* Variable size tag name */
257 } __attribute__((packed
));
259 typedef struct V9fsStatfs
272 typedef struct V9fsStatfsState
{
281 extern size_t pdu_packunpack(void *addr
, struct iovec
*sg
, int sg_count
,
282 size_t offset
, size_t size
, int pack
);
284 static inline size_t do_pdu_unpack(void *dst
, struct iovec
*sg
, int sg_count
,
285 size_t offset
, size_t size
)
287 return pdu_packunpack(dst
, sg
, sg_count
, offset
, size
, 0);