[SK_BUFF]: Use the helpers to get the layer header pointer
[linux-2.6/mini2440.git] / include / linux / nfs4.h
blob1be5be88debe77c5e51aed74ef77fb8697974b5f
1 /*
2 * include/linux/nfs4.h
4 * NFSv4 protocol definitions.
6 * Copyright (c) 2002 The Regents of the University of Michigan.
7 * All rights reserved.
9 * Kendrick Smith <kmsmith@umich.edu>
10 * Andy Adamson <andros@umich.edu>
13 #ifndef _LINUX_NFS4_H
14 #define _LINUX_NFS4_H
16 #include <linux/types.h>
18 #define NFS4_VERIFIER_SIZE 8
19 #define NFS4_FHSIZE 128
20 #define NFS4_MAXPATHLEN PATH_MAX
21 #define NFS4_MAXNAMLEN NAME_MAX
23 #define NFS4_ACCESS_READ 0x0001
24 #define NFS4_ACCESS_LOOKUP 0x0002
25 #define NFS4_ACCESS_MODIFY 0x0004
26 #define NFS4_ACCESS_EXTEND 0x0008
27 #define NFS4_ACCESS_DELETE 0x0010
28 #define NFS4_ACCESS_EXECUTE 0x0020
30 #define NFS4_FH_PERSISTENT 0x0000
31 #define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001
32 #define NFS4_FH_VOLATILE_ANY 0x0002
33 #define NFS4_FH_VOL_MIGRATION 0x0004
34 #define NFS4_FH_VOL_RENAME 0x0008
36 #define NFS4_OPEN_RESULT_CONFIRM 0x0002
37 #define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004
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,
94 NFS4_ACL_WHO_OWNER,
95 NFS4_ACL_WHO_GROUP,
96 NFS4_ACL_WHO_EVERYONE,
99 #ifdef __KERNEL__
100 #include <linux/list.h>
102 struct nfs4_ace {
103 uint32_t type;
104 uint32_t flag;
105 uint32_t access_mask;
106 int whotype;
107 uid_t who;
110 struct nfs4_acl {
111 uint32_t naces;
112 struct nfs4_ace aces[0];
115 typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier;
116 typedef struct { char data[16]; } nfs4_stateid;
118 enum nfs_opnum4 {
119 OP_ACCESS = 3,
120 OP_CLOSE = 4,
121 OP_COMMIT = 5,
122 OP_CREATE = 6,
123 OP_DELEGPURGE = 7,
124 OP_DELEGRETURN = 8,
125 OP_GETATTR = 9,
126 OP_GETFH = 10,
127 OP_LINK = 11,
128 OP_LOCK = 12,
129 OP_LOCKT = 13,
130 OP_LOCKU = 14,
131 OP_LOOKUP = 15,
132 OP_LOOKUPP = 16,
133 OP_NVERIFY = 17,
134 OP_OPEN = 18,
135 OP_OPENATTR = 19,
136 OP_OPEN_CONFIRM = 20,
137 OP_OPEN_DOWNGRADE = 21,
138 OP_PUTFH = 22,
139 OP_PUTPUBFH = 23,
140 OP_PUTROOTFH = 24,
141 OP_READ = 25,
142 OP_READDIR = 26,
143 OP_READLINK = 27,
144 OP_REMOVE = 28,
145 OP_RENAME = 29,
146 OP_RENEW = 30,
147 OP_RESTOREFH = 31,
148 OP_SAVEFH = 32,
149 OP_SECINFO = 33,
150 OP_SETATTR = 34,
151 OP_SETCLIENTID = 35,
152 OP_SETCLIENTID_CONFIRM = 36,
153 OP_VERIFY = 37,
154 OP_WRITE = 38,
155 OP_RELEASE_LOCKOWNER = 39,
156 OP_ILLEGAL = 10044,
159 /*Defining first and last NFS4 operations implemented.
160 Needs to be updated if more operations are defined in future.*/
162 #define FIRST_NFS4_OP OP_ACCESS
163 #define LAST_NFS4_OP OP_RELEASE_LOCKOWNER
165 enum nfsstat4 {
166 NFS4_OK = 0,
167 NFS4ERR_PERM = 1,
168 NFS4ERR_NOENT = 2,
169 NFS4ERR_IO = 5,
170 NFS4ERR_NXIO = 6,
171 NFS4ERR_ACCESS = 13,
172 NFS4ERR_EXIST = 17,
173 NFS4ERR_XDEV = 18,
174 /* Unused/reserved 19 */
175 NFS4ERR_NOTDIR = 20,
176 NFS4ERR_ISDIR = 21,
177 NFS4ERR_INVAL = 22,
178 NFS4ERR_FBIG = 27,
179 NFS4ERR_NOSPC = 28,
180 NFS4ERR_ROFS = 30,
181 NFS4ERR_MLINK = 31,
182 NFS4ERR_NAMETOOLONG = 63,
183 NFS4ERR_NOTEMPTY = 66,
184 NFS4ERR_DQUOT = 69,
185 NFS4ERR_STALE = 70,
186 NFS4ERR_BADHANDLE = 10001,
187 NFS4ERR_BAD_COOKIE = 10003,
188 NFS4ERR_NOTSUPP = 10004,
189 NFS4ERR_TOOSMALL = 10005,
190 NFS4ERR_SERVERFAULT = 10006,
191 NFS4ERR_BADTYPE = 10007,
192 NFS4ERR_DELAY = 10008,
193 NFS4ERR_SAME = 10009,
194 NFS4ERR_DENIED = 10010,
195 NFS4ERR_EXPIRED = 10011,
196 NFS4ERR_LOCKED = 10012,
197 NFS4ERR_GRACE = 10013,
198 NFS4ERR_FHEXPIRED = 10014,
199 NFS4ERR_SHARE_DENIED = 10015,
200 NFS4ERR_WRONGSEC = 10016,
201 NFS4ERR_CLID_INUSE = 10017,
202 NFS4ERR_RESOURCE = 10018,
203 NFS4ERR_MOVED = 10019,
204 NFS4ERR_NOFILEHANDLE = 10020,
205 NFS4ERR_MINOR_VERS_MISMATCH = 10021,
206 NFS4ERR_STALE_CLIENTID = 10022,
207 NFS4ERR_STALE_STATEID = 10023,
208 NFS4ERR_OLD_STATEID = 10024,
209 NFS4ERR_BAD_STATEID = 10025,
210 NFS4ERR_BAD_SEQID = 10026,
211 NFS4ERR_NOT_SAME = 10027,
212 NFS4ERR_LOCK_RANGE = 10028,
213 NFS4ERR_SYMLINK = 10029,
214 NFS4ERR_RESTOREFH = 10030,
215 NFS4ERR_LEASE_MOVED = 10031,
216 NFS4ERR_ATTRNOTSUPP = 10032,
217 NFS4ERR_NO_GRACE = 10033,
218 NFS4ERR_RECLAIM_BAD = 10034,
219 NFS4ERR_RECLAIM_CONFLICT = 10035,
220 NFS4ERR_BADXDR = 10036,
221 NFS4ERR_LOCKS_HELD = 10037,
222 NFS4ERR_OPENMODE = 10038,
223 NFS4ERR_BADOWNER = 10039,
224 NFS4ERR_BADCHAR = 10040,
225 NFS4ERR_BADNAME = 10041,
226 NFS4ERR_BAD_RANGE = 10042,
227 NFS4ERR_LOCK_NOTSUPP = 10043,
228 NFS4ERR_OP_ILLEGAL = 10044,
229 NFS4ERR_DEADLOCK = 10045,
230 NFS4ERR_FILE_OPEN = 10046,
231 NFS4ERR_ADMIN_REVOKED = 10047,
232 NFS4ERR_CB_PATH_DOWN = 10048
236 * Note: NF4BAD is not actually part of the protocol; it is just used
237 * internally by nfsd.
239 enum nfs_ftype4 {
240 NF4BAD = 0,
241 NF4REG = 1, /* Regular File */
242 NF4DIR = 2, /* Directory */
243 NF4BLK = 3, /* Special File - block device */
244 NF4CHR = 4, /* Special File - character device */
245 NF4LNK = 5, /* Symbolic Link */
246 NF4SOCK = 6, /* Special File - socket */
247 NF4FIFO = 7, /* Special File - fifo */
248 NF4ATTRDIR = 8, /* Attribute Directory */
249 NF4NAMEDATTR = 9 /* Named Attribute */
252 enum open_claim_type4 {
253 NFS4_OPEN_CLAIM_NULL = 0,
254 NFS4_OPEN_CLAIM_PREVIOUS = 1,
255 NFS4_OPEN_CLAIM_DELEGATE_CUR = 2,
256 NFS4_OPEN_CLAIM_DELEGATE_PREV = 3
259 enum opentype4 {
260 NFS4_OPEN_NOCREATE = 0,
261 NFS4_OPEN_CREATE = 1
264 enum createmode4 {
265 NFS4_CREATE_UNCHECKED = 0,
266 NFS4_CREATE_GUARDED = 1,
267 NFS4_CREATE_EXCLUSIVE = 2
270 enum limit_by4 {
271 NFS4_LIMIT_SIZE = 1,
272 NFS4_LIMIT_BLOCKS = 2
275 enum open_delegation_type4 {
276 NFS4_OPEN_DELEGATE_NONE = 0,
277 NFS4_OPEN_DELEGATE_READ = 1,
278 NFS4_OPEN_DELEGATE_WRITE = 2
281 enum lock_type4 {
282 NFS4_UNLOCK_LT = 0,
283 NFS4_READ_LT = 1,
284 NFS4_WRITE_LT = 2,
285 NFS4_READW_LT = 3,
286 NFS4_WRITEW_LT = 4
290 /* Mandatory Attributes */
291 #define FATTR4_WORD0_SUPPORTED_ATTRS (1UL << 0)
292 #define FATTR4_WORD0_TYPE (1UL << 1)
293 #define FATTR4_WORD0_FH_EXPIRE_TYPE (1UL << 2)
294 #define FATTR4_WORD0_CHANGE (1UL << 3)
295 #define FATTR4_WORD0_SIZE (1UL << 4)
296 #define FATTR4_WORD0_LINK_SUPPORT (1UL << 5)
297 #define FATTR4_WORD0_SYMLINK_SUPPORT (1UL << 6)
298 #define FATTR4_WORD0_NAMED_ATTR (1UL << 7)
299 #define FATTR4_WORD0_FSID (1UL << 8)
300 #define FATTR4_WORD0_UNIQUE_HANDLES (1UL << 9)
301 #define FATTR4_WORD0_LEASE_TIME (1UL << 10)
302 #define FATTR4_WORD0_RDATTR_ERROR (1UL << 11)
304 /* Recommended Attributes */
305 #define FATTR4_WORD0_ACL (1UL << 12)
306 #define FATTR4_WORD0_ACLSUPPORT (1UL << 13)
307 #define FATTR4_WORD0_ARCHIVE (1UL << 14)
308 #define FATTR4_WORD0_CANSETTIME (1UL << 15)
309 #define FATTR4_WORD0_CASE_INSENSITIVE (1UL << 16)
310 #define FATTR4_WORD0_CASE_PRESERVING (1UL << 17)
311 #define FATTR4_WORD0_CHOWN_RESTRICTED (1UL << 18)
312 #define FATTR4_WORD0_FILEHANDLE (1UL << 19)
313 #define FATTR4_WORD0_FILEID (1UL << 20)
314 #define FATTR4_WORD0_FILES_AVAIL (1UL << 21)
315 #define FATTR4_WORD0_FILES_FREE (1UL << 22)
316 #define FATTR4_WORD0_FILES_TOTAL (1UL << 23)
317 #define FATTR4_WORD0_FS_LOCATIONS (1UL << 24)
318 #define FATTR4_WORD0_HIDDEN (1UL << 25)
319 #define FATTR4_WORD0_HOMOGENEOUS (1UL << 26)
320 #define FATTR4_WORD0_MAXFILESIZE (1UL << 27)
321 #define FATTR4_WORD0_MAXLINK (1UL << 28)
322 #define FATTR4_WORD0_MAXNAME (1UL << 29)
323 #define FATTR4_WORD0_MAXREAD (1UL << 30)
324 #define FATTR4_WORD0_MAXWRITE (1UL << 31)
325 #define FATTR4_WORD1_MIMETYPE (1UL << 0)
326 #define FATTR4_WORD1_MODE (1UL << 1)
327 #define FATTR4_WORD1_NO_TRUNC (1UL << 2)
328 #define FATTR4_WORD1_NUMLINKS (1UL << 3)
329 #define FATTR4_WORD1_OWNER (1UL << 4)
330 #define FATTR4_WORD1_OWNER_GROUP (1UL << 5)
331 #define FATTR4_WORD1_QUOTA_HARD (1UL << 6)
332 #define FATTR4_WORD1_QUOTA_SOFT (1UL << 7)
333 #define FATTR4_WORD1_QUOTA_USED (1UL << 8)
334 #define FATTR4_WORD1_RAWDEV (1UL << 9)
335 #define FATTR4_WORD1_SPACE_AVAIL (1UL << 10)
336 #define FATTR4_WORD1_SPACE_FREE (1UL << 11)
337 #define FATTR4_WORD1_SPACE_TOTAL (1UL << 12)
338 #define FATTR4_WORD1_SPACE_USED (1UL << 13)
339 #define FATTR4_WORD1_SYSTEM (1UL << 14)
340 #define FATTR4_WORD1_TIME_ACCESS (1UL << 15)
341 #define FATTR4_WORD1_TIME_ACCESS_SET (1UL << 16)
342 #define FATTR4_WORD1_TIME_BACKUP (1UL << 17)
343 #define FATTR4_WORD1_TIME_CREATE (1UL << 18)
344 #define FATTR4_WORD1_TIME_DELTA (1UL << 19)
345 #define FATTR4_WORD1_TIME_METADATA (1UL << 20)
346 #define FATTR4_WORD1_TIME_MODIFY (1UL << 21)
347 #define FATTR4_WORD1_TIME_MODIFY_SET (1UL << 22)
348 #define FATTR4_WORD1_MOUNTED_ON_FILEID (1UL << 23)
350 #define NFSPROC4_NULL 0
351 #define NFSPROC4_COMPOUND 1
352 #define NFS4_MINOR_VERSION 0
353 #define NFS4_DEBUG 1
355 /* Index of predefined Linux client operations */
357 enum {
358 NFSPROC4_CLNT_NULL = 0, /* Unused */
359 NFSPROC4_CLNT_READ,
360 NFSPROC4_CLNT_WRITE,
361 NFSPROC4_CLNT_COMMIT,
362 NFSPROC4_CLNT_OPEN,
363 NFSPROC4_CLNT_OPEN_CONFIRM,
364 NFSPROC4_CLNT_OPEN_NOATTR,
365 NFSPROC4_CLNT_OPEN_DOWNGRADE,
366 NFSPROC4_CLNT_CLOSE,
367 NFSPROC4_CLNT_SETATTR,
368 NFSPROC4_CLNT_FSINFO,
369 NFSPROC4_CLNT_RENEW,
370 NFSPROC4_CLNT_SETCLIENTID,
371 NFSPROC4_CLNT_SETCLIENTID_CONFIRM,
372 NFSPROC4_CLNT_LOCK,
373 NFSPROC4_CLNT_LOCKT,
374 NFSPROC4_CLNT_LOCKU,
375 NFSPROC4_CLNT_ACCESS,
376 NFSPROC4_CLNT_GETATTR,
377 NFSPROC4_CLNT_LOOKUP,
378 NFSPROC4_CLNT_LOOKUP_ROOT,
379 NFSPROC4_CLNT_REMOVE,
380 NFSPROC4_CLNT_RENAME,
381 NFSPROC4_CLNT_LINK,
382 NFSPROC4_CLNT_SYMLINK,
383 NFSPROC4_CLNT_CREATE,
384 NFSPROC4_CLNT_PATHCONF,
385 NFSPROC4_CLNT_STATFS,
386 NFSPROC4_CLNT_READLINK,
387 NFSPROC4_CLNT_READDIR,
388 NFSPROC4_CLNT_SERVER_CAPS,
389 NFSPROC4_CLNT_DELEGRETURN,
390 NFSPROC4_CLNT_GETACL,
391 NFSPROC4_CLNT_SETACL,
392 NFSPROC4_CLNT_FS_LOCATIONS,
395 #endif
396 #endif
399 * Local variables:
400 * c-basic-offset: 8
401 * End: