s390x/virtio-ccw: support virtio-1 set_vq format
[qemu.git] / fsdev / virtio-9p-marshal.h
blob5df65a835738ffe2bcf70df6f556ceb436a55429
1 #ifndef _QEMU_VIRTIO_9P_MARSHAL_H
2 #define _QEMU_VIRTIO_9P_MARSHAL_H
4 typedef struct V9fsString
6 uint16_t size;
7 char *data;
8 } V9fsString;
10 typedef struct V9fsQID
12 int8_t type;
13 int32_t version;
14 int64_t path;
15 } V9fsQID;
17 typedef struct V9fsStat
19 int16_t size;
20 int16_t type;
21 int32_t dev;
22 V9fsQID qid;
23 int32_t mode;
24 int32_t atime;
25 int32_t mtime;
26 int64_t length;
27 V9fsString name;
28 V9fsString uid;
29 V9fsString gid;
30 V9fsString muid;
31 /* 9p2000.u */
32 V9fsString extension;
33 int32_t n_uid;
34 int32_t n_gid;
35 int32_t n_muid;
36 } V9fsStat;
38 typedef struct V9fsIattr
40 int32_t valid;
41 int32_t mode;
42 int32_t uid;
43 int32_t gid;
44 int64_t size;
45 int64_t atime_sec;
46 int64_t atime_nsec;
47 int64_t mtime_sec;
48 int64_t mtime_nsec;
49 } V9fsIattr;
51 typedef struct V9fsStatDotl {
52 uint64_t st_result_mask;
53 V9fsQID qid;
54 uint32_t st_mode;
55 uint32_t st_uid;
56 uint32_t st_gid;
57 uint64_t st_nlink;
58 uint64_t st_rdev;
59 uint64_t st_size;
60 uint64_t st_blksize;
61 uint64_t st_blocks;
62 uint64_t st_atime_sec;
63 uint64_t st_atime_nsec;
64 uint64_t st_mtime_sec;
65 uint64_t st_mtime_nsec;
66 uint64_t st_ctime_sec;
67 uint64_t st_ctime_nsec;
68 uint64_t st_btime_sec;
69 uint64_t st_btime_nsec;
70 uint64_t st_gen;
71 uint64_t st_data_version;
72 } V9fsStatDotl;
74 static inline void v9fs_string_init(V9fsString *str)
76 str->data = NULL;
77 str->size = 0;
79 extern void v9fs_string_free(V9fsString *str);
80 extern void v9fs_string_null(V9fsString *str);
81 extern void v9fs_string_sprintf(V9fsString *str, const char *fmt, ...);
82 extern void v9fs_string_copy(V9fsString *lhs, V9fsString *rhs);
84 ssize_t v9fs_pack(struct iovec *in_sg, int in_num, size_t offset,
85 const void *src, size_t size);
86 ssize_t v9fs_unmarshal(struct iovec *out_sg, int out_num, size_t offset,
87 int bswap, const char *fmt, ...);
88 ssize_t v9fs_marshal(struct iovec *in_sg, int in_num, size_t offset,
89 int bswap, const char *fmt, ...);
90 #endif