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
60 #define P9_NOTAG (u16)(~0)
61 #define P9_NOFID (u32)(~0)
62 #define P9_MAXWELEM 16
64 typedef struct V9fsPDU V9fsPDU
;
71 VirtQueueElement elem
;
72 QLIST_ENTRY(V9fsPDU
) next
;
77 * 1) change user needs to set groups and stuff
80 /* from Linux's linux/virtio_9p.h */
82 /* The ID for virtio console */
83 #define VIRTIO_ID_9P 9
85 #define MAX_TAG_LEN 32
87 #define BUG_ON(cond) assert(!(cond))
89 typedef struct V9fsFidState V9fsFidState
;
91 typedef struct V9fsString
97 typedef struct V9fsQID
104 typedef struct V9fsStat
119 V9fsString extension
;
135 typedef struct V9fsState
139 V9fsPDU pdus
[MAX_REQ
];
140 QLIST_HEAD(, V9fsPDU
) free_list
;
141 V9fsFidState
*fid_list
;
149 typedef struct V9fsCreateState
{
158 V9fsString extension
;
162 typedef struct V9fsStatState
{
170 typedef struct V9fsWalkState
{
177 V9fsFidState
*newfidp
;
183 typedef struct V9fsOpenState
{
192 typedef struct V9fsReadState
{
199 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
211 typedef struct V9fsWriteState
{
219 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
224 typedef struct V9fsRemoveState
{
230 typedef struct V9fsWstatState
241 struct virtio_9p_config
243 /* number of characters in tag */
245 /* Variable size tag name */
247 } __attribute__((packed
));
249 extern size_t pdu_packunpack(void *addr
, struct iovec
*sg
, int sg_count
,
250 size_t offset
, size_t size
, int pack
);
252 static inline size_t do_pdu_unpack(void *dst
, struct iovec
*sg
, int sg_count
,
253 size_t offset
, size_t size
)
255 return pdu_packunpack(dst
, sg
, sg_count
, offset
, size
, 0);