Statistics
| Branch: | Revision:

root / fsdev / virtio-9p-marshal.h @ cb9c377f

History | View | Annotate | Download (2 kB)

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