4 * NFSv4 protocol definitions.
6 * Copyright (c) 2002 The Regents of the University of Michigan.
9 * Kendrick Smith <kmsmith@umich.edu>
10 * Andy Adamson <andros@umich.edu>
16 #include <linux/types.h>
17 #include <linux/list.h>
19 #define NFS4_VERIFIER_SIZE 8
20 #define NFS4_FHSIZE 128
21 #define NFS4_MAXPATHLEN PATH_MAX
22 #define NFS4_MAXNAMLEN NAME_MAX
24 #define NFS4_ACCESS_READ 0x0001
25 #define NFS4_ACCESS_LOOKUP 0x0002
26 #define NFS4_ACCESS_MODIFY 0x0004
27 #define NFS4_ACCESS_EXTEND 0x0008
28 #define NFS4_ACCESS_DELETE 0x0010
29 #define NFS4_ACCESS_EXECUTE 0x0020
31 #define NFS4_FH_PERISTENT 0x0000
32 #define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001
33 #define NFS4_FH_VOLATILE_ANY 0x0002
34 #define NFS4_FH_VOL_MIGRATION 0x0004
35 #define NFS4_FH_VOL_RENAME 0x0008
37 #define NFS4_OPEN_RESULT_CONFIRM 0x0002
39 #define NFS4_SHARE_ACCESS_READ 0x0001
40 #define NFS4_SHARE_ACCESS_WRITE 0x0002
41 #define NFS4_SHARE_ACCESS_BOTH 0x0003
42 #define NFS4_SHARE_DENY_READ 0x0001
43 #define NFS4_SHARE_DENY_WRITE 0x0002
44 #define NFS4_SHARE_DENY_BOTH 0x0003
46 #define NFS4_SET_TO_SERVER_TIME 0
47 #define NFS4_SET_TO_CLIENT_TIME 1
49 #define NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE 0
50 #define NFS4_ACE_ACCESS_DENIED_ACE_TYPE 1
51 #define NFS4_ACE_SYSTEM_AUDIT_ACE_TYPE 2
52 #define NFS4_ACE_SYSTEM_ALARM_ACE_TYPE 3
54 #define ACL4_SUPPORT_ALLOW_ACL 0x01
55 #define ACL4_SUPPORT_DENY_ACL 0x02
56 #define ACL4_SUPPORT_AUDIT_ACL 0x04
57 #define ACL4_SUPPORT_ALARM_ACL 0x08
59 #define NFS4_ACE_FILE_INHERIT_ACE 0x00000001
60 #define NFS4_ACE_DIRECTORY_INHERIT_ACE 0x00000002
61 #define NFS4_ACE_NO_PROPAGATE_INHERIT_ACE 0x00000004
62 #define NFS4_ACE_INHERIT_ONLY_ACE 0x00000008
63 #define NFS4_ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010
64 #define NFS4_ACE_FAILED_ACCESS_ACE_FLAG 0x00000020
65 #define NFS4_ACE_IDENTIFIER_GROUP 0x00000040
66 #define NFS4_ACE_OWNER 0x00000080
67 #define NFS4_ACE_GROUP 0x00000100
68 #define NFS4_ACE_EVERYONE 0x00000200
70 #define NFS4_ACE_READ_DATA 0x00000001
71 #define NFS4_ACE_LIST_DIRECTORY 0x00000001
72 #define NFS4_ACE_WRITE_DATA 0x00000002
73 #define NFS4_ACE_ADD_FILE 0x00000002
74 #define NFS4_ACE_APPEND_DATA 0x00000004
75 #define NFS4_ACE_ADD_SUBDIRECTORY 0x00000004
76 #define NFS4_ACE_READ_NAMED_ATTRS 0x00000008
77 #define NFS4_ACE_WRITE_NAMED_ATTRS 0x00000010
78 #define NFS4_ACE_EXECUTE 0x00000020
79 #define NFS4_ACE_DELETE_CHILD 0x00000040
80 #define NFS4_ACE_READ_ATTRIBUTES 0x00000080
81 #define NFS4_ACE_WRITE_ATTRIBUTES 0x00000100
82 #define NFS4_ACE_DELETE 0x00010000
83 #define NFS4_ACE_READ_ACL 0x00020000
84 #define NFS4_ACE_WRITE_ACL 0x00040000
85 #define NFS4_ACE_WRITE_OWNER 0x00080000
86 #define NFS4_ACE_SYNCHRONIZE 0x00100000
87 #define NFS4_ACE_GENERIC_READ 0x00120081
88 #define NFS4_ACE_GENERIC_WRITE 0x00160106
89 #define NFS4_ACE_GENERIC_EXECUTE 0x001200A0
90 #define NFS4_ACE_MASK_ALL 0x001F01FF
92 enum nfs4_acl_whotype
{
93 NFS4_ACL_WHO_NAMED
= 0,
96 NFS4_ACL_WHO_EVERYONE
,
102 uint32_t access_mask
;
105 struct list_head l_ace
;
110 struct list_head ace_head
;
113 typedef struct { char data
[NFS4_VERIFIER_SIZE
]; } nfs4_verifier
;
114 typedef struct { char data
[16]; } nfs4_stateid
;
134 OP_OPEN_CONFIRM
= 20,
135 OP_OPEN_DOWNGRADE
= 21,
150 OP_SETCLIENTID_CONFIRM
= 36,
153 OP_RELEASE_LOCKOWNER
= 39,
166 /* Unused/reserved 19 */
174 NFS4ERR_NAMETOOLONG
= 63,
175 NFS4ERR_NOTEMPTY
= 66,
178 NFS4ERR_BADHANDLE
= 10001,
179 NFS4ERR_BAD_COOKIE
= 10003,
180 NFS4ERR_NOTSUPP
= 10004,
181 NFS4ERR_TOOSMALL
= 10005,
182 NFS4ERR_SERVERFAULT
= 10006,
183 NFS4ERR_BADTYPE
= 10007,
184 NFS4ERR_DELAY
= 10008,
185 NFS4ERR_SAME
= 10009,
186 NFS4ERR_DENIED
= 10010,
187 NFS4ERR_EXPIRED
= 10011,
188 NFS4ERR_LOCKED
= 10012,
189 NFS4ERR_GRACE
= 10013,
190 NFS4ERR_FHEXPIRED
= 10014,
191 NFS4ERR_SHARE_DENIED
= 10015,
192 NFS4ERR_WRONGSEC
= 10016,
193 NFS4ERR_CLID_INUSE
= 10017,
194 NFS4ERR_RESOURCE
= 10018,
195 NFS4ERR_MOVED
= 10019,
196 NFS4ERR_NOFILEHANDLE
= 10020,
197 NFS4ERR_MINOR_VERS_MISMATCH
= 10021,
198 NFS4ERR_STALE_CLIENTID
= 10022,
199 NFS4ERR_STALE_STATEID
= 10023,
200 NFS4ERR_OLD_STATEID
= 10024,
201 NFS4ERR_BAD_STATEID
= 10025,
202 NFS4ERR_BAD_SEQID
= 10026,
203 NFS4ERR_NOT_SAME
= 10027,
204 NFS4ERR_LOCK_RANGE
= 10028,
205 NFS4ERR_SYMLINK
= 10029,
206 NFS4ERR_RESTOREFH
= 10030,
207 NFS4ERR_LEASE_MOVED
= 10031,
208 NFS4ERR_ATTRNOTSUPP
= 10032,
209 NFS4ERR_NO_GRACE
= 10033,
210 NFS4ERR_RECLAIM_BAD
= 10034,
211 NFS4ERR_RECLAIM_CONFLICT
= 10035,
212 NFS4ERR_BADXDR
= 10036,
213 NFS4ERR_LOCKS_HELD
= 10037,
214 NFS4ERR_OPENMODE
= 10038,
215 NFS4ERR_BADOWNER
= 10039,
216 NFS4ERR_BADCHAR
= 10040,
217 NFS4ERR_BADNAME
= 10041,
218 NFS4ERR_BAD_RANGE
= 10042,
219 NFS4ERR_LOCK_NOTSUPP
= 10043,
220 NFS4ERR_OP_ILLEGAL
= 10044,
221 NFS4ERR_DEADLOCK
= 10045,
222 NFS4ERR_FILE_OPEN
= 10046,
223 NFS4ERR_ADMIN_REVOKED
= 10047,
224 NFS4ERR_CB_PATH_DOWN
= 10048
228 * Note: NF4BAD is not actually part of the protocol; it is just used
229 * internally by nfsd.
233 NF4REG
= 1, /* Regular File */
234 NF4DIR
= 2, /* Directory */
235 NF4BLK
= 3, /* Special File - block device */
236 NF4CHR
= 4, /* Special File - character device */
237 NF4LNK
= 5, /* Symbolic Link */
238 NF4SOCK
= 6, /* Special File - socket */
239 NF4FIFO
= 7, /* Special File - fifo */
240 NF4ATTRDIR
= 8, /* Attribute Directory */
241 NF4NAMEDATTR
= 9 /* Named Attribute */
244 enum open_claim_type4
{
245 NFS4_OPEN_CLAIM_NULL
= 0,
246 NFS4_OPEN_CLAIM_PREVIOUS
= 1,
247 NFS4_OPEN_CLAIM_DELEGATE_CUR
= 2,
248 NFS4_OPEN_CLAIM_DELEGATE_PREV
= 3
252 NFS4_OPEN_NOCREATE
= 0,
257 NFS4_CREATE_UNCHECKED
= 0,
258 NFS4_CREATE_GUARDED
= 1,
259 NFS4_CREATE_EXCLUSIVE
= 2
264 NFS4_LIMIT_BLOCKS
= 2
267 enum open_delegation_type4
{
268 NFS4_OPEN_DELEGATE_NONE
= 0,
269 NFS4_OPEN_DELEGATE_READ
= 1,
270 NFS4_OPEN_DELEGATE_WRITE
= 2
282 /* Mandatory Attributes */
283 #define FATTR4_WORD0_SUPPORTED_ATTRS (1UL << 0)
284 #define FATTR4_WORD0_TYPE (1UL << 1)
285 #define FATTR4_WORD0_FH_EXPIRE_TYPE (1UL << 2)
286 #define FATTR4_WORD0_CHANGE (1UL << 3)
287 #define FATTR4_WORD0_SIZE (1UL << 4)
288 #define FATTR4_WORD0_LINK_SUPPORT (1UL << 5)
289 #define FATTR4_WORD0_SYMLINK_SUPPORT (1UL << 6)
290 #define FATTR4_WORD0_NAMED_ATTR (1UL << 7)
291 #define FATTR4_WORD0_FSID (1UL << 8)
292 #define FATTR4_WORD0_UNIQUE_HANDLES (1UL << 9)
293 #define FATTR4_WORD0_LEASE_TIME (1UL << 10)
294 #define FATTR4_WORD0_RDATTR_ERROR (1UL << 11)
296 /* Recommended Attributes */
297 #define FATTR4_WORD0_ACL (1UL << 12)
298 #define FATTR4_WORD0_ACLSUPPORT (1UL << 13)
299 #define FATTR4_WORD0_ARCHIVE (1UL << 14)
300 #define FATTR4_WORD0_CANSETTIME (1UL << 15)
301 #define FATTR4_WORD0_CASE_INSENSITIVE (1UL << 16)
302 #define FATTR4_WORD0_CASE_PRESERVING (1UL << 17)
303 #define FATTR4_WORD0_CHOWN_RESTRICTED (1UL << 18)
304 #define FATTR4_WORD0_FILEHANDLE (1UL << 19)
305 #define FATTR4_WORD0_FILEID (1UL << 20)
306 #define FATTR4_WORD0_FILES_AVAIL (1UL << 21)
307 #define FATTR4_WORD0_FILES_FREE (1UL << 22)
308 #define FATTR4_WORD0_FILES_TOTAL (1UL << 23)
309 #define FATTR4_WORD0_FS_LOCATIONS (1UL << 24)
310 #define FATTR4_WORD0_HIDDEN (1UL << 25)
311 #define FATTR4_WORD0_HOMOGENEOUS (1UL << 26)
312 #define FATTR4_WORD0_MAXFILESIZE (1UL << 27)
313 #define FATTR4_WORD0_MAXLINK (1UL << 28)
314 #define FATTR4_WORD0_MAXNAME (1UL << 29)
315 #define FATTR4_WORD0_MAXREAD (1UL << 30)
316 #define FATTR4_WORD0_MAXWRITE (1UL << 31)
317 #define FATTR4_WORD1_MIMETYPE (1UL << 0)
318 #define FATTR4_WORD1_MODE (1UL << 1)
319 #define FATTR4_WORD1_NO_TRUNC (1UL << 2)
320 #define FATTR4_WORD1_NUMLINKS (1UL << 3)
321 #define FATTR4_WORD1_OWNER (1UL << 4)
322 #define FATTR4_WORD1_OWNER_GROUP (1UL << 5)
323 #define FATTR4_WORD1_QUOTA_HARD (1UL << 6)
324 #define FATTR4_WORD1_QUOTA_SOFT (1UL << 7)
325 #define FATTR4_WORD1_QUOTA_USED (1UL << 8)
326 #define FATTR4_WORD1_RAWDEV (1UL << 9)
327 #define FATTR4_WORD1_SPACE_AVAIL (1UL << 10)
328 #define FATTR4_WORD1_SPACE_FREE (1UL << 11)
329 #define FATTR4_WORD1_SPACE_TOTAL (1UL << 12)
330 #define FATTR4_WORD1_SPACE_USED (1UL << 13)
331 #define FATTR4_WORD1_SYSTEM (1UL << 14)
332 #define FATTR4_WORD1_TIME_ACCESS (1UL << 15)
333 #define FATTR4_WORD1_TIME_ACCESS_SET (1UL << 16)
334 #define FATTR4_WORD1_TIME_BACKUP (1UL << 17)
335 #define FATTR4_WORD1_TIME_CREATE (1UL << 18)
336 #define FATTR4_WORD1_TIME_DELTA (1UL << 19)
337 #define FATTR4_WORD1_TIME_METADATA (1UL << 20)
338 #define FATTR4_WORD1_TIME_MODIFY (1UL << 21)
339 #define FATTR4_WORD1_TIME_MODIFY_SET (1UL << 22)
340 #define FATTR4_WORD1_MOUNTED_ON_FILEID (1UL << 23)
342 #define NFSPROC4_NULL 0
343 #define NFSPROC4_COMPOUND 1
344 #define NFS4_MINOR_VERSION 0
349 /* Index of predefined Linux client operations */
352 NFSPROC4_CLNT_NULL
= 0, /* Unused */
355 NFSPROC4_CLNT_COMMIT
,
357 NFSPROC4_CLNT_OPEN_CONFIRM
,
358 NFSPROC4_CLNT_OPEN_NOATTR
,
359 NFSPROC4_CLNT_OPEN_DOWNGRADE
,
361 NFSPROC4_CLNT_SETATTR
,
362 NFSPROC4_CLNT_FSINFO
,
364 NFSPROC4_CLNT_SETCLIENTID
,
365 NFSPROC4_CLNT_SETCLIENTID_CONFIRM
,
369 NFSPROC4_CLNT_ACCESS
,
370 NFSPROC4_CLNT_GETATTR
,
371 NFSPROC4_CLNT_LOOKUP
,
372 NFSPROC4_CLNT_LOOKUP_ROOT
,
373 NFSPROC4_CLNT_REMOVE
,
374 NFSPROC4_CLNT_RENAME
,
376 NFSPROC4_CLNT_SYMLINK
,
377 NFSPROC4_CLNT_CREATE
,
378 NFSPROC4_CLNT_PATHCONF
,
379 NFSPROC4_CLNT_STATFS
,
380 NFSPROC4_CLNT_READLINK
,
381 NFSPROC4_CLNT_READDIR
,
382 NFSPROC4_CLNT_SERVER_CAPS
,
383 NFSPROC4_CLNT_DELEGRETURN
,