protocol_yfs.h 4.5 KB

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