2
0

9p-proxy.h 1.9 KB

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