protocol_yfs.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. YFSINLINEBULKSTATUS = 64536, /* YFS Fetch multiple file statuses with errors */
  50. YFSFETCHDATA64 = 64537, /* YFS Fetch file data */
  51. YFSSTOREDATA64 = 64538, /* YFS Store file data */
  52. YFSUPDATESYMLINK = 64540,
  53. };
  54. struct yfs_xdr_u64 {
  55. __be32 msw;
  56. __be32 lsw;
  57. } __packed;
  58. static inline u64 xdr_to_u64(const struct yfs_xdr_u64 x)
  59. {
  60. return ((u64)ntohl(x.msw) << 32) | ntohl(x.lsw);
  61. }
  62. static inline struct yfs_xdr_u64 u64_to_xdr(const u64 x)
  63. {
  64. return (struct yfs_xdr_u64){ .msw = htonl(x >> 32), .lsw = htonl(x) };
  65. }
  66. struct yfs_xdr_vnode {
  67. struct yfs_xdr_u64 lo;
  68. __be32 hi;
  69. __be32 unique;
  70. } __packed;
  71. struct yfs_xdr_YFSFid {
  72. struct yfs_xdr_u64 volume;
  73. struct yfs_xdr_vnode vnode;
  74. } __packed;
  75. struct yfs_xdr_YFSFetchStatus {
  76. __be32 type;
  77. __be32 nlink;
  78. struct yfs_xdr_u64 size;
  79. struct yfs_xdr_u64 data_version;
  80. struct yfs_xdr_u64 author;
  81. struct yfs_xdr_u64 owner;
  82. struct yfs_xdr_u64 group;
  83. __be32 mode;
  84. __be32 caller_access;
  85. __be32 anon_access;
  86. struct yfs_xdr_vnode parent;
  87. __be32 data_access_protocol;
  88. struct yfs_xdr_u64 mtime_client;
  89. struct yfs_xdr_u64 mtime_server;
  90. __be32 lock_count;
  91. __be32 abort_code;
  92. } __packed;
  93. struct yfs_xdr_YFSCallBack {
  94. __be32 version;
  95. struct yfs_xdr_u64 expiration_time;
  96. __be32 type;
  97. } __packed;
  98. struct yfs_xdr_YFSStoreStatus {
  99. __be32 mask;
  100. __be32 mode;
  101. struct yfs_xdr_u64 mtime_client;
  102. struct yfs_xdr_u64 owner;
  103. struct yfs_xdr_u64 group;
  104. } __packed;
  105. struct yfs_xdr_RPCFlags {
  106. __be32 rpc_flags;
  107. } __packed;
  108. struct yfs_xdr_YFSVolSync {
  109. struct yfs_xdr_u64 vol_creation_date;
  110. struct yfs_xdr_u64 vol_update_date;
  111. struct yfs_xdr_u64 max_quota;
  112. struct yfs_xdr_u64 blocks_in_use;
  113. struct yfs_xdr_u64 blocks_avail;
  114. } __packed;
  115. enum yfs_volume_type {
  116. yfs_volume_type_ro = 0,
  117. yfs_volume_type_rw = 1,
  118. };
  119. #define yfs_FVSOnline 0x1
  120. #define yfs_FVSInservice 0x2
  121. #define yfs_FVSBlessed 0x4
  122. #define yfs_FVSNeedsSalvage 0x8
  123. struct yfs_xdr_YFSFetchVolumeStatus {
  124. struct yfs_xdr_u64 vid;
  125. struct yfs_xdr_u64 parent_id;
  126. __be32 flags;
  127. __be32 type;
  128. struct yfs_xdr_u64 max_quota;
  129. struct yfs_xdr_u64 blocks_in_use;
  130. struct yfs_xdr_u64 part_blocks_avail;
  131. struct yfs_xdr_u64 part_max_blocks;
  132. struct yfs_xdr_u64 vol_copy_date;
  133. struct yfs_xdr_u64 vol_backup_date;
  134. } __packed;
  135. struct yfs_xdr_YFSStoreVolumeStatus {
  136. __be32 mask;
  137. struct yfs_xdr_u64 min_quota;
  138. struct yfs_xdr_u64 max_quota;
  139. struct yfs_xdr_u64 file_quota;
  140. } __packed;
  141. enum yfs_lock_type {
  142. yfs_LockNone = -1,
  143. yfs_LockRead = 0,
  144. yfs_LockWrite = 1,
  145. yfs_LockExtend = 2,
  146. yfs_LockRelease = 3,
  147. yfs_LockMandatoryRead = 0x100,
  148. yfs_LockMandatoryWrite = 0x101,
  149. yfs_LockMandatoryExtend = 0x102,
  150. };