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
80 enum p9_proto_version
{
81 V9FS_PROTO_2000U
= 0x01,
82 V9FS_PROTO_2000L
= 0x02,
85 #define P9_NOTAG (u16)(~0)
86 #define P9_NOFID (u32)(~0)
87 #define P9_MAXWELEM 16
90 * ample room for Twrite/Rread header
91 * size[4] Tread/Twrite tag[2] fid[4] offset[8] count[4]
95 typedef struct V9fsPDU V9fsPDU
;
102 VirtQueueElement elem
;
103 QLIST_ENTRY(V9fsPDU
) next
;
108 * 1) change user needs to set groups and stuff
111 /* from Linux's linux/virtio_9p.h */
113 /* The ID for virtio console */
114 #define VIRTIO_ID_9P 9
116 #define MAX_TAG_LEN 32
118 #define BUG_ON(cond) assert(!(cond))
120 typedef struct V9fsFidState V9fsFidState
;
122 typedef struct V9fsString
128 typedef struct V9fsQID
135 typedef struct V9fsStat
150 V9fsString extension
;
166 typedef struct V9fsState
170 V9fsPDU pdus
[MAX_REQ
];
171 QLIST_HEAD(, V9fsPDU
) free_list
;
172 V9fsFidState
*fid_list
;
178 enum p9_proto_version proto_version
;
182 typedef struct V9fsCreateState
{
191 V9fsString extension
;
196 typedef struct V9fsLcreateState
{
207 typedef struct V9fsStatState
{
215 typedef struct V9fsStatDotl
{
216 uint64_t st_result_mask
;
226 uint64_t st_atime_sec
;
227 uint64_t st_atime_nsec
;
228 uint64_t st_mtime_sec
;
229 uint64_t st_mtime_nsec
;
230 uint64_t st_ctime_sec
;
231 uint64_t st_ctime_nsec
;
232 uint64_t st_btime_sec
;
233 uint64_t st_btime_nsec
;
235 uint64_t st_data_version
;
238 typedef struct V9fsStatStateDotl
{
241 V9fsStatDotl v9stat_dotl
;
246 typedef struct V9fsWalkState
{
253 V9fsFidState
*newfidp
;
259 typedef struct V9fsOpenState
{
269 typedef struct V9fsReadState
{
276 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
288 typedef struct V9fsWriteState
{
296 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
301 typedef struct V9fsRemoveState
{
307 typedef struct V9fsWstatState
317 typedef struct V9fsSymlinkState
329 typedef struct V9fsIattr
342 typedef struct V9fsSetattrState
350 struct virtio_9p_config
352 /* number of characters in tag */
354 /* Variable size tag name */
356 } __attribute__((packed
));
358 typedef struct V9fsStatfs
371 typedef struct V9fsStatfsState
{
380 typedef struct V9fsMkState
{
389 typedef struct V9fsRenameState
{
397 extern size_t pdu_packunpack(void *addr
, struct iovec
*sg
, int sg_count
,
398 size_t offset
, size_t size
, int pack
);
400 static inline size_t do_pdu_unpack(void *dst
, struct iovec
*sg
, int sg_count
,
401 size_t offset
, size_t size
)
403 return pdu_packunpack(dst
, sg
, sg_count
, offset
, size
, 0);