xref: /openbmc/qemu/hw/9pfs/9p-proxy.h (revision 71d72ece)
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 
13 /*
14  * NOTE: The 9p 'proxy' backend is deprecated (since QEMU 8.1) and will be
15  * removed in a future version of QEMU!
16  */
17 
18 #ifndef QEMU_9P_PROXY_H
19 #define QEMU_9P_PROXY_H
20 
21 #define PROXY_MAX_IO_SZ (64 * 1024)
22 #define V9FS_FD_VALID INT_MAX
23 
24 /*
25  * proxy iovec only support one element and
26  * marsha/unmarshal doesn't do little endian conversion.
27  */
28 #define proxy_unmarshal(in_sg, offset, fmt, args...) \
29     v9fs_iov_unmarshal(in_sg, 1, offset, 0, fmt, ##args)
30 #define proxy_marshal(out_sg, offset, fmt, args...) \
31     v9fs_iov_marshal(out_sg, 1, offset, 0, fmt, ##args)
32 
33 union MsgControl {
34     struct cmsghdr cmsg;
35     char control[CMSG_SPACE(sizeof(int))];
36 };
37 
38 typedef struct {
39     uint32_t type;
40     uint32_t size;
41 } ProxyHeader;
42 
43 #define PROXY_HDR_SZ (sizeof(ProxyHeader))
44 
45 enum {
46     T_SUCCESS = 0,
47     T_ERROR,
48     T_OPEN,
49     T_CREATE,
50     T_MKNOD,
51     T_MKDIR,
52     T_SYMLINK,
53     T_LINK,
54     T_LSTAT,
55     T_READLINK,
56     T_STATFS,
57     T_CHMOD,
58     T_CHOWN,
59     T_TRUNCATE,
60     T_UTIME,
61     T_RENAME,
62     T_REMOVE,
63     T_LGETXATTR,
64     T_LLISTXATTR,
65     T_LSETXATTR,
66     T_LREMOVEXATTR,
67     T_GETVERSION,
68 };
69 
70 typedef struct {
71     uint64_t st_dev;
72     uint64_t st_ino;
73     uint64_t st_nlink;
74     uint32_t st_mode;
75     uint32_t st_uid;
76     uint32_t st_gid;
77     uint64_t st_rdev;
78     uint64_t st_size;
79     uint64_t st_blksize;
80     uint64_t st_blocks;
81     uint64_t st_atim_sec;
82     uint64_t st_atim_nsec;
83     uint64_t st_mtim_sec;
84     uint64_t st_mtim_nsec;
85     uint64_t st_ctim_sec;
86     uint64_t st_ctim_nsec;
87 } ProxyStat;
88 
89 typedef struct {
90     uint64_t f_type;
91     uint64_t f_bsize;
92     uint64_t f_blocks;
93     uint64_t f_bfree;
94     uint64_t f_bavail;
95     uint64_t f_files;
96     uint64_t f_ffree;
97     uint64_t f_fsid[2];
98     uint64_t f_namelen;
99     uint64_t f_frsize;
100 } ProxyStatFS;
101 #endif
102