]> git.proxmox.com Git - mirror_qemu.git/blame - hw/9pfs/9p-proxy.h
tests: fix leaks in test-io-channel-command
[mirror_qemu.git] / hw / 9pfs / 9p-proxy.h
CommitLineData
4c793dda 1/*
494a8ebe 2 * 9p Proxy callback
4c793dda
MK
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 */
2a6a4076
MA
12
13#ifndef QEMU_9P_PROXY_H
14#define QEMU_9P_PROXY_H
4c793dda
MK
15
16#define PROXY_MAX_IO_SZ (64 * 1024)
daf0b9ac 17#define V9FS_FD_VALID INT_MAX
4c793dda 18
17bff52b
MK
19/*
20 * proxy iovec only support one element and
21 * marsha/unmarshal doesn't do little endian conversion.
22 */
23#define proxy_unmarshal(in_sg, offset, fmt, args...) \
2209bd05 24 v9fs_iov_unmarshal(in_sg, 1, offset, 0, fmt, ##args)
17bff52b 25#define proxy_marshal(out_sg, offset, fmt, args...) \
2209bd05 26 v9fs_iov_marshal(out_sg, 1, offset, 0, fmt, ##args)
17bff52b 27
daf0b9ac
MK
28union MsgControl {
29 struct cmsghdr cmsg;
30 char control[CMSG_SPACE(sizeof(int))];
31};
32
4c793dda
MK
33typedef struct {
34 uint32_t type;
35 uint32_t size;
36} ProxyHeader;
37
38#define PROXY_HDR_SZ (sizeof(ProxyHeader))
39
daf0b9ac 40enum {
39f8c32c
MK
41 T_SUCCESS = 0,
42 T_ERROR,
43 T_OPEN,
daf0b9ac 44 T_CREATE,
39f8c32c
MK
45 T_MKNOD,
46 T_MKDIR,
47 T_SYMLINK,
48 T_LINK,
b178adc3
MK
49 T_LSTAT,
50 T_READLINK,
51 T_STATFS,
ea75fc4e
MK
52 T_CHMOD,
53 T_CHOWN,
54 T_TRUNCATE,
55 T_UTIME,
56 T_RENAME,
57 T_REMOVE,
d52b09e4
MK
58 T_LGETXATTR,
59 T_LLISTXATTR,
60 T_LSETXATTR,
61 T_LREMOVEXATTR,
d090e452 62 T_GETVERSION,
daf0b9ac
MK
63};
64
b178adc3
MK
65typedef struct {
66 uint64_t st_dev;
67 uint64_t st_ino;
68 uint64_t st_nlink;
69 uint32_t st_mode;
70 uint32_t st_uid;
71 uint32_t st_gid;
72 uint64_t st_rdev;
73 uint64_t st_size;
74 uint64_t st_blksize;
75 uint64_t st_blocks;
76 uint64_t st_atim_sec;
77 uint64_t st_atim_nsec;
78 uint64_t st_mtim_sec;
79 uint64_t st_mtim_nsec;
80 uint64_t st_ctim_sec;
81 uint64_t st_ctim_nsec;
82} ProxyStat;
83
84typedef struct {
85 uint64_t f_type;
86 uint64_t f_bsize;
87 uint64_t f_blocks;
88 uint64_t f_bfree;
89 uint64_t f_bavail;
90 uint64_t f_files;
91 uint64_t f_ffree;
92 uint64_t f_fsid[2];
93 uint64_t f_namelen;
94 uint64_t f_frsize;
95} ProxyStatFS;
4c793dda 96#endif