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
86 enum p9_proto_version
{
87 V9FS_PROTO_2000U
= 0x01,
88 V9FS_PROTO_2000L
= 0x02,
91 #define P9_NOTAG (u16)(~0)
92 #define P9_NOFID (u32)(~0)
93 #define P9_MAXWELEM 16
96 * ample room for Twrite/Rread header
97 * size[4] Tread/Twrite tag[2] fid[4] offset[8] count[4]
101 typedef struct V9fsPDU V9fsPDU
;
108 VirtQueueElement elem
;
109 QLIST_ENTRY(V9fsPDU
) next
;
114 * 1) change user needs to set groups and stuff
117 /* from Linux's linux/virtio_9p.h */
119 /* The ID for virtio console */
120 #define VIRTIO_ID_9P 9
122 #define MAX_TAG_LEN 32
124 #define BUG_ON(cond) assert(!(cond))
126 typedef struct V9fsFidState V9fsFidState
;
128 typedef struct V9fsString
134 typedef struct V9fsQID
141 typedef struct V9fsStat
156 V9fsString extension
;
169 typedef struct V9fsXattr
192 typedef struct V9fsState
196 V9fsPDU pdus
[MAX_REQ
];
197 QLIST_HEAD(, V9fsPDU
) free_list
;
198 V9fsFidState
*fid_list
;
204 enum p9_proto_version proto_version
;
208 typedef struct V9fsCreateState
{
217 V9fsString extension
;
222 typedef struct V9fsLcreateState
{
233 typedef struct V9fsStatState
{
241 typedef struct V9fsStatDotl
{
242 uint64_t st_result_mask
;
252 uint64_t st_atime_sec
;
253 uint64_t st_atime_nsec
;
254 uint64_t st_mtime_sec
;
255 uint64_t st_mtime_nsec
;
256 uint64_t st_ctime_sec
;
257 uint64_t st_ctime_nsec
;
258 uint64_t st_btime_sec
;
259 uint64_t st_btime_nsec
;
261 uint64_t st_data_version
;
264 typedef struct V9fsStatStateDotl
{
267 V9fsStatDotl v9stat_dotl
;
272 typedef struct V9fsWalkState
{
279 V9fsFidState
*newfidp
;
285 typedef struct V9fsOpenState
{
295 typedef struct V9fsReadState
{
302 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
314 typedef struct V9fsWriteState
{
322 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
327 typedef struct V9fsRemoveState
{
333 typedef struct V9fsWstatState
343 typedef struct V9fsSymlinkState
355 typedef struct V9fsIattr
368 typedef struct V9fsSetattrState
376 struct virtio_9p_config
378 /* number of characters in tag */
380 /* Variable size tag name */
382 } __attribute__((packed
));
384 typedef struct V9fsStatfs
397 typedef struct V9fsStatfsState
{
406 typedef struct V9fsMkState
{
415 typedef struct V9fsRenameState
{
423 typedef struct V9fsXattrState
427 V9fsFidState
*file_fidp
;
428 V9fsFidState
*xattr_fidp
;
435 extern size_t pdu_packunpack(void *addr
, struct iovec
*sg
, int sg_count
,
436 size_t offset
, size_t size
, int pack
);
438 static inline size_t do_pdu_unpack(void *dst
, struct iovec
*sg
, int sg_count
,
439 size_t offset
, size_t size
)
441 return pdu_packunpack(dst
, sg
, sg_count
, offset
, size
, 0);