xref: /openbmc/qemu/fsdev/9p-marshal.h (revision 05caa062)
1 #ifndef QEMU_9P_MARSHAL_H
2 #define QEMU_9P_MARSHAL_H
3 
4 #include "p9array.h"
5 
6 typedef struct V9fsString {
7     uint16_t size;
8     char *data;
9 } V9fsString;
10 P9ARRAY_DECLARE_TYPE(V9fsString);
11 
12 typedef struct V9fsQID {
13     uint8_t type;
14     uint32_t version;
15     uint64_t path;
16 } V9fsQID;
17 
18 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;
37 
38 typedef struct V9fsIattr {
39     int32_t valid;
40     int32_t mode;
41     int32_t uid;
42     int32_t gid;
43     int64_t size;
44     int64_t atime_sec;
45     int64_t atime_nsec;
46     int64_t mtime_sec;
47     int64_t mtime_nsec;
48 } V9fsIattr;
49 
50 typedef struct V9fsStatDotl {
51     uint64_t st_result_mask;
52     V9fsQID qid;
53     uint32_t st_mode;
54     uint32_t st_uid;
55     uint32_t st_gid;
56     uint64_t st_nlink;
57     uint64_t st_rdev;
58     uint64_t st_size;
59     uint64_t st_blksize;
60     uint64_t st_blocks;
61     uint64_t st_atime_sec;
62     uint64_t st_atime_nsec;
63     uint64_t st_mtime_sec;
64     uint64_t st_mtime_nsec;
65     uint64_t st_ctime_sec;
66     uint64_t st_ctime_nsec;
67     uint64_t st_btime_sec;
68     uint64_t st_btime_nsec;
69     uint64_t st_gen;
70     uint64_t st_data_version;
71 } V9fsStatDotl;
72 
73 static inline void v9fs_string_init(V9fsString *str)
74 {
75     str->data = NULL;
76     str->size = 0;
77 }
78 void v9fs_string_free(V9fsString *str);
79 void v9fs_string_sprintf(V9fsString *str, const char *fmt, ...);
80 void v9fs_string_copy(V9fsString *lhs, V9fsString *rhs);
81 
82 #endif
83