nfs4.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. /*
  2. * include/linux/nfs4.h
  3. *
  4. * NFSv4 protocol definitions.
  5. *
  6. * Copyright (c) 2002 The Regents of the University of Michigan.
  7. * All rights reserved.
  8. *
  9. * Kendrick Smith <kmsmith@umich.edu>
  10. * Andy Adamson <andros@umich.edu>
  11. */
  12. #ifndef _LINUX_NFS4_H
  13. #define _LINUX_NFS4_H
  14. #include <linux/list.h>
  15. #include <linux/uidgid.h>
  16. #include <uapi/linux/nfs4.h>
  17. enum nfs4_acl_whotype {
  18. NFS4_ACL_WHO_NAMED = 0,
  19. NFS4_ACL_WHO_OWNER,
  20. NFS4_ACL_WHO_GROUP,
  21. NFS4_ACL_WHO_EVERYONE,
  22. };
  23. struct nfs4_ace {
  24. uint32_t type;
  25. uint32_t flag;
  26. uint32_t access_mask;
  27. int whotype;
  28. union {
  29. kuid_t who_uid;
  30. kgid_t who_gid;
  31. };
  32. };
  33. struct nfs4_acl {
  34. uint32_t naces;
  35. struct nfs4_ace aces[0];
  36. };
  37. #define NFS4_MAXLABELLEN 2048
  38. struct nfs4_label {
  39. uint32_t lfs;
  40. uint32_t pi;
  41. u32 len;
  42. char *label;
  43. };
  44. typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier;
  45. struct nfs_stateid4 {
  46. __be32 seqid;
  47. char other[NFS4_STATEID_OTHER_SIZE];
  48. } __attribute__ ((packed));
  49. typedef struct nfs_stateid4 nfs4_stateid;
  50. enum nfs_opnum4 {
  51. OP_ACCESS = 3,
  52. OP_CLOSE = 4,
  53. OP_COMMIT = 5,
  54. OP_CREATE = 6,
  55. OP_DELEGPURGE = 7,
  56. OP_DELEGRETURN = 8,
  57. OP_GETATTR = 9,
  58. OP_GETFH = 10,
  59. OP_LINK = 11,
  60. OP_LOCK = 12,
  61. OP_LOCKT = 13,
  62. OP_LOCKU = 14,
  63. OP_LOOKUP = 15,
  64. OP_LOOKUPP = 16,
  65. OP_NVERIFY = 17,
  66. OP_OPEN = 18,
  67. OP_OPENATTR = 19,
  68. OP_OPEN_CONFIRM = 20,
  69. OP_OPEN_DOWNGRADE = 21,
  70. OP_PUTFH = 22,
  71. OP_PUTPUBFH = 23,
  72. OP_PUTROOTFH = 24,
  73. OP_READ = 25,
  74. OP_READDIR = 26,
  75. OP_READLINK = 27,
  76. OP_REMOVE = 28,
  77. OP_RENAME = 29,
  78. OP_RENEW = 30,
  79. OP_RESTOREFH = 31,
  80. OP_SAVEFH = 32,
  81. OP_SECINFO = 33,
  82. OP_SETATTR = 34,
  83. OP_SETCLIENTID = 35,
  84. OP_SETCLIENTID_CONFIRM = 36,
  85. OP_VERIFY = 37,
  86. OP_WRITE = 38,
  87. OP_RELEASE_LOCKOWNER = 39,
  88. /* nfs41 */
  89. OP_BACKCHANNEL_CTL = 40,
  90. OP_BIND_CONN_TO_SESSION = 41,
  91. OP_EXCHANGE_ID = 42,
  92. OP_CREATE_SESSION = 43,
  93. OP_DESTROY_SESSION = 44,
  94. OP_FREE_STATEID = 45,
  95. OP_GET_DIR_DELEGATION = 46,
  96. OP_GETDEVICEINFO = 47,
  97. OP_GETDEVICELIST = 48,
  98. OP_LAYOUTCOMMIT = 49,
  99. OP_LAYOUTGET = 50,
  100. OP_LAYOUTRETURN = 51,
  101. OP_SECINFO_NO_NAME = 52,
  102. OP_SEQUENCE = 53,
  103. OP_SET_SSV = 54,
  104. OP_TEST_STATEID = 55,
  105. OP_WANT_DELEGATION = 56,
  106. OP_DESTROY_CLIENTID = 57,
  107. OP_RECLAIM_COMPLETE = 58,
  108. /* nfs42 */
  109. OP_ALLOCATE = 59,
  110. OP_COPY = 60,
  111. OP_COPY_NOTIFY = 61,
  112. OP_DEALLOCATE = 62,
  113. OP_IO_ADVISE = 63,
  114. OP_LAYOUTERROR = 64,
  115. OP_LAYOUTSTATS = 65,
  116. OP_OFFLOAD_CANCEL = 66,
  117. OP_OFFLOAD_STATUS = 67,
  118. OP_READ_PLUS = 68,
  119. OP_SEEK = 69,
  120. OP_WRITE_SAME = 70,
  121. OP_CLONE = 71,
  122. OP_ILLEGAL = 10044,
  123. };
  124. /*Defining first and last NFS4 operations implemented.
  125. Needs to be updated if more operations are defined in future.*/
  126. #define FIRST_NFS4_OP OP_ACCESS
  127. #define LAST_NFS4_OP OP_WRITE_SAME
  128. #define LAST_NFS40_OP OP_RELEASE_LOCKOWNER
  129. #define LAST_NFS41_OP OP_RECLAIM_COMPLETE
  130. #define LAST_NFS42_OP OP_WRITE_SAME
  131. enum nfsstat4 {
  132. NFS4_OK = 0,
  133. NFS4ERR_PERM = 1,
  134. NFS4ERR_NOENT = 2,
  135. NFS4ERR_IO = 5,
  136. NFS4ERR_NXIO = 6,
  137. NFS4ERR_ACCESS = 13,
  138. NFS4ERR_EXIST = 17,
  139. NFS4ERR_XDEV = 18,
  140. /* Unused/reserved 19 */
  141. NFS4ERR_NOTDIR = 20,
  142. NFS4ERR_ISDIR = 21,
  143. NFS4ERR_INVAL = 22,
  144. NFS4ERR_FBIG = 27,
  145. NFS4ERR_NOSPC = 28,
  146. NFS4ERR_ROFS = 30,
  147. NFS4ERR_MLINK = 31,
  148. NFS4ERR_NAMETOOLONG = 63,
  149. NFS4ERR_NOTEMPTY = 66,
  150. NFS4ERR_DQUOT = 69,
  151. NFS4ERR_STALE = 70,
  152. NFS4ERR_BADHANDLE = 10001,
  153. NFS4ERR_BAD_COOKIE = 10003,
  154. NFS4ERR_NOTSUPP = 10004,
  155. NFS4ERR_TOOSMALL = 10005,
  156. NFS4ERR_SERVERFAULT = 10006,
  157. NFS4ERR_BADTYPE = 10007,
  158. NFS4ERR_DELAY = 10008,
  159. NFS4ERR_SAME = 10009,
  160. NFS4ERR_DENIED = 10010,
  161. NFS4ERR_EXPIRED = 10011,
  162. NFS4ERR_LOCKED = 10012,
  163. NFS4ERR_GRACE = 10013,
  164. NFS4ERR_FHEXPIRED = 10014,
  165. NFS4ERR_SHARE_DENIED = 10015,
  166. NFS4ERR_WRONGSEC = 10016,
  167. NFS4ERR_CLID_INUSE = 10017,
  168. NFS4ERR_RESOURCE = 10018,
  169. NFS4ERR_MOVED = 10019,
  170. NFS4ERR_NOFILEHANDLE = 10020,
  171. NFS4ERR_MINOR_VERS_MISMATCH = 10021,
  172. NFS4ERR_STALE_CLIENTID = 10022,
  173. NFS4ERR_STALE_STATEID = 10023,
  174. NFS4ERR_OLD_STATEID = 10024,
  175. NFS4ERR_BAD_STATEID = 10025,
  176. NFS4ERR_BAD_SEQID = 10026,
  177. NFS4ERR_NOT_SAME = 10027,
  178. NFS4ERR_LOCK_RANGE = 10028,
  179. NFS4ERR_SYMLINK = 10029,
  180. NFS4ERR_RESTOREFH = 10030,
  181. NFS4ERR_LEASE_MOVED = 10031,
  182. NFS4ERR_ATTRNOTSUPP = 10032,
  183. NFS4ERR_NO_GRACE = 10033,
  184. NFS4ERR_RECLAIM_BAD = 10034,
  185. NFS4ERR_RECLAIM_CONFLICT = 10035,
  186. NFS4ERR_BADXDR = 10036,
  187. NFS4ERR_LOCKS_HELD = 10037,
  188. NFS4ERR_OPENMODE = 10038,
  189. NFS4ERR_BADOWNER = 10039,
  190. NFS4ERR_BADCHAR = 10040,
  191. NFS4ERR_BADNAME = 10041,
  192. NFS4ERR_BAD_RANGE = 10042,
  193. NFS4ERR_LOCK_NOTSUPP = 10043,
  194. NFS4ERR_OP_ILLEGAL = 10044,
  195. NFS4ERR_DEADLOCK = 10045,
  196. NFS4ERR_FILE_OPEN = 10046,
  197. NFS4ERR_ADMIN_REVOKED = 10047,
  198. NFS4ERR_CB_PATH_DOWN = 10048,
  199. /* nfs41 */
  200. NFS4ERR_BADIOMODE = 10049,
  201. NFS4ERR_BADLAYOUT = 10050,
  202. NFS4ERR_BAD_SESSION_DIGEST = 10051,
  203. NFS4ERR_BADSESSION = 10052,
  204. NFS4ERR_BADSLOT = 10053,
  205. NFS4ERR_COMPLETE_ALREADY = 10054,
  206. NFS4ERR_CONN_NOT_BOUND_TO_SESSION = 10055,
  207. NFS4ERR_DELEG_ALREADY_WANTED = 10056,
  208. NFS4ERR_BACK_CHAN_BUSY = 10057, /* backchan reqs outstanding */
  209. NFS4ERR_LAYOUTTRYLATER = 10058,
  210. NFS4ERR_LAYOUTUNAVAILABLE = 10059,
  211. NFS4ERR_NOMATCHING_LAYOUT = 10060,
  212. NFS4ERR_RECALLCONFLICT = 10061,
  213. NFS4ERR_UNKNOWN_LAYOUTTYPE = 10062,
  214. NFS4ERR_SEQ_MISORDERED = 10063, /* unexpected seq.id in req */
  215. NFS4ERR_SEQUENCE_POS = 10064, /* [CB_]SEQ. op not 1st op */
  216. NFS4ERR_REQ_TOO_BIG = 10065, /* request too big */
  217. NFS4ERR_REP_TOO_BIG = 10066, /* reply too big */
  218. NFS4ERR_REP_TOO_BIG_TO_CACHE = 10067, /* rep. not all cached */
  219. NFS4ERR_RETRY_UNCACHED_REP = 10068, /* retry & rep. uncached */
  220. NFS4ERR_UNSAFE_COMPOUND = 10069, /* retry/recovery too hard */
  221. NFS4ERR_TOO_MANY_OPS = 10070, /* too many ops in [CB_]COMP */
  222. NFS4ERR_OP_NOT_IN_SESSION = 10071, /* op needs [CB_]SEQ. op */
  223. NFS4ERR_HASH_ALG_UNSUPP = 10072, /* hash alg. not supp. */
  224. /* Error 10073 is unused. */
  225. NFS4ERR_CLIENTID_BUSY = 10074, /* clientid has state */
  226. NFS4ERR_PNFS_IO_HOLE = 10075, /* IO to _SPARSE file hole */
  227. NFS4ERR_SEQ_FALSE_RETRY = 10076, /* retry not original */
  228. NFS4ERR_BAD_HIGH_SLOT = 10077, /* sequence arg bad */
  229. NFS4ERR_DEADSESSION = 10078, /* persistent session dead */
  230. NFS4ERR_ENCR_ALG_UNSUPP = 10079, /* SSV alg mismatch */
  231. NFS4ERR_PNFS_NO_LAYOUT = 10080, /* direct I/O with no layout */
  232. NFS4ERR_NOT_ONLY_OP = 10081, /* bad compound */
  233. NFS4ERR_WRONG_CRED = 10082, /* permissions:state change */
  234. NFS4ERR_WRONG_TYPE = 10083, /* current operation mismatch */
  235. NFS4ERR_DIRDELEG_UNAVAIL = 10084, /* no directory delegation */
  236. NFS4ERR_REJECT_DELEG = 10085, /* on callback */
  237. NFS4ERR_RETURNCONFLICT = 10086, /* outstanding layoutreturn */
  238. NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */
  239. /* nfs42 */
  240. NFS4ERR_PARTNER_NOTSUPP = 10088,
  241. NFS4ERR_PARTNER_NO_AUTH = 10089,
  242. NFS4ERR_UNION_NOTSUPP = 10090,
  243. NFS4ERR_OFFLOAD_DENIED = 10091,
  244. NFS4ERR_WRONG_LFS = 10092,
  245. NFS4ERR_BADLABEL = 10093,
  246. NFS4ERR_OFFLOAD_NO_REQS = 10094,
  247. };
  248. static inline bool seqid_mutating_err(u32 err)
  249. {
  250. /* See RFC 7530, section 9.1.7 */
  251. switch (err) {
  252. case NFS4ERR_STALE_CLIENTID:
  253. case NFS4ERR_STALE_STATEID:
  254. case NFS4ERR_BAD_STATEID:
  255. case NFS4ERR_BAD_SEQID:
  256. case NFS4ERR_BADXDR:
  257. case NFS4ERR_RESOURCE:
  258. case NFS4ERR_NOFILEHANDLE:
  259. case NFS4ERR_MOVED:
  260. return false;
  261. };
  262. return true;
  263. }
  264. /*
  265. * Note: NF4BAD is not actually part of the protocol; it is just used
  266. * internally by nfsd.
  267. */
  268. enum nfs_ftype4 {
  269. NF4BAD = 0,
  270. NF4REG = 1, /* Regular File */
  271. NF4DIR = 2, /* Directory */
  272. NF4BLK = 3, /* Special File - block device */
  273. NF4CHR = 4, /* Special File - character device */
  274. NF4LNK = 5, /* Symbolic Link */
  275. NF4SOCK = 6, /* Special File - socket */
  276. NF4FIFO = 7, /* Special File - fifo */
  277. NF4ATTRDIR = 8, /* Attribute Directory */
  278. NF4NAMEDATTR = 9 /* Named Attribute */
  279. };
  280. enum open_claim_type4 {
  281. NFS4_OPEN_CLAIM_NULL = 0,
  282. NFS4_OPEN_CLAIM_PREVIOUS = 1,
  283. NFS4_OPEN_CLAIM_DELEGATE_CUR = 2,
  284. NFS4_OPEN_CLAIM_DELEGATE_PREV = 3,
  285. NFS4_OPEN_CLAIM_FH = 4, /* 4.1 */
  286. NFS4_OPEN_CLAIM_DELEG_CUR_FH = 5, /* 4.1 */
  287. NFS4_OPEN_CLAIM_DELEG_PREV_FH = 6, /* 4.1 */
  288. };
  289. enum opentype4 {
  290. NFS4_OPEN_NOCREATE = 0,
  291. NFS4_OPEN_CREATE = 1
  292. };
  293. enum createmode4 {
  294. NFS4_CREATE_UNCHECKED = 0,
  295. NFS4_CREATE_GUARDED = 1,
  296. NFS4_CREATE_EXCLUSIVE = 2,
  297. /*
  298. * New to NFSv4.1. If session is persistent,
  299. * GUARDED4 MUST be used. Otherwise, use
  300. * EXCLUSIVE4_1 instead of EXCLUSIVE4.
  301. */
  302. NFS4_CREATE_EXCLUSIVE4_1 = 3
  303. };
  304. enum limit_by4 {
  305. NFS4_LIMIT_SIZE = 1,
  306. NFS4_LIMIT_BLOCKS = 2
  307. };
  308. enum open_delegation_type4 {
  309. NFS4_OPEN_DELEGATE_NONE = 0,
  310. NFS4_OPEN_DELEGATE_READ = 1,
  311. NFS4_OPEN_DELEGATE_WRITE = 2,
  312. NFS4_OPEN_DELEGATE_NONE_EXT = 3, /* 4.1 */
  313. };
  314. enum why_no_delegation4 { /* new to v4.1 */
  315. WND4_NOT_WANTED = 0,
  316. WND4_CONTENTION = 1,
  317. WND4_RESOURCE = 2,
  318. WND4_NOT_SUPP_FTYPE = 3,
  319. WND4_WRITE_DELEG_NOT_SUPP_FTYPE = 4,
  320. WND4_NOT_SUPP_UPGRADE = 5,
  321. WND4_NOT_SUPP_DOWNGRADE = 6,
  322. WND4_CANCELLED = 7,
  323. WND4_IS_DIR = 8,
  324. };
  325. enum lock_type4 {
  326. NFS4_UNLOCK_LT = 0,
  327. NFS4_READ_LT = 1,
  328. NFS4_WRITE_LT = 2,
  329. NFS4_READW_LT = 3,
  330. NFS4_WRITEW_LT = 4
  331. };
  332. /* Mandatory Attributes */
  333. #define FATTR4_WORD0_SUPPORTED_ATTRS (1UL << 0)
  334. #define FATTR4_WORD0_TYPE (1UL << 1)
  335. #define FATTR4_WORD0_FH_EXPIRE_TYPE (1UL << 2)
  336. #define FATTR4_WORD0_CHANGE (1UL << 3)
  337. #define FATTR4_WORD0_SIZE (1UL << 4)
  338. #define FATTR4_WORD0_LINK_SUPPORT (1UL << 5)
  339. #define FATTR4_WORD0_SYMLINK_SUPPORT (1UL << 6)
  340. #define FATTR4_WORD0_NAMED_ATTR (1UL << 7)
  341. #define FATTR4_WORD0_FSID (1UL << 8)
  342. #define FATTR4_WORD0_UNIQUE_HANDLES (1UL << 9)
  343. #define FATTR4_WORD0_LEASE_TIME (1UL << 10)
  344. #define FATTR4_WORD0_RDATTR_ERROR (1UL << 11)
  345. /* Mandatory in NFSv4.1 */
  346. #define FATTR4_WORD2_SUPPATTR_EXCLCREAT (1UL << 11)
  347. /* Recommended Attributes */
  348. #define FATTR4_WORD0_ACL (1UL << 12)
  349. #define FATTR4_WORD0_ACLSUPPORT (1UL << 13)
  350. #define FATTR4_WORD0_ARCHIVE (1UL << 14)
  351. #define FATTR4_WORD0_CANSETTIME (1UL << 15)
  352. #define FATTR4_WORD0_CASE_INSENSITIVE (1UL << 16)
  353. #define FATTR4_WORD0_CASE_PRESERVING (1UL << 17)
  354. #define FATTR4_WORD0_CHOWN_RESTRICTED (1UL << 18)
  355. #define FATTR4_WORD0_FILEHANDLE (1UL << 19)
  356. #define FATTR4_WORD0_FILEID (1UL << 20)
  357. #define FATTR4_WORD0_FILES_AVAIL (1UL << 21)
  358. #define FATTR4_WORD0_FILES_FREE (1UL << 22)
  359. #define FATTR4_WORD0_FILES_TOTAL (1UL << 23)
  360. #define FATTR4_WORD0_FS_LOCATIONS (1UL << 24)
  361. #define FATTR4_WORD0_HIDDEN (1UL << 25)
  362. #define FATTR4_WORD0_HOMOGENEOUS (1UL << 26)
  363. #define FATTR4_WORD0_MAXFILESIZE (1UL << 27)
  364. #define FATTR4_WORD0_MAXLINK (1UL << 28)
  365. #define FATTR4_WORD0_MAXNAME (1UL << 29)
  366. #define FATTR4_WORD0_MAXREAD (1UL << 30)
  367. #define FATTR4_WORD0_MAXWRITE (1UL << 31)
  368. #define FATTR4_WORD1_MIMETYPE (1UL << 0)
  369. #define FATTR4_WORD1_MODE (1UL << 1)
  370. #define FATTR4_WORD1_NO_TRUNC (1UL << 2)
  371. #define FATTR4_WORD1_NUMLINKS (1UL << 3)
  372. #define FATTR4_WORD1_OWNER (1UL << 4)
  373. #define FATTR4_WORD1_OWNER_GROUP (1UL << 5)
  374. #define FATTR4_WORD1_QUOTA_HARD (1UL << 6)
  375. #define FATTR4_WORD1_QUOTA_SOFT (1UL << 7)
  376. #define FATTR4_WORD1_QUOTA_USED (1UL << 8)
  377. #define FATTR4_WORD1_RAWDEV (1UL << 9)
  378. #define FATTR4_WORD1_SPACE_AVAIL (1UL << 10)
  379. #define FATTR4_WORD1_SPACE_FREE (1UL << 11)
  380. #define FATTR4_WORD1_SPACE_TOTAL (1UL << 12)
  381. #define FATTR4_WORD1_SPACE_USED (1UL << 13)
  382. #define FATTR4_WORD1_SYSTEM (1UL << 14)
  383. #define FATTR4_WORD1_TIME_ACCESS (1UL << 15)
  384. #define FATTR4_WORD1_TIME_ACCESS_SET (1UL << 16)
  385. #define FATTR4_WORD1_TIME_BACKUP (1UL << 17)
  386. #define FATTR4_WORD1_TIME_CREATE (1UL << 18)
  387. #define FATTR4_WORD1_TIME_DELTA (1UL << 19)
  388. #define FATTR4_WORD1_TIME_METADATA (1UL << 20)
  389. #define FATTR4_WORD1_TIME_MODIFY (1UL << 21)
  390. #define FATTR4_WORD1_TIME_MODIFY_SET (1UL << 22)
  391. #define FATTR4_WORD1_MOUNTED_ON_FILEID (1UL << 23)
  392. #define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30)
  393. #define FATTR4_WORD2_LAYOUT_TYPES (1UL << 0)
  394. #define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1)
  395. #define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4)
  396. #define FATTR4_WORD2_CLONE_BLKSIZE (1UL << 13)
  397. #define FATTR4_WORD2_SECURITY_LABEL (1UL << 16)
  398. /* MDS threshold bitmap bits */
  399. #define THRESHOLD_RD (1UL << 0)
  400. #define THRESHOLD_WR (1UL << 1)
  401. #define THRESHOLD_RD_IO (1UL << 2)
  402. #define THRESHOLD_WR_IO (1UL << 3)
  403. #define NFSPROC4_NULL 0
  404. #define NFSPROC4_COMPOUND 1
  405. #define NFS4_VERSION 4
  406. #define NFS4_MINOR_VERSION 0
  407. #define NFS4_DEBUG 1
  408. /* Index of predefined Linux client operations */
  409. enum {
  410. NFSPROC4_CLNT_NULL = 0, /* Unused */
  411. NFSPROC4_CLNT_READ,
  412. NFSPROC4_CLNT_WRITE,
  413. NFSPROC4_CLNT_COMMIT,
  414. NFSPROC4_CLNT_OPEN,
  415. NFSPROC4_CLNT_OPEN_CONFIRM,
  416. NFSPROC4_CLNT_OPEN_NOATTR,
  417. NFSPROC4_CLNT_OPEN_DOWNGRADE,
  418. NFSPROC4_CLNT_CLOSE,
  419. NFSPROC4_CLNT_SETATTR,
  420. NFSPROC4_CLNT_FSINFO,
  421. NFSPROC4_CLNT_RENEW,
  422. NFSPROC4_CLNT_SETCLIENTID,
  423. NFSPROC4_CLNT_SETCLIENTID_CONFIRM,
  424. NFSPROC4_CLNT_LOCK,
  425. NFSPROC4_CLNT_LOCKT,
  426. NFSPROC4_CLNT_LOCKU,
  427. NFSPROC4_CLNT_ACCESS,
  428. NFSPROC4_CLNT_GETATTR,
  429. NFSPROC4_CLNT_LOOKUP,
  430. NFSPROC4_CLNT_LOOKUP_ROOT,
  431. NFSPROC4_CLNT_REMOVE,
  432. NFSPROC4_CLNT_RENAME,
  433. NFSPROC4_CLNT_LINK,
  434. NFSPROC4_CLNT_SYMLINK,
  435. NFSPROC4_CLNT_CREATE,
  436. NFSPROC4_CLNT_PATHCONF,
  437. NFSPROC4_CLNT_STATFS,
  438. NFSPROC4_CLNT_READLINK,
  439. NFSPROC4_CLNT_READDIR,
  440. NFSPROC4_CLNT_SERVER_CAPS,
  441. NFSPROC4_CLNT_DELEGRETURN,
  442. NFSPROC4_CLNT_GETACL,
  443. NFSPROC4_CLNT_SETACL,
  444. NFSPROC4_CLNT_FS_LOCATIONS,
  445. NFSPROC4_CLNT_RELEASE_LOCKOWNER,
  446. NFSPROC4_CLNT_SECINFO,
  447. NFSPROC4_CLNT_FSID_PRESENT,
  448. /* nfs41 */
  449. NFSPROC4_CLNT_EXCHANGE_ID,
  450. NFSPROC4_CLNT_CREATE_SESSION,
  451. NFSPROC4_CLNT_DESTROY_SESSION,
  452. NFSPROC4_CLNT_SEQUENCE,
  453. NFSPROC4_CLNT_GET_LEASE_TIME,
  454. NFSPROC4_CLNT_RECLAIM_COMPLETE,
  455. NFSPROC4_CLNT_LAYOUTGET,
  456. NFSPROC4_CLNT_GETDEVICEINFO,
  457. NFSPROC4_CLNT_LAYOUTCOMMIT,
  458. NFSPROC4_CLNT_LAYOUTRETURN,
  459. NFSPROC4_CLNT_SECINFO_NO_NAME,
  460. NFSPROC4_CLNT_TEST_STATEID,
  461. NFSPROC4_CLNT_FREE_STATEID,
  462. NFSPROC4_CLNT_GETDEVICELIST,
  463. NFSPROC4_CLNT_BIND_CONN_TO_SESSION,
  464. NFSPROC4_CLNT_DESTROY_CLIENTID,
  465. /* nfs42 */
  466. NFSPROC4_CLNT_SEEK,
  467. NFSPROC4_CLNT_ALLOCATE,
  468. NFSPROC4_CLNT_DEALLOCATE,
  469. NFSPROC4_CLNT_LAYOUTSTATS,
  470. NFSPROC4_CLNT_CLONE,
  471. };
  472. /* nfs41 types */
  473. struct nfs4_sessionid {
  474. unsigned char data[NFS4_MAX_SESSIONID_LEN];
  475. };
  476. /* Create Session Flags */
  477. #define SESSION4_PERSIST 0x001
  478. #define SESSION4_BACK_CHAN 0x002
  479. #define SESSION4_RDMA 0x004
  480. #define SESSION4_FLAG_MASK_A 0x007
  481. enum state_protect_how4 {
  482. SP4_NONE = 0,
  483. SP4_MACH_CRED = 1,
  484. SP4_SSV = 2
  485. };
  486. enum pnfs_layouttype {
  487. LAYOUT_NFSV4_1_FILES = 1,
  488. LAYOUT_OSD2_OBJECTS = 2,
  489. LAYOUT_BLOCK_VOLUME = 3,
  490. LAYOUT_FLEX_FILES = 4,
  491. LAYOUT_TYPE_MAX
  492. };
  493. /* used for both layout return and recall */
  494. enum pnfs_layoutreturn_type {
  495. RETURN_FILE = 1,
  496. RETURN_FSID = 2,
  497. RETURN_ALL = 3
  498. };
  499. enum pnfs_iomode {
  500. IOMODE_READ = 1,
  501. IOMODE_RW = 2,
  502. IOMODE_ANY = 3,
  503. };
  504. enum pnfs_notify_deviceid_type4 {
  505. NOTIFY_DEVICEID4_CHANGE = 1 << 1,
  506. NOTIFY_DEVICEID4_DELETE = 1 << 2,
  507. };
  508. enum pnfs_block_volume_type {
  509. PNFS_BLOCK_VOLUME_SIMPLE = 0,
  510. PNFS_BLOCK_VOLUME_SLICE = 1,
  511. PNFS_BLOCK_VOLUME_CONCAT = 2,
  512. PNFS_BLOCK_VOLUME_STRIPE = 3,
  513. };
  514. enum pnfs_block_extent_state {
  515. PNFS_BLOCK_READWRITE_DATA = 0,
  516. PNFS_BLOCK_READ_DATA = 1,
  517. PNFS_BLOCK_INVALID_DATA = 2,
  518. PNFS_BLOCK_NONE_DATA = 3,
  519. };
  520. /* on the wire size of a block layout extent */
  521. #define PNFS_BLOCK_EXTENT_SIZE \
  522. (7 * sizeof(__be32) + NFS4_DEVICEID4_SIZE)
  523. #define NFL4_UFLG_MASK 0x0000003F
  524. #define NFL4_UFLG_DENSE 0x00000001
  525. #define NFL4_UFLG_COMMIT_THRU_MDS 0x00000002
  526. #define NFL4_UFLG_STRIPE_UNIT_SIZE_MASK 0xFFFFFFC0
  527. /* Encoded in the loh_body field of type layouthint4 */
  528. enum filelayout_hint_care4 {
  529. NFLH4_CARE_DENSE = NFL4_UFLG_DENSE,
  530. NFLH4_CARE_COMMIT_THRU_MDS = NFL4_UFLG_COMMIT_THRU_MDS,
  531. NFLH4_CARE_STRIPE_UNIT_SIZE = 0x00000040,
  532. NFLH4_CARE_STRIPE_COUNT = 0x00000080
  533. };
  534. #define NFS4_DEVICEID4_SIZE 16
  535. struct nfs4_deviceid {
  536. char data[NFS4_DEVICEID4_SIZE];
  537. };
  538. enum data_content4 {
  539. NFS4_CONTENT_DATA = 0,
  540. NFS4_CONTENT_HOLE = 1,
  541. };
  542. #endif