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
84 enum p9_proto_version
{
85 V9FS_PROTO_2000U
= 0x01,
86 V9FS_PROTO_2000L
= 0x02,
89 #define P9_NOTAG (u16)(~0)
90 #define P9_NOFID (u32)(~0)
91 #define P9_MAXWELEM 16
94 * ample room for Twrite/Rread header
95 * size[4] Tread/Twrite tag[2] fid[4] offset[8] count[4]
99 typedef struct V9fsPDU V9fsPDU
;
106 VirtQueueElement elem
;
107 QLIST_ENTRY(V9fsPDU
) next
;
112 * 1) change user needs to set groups and stuff
115 /* from Linux's linux/virtio_9p.h */
117 /* The ID for virtio console */
118 #define VIRTIO_ID_9P 9
120 #define MAX_TAG_LEN 32
122 #define BUG_ON(cond) assert(!(cond))
124 typedef struct V9fsFidState V9fsFidState
;
126 typedef struct V9fsString
132 typedef struct V9fsQID
139 typedef struct V9fsStat
154 V9fsString extension
;
167 typedef struct V9fsXattr
190 typedef struct V9fsState
194 V9fsPDU pdus
[MAX_REQ
];
195 QLIST_HEAD(, V9fsPDU
) free_list
;
196 V9fsFidState
*fid_list
;
202 enum p9_proto_version proto_version
;
206 typedef struct V9fsCreateState
{
215 V9fsString extension
;
220 typedef struct V9fsLcreateState
{
231 typedef struct V9fsStatState
{
239 typedef struct V9fsStatDotl
{
240 uint64_t st_result_mask
;
250 uint64_t st_atime_sec
;
251 uint64_t st_atime_nsec
;
252 uint64_t st_mtime_sec
;
253 uint64_t st_mtime_nsec
;
254 uint64_t st_ctime_sec
;
255 uint64_t st_ctime_nsec
;
256 uint64_t st_btime_sec
;
257 uint64_t st_btime_nsec
;
259 uint64_t st_data_version
;
262 typedef struct V9fsStatStateDotl
{
265 V9fsStatDotl v9stat_dotl
;
270 typedef struct V9fsWalkState
{
277 V9fsFidState
*newfidp
;
283 typedef struct V9fsOpenState
{
293 typedef struct V9fsReadState
{
300 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
312 typedef struct V9fsWriteState
{
320 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
325 typedef struct V9fsRemoveState
{
331 typedef struct V9fsWstatState
341 typedef struct V9fsSymlinkState
353 typedef struct V9fsIattr
366 typedef struct V9fsSetattrState
374 struct virtio_9p_config
376 /* number of characters in tag */
378 /* Variable size tag name */
380 } __attribute__((packed
));
382 typedef struct V9fsStatfs
395 typedef struct V9fsStatfsState
{
404 typedef struct V9fsMkState
{
413 typedef struct V9fsRenameState
{
421 typedef struct V9fsXattrState
425 V9fsFidState
*file_fidp
;
426 V9fsFidState
*xattr_fidp
;
433 extern size_t pdu_packunpack(void *addr
, struct iovec
*sg
, int sg_count
,
434 size_t offset
, size_t size
, int pack
);
436 static inline size_t do_pdu_unpack(void *dst
, struct iovec
*sg
, int sg_count
,
437 size_t offset
, size_t size
)
439 return pdu_packunpack(dst
, sg
, sg_count
, offset
, size
, 0);