xref: /linux/include/uapi/linux/nfs4.h (revision d2a00cce)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
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  */
13 
14 #ifndef _UAPI_LINUX_NFS4_H
15 #define _UAPI_LINUX_NFS4_H
16 
17 #include <linux/types.h>
18 
19 #define NFS4_BITMAP_SIZE	3
20 #define NFS4_VERIFIER_SIZE	8
21 #define NFS4_STATEID_SEQID_SIZE 4
22 #define NFS4_STATEID_OTHER_SIZE 12
23 #define NFS4_STATEID_SIZE	(NFS4_STATEID_SEQID_SIZE + NFS4_STATEID_OTHER_SIZE)
24 #define NFS4_FHSIZE		128
25 #define NFS4_MAXPATHLEN		PATH_MAX
26 #define NFS4_MAXNAMLEN		NAME_MAX
27 #define NFS4_OPAQUE_LIMIT	1024
28 #define NFS4_MAX_SESSIONID_LEN	16
29 
30 #define NFS4_ACCESS_READ        0x0001
31 #define NFS4_ACCESS_LOOKUP      0x0002
32 #define NFS4_ACCESS_MODIFY      0x0004
33 #define NFS4_ACCESS_EXTEND      0x0008
34 #define NFS4_ACCESS_DELETE      0x0010
35 #define NFS4_ACCESS_EXECUTE     0x0020
36 #define NFS4_ACCESS_XAREAD      0x0040
37 #define NFS4_ACCESS_XAWRITE     0x0080
38 #define NFS4_ACCESS_XALIST      0x0100
39 
40 #define NFS4_FH_PERSISTENT		0x0000
41 #define NFS4_FH_NOEXPIRE_WITH_OPEN	0x0001
42 #define NFS4_FH_VOLATILE_ANY		0x0002
43 #define NFS4_FH_VOL_MIGRATION		0x0004
44 #define NFS4_FH_VOL_RENAME		0x0008
45 
46 #define NFS4_OPEN_RESULT_CONFIRM		0x0002
47 #define NFS4_OPEN_RESULT_LOCKTYPE_POSIX		0x0004
48 #define NFS4_OPEN_RESULT_PRESERVE_UNLINKED	0x0008
49 #define NFS4_OPEN_RESULT_NO_OPEN_STATEID	0x0010
50 #define NFS4_OPEN_RESULT_MAY_NOTIFY_LOCK	0x0020
51 
52 #define NFS4_SHARE_ACCESS_MASK	0x000F
53 #define NFS4_SHARE_ACCESS_READ	0x0001
54 #define NFS4_SHARE_ACCESS_WRITE	0x0002
55 #define NFS4_SHARE_ACCESS_BOTH	0x0003
56 #define NFS4_SHARE_DENY_READ	0x0001
57 #define NFS4_SHARE_DENY_WRITE	0x0002
58 #define NFS4_SHARE_DENY_BOTH	0x0003
59 
60 /* nfs41 */
61 #define NFS4_SHARE_WANT_MASK		0xFF00
62 #define NFS4_SHARE_WANT_NO_PREFERENCE	0x0000
63 #define NFS4_SHARE_WANT_READ_DELEG	0x0100
64 #define NFS4_SHARE_WANT_WRITE_DELEG	0x0200
65 #define NFS4_SHARE_WANT_ANY_DELEG	0x0300
66 #define NFS4_SHARE_WANT_NO_DELEG	0x0400
67 #define NFS4_SHARE_WANT_CANCEL		0x0500
68 
69 #define NFS4_SHARE_WHEN_MASK		0xF0000
70 #define NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL	0x10000
71 #define NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED		0x20000
72 
73 #define NFS4_SHARE_WANT_DELEG_TIMESTAMPS		0x100000
74 #define NFS4_SHARE_WANT_OPEN_XOR_DELEGATION		0x200000
75 
76 #define NFS4_CDFC4_FORE	0x1
77 #define NFS4_CDFC4_BACK 0x2
78 #define NFS4_CDFC4_BOTH 0x3
79 #define NFS4_CDFC4_FORE_OR_BOTH 0x3
80 #define NFS4_CDFC4_BACK_OR_BOTH 0x7
81 
82 #define NFS4_CDFS4_FORE 0x1
83 #define NFS4_CDFS4_BACK 0x2
84 #define NFS4_CDFS4_BOTH 0x3
85 
86 #define NFS4_SET_TO_SERVER_TIME	0
87 #define NFS4_SET_TO_CLIENT_TIME	1
88 
89 #define NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE 0
90 #define NFS4_ACE_ACCESS_DENIED_ACE_TYPE  1
91 #define NFS4_ACE_SYSTEM_AUDIT_ACE_TYPE   2
92 #define NFS4_ACE_SYSTEM_ALARM_ACE_TYPE   3
93 
94 #define ACL4_SUPPORT_ALLOW_ACL 0x01
95 #define ACL4_SUPPORT_DENY_ACL  0x02
96 #define ACL4_SUPPORT_AUDIT_ACL 0x04
97 #define ACL4_SUPPORT_ALARM_ACL 0x08
98 
99 #define NFS4_ACL_AUTO_INHERIT 0x00000001
100 #define NFS4_ACL_PROTECTED    0x00000002
101 #define NFS4_ACL_DEFAULTED    0x00000004
102 
103 #define NFS4_ACE_FILE_INHERIT_ACE             0x00000001
104 #define NFS4_ACE_DIRECTORY_INHERIT_ACE        0x00000002
105 #define NFS4_ACE_NO_PROPAGATE_INHERIT_ACE     0x00000004
106 #define NFS4_ACE_INHERIT_ONLY_ACE             0x00000008
107 #define NFS4_ACE_SUCCESSFUL_ACCESS_ACE_FLAG   0x00000010
108 #define NFS4_ACE_FAILED_ACCESS_ACE_FLAG       0x00000020
109 #define NFS4_ACE_IDENTIFIER_GROUP             0x00000040
110 #define NFS4_ACE_INHERITED_ACE                0x00000080
111 
112 #define NFS4_ACE_READ_DATA                    0x00000001
113 #define NFS4_ACE_LIST_DIRECTORY               0x00000001
114 #define NFS4_ACE_WRITE_DATA                   0x00000002
115 #define NFS4_ACE_ADD_FILE                     0x00000002
116 #define NFS4_ACE_APPEND_DATA                  0x00000004
117 #define NFS4_ACE_ADD_SUBDIRECTORY             0x00000004
118 #define NFS4_ACE_READ_NAMED_ATTRS             0x00000008
119 #define NFS4_ACE_WRITE_NAMED_ATTRS            0x00000010
120 #define NFS4_ACE_EXECUTE                      0x00000020
121 #define NFS4_ACE_DELETE_CHILD                 0x00000040
122 #define NFS4_ACE_READ_ATTRIBUTES              0x00000080
123 #define NFS4_ACE_WRITE_ATTRIBUTES             0x00000100
124 #define NFS4_ACE_WRITE_RETENTION              0x00000200
125 #define NFS4_ACE_WRITE_RETENTION_HOLD         0x00000400
126 #define NFS4_ACE_DELETE                       0x00010000
127 #define NFS4_ACE_READ_ACL                     0x00020000
128 #define NFS4_ACE_WRITE_ACL                    0x00040000
129 #define NFS4_ACE_WRITE_OWNER                  0x00080000
130 #define NFS4_ACE_SYNCHRONIZE                  0x00100000
131 #define NFS4_ACE_GENERIC_READ                 0x00120081
132 #define NFS4_ACE_GENERIC_WRITE                0x00160106
133 #define NFS4_ACE_GENERIC_EXECUTE              0x001200A0
134 #define NFS4_ACE_MASK_ALL                     0x001F01FF
135 
136 #define EXCHGID4_FLAG_SUPP_MOVED_REFER		0x00000001
137 #define EXCHGID4_FLAG_SUPP_MOVED_MIGR		0x00000002
138 #define EXCHGID4_FLAG_BIND_PRINC_STATEID	0x00000100
139 
140 #define EXCHGID4_FLAG_USE_NON_PNFS		0x00010000
141 #define EXCHGID4_FLAG_USE_PNFS_MDS		0x00020000
142 #define EXCHGID4_FLAG_USE_PNFS_DS		0x00040000
143 #define EXCHGID4_FLAG_MASK_PNFS			0x00070000
144 
145 #define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A	0x40000000
146 #define EXCHGID4_FLAG_CONFIRMED_R		0x80000000
147 
148 #define EXCHGID4_FLAG_SUPP_FENCE_OPS		0x00000004
149 /*
150  * Since the validity of these bits depends on whether
151  * they're set in the argument or response, have separate
152  * invalid flag masks for arg (_A) and resp (_R).
153  */
154 #define EXCHGID4_FLAG_MASK_A			0x40070103
155 #define EXCHGID4_FLAG_MASK_R			0x80070103
156 #define EXCHGID4_2_FLAG_MASK_R			0x80070107
157 
158 #define SEQ4_STATUS_CB_PATH_DOWN		0x00000001
159 #define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING	0x00000002
160 #define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED	0x00000004
161 #define SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED	0x00000008
162 #define SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED	0x00000010
163 #define SEQ4_STATUS_ADMIN_STATE_REVOKED		0x00000020
164 #define SEQ4_STATUS_RECALLABLE_STATE_REVOKED	0x00000040
165 #define SEQ4_STATUS_LEASE_MOVED			0x00000080
166 #define SEQ4_STATUS_RESTART_RECLAIM_NEEDED	0x00000100
167 #define SEQ4_STATUS_CB_PATH_DOWN_SESSION	0x00000200
168 #define SEQ4_STATUS_BACKCHANNEL_FAULT		0x00000400
169 
170 #define NFS4_SECINFO_STYLE4_CURRENT_FH	0
171 #define NFS4_SECINFO_STYLE4_PARENT	1
172 
173 #define NFS4_MAX_UINT64	(~(__u64)0)
174 
175 /* An NFS4 sessions server must support at least NFS4_MAX_OPS operations.
176  * If a compound requires more operations, adjust NFS4_MAX_OPS accordingly.
177  */
178 #define NFS4_MAX_OPS   8
179 
180 /* Our NFS4 client back channel server only wants the cb_sequene and the
181  * actual operation per compound
182  */
183 #define NFS4_MAX_BACK_CHANNEL_OPS 2
184 
185 #endif /* _UAPI_LINUX_NFS4_H */
186