ReactOS  0.4.11-dev-946-g431643b
nfs41_const.h
Go to the documentation of this file.
1 /* NFSv4.1 client for Windows
2  * Copyright 2012 The Regents of the University of Michigan
3  *
4  * Olga Kornievskaia <aglo@umich.edu>
5  * Casey Bodley <cbodley@umich.edu>
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation; either version 2.1 of the License, or (at
10  * your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * without any warranty; without even the implied warranty of merchantability
14  * or fitness for a particular purpose. See the GNU Lesser General Public
15  * License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  */
21 
22 #ifndef __NFS41_NFS_CONST_H__
23 #define __NFS41_NFS_CONST_H__
24 
25 
26 /*
27  * Sizes
28  */
29 #define NFS4_FHSIZE 128
30 #define NFS4_VERIFIER_SIZE 8
31 #define NFS4_OPAQUE_LIMIT 1024
32 #define NFS4_SESSIONID_SIZE 16
33 #define NFS4_STATEID_OTHER 12
34 #define NFS4_EASIZE 256
35 #define NFS4_EANAME_SIZE 128
36 
37 
38 #define NFS41_MAX_FILEIO_SIZE (1024 * 1024)
39 #define NFS41_MAX_SERVER_CACHE 1024
40 #define NFS41_MAX_RPC_REQS 128
41 
42 #define UPCALL_BUF_SIZE 2048
43 
44 /* MaximumComponentNameLength reported for FileFsAttributeInformation */
45 #define NFS41_MAX_COMPONENT_LEN 256
46 #define NFS41_MAX_PATH_LEN 1280
47 
48 #define NFS41_HOSTNAME_LEN 64
49 #define NFS41_ADDRS_PER_SERVER 4
50 
51 /* max length of ipv6 address 48
52  * sizeof(".255.255") + 8 */
53 #define NFS41_UNIVERSAL_ADDR_LEN 56
54 
55 /* "udp" "tcp" "udp6" "tcp6" */
56 #define NFS41_NETWORK_ID_LEN 4
57 
58 /* msdn: There is a maximum of 31 reparse points (and
59  * therefore symbolic links) allowed in a particular path. */
60 #define NFS41_MAX_SYMLINK_DEPTH 31
61 
62 
63 /* 424 bytes: max rpc header for reply with data */
64 /* 32 bytes: max COMPOUND response */
65 /* 40 bytes: max SEQUENCE response */
66 /* 4 bytes: max PUTFH response */
67 /* 12 bytes: max READ response */
68 #define READ_OVERHEAD 512
69 
70 /* 840 bytes: max rpc header for call */
71 /* 32 bytes: max COMPOUND request */
72 /* 32 bytes: max SEQUENCE request */
73 /* 132 bytes: max PUTFH request */
74 /* 32 bytes: max WRITE request */
75 #define WRITE_OVERHEAD 1068
76 
77 
78 #define NFS41_RPC_PROGRAM 100003
79 #define NFS41_RPC_VERSION 4
80 #define NFS41_RPC_CBPROGRAM 0x2358
81 
82 
83 /*
84  * Error status
85  */
86 enum nfsstat4 {
87  NFS4_OK = 0, /* everything is okay */
88  NFS4ERR_PERM = 1, /* caller not privileged */
89  NFS4ERR_NOENT = 2, /* no such file/directory */
90  NFS4ERR_IO = 5, /* hard I/O error */
91  NFS4ERR_NXIO = 6, /* no such device */
92  NFS4ERR_ACCESS = 13, /* access denied */
93  NFS4ERR_EXIST = 17, /* file already exists */
94  NFS4ERR_XDEV = 18, /* different filesystems */
95 
96  NFS4ERR_NOTDIR = 20, /* should be a directory */
97  NFS4ERR_ISDIR = 21, /* should not be directory */
98  NFS4ERR_INVAL = 22, /* invalid argument */
99  NFS4ERR_FBIG = 27, /* file exceeds server max */
100  NFS4ERR_NOSPC = 28, /* no space on filesystem */
101  NFS4ERR_ROFS = 30, /* read-only filesystem */
102  NFS4ERR_MLINK = 31, /* too many hard links */
103  NFS4ERR_NAMETOOLONG = 63, /* name exceeds server max */
104  NFS4ERR_NOTEMPTY = 66, /* directory not empty */
105  NFS4ERR_DQUOT = 69, /* hard quota limit reached*/
106  NFS4ERR_STALE = 70, /* file no longer exists */
107  NFS4ERR_BADHANDLE = 10001, /* Illegal filehandle */
108  NFS4ERR_BAD_COOKIE = 10003, /* READDIR cookie is stale */
109  NFS4ERR_NOTSUPP = 10004, /* operation not supported */
110  NFS4ERR_TOOSMALL = 10005, /* response limit exceeded */
111  NFS4ERR_SERVERFAULT = 10006, /* undefined server error */
112  NFS4ERR_BADTYPE = 10007, /* type invalid for CREATE */
113  NFS4ERR_DELAY = 10008, /* file "busy" - retry */
114  NFS4ERR_SAME = 10009, /* nverify says attrs same */
115  NFS4ERR_DENIED = 10010, /* lock unavailable */
116  NFS4ERR_EXPIRED = 10011, /* lock lease expired */
117  NFS4ERR_LOCKED = 10012, /* I/O failed due to lock */
118  NFS4ERR_GRACE = 10013, /* in grace period */
119  NFS4ERR_FHEXPIRED = 10014, /* filehandle expired */
120  NFS4ERR_SHARE_DENIED = 10015, /* share reserve denied */
121  NFS4ERR_WRONGSEC = 10016, /* wrong security flavor */
122  NFS4ERR_CLID_INUSE = 10017, /* clientid in use */
123 
124  /* NFS4ERR_RESOURCE is not a valid error in NFSv4.1 */
125  NFS4ERR_RESOURCE = 10018, /* resource exhaustion */
126  NFS4ERR_MOVED = 10019, /* filesystem relocated */
127  NFS4ERR_NOFILEHANDLE = 10020, /* current FH is not set */
128  NFS4ERR_MINOR_VERS_MISMATCH = 10021, /* minor vers not supp */
129  NFS4ERR_STALE_CLIENTID = 10022, /* server has rebooted */
130  NFS4ERR_STALE_STATEID = 10023, /* server has rebooted */
131  NFS4ERR_OLD_STATEID = 10024, /* state is out of sync */
132  NFS4ERR_BAD_STATEID = 10025, /* incorrect stateid */
133  NFS4ERR_BAD_SEQID = 10026, /* request is out of seq. */
134  NFS4ERR_NOT_SAME = 10027, /* verify - attrs not same */
135  NFS4ERR_LOCK_RANGE = 10028, /* overlapping lock range */
136  NFS4ERR_SYMLINK = 10029, /* should be file/directory*/
137  NFS4ERR_RESTOREFH = 10030, /* no saved filehandle */
138  NFS4ERR_LEASE_MOVED = 10031, /* some filesystem moved */
139  NFS4ERR_ATTRNOTSUPP = 10032, /* recommended attr not sup*/
140  NFS4ERR_NO_GRACE = 10033, /* reclaim outside of grace*/
141  NFS4ERR_RECLAIM_BAD = 10034, /* reclaim error at server */
142  NFS4ERR_RECLAIM_CONFLICT = 10035, /* conflict on reclaim */
143  NFS4ERR_BADXDR = 10036, /* XDR decode failed */
144  NFS4ERR_LOCKS_HELD = 10037, /* file locks held at CLOSE*/
145  NFS4ERR_OPENMODE = 10038, /* conflict in OPEN and I/O*/
146  NFS4ERR_BADOWNER = 10039, /* owner translation bad */
147  NFS4ERR_BADCHAR = 10040, /* utf-8 char not supported*/
148  NFS4ERR_BADNAME = 10041, /* name not supported */
149  NFS4ERR_BAD_RANGE = 10042, /* lock range not supported*/
150  NFS4ERR_LOCK_NOTSUPP = 10043, /* no atomic up/downgrade */
151  NFS4ERR_OP_ILLEGAL = 10044, /* undefined operation */
152  NFS4ERR_DEADLOCK = 10045, /* file locking deadlock */
153  NFS4ERR_FILE_OPEN = 10046, /* open file blocks op. */
154  NFS4ERR_ADMIN_REVOKED = 10047, /* lockowner state revoked */
155  NFS4ERR_CB_PATH_DOWN = 10048, /* callback path down */
156 
157  /* NFSv4.1 errors start here. */
166  NFS4ERR_BACK_CHAN_BUSY = 10057, /*backchan reqs outstanding*/
172  NFS4ERR_SEQ_MISORDERED = 10063, /* unexpected seq.ID in req*/
173  NFS4ERR_SEQUENCE_POS = 10064, /* [CB_]SEQ. op not 1st op */
174  NFS4ERR_REQ_TOO_BIG = 10065, /* request too big */
175  NFS4ERR_REP_TOO_BIG = 10066, /* reply too big */
176  NFS4ERR_REP_TOO_BIG_TO_CACHE = 10067, /* rep. not all cached */
177  NFS4ERR_RETRY_UNCACHED_REP = 10068, /* retry & rep. uncached */
178  NFS4ERR_UNSAFE_COMPOUND = 10069, /* retry/recovery too hard */
179  NFS4ERR_TOO_MANY_OPS = 10070, /*too many ops in [CB_]COMP*/
180  NFS4ERR_OP_NOT_IN_SESSION = 10071, /* op needs [CB_]SEQ. op */
181  NFS4ERR_HASH_ALG_UNSUPP = 10072, /* hash alg. not supp. */
182  /* Error 10073 is unused. */
183  NFS4ERR_CLIENTID_BUSY = 10074, /* clientid has state */
184  NFS4ERR_PNFS_IO_HOLE = 10075, /* IO to _SPARSE file hole */
185  NFS4ERR_SEQ_FALSE_RETRY = 10076, /* Retry != original req. */
186  NFS4ERR_BAD_HIGH_SLOT = 10077, /* req has bad highest_slot*/
187  NFS4ERR_DEADSESSION = 10078, /*new req sent to dead sess*/
188  NFS4ERR_ENCR_ALG_UNSUPP = 10079, /* encr alg. not supp. */
189  NFS4ERR_PNFS_NO_LAYOUT = 10080, /* I/O without a layout */
190  NFS4ERR_NOT_ONLY_OP = 10081, /* addl ops not allowed */
191  NFS4ERR_WRONG_CRED = 10082, /* op done by wrong cred */
192  NFS4ERR_WRONG_TYPE = 10083, /* op on wrong type object */
193  NFS4ERR_DIRDELEG_UNAVAIL = 10084, /* delegation not avail. */
194  NFS4ERR_REJECT_DELEG = 10085, /* cb rejected delegation */
195  NFS4ERR_RETURNCONFLICT = 10086, /* layout get before return*/
196  NFS4ERR_DELEG_REVOKED = 10087 /* deleg./layout revoked */
197 };
198 
199 #define MAKE_WORD0(XXX) (1 << XXX)
200 #define MAKE_WORD1(XXX) (1 << (XXX-32))
201 #define MAKE_WORD2(XXX) (1 << (XXX-64))
202 
203 enum {
204 /*
205  * Mandatory Attributes
206  */
221 
222 /*
223  * Recommended Attributes
224  */
288 };
289 
290 /*
291  * File types
292  */
294  NF4REG = 1, /* Regular File */
295  NF4DIR = 2, /* Directory */
296  NF4BLK = 3, /* Special File - block device */
297  NF4CHR = 4, /* Special File - character device */
298  NF4LNK = 5, /* Symbolic Link */
299  NF4SOCK = 6, /* Special File - socket */
300  NF4FIFO = 7, /* Special File - fifo */
301  NF4ATTRDIR = 8, /* Attribute Directory */
302  NF4NAMEDATTR = 9, /* Named Attribute */
303 
305 };
306 
307 #define CREATE_SESSION4_FLAG_PERSIST 0x00000001
308 #define CREATE_SESSION4_FLAG_CONN_BACK_CHAN 0x00000002
309 #define CREATE_SESSION4_FLAG_CONN_RDMA 0x00000004
310 
311 /* ACLS aclsupport attribute values */
312 #define ACL4_SUPPORT_ALLOW_ACL 0x00000001
313 #define ACL4_SUPPORT_DENY_ACL 0x00000002
314 #define ACL4_SUPPORT_AUDIT_ACL 0x00000004
315 #define ACL4_SUPPORT_ALARM_ACL 0x00000008
316 
317 /* ACLS acetype4 field constants */
318 #define ACE4_ACCESS_ALLOWED_ACE_TYPE 0x00000000
319 #define ACE4_ACCESS_DENIED_ACE_TYPE 0x00000001
320 #define ACE4_SYSTEM_AUDIT_ACE_TYPE 0x00000002
321 #define ACE4_SYSTEM_ALARM_ACE_TYPE 0x00000003
322 
323 /* ACLS acemask4 field constants */
324 #define ACE4_READ_DATA 0x00000001
325 #define ACE4_LIST_DIRECTORY 0x00000001
326 #define ACE4_WRITE_DATA 0x00000002
327 #define ACE4_ADD_FILE 0x00000002
328 #define ACE4_APPEND_DATA 0x00000004
329 #define ACE4_ADD_SUBDIRECTORY 0x00000004
330 #define ACE4_READ_NAMED_ATTRS 0x00000008
331 #define ACE4_WRITE_NAMED_ATTRS 0x00000010
332 #define ACE4_EXECUTE 0x00000020
333 #define ACE4_DELETE_CHILD 0x00000040
334 #define ACE4_READ_ATTRIBUTES 0x00000080
335 #define ACE4_WRITE_ATTRIBUTES 0x00000100
336 #define ACE4_WRITE_RETENTION 0x00000200
337 #define ACE4_WRITE_RETENTION_HOLD 0x00000400
338 
339 #define ACE4_DELETE 0x00010000
340 #define ACE4_READ_ACL 0x00020000
341 #define ACE4_WRITE_ACL 0x00040000
342 #define ACE4_WRITE_OWNER 0x00080000
343 #define ACE4_SYNCHRONIZE 0x00100000
344 
345 #define ACE4_ALL_FILE ACE4_READ_DATA|ACE4_WRITE_DATA|ACE4_APPEND_DATA| \
346  ACE4_READ_NAMED_ATTRS|ACE4_WRITE_NAMED_ATTRS|ACE4_EXECUTE| \
347  ACE4_READ_ATTRIBUTES|ACE4_WRITE_ATTRIBUTES| \
348  ACE4_DELETE|ACE4_READ_ACL|ACE4_WRITE_ACL|ACE4_WRITE_OWNER| \
349  ACE4_SYNCHRONIZE
350 #define ACE4_ALL_DIR ACE4_READ_DATA|ACE4_WRITE_DATA|ACE4_APPEND_DATA| \
351  ACE4_READ_NAMED_ATTRS|ACE4_WRITE_NAMED_ATTRS|ACE4_EXECUTE| \
352  ACE4_DELETE_CHILD|ACE4_READ_ATTRIBUTES|ACE4_WRITE_ATTRIBUTES| \
353  ACE4_DELETE|ACE4_READ_ACL|ACE4_WRITE_ACL|ACE4_WRITE_OWNER| \
354  ACE4_SYNCHRONIZE
355 
356 #define ACE4_GENERIC_READ ACE4_READ_DATA|ACE4_READ_NAMED_ATTRS| \
357  ACE4_READ_ATTRIBUTES|ACE4_READ_ACL|ACE4_SYNCHRONIZE
358 #define ACE4_GENERIC_WRITE ACE4_WRITE_DATA|ACE4_WRITE_NAMED_ATTRS| \
359  ACE4_WRITE_ATTRIBUTES|ACE4_READ_ACL|ACE4_SYNCHRONIZE
360 #define ACE4_GENERIC_EXECUTE ACE4_EXECUTE|ACE4_READ_ATTRIBUTES| \
361  ACE4_READ_ACL|ACE4_SYNCHRONIZE
362 
363 
364 
365 #define ACE4_FILE_ALL_ACCESS ACE4_READ_DATA|ACE4_LIST_DIRECTORY| \
366  ACE4_WRITE_DATA|ACE4_ADD_FILE|ACE4_APPEND_DATA|ACE4_ADD_SUBDIRECTORY| \
367  ACE4_READ_NAMED_ATTRS|ACE4_WRITE_NAMED_ATTRS|ACE4_EXECUTE| \
368  ACE4_READ_ATTRIBUTES|ACE4_WRITE_ATTRIBUTES
369 
370 /* ACLS aceflag4 field constants */
371 #define ACE4_FILE_INHERIT_ACE 0x00000001
372 #define ACE4_DIRECTORY_INHERIT_ACE 0x00000002
373 #define ACE4_NO_PROPAGATE_INHERIT_ACE 0x00000004
374 #define ACE4_INHERIT_ONLY_ACE 0x00000008
375 #define ACE4_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010
376 #define ACE4_FAILED_ACCESS_ACE_FLAG 0x00000020
377 #define ACE4_IDENTIFIER_GROUP 0x00000040
378 #define ACE4_INHERITED_ACE 0x00000080
379 
380 /* ACLS well-defined WHOs */
381 #define ACE4_OWNER "OWNER@"
382 #define ACE4_GROUP "GROUP@"
383 #define ACE4_EVERYONE "EVERYONE@"
384 #define ACE4_INTERACTIVE "INTERACTIVE@"
385 #define ACE4_NETWORK "NETWORK@"
386 #define ACE4_DIALUP "DIALUP@"
387 #define ACE4_BATCH "BATCH@"
388 #define ACE4_ANONYMOUS "ANONYMOUS@"
389 #define ACE4_AUTHENTICATED "AUTHENTICATED@"
390 #define ACE4_SERVICE "SERVICE@"
391 #define ACE4_NOBODY "nobody"
392 
393 /* ACLE nfsacl41 aclflag4 constants */
394 #define ACL4_AUTO_INHERIT 0x00000001
395 #define ACL4_PROTECTED 0x00000002
396 #define ACL4_DEFAULTED 0x00000004
397 
398 
399 #endif /* !__NFS41_NFS_CONST_H__ */
nfs_ftype4
Definition: nfs41_const.h:293
#define MAKE_WORD0(XXX)
Definition: nfs41_const.h:199
#define MAKE_WORD2(XXX)
Definition: nfs41_const.h:201
nfsstat4
Definition: nfs41_const.h:86
#define MAKE_WORD1(XXX)
Definition: nfs41_const.h:200