xref: /qemu/hw/9pfs/9p-proxy.h (revision 7a4e543d)
1 /*
2  * 9p Proxy callback
3  *
4  * Copyright IBM, Corp. 2011
5  *
6  * Authors:
7  * M. Mohan Kumar <mohan@in.ibm.com>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2.  See
10  * the COPYING file in the top-level directory.
11  */
12 #ifndef _QEMU_9P_PROXY_H
13 #define _QEMU_9P_PROXY_H
14 
15 #define PROXY_MAX_IO_SZ (64 * 1024)
16 #define V9FS_FD_VALID INT_MAX
17 
18 /*
19  * proxy iovec only support one element and
20  * marsha/unmarshal doesn't do little endian conversion.
21  */
22 #define proxy_unmarshal(in_sg, offset, fmt, args...) \
23     v9fs_iov_unmarshal(in_sg, 1, offset, 0, fmt, ##args)
24 #define proxy_marshal(out_sg, offset, fmt, args...) \
25     v9fs_iov_marshal(out_sg, 1, offset, 0, fmt, ##args)
26 
27 union MsgControl {
28     struct cmsghdr cmsg;
29     char control[CMSG_SPACE(sizeof(int))];
30 };
31 
32 typedef struct {
33     uint32_t type;
34     uint32_t size;
35 } ProxyHeader;
36 
37 #define PROXY_HDR_SZ (sizeof(ProxyHeader))
38 
39 enum {
40     T_SUCCESS = 0,
41     T_ERROR,
42     T_OPEN,
43     T_CREATE,
44     T_MKNOD,
45     T_MKDIR,
46     T_SYMLINK,
47     T_LINK,
48     T_LSTAT,
49     T_READLINK,
50     T_STATFS,
51     T_CHMOD,
52     T_CHOWN,
53     T_TRUNCATE,
54     T_UTIME,
55     T_RENAME,
56     T_REMOVE,
57     T_LGETXATTR,
58     T_LLISTXATTR,
59     T_LSETXATTR,
60     T_LREMOVEXATTR,
61     T_GETVERSION,
62 };
63 
64 typedef struct {
65     uint64_t st_dev;
66     uint64_t st_ino;
67     uint64_t st_nlink;
68     uint32_t st_mode;
69     uint32_t st_uid;
70     uint32_t st_gid;
71     uint64_t st_rdev;
72     uint64_t st_size;
73     uint64_t st_blksize;
74     uint64_t st_blocks;
75     uint64_t st_atim_sec;
76     uint64_t st_atim_nsec;
77     uint64_t st_mtim_sec;
78     uint64_t st_mtim_nsec;
79     uint64_t st_ctim_sec;
80     uint64_t st_ctim_nsec;
81 } ProxyStat;
82 
83 typedef struct {
84     uint64_t f_type;
85     uint64_t f_bsize;
86     uint64_t f_blocks;
87     uint64_t f_bfree;
88     uint64_t f_bavail;
89     uint64_t f_files;
90     uint64_t f_ffree;
91     uint64_t f_fsid[2];
92     uint64_t f_namelen;
93     uint64_t f_frsize;
94 } ProxyStatFS;
95 #endif
96