protocol_yfs.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /* YFS protocol bits
  3. *
  4. * Copyright (C) 2018 Red Hat, Inc. All Rights Reserved.
  5. * Written by David Howells (dhowells@redhat.com)
  6. */
  7. #define YFS_FS_SERVICE 2500
  8. #define YFS_CM_SERVICE 2501
  9. #define YFSCBMAX 1024
  10. enum YFS_CM_Operations {
  11. YFSCBProbe = 206, /* probe client */
  12. YFSCBGetLock = 207, /* get contents of CM lock table */
  13. YFSCBXStatsVersion = 209, /* get version of extended statistics */
  14. YFSCBGetXStats = 210, /* get contents of extended statistics data */
  15. YFSCBInitCallBackState3 = 213, /* initialise callback state, version 3 */
  16. YFSCBProbeUuid = 214, /* check the client hasn't rebooted */
  17. YFSCBGetServerPrefs = 215,
  18. YFSCBGetCellServDV = 216,
  19. YFSCBGetLocalCell = 217,
  20. YFSCBGetCacheConfig = 218,
  21. YFSCBGetCellByNum = 65537,
  22. YFSCBTellMeAboutYourself = 65538, /* get client capabilities */
  23. YFSCBCallBack = 64204,
  24. };
  25. enum YFS_FS_Operations {
  26. YFSFETCHACL = 64131, /* YFS Fetch file AFS3 ACL */
  27. YFSFETCHSTATUS = 64132, /* YFS Fetch file status */
  28. YFSSTOREACL = 64134, /* YFS Store file AFS3 ACL */
  29. YFSSTORESTATUS = 64135, /* YFS Store file status */
  30. YFSREMOVEFILE = 64136, /* YFS Remove a file */
  31. YFSCREATEFILE = 64137, /* YFS Create a file */
  32. YFSRENAME = 64138, /* YFS Rename or move a file or directory */
  33. YFSSYMLINK = 64139, /* YFS Create a symbolic link */
  34. YFSLINK = 64140, /* YFS Create a hard link */
  35. YFSMAKEDIR = 64141, /* YFS Create a directory */
  36. YFSREMOVEDIR = 64142, /* YFS Remove a directory */
  37. YFSGETVOLUMESTATUS = 64149, /* YFS Get volume status information */
  38. YFSSETVOLUMESTATUS = 64150, /* YFS Set volume status information */
  39. YFSSETLOCK = 64156, /* YFS Request a file lock */
  40. YFSEXTENDLOCK = 64157, /* YFS Extend a file lock */
  41. YFSRELEASELOCK = 64158, /* YFS Release a file lock */
  42. YFSLOOKUP = 64161, /* YFS lookup file in directory */
  43. YFSFLUSHCPS = 64165,
  44. YFSFETCHOPAQUEACL = 64168, /* YFS Fetch file YFS ACL */
  45. YFSWHOAMI = 64170,
  46. YFSREMOVEACL = 64171,
  47. YFSREMOVEFILE2 = 64173,
  48. YFSSTOREOPAQUEACL2 = 64174,
  49. YFSRENAME_REPLACE = 64176,
  50. YFSRENAME_NOREPLACE = 64177,
  51. YFSRENAME_EXCHANGE = 64187,
  52. YFSINLINEBULKSTATUS = 64536, /* YFS Fetch multiple file statuses with errors */
  53. YFSFETCHDATA64 = 64537, /* YFS Fetch file data */
  54. YFSSTOREDATA64 = 64538, /* YFS Store file data */
  55. YFSUPDATESYMLINK = 64540,
  56. };
  57. struct yfs_xdr_u64 {
  58. __be32 msw;
  59. __be32 lsw;
  60. } __packed;
  61. static inline u64 xdr_to_u64(const struct yfs_xdr_u64 x)
  62. {
  63. return ((u64)ntohl(x.msw) << 32) | ntohl(x.lsw);
  64. }
  65. static inline struct yfs_xdr_u64 u64_to_xdr(const u64 x)
  66. {
  67. return (struct yfs_xdr_u64){ .msw = htonl(x >> 32), .lsw = htonl(x) };
  68. }
  69. struct yfs_xdr_vnode {
  70. struct yfs_xdr_u64 lo;
  71. __be32 hi;
  72. __be32 unique;
  73. } __packed;
  74. struct yfs_xdr_YFSFid {
  75. struct yfs_xdr_u64 volume;
  76. struct yfs_xdr_vnode vnode;
  77. } __packed;
  78. struct yfs_xdr_YFSFetchStatus {
  79. __be32 type;
  80. __be32 nlink;
  81. struct yfs_xdr_u64 size;
  82. struct yfs_xdr_u64 data_version;
  83. struct yfs_xdr_u64 author;
  84. struct yfs_xdr_u64 owner;
  85. struct yfs_xdr_u64 group;
  86. __be32 mode;
  87. __be32 caller_access;
  88. __be32 anon_access;
  89. struct yfs_xdr_vnode parent;
  90. __be32 data_access_protocol;
  91. struct yfs_xdr_u64 mtime_client;
  92. struct yfs_xdr_u64 mtime_server;
  93. __be32 lock_count;
  94. __be32 abort_code;
  95. } __packed;
  96. struct yfs_xdr_YFSCallBack {
  97. __be32 version;
  98. struct yfs_xdr_u64 expiration_time;
  99. __be32 type;
  100. } __packed;
  101. struct yfs_xdr_YFSStoreStatus {
  102. __be32 mask;
  103. __be32 mode;
  104. struct yfs_xdr_u64 mtime_client;
  105. struct yfs_xdr_u64 owner;
  106. struct yfs_xdr_u64 group;
  107. } __packed;
  108. struct yfs_xdr_RPCFlags {
  109. __be32 rpc_flags;
  110. } __packed;
  111. struct yfs_xdr_YFSVolSync {
  112. struct yfs_xdr_u64 vol_creation_date;
  113. struct yfs_xdr_u64 vol_update_date;
  114. struct yfs_xdr_u64 max_quota;
  115. struct yfs_xdr_u64 blocks_in_use;
  116. struct yfs_xdr_u64 blocks_avail;
  117. } __packed;
  118. enum yfs_volume_type {
  119. yfs_volume_type_ro = 0,
  120. yfs_volume_type_rw = 1,
  121. };
  122. #define yfs_FVSOnline 0x1
  123. #define yfs_FVSInservice 0x2
  124. #define yfs_FVSBlessed 0x4
  125. #define yfs_FVSNeedsSalvage 0x8
  126. struct yfs_xdr_YFSFetchVolumeStatus {
  127. struct yfs_xdr_u64 vid;
  128. struct yfs_xdr_u64 parent_id;
  129. __be32 flags;
  130. __be32 type;
  131. struct yfs_xdr_u64 max_quota;
  132. struct yfs_xdr_u64 blocks_in_use;
  133. struct yfs_xdr_u64 part_blocks_avail;
  134. struct yfs_xdr_u64 part_max_blocks;
  135. struct yfs_xdr_u64 vol_copy_date;
  136. struct yfs_xdr_u64 vol_backup_date;
  137. } __packed;
  138. struct yfs_xdr_YFSStoreVolumeStatus {
  139. __be32 mask;
  140. struct yfs_xdr_u64 min_quota;
  141. struct yfs_xdr_u64 max_quota;
  142. struct yfs_xdr_u64 file_quota;
  143. } __packed;
  144. enum yfs_lock_type {
  145. yfs_LockNone = -1,
  146. yfs_LockRead = 0,
  147. yfs_LockWrite = 1,
  148. yfs_LockExtend = 2,
  149. yfs_LockRelease = 3,
  150. yfs_LockMandatoryRead = 0x100,
  151. yfs_LockMandatoryWrite = 0x101,
  152. yfs_LockMandatoryExtend = 0x102,
  153. };
  154. /* RXYFS Viced Capability Flags */
  155. #define YFS_VICED_CAPABILITY_ERRORTRANS 0x0001 /* Deprecated v0.195 */
  156. #define YFS_VICED_CAPABILITY_64BITFILES 0x0002 /* Deprecated v0.195 */
  157. #define YFS_VICED_CAPABILITY_WRITELOCKACL 0x0004 /* Can lock a file even without lock perm */
  158. #define YFS_VICED_CAPABILITY_SANEACLS 0x0008 /* Deprecated v0.195 */