xref: /openbmc/qemu/fsdev/9p-marshal.h (revision c09124dc)
1 #ifndef QEMU_9P_MARSHAL_H
2 #define QEMU_9P_MARSHAL_H
3 
4 typedef struct V9fsString {
5     uint16_t size;
6     char *data;
7 } V9fsString;
8 
9 typedef struct V9fsQID {
10     uint8_t type;
11     uint32_t version;
12     uint64_t path;
13 } V9fsQID;
14 
15 typedef struct V9fsStat {
16     int16_t size;
17     int16_t type;
18     int32_t dev;
19     V9fsQID qid;
20     int32_t mode;
21     int32_t atime;
22     int32_t mtime;
23     int64_t length;
24     V9fsString name;
25     V9fsString uid;
26     V9fsString gid;
27     V9fsString muid;
28     /* 9p2000.u */
29     V9fsString extension;
30     int32_t n_uid;
31     int32_t n_gid;
32     int32_t n_muid;
33 } V9fsStat;
34 
35 typedef struct V9fsIattr {
36     int32_t valid;
37     int32_t mode;
38     int32_t uid;
39     int32_t gid;
40     int64_t size;
41     int64_t atime_sec;
42     int64_t atime_nsec;
43     int64_t mtime_sec;
44     int64_t mtime_nsec;
45 } V9fsIattr;
46 
47 typedef struct V9fsStatDotl {
48     uint64_t st_result_mask;
49     V9fsQID qid;
50     uint32_t st_mode;
51     uint32_t st_uid;
52     uint32_t st_gid;
53     uint64_t st_nlink;
54     uint64_t st_rdev;
55     uint64_t st_size;
56     uint64_t st_blksize;
57     uint64_t st_blocks;
58     uint64_t st_atime_sec;
59     uint64_t st_atime_nsec;
60     uint64_t st_mtime_sec;
61     uint64_t st_mtime_nsec;
62     uint64_t st_ctime_sec;
63     uint64_t st_ctime_nsec;
64     uint64_t st_btime_sec;
65     uint64_t st_btime_nsec;
66     uint64_t st_gen;
67     uint64_t st_data_version;
68 } V9fsStatDotl;
69 
70 static inline void v9fs_string_init(V9fsString *str)
71 {
72     str->data = NULL;
73     str->size = 0;
74 }
75 void v9fs_string_free(V9fsString *str);
76 void v9fs_string_sprintf(V9fsString *str, const char *fmt, ...);
77 void v9fs_string_copy(V9fsString *lhs, V9fsString *rhs);
78 
79 #endif
80