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
82 enum p9_proto_version
{
83 V9FS_PROTO_2000U
= 0x01,
84 V9FS_PROTO_2000L
= 0x02,
87 #define P9_NOTAG (u16)(~0)
88 #define P9_NOFID (u32)(~0)
89 #define P9_MAXWELEM 16
92 * ample room for Twrite/Rread header
93 * size[4] Tread/Twrite tag[2] fid[4] offset[8] count[4]
97 typedef struct V9fsPDU V9fsPDU
;
104 VirtQueueElement elem
;
105 QLIST_ENTRY(V9fsPDU
) next
;
110 * 1) change user needs to set groups and stuff
113 /* from Linux's linux/virtio_9p.h */
115 /* The ID for virtio console */
116 #define VIRTIO_ID_9P 9
118 #define MAX_TAG_LEN 32
120 #define BUG_ON(cond) assert(!(cond))
122 typedef struct V9fsFidState V9fsFidState
;
124 typedef struct V9fsString
130 typedef struct V9fsQID
137 typedef struct V9fsStat
152 V9fsString extension
;
165 typedef struct V9fsXattr
188 typedef struct V9fsState
192 V9fsPDU pdus
[MAX_REQ
];
193 QLIST_HEAD(, V9fsPDU
) free_list
;
194 V9fsFidState
*fid_list
;
200 enum p9_proto_version proto_version
;
204 typedef struct V9fsCreateState
{
213 V9fsString extension
;
218 typedef struct V9fsLcreateState
{
229 typedef struct V9fsStatState
{
237 typedef struct V9fsStatDotl
{
238 uint64_t st_result_mask
;
248 uint64_t st_atime_sec
;
249 uint64_t st_atime_nsec
;
250 uint64_t st_mtime_sec
;
251 uint64_t st_mtime_nsec
;
252 uint64_t st_ctime_sec
;
253 uint64_t st_ctime_nsec
;
254 uint64_t st_btime_sec
;
255 uint64_t st_btime_nsec
;
257 uint64_t st_data_version
;
260 typedef struct V9fsStatStateDotl
{
263 V9fsStatDotl v9stat_dotl
;
268 typedef struct V9fsWalkState
{
275 V9fsFidState
*newfidp
;
281 typedef struct V9fsOpenState
{
291 typedef struct V9fsReadState
{
298 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
310 typedef struct V9fsWriteState
{
318 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
323 typedef struct V9fsRemoveState
{
329 typedef struct V9fsWstatState
339 typedef struct V9fsSymlinkState
351 typedef struct V9fsIattr
364 typedef struct V9fsSetattrState
372 struct virtio_9p_config
374 /* number of characters in tag */
376 /* Variable size tag name */
378 } __attribute__((packed
));
380 typedef struct V9fsStatfs
393 typedef struct V9fsStatfsState
{
402 typedef struct V9fsMkState
{
411 typedef struct V9fsRenameState
{
419 extern size_t pdu_packunpack(void *addr
, struct iovec
*sg
, int sg_count
,
420 size_t offset
, size_t size
, int pack
);
422 static inline size_t do_pdu_unpack(void *dst
, struct iovec
*sg
, int sg_count
,
423 size_t offset
, size_t size
)
425 return pdu_packunpack(dst
, sg
, sg_count
, offset
, size
, 0);