xref: /openbmc/qemu/fsdev/9p-marshal.h (revision ba632924)
1 #ifndef QEMU_9P_MARSHAL_H
2 #define QEMU_9P_MARSHAL_H
3 
4 typedef struct V9fsString
5 {
6     uint16_t size;
7     char *data;
8 } V9fsString;
9 
10 typedef struct V9fsQID
11 {
12     int8_t type;
13     int32_t version;
14     int64_t path;
15 } V9fsQID;
16 
17 typedef struct V9fsStat
18 {
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;
37 
38 typedef struct V9fsIattr
39 {
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;
50 
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;
73 
74 static inline void v9fs_string_init(V9fsString *str)
75 {
76     str->data = NULL;
77     str->size = 0;
78 }
79 void v9fs_string_free(V9fsString *str);
80 void v9fs_string_sprintf(V9fsString *str, const char *fmt, ...);
81 void v9fs_string_copy(V9fsString *lhs, V9fsString *rhs);
82 
83 #endif
84