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
70 enum p9_proto_version
{
71 V9FS_PROTO_2000U
= 0x01,
72 V9FS_PROTO_2000L
= 0x02,
75 #define P9_NOTAG (u16)(~0)
76 #define P9_NOFID (u32)(~0)
77 #define P9_MAXWELEM 16
80 * ample room for Twrite/Rread header
81 * size[4] Tread/Twrite tag[2] fid[4] offset[8] count[4]
85 typedef struct V9fsPDU V9fsPDU
;
92 VirtQueueElement elem
;
93 QLIST_ENTRY(V9fsPDU
) next
;
98 * 1) change user needs to set groups and stuff
101 /* from Linux's linux/virtio_9p.h */
103 /* The ID for virtio console */
104 #define VIRTIO_ID_9P 9
106 #define MAX_TAG_LEN 32
108 #define BUG_ON(cond) assert(!(cond))
110 typedef struct V9fsFidState V9fsFidState
;
112 typedef struct V9fsString
118 typedef struct V9fsQID
125 typedef struct V9fsStat
140 V9fsString extension
;
156 typedef struct V9fsState
160 V9fsPDU pdus
[MAX_REQ
];
161 QLIST_HEAD(, V9fsPDU
) free_list
;
162 V9fsFidState
*fid_list
;
168 enum p9_proto_version proto_version
;
172 typedef struct V9fsCreateState
{
181 V9fsString extension
;
186 typedef struct V9fsStatState
{
194 typedef struct V9fsStatDotl
{
195 uint64_t st_result_mask
;
205 uint64_t st_atime_sec
;
206 uint64_t st_atime_nsec
;
207 uint64_t st_mtime_sec
;
208 uint64_t st_mtime_nsec
;
209 uint64_t st_ctime_sec
;
210 uint64_t st_ctime_nsec
;
211 uint64_t st_btime_sec
;
212 uint64_t st_btime_nsec
;
214 uint64_t st_data_version
;
217 typedef struct V9fsStatStateDotl
{
220 V9fsStatDotl v9stat_dotl
;
225 typedef struct V9fsWalkState
{
232 V9fsFidState
*newfidp
;
238 typedef struct V9fsOpenState
{
248 typedef struct V9fsReadState
{
255 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
267 typedef struct V9fsWriteState
{
275 struct iovec iov
[128]; /* FIXME: bad, bad, bad */
280 typedef struct V9fsRemoveState
{
286 typedef struct V9fsWstatState
297 typedef struct V9fsIattr
310 typedef struct V9fsSetattrState
318 struct virtio_9p_config
320 /* number of characters in tag */
322 /* Variable size tag name */
324 } __attribute__((packed
));
326 typedef struct V9fsStatfs
339 typedef struct V9fsStatfsState
{
348 extern size_t pdu_packunpack(void *addr
, struct iovec
*sg
, int sg_count
,
349 size_t offset
, size_t size
, int pack
);
351 static inline size_t do_pdu_unpack(void *dst
, struct iovec
*sg
, int sg_count
,
352 size_t offset
, size_t size
)
354 return pdu_packunpack(dst
, sg
, sg_count
, offset
, size
, 0);