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
66 enum p9_proto_version
{
67 V9FS_PROTO_2000U
= 0x01,
68 V9FS_PROTO_2000L
= 0x02,
71 #define P9_NOTAG (u16)(~0)
72 #define P9_NOFID (u32)(~0)
73 #define P9_MAXWELEM 16
76 * ample room for Twrite/Rread header
77 * size[4] Tread/Twrite tag[2] fid[4] offset[8] count[4]
81 typedef struct V9fsPDU V9fsPDU
;
88 VirtQueueElement elem
;
89 QLIST_ENTRY(V9fsPDU
) next
;
94 * 1) change user needs to set groups and stuff
97 /* from Linux's linux/virtio_9p.h */
99 /* The ID for virtio console */
100 #define VIRTIO_ID_9P 9
102 #define MAX_TAG_LEN 32
104 #define BUG_ON(cond) assert(!(cond))
106 typedef struct V9fsFidState V9fsFidState
;
108 typedef struct V9fsString
114 typedef struct V9fsQID
121 typedef struct V9fsStat
136 V9fsString extension
;
152 typedef struct V9fsState
156 V9fsPDU pdus
[MAX_REQ
];
157 QLIST_HEAD(, V9fsPDU
) free_list
;
158 V9fsFidState
*fid_list
;
164 enum p9_proto_version proto_version
;
168 typedef struct V9fsCreateState
{
177 V9fsString extension
;
182 typedef struct V9fsStatState
{
190 typedef struct V9fsStatDotl
{
191 uint64_t st_result_mask
;
201 uint64_t st_atime_sec
;
202 uint64_t st_atime_nsec
;
203 uint64_t st_mtime_sec
;
204 uint64_t st_mtime_nsec
;
205 uint64_t st_ctime_sec
;
206 uint64_t st_ctime_nsec
;
207 uint64_t st_btime_sec
;
208 uint64_t st_btime_nsec
;
210 uint64_t st_data_version
;
213 typedef struct V9fsStatStateDotl
{
216 V9fsStatDotl v9stat_dotl
;
221 typedef struct V9fsWalkState
{
228 V9fsFidState
*newfidp
;
234 typedef struct V9fsOpenState
{
244 typedef struct V9fsReadState
{
251 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
263 typedef struct V9fsWriteState
{
271 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
276 typedef struct V9fsRemoveState
{
282 typedef struct V9fsWstatState
293 struct virtio_9p_config
295 /* number of characters in tag */
297 /* Variable size tag name */
299 } __attribute__((packed
));
301 typedef struct V9fsStatfs
314 typedef struct V9fsStatfsState
{
323 extern size_t pdu_packunpack(void *addr
, struct iovec
*sg
, int sg_count
,
324 size_t offset
, size_t size
, int pack
);
326 static inline size_t do_pdu_unpack(void *dst
, struct iovec
*sg
, int sg_count
,
327 size_t offset
, size_t size
)
329 return pdu_packunpack(dst
, sg
, sg_count
, offset
, size
, 0);