9p-proxy.h (1905B)
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#ifndef QEMU_9P_PROXY_H 14#define QEMU_9P_PROXY_H 15 16#define PROXY_MAX_IO_SZ (64 * 1024) 17#define V9FS_FD_VALID INT_MAX 18 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...) \ 24 v9fs_iov_unmarshal(in_sg, 1, offset, 0, fmt, ##args) 25#define proxy_marshal(out_sg, offset, fmt, args...) \ 26 v9fs_iov_marshal(out_sg, 1, offset, 0, fmt, ##args) 27 28union MsgControl { 29 struct cmsghdr cmsg; 30 char control[CMSG_SPACE(sizeof(int))]; 31}; 32 33typedef struct { 34 uint32_t type; 35 uint32_t size; 36} ProxyHeader; 37 38#define PROXY_HDR_SZ (sizeof(ProxyHeader)) 39 40enum { 41 T_SUCCESS = 0, 42 T_ERROR, 43 T_OPEN, 44 T_CREATE, 45 T_MKNOD, 46 T_MKDIR, 47 T_SYMLINK, 48 T_LINK, 49 T_LSTAT, 50 T_READLINK, 51 T_STATFS, 52 T_CHMOD, 53 T_CHOWN, 54 T_TRUNCATE, 55 T_UTIME, 56 T_RENAME, 57 T_REMOVE, 58 T_LGETXATTR, 59 T_LLISTXATTR, 60 T_LSETXATTR, 61 T_LREMOVEXATTR, 62 T_GETVERSION, 63}; 64 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; 96#endif