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
88 enum p9_proto_version
{
89 V9FS_PROTO_2000U
= 0x01,
90 V9FS_PROTO_2000L
= 0x02,
93 #define P9_NOTAG (u16)(~0)
94 #define P9_NOFID (u32)(~0)
95 #define P9_MAXWELEM 16
98 * ample room for Twrite/Rread header
99 * size[4] Tread/Twrite tag[2] fid[4] offset[8] count[4]
101 #define P9_IOHDRSZ 24
103 typedef struct V9fsPDU V9fsPDU
;
110 VirtQueueElement elem
;
111 QLIST_ENTRY(V9fsPDU
) next
;
116 * 1) change user needs to set groups and stuff
119 /* from Linux's linux/virtio_9p.h */
121 /* The ID for virtio console */
122 #define VIRTIO_ID_9P 9
124 #define MAX_TAG_LEN 32
126 #define BUG_ON(cond) assert(!(cond))
128 typedef struct V9fsFidState V9fsFidState
;
130 typedef struct V9fsString
136 typedef struct V9fsQID
143 typedef struct V9fsStat
158 V9fsString extension
;
171 typedef struct V9fsXattr
194 typedef struct V9fsState
198 V9fsPDU pdus
[MAX_REQ
];
199 QLIST_HEAD(, V9fsPDU
) free_list
;
200 V9fsFidState
*fid_list
;
206 enum p9_proto_version proto_version
;
210 typedef struct V9fsCreateState
{
219 V9fsString extension
;
224 typedef struct V9fsLcreateState
{
235 typedef struct V9fsStatState
{
243 typedef struct V9fsStatDotl
{
244 uint64_t st_result_mask
;
254 uint64_t st_atime_sec
;
255 uint64_t st_atime_nsec
;
256 uint64_t st_mtime_sec
;
257 uint64_t st_mtime_nsec
;
258 uint64_t st_ctime_sec
;
259 uint64_t st_ctime_nsec
;
260 uint64_t st_btime_sec
;
261 uint64_t st_btime_nsec
;
263 uint64_t st_data_version
;
266 typedef struct V9fsStatStateDotl
{
269 V9fsStatDotl v9stat_dotl
;
274 typedef struct V9fsWalkState
{
281 V9fsFidState
*newfidp
;
287 typedef struct V9fsOpenState
{
297 typedef struct V9fsReadState
{
304 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
316 typedef struct V9fsWriteState
{
324 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
329 typedef struct V9fsRemoveState
{
335 typedef struct V9fsWstatState
345 typedef struct V9fsSymlinkState
357 typedef struct V9fsIattr
370 typedef struct V9fsSetattrState
378 struct virtio_9p_config
380 /* number of characters in tag */
382 /* Variable size tag name */
384 } __attribute__((packed
));
386 typedef struct V9fsStatfs
399 typedef struct V9fsStatfsState
{
408 typedef struct V9fsMkState
{
417 typedef struct V9fsRenameState
{
425 typedef struct V9fsXattrState
429 V9fsFidState
*file_fidp
;
430 V9fsFidState
*xattr_fidp
;
437 extern size_t pdu_packunpack(void *addr
, struct iovec
*sg
, int sg_count
,
438 size_t offset
, size_t size
, int pack
);
440 static inline size_t do_pdu_unpack(void *dst
, struct iovec
*sg
, int sg_count
,
441 size_t offset
, size_t size
)
443 return pdu_packunpack(dst
, sg
, sg_count
, offset
, size
, 0);