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