9p-proxy.h 2.0 KB

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