Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * include/linux/nfs4.h |
| 3 | * |
| 4 | * NFSv4 protocol definitions. |
| 5 | * |
| 6 | * Copyright (c) 2002 The Regents of the University of Michigan. |
| 7 | * All rights reserved. |
| 8 | * |
| 9 | * Kendrick Smith <kmsmith@umich.edu> |
| 10 | * Andy Adamson <andros@umich.edu> |
| 11 | */ |
| 12 | |
| 13 | #ifndef _LINUX_NFS4_H |
| 14 | #define _LINUX_NFS4_H |
| 15 | |
| 16 | #include <linux/types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
Jeff Layton | aa53ed5 | 2007-06-05 14:49:03 -0400 | [diff] [blame] | 18 | #define NFS4_BITMAP_SIZE 2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | #define NFS4_VERIFIER_SIZE 8 |
Trond Myklebust | 8ae20ab | 2007-05-14 16:50:45 -0400 | [diff] [blame] | 20 | #define NFS4_STATEID_SIZE 16 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | #define NFS4_FHSIZE 128 |
| 22 | #define NFS4_MAXPATHLEN PATH_MAX |
| 23 | #define NFS4_MAXNAMLEN NAME_MAX |
Benny Halevy | 18df188 | 2009-04-03 08:27:36 +0300 | [diff] [blame] | 24 | #define NFS4_MAX_SESSIONID_LEN 16 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | |
| 26 | #define NFS4_ACCESS_READ 0x0001 |
| 27 | #define NFS4_ACCESS_LOOKUP 0x0002 |
| 28 | #define NFS4_ACCESS_MODIFY 0x0004 |
| 29 | #define NFS4_ACCESS_EXTEND 0x0008 |
| 30 | #define NFS4_ACCESS_DELETE 0x0010 |
| 31 | #define NFS4_ACCESS_EXECUTE 0x0020 |
| 32 | |
NeilBrown | 4964000 | 2005-06-23 22:02:58 -0700 | [diff] [blame] | 33 | #define NFS4_FH_PERSISTENT 0x0000 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | #define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001 |
| 35 | #define NFS4_FH_VOLATILE_ANY 0x0002 |
| 36 | #define NFS4_FH_VOL_MIGRATION 0x0004 |
| 37 | #define NFS4_FH_VOL_RENAME 0x0008 |
| 38 | |
| 39 | #define NFS4_OPEN_RESULT_CONFIRM 0x0002 |
| 40 | #define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004 |
| 41 | |
Benny Halevy | 18df188 | 2009-04-03 08:27:36 +0300 | [diff] [blame] | 42 | #define NFS4_SHARE_ACCESS_MASK 0x000F |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | #define NFS4_SHARE_ACCESS_READ 0x0001 |
| 44 | #define NFS4_SHARE_ACCESS_WRITE 0x0002 |
| 45 | #define NFS4_SHARE_ACCESS_BOTH 0x0003 |
| 46 | #define NFS4_SHARE_DENY_READ 0x0001 |
| 47 | #define NFS4_SHARE_DENY_WRITE 0x0002 |
| 48 | #define NFS4_SHARE_DENY_BOTH 0x0003 |
| 49 | |
Benny Halevy | 18df188 | 2009-04-03 08:27:36 +0300 | [diff] [blame] | 50 | /* nfs41 */ |
| 51 | #define NFS4_SHARE_WANT_MASK 0xFF00 |
| 52 | #define NFS4_SHARE_WANT_NO_PREFERENCE 0x0000 |
| 53 | #define NFS4_SHARE_WANT_READ_DELEG 0x0100 |
| 54 | #define NFS4_SHARE_WANT_WRITE_DELEG 0x0200 |
| 55 | #define NFS4_SHARE_WANT_ANY_DELEG 0x0300 |
| 56 | #define NFS4_SHARE_WANT_NO_DELEG 0x0400 |
| 57 | #define NFS4_SHARE_WANT_CANCEL 0x0500 |
| 58 | |
| 59 | #define NFS4_SHARE_WHEN_MASK 0xF0000 |
| 60 | #define NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL 0x10000 |
| 61 | #define NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED 0x20000 |
| 62 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | #define NFS4_SET_TO_SERVER_TIME 0 |
| 64 | #define NFS4_SET_TO_CLIENT_TIME 1 |
| 65 | |
| 66 | #define NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE 0 |
| 67 | #define NFS4_ACE_ACCESS_DENIED_ACE_TYPE 1 |
| 68 | #define NFS4_ACE_SYSTEM_AUDIT_ACE_TYPE 2 |
| 69 | #define NFS4_ACE_SYSTEM_ALARM_ACE_TYPE 3 |
| 70 | |
| 71 | #define ACL4_SUPPORT_ALLOW_ACL 0x01 |
| 72 | #define ACL4_SUPPORT_DENY_ACL 0x02 |
| 73 | #define ACL4_SUPPORT_AUDIT_ACL 0x04 |
| 74 | #define ACL4_SUPPORT_ALARM_ACL 0x08 |
| 75 | |
| 76 | #define NFS4_ACE_FILE_INHERIT_ACE 0x00000001 |
| 77 | #define NFS4_ACE_DIRECTORY_INHERIT_ACE 0x00000002 |
| 78 | #define NFS4_ACE_NO_PROPAGATE_INHERIT_ACE 0x00000004 |
| 79 | #define NFS4_ACE_INHERIT_ONLY_ACE 0x00000008 |
| 80 | #define NFS4_ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010 |
| 81 | #define NFS4_ACE_FAILED_ACCESS_ACE_FLAG 0x00000020 |
| 82 | #define NFS4_ACE_IDENTIFIER_GROUP 0x00000040 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | |
| 84 | #define NFS4_ACE_READ_DATA 0x00000001 |
| 85 | #define NFS4_ACE_LIST_DIRECTORY 0x00000001 |
| 86 | #define NFS4_ACE_WRITE_DATA 0x00000002 |
| 87 | #define NFS4_ACE_ADD_FILE 0x00000002 |
| 88 | #define NFS4_ACE_APPEND_DATA 0x00000004 |
| 89 | #define NFS4_ACE_ADD_SUBDIRECTORY 0x00000004 |
| 90 | #define NFS4_ACE_READ_NAMED_ATTRS 0x00000008 |
| 91 | #define NFS4_ACE_WRITE_NAMED_ATTRS 0x00000010 |
| 92 | #define NFS4_ACE_EXECUTE 0x00000020 |
| 93 | #define NFS4_ACE_DELETE_CHILD 0x00000040 |
| 94 | #define NFS4_ACE_READ_ATTRIBUTES 0x00000080 |
| 95 | #define NFS4_ACE_WRITE_ATTRIBUTES 0x00000100 |
| 96 | #define NFS4_ACE_DELETE 0x00010000 |
| 97 | #define NFS4_ACE_READ_ACL 0x00020000 |
| 98 | #define NFS4_ACE_WRITE_ACL 0x00040000 |
| 99 | #define NFS4_ACE_WRITE_OWNER 0x00080000 |
| 100 | #define NFS4_ACE_SYNCHRONIZE 0x00100000 |
| 101 | #define NFS4_ACE_GENERIC_READ 0x00120081 |
| 102 | #define NFS4_ACE_GENERIC_WRITE 0x00160106 |
| 103 | #define NFS4_ACE_GENERIC_EXECUTE 0x001200A0 |
| 104 | #define NFS4_ACE_MASK_ALL 0x001F01FF |
| 105 | |
Benny Halevy | 18df188 | 2009-04-03 08:27:36 +0300 | [diff] [blame] | 106 | #define EXCHGID4_FLAG_SUPP_MOVED_REFER 0x00000001 |
| 107 | #define EXCHGID4_FLAG_SUPP_MOVED_MIGR 0x00000002 |
| 108 | #define EXCHGID4_FLAG_USE_NON_PNFS 0x00010000 |
| 109 | #define EXCHGID4_FLAG_USE_PNFS_MDS 0x00020000 |
| 110 | #define EXCHGID4_FLAG_USE_PNFS_DS 0x00040000 |
| 111 | #define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A 0x40000000 |
| 112 | #define EXCHGID4_FLAG_CONFIRMED_R 0x80000000 |
| 113 | /* |
| 114 | * Since the validity of these bits depends on whether |
| 115 | * they're set in the argument or response, have separate |
| 116 | * invalid flag masks for arg (_A) and resp (_R). |
| 117 | */ |
| 118 | #define EXCHGID4_FLAG_MASK_A 0x40070003 |
| 119 | #define EXCHGID4_FLAG_MASK_R 0x80070003 |
| 120 | |
| 121 | #define SEQ4_STATUS_CB_PATH_DOWN 0x00000001 |
| 122 | #define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING 0x00000002 |
| 123 | #define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED 0x00000004 |
| 124 | #define SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED 0x00000008 |
| 125 | #define SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED 0x00000010 |
| 126 | #define SEQ4_STATUS_ADMIN_STATE_REVOKED 0x00000020 |
| 127 | #define SEQ4_STATUS_RECALLABLE_STATE_REVOKED 0x00000040 |
| 128 | #define SEQ4_STATUS_LEASE_MOVED 0x00000080 |
| 129 | #define SEQ4_STATUS_RESTART_RECLAIM_NEEDED 0x00000100 |
| 130 | |
Benny Halevy | 87df4de | 2008-12-15 19:42:03 +0200 | [diff] [blame] | 131 | #define NFS4_MAX_UINT64 (~(u64)0) |
| 132 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | enum nfs4_acl_whotype { |
| 134 | NFS4_ACL_WHO_NAMED = 0, |
| 135 | NFS4_ACL_WHO_OWNER, |
| 136 | NFS4_ACL_WHO_GROUP, |
| 137 | NFS4_ACL_WHO_EVERYONE, |
| 138 | }; |
| 139 | |
David Woodhouse | 997b7af | 2006-04-25 14:51:45 +0100 | [diff] [blame] | 140 | #ifdef __KERNEL__ |
| 141 | #include <linux/list.h> |
| 142 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | struct nfs4_ace { |
| 144 | uint32_t type; |
| 145 | uint32_t flag; |
| 146 | uint32_t access_mask; |
| 147 | int whotype; |
| 148 | uid_t who; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | }; |
| 150 | |
| 151 | struct nfs4_acl { |
| 152 | uint32_t naces; |
J. Bruce Fields | 28e05dd | 2007-02-16 01:28:30 -0800 | [diff] [blame] | 153 | struct nfs4_ace aces[0]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 | }; |
| 155 | |
| 156 | typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; |
Trond Myklebust | 8ae20ab | 2007-05-14 16:50:45 -0400 | [diff] [blame] | 157 | typedef struct { char data[NFS4_STATEID_SIZE]; } nfs4_stateid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | |
| 159 | enum nfs_opnum4 { |
| 160 | OP_ACCESS = 3, |
| 161 | OP_CLOSE = 4, |
| 162 | OP_COMMIT = 5, |
| 163 | OP_CREATE = 6, |
| 164 | OP_DELEGPURGE = 7, |
| 165 | OP_DELEGRETURN = 8, |
| 166 | OP_GETATTR = 9, |
| 167 | OP_GETFH = 10, |
| 168 | OP_LINK = 11, |
| 169 | OP_LOCK = 12, |
| 170 | OP_LOCKT = 13, |
| 171 | OP_LOCKU = 14, |
| 172 | OP_LOOKUP = 15, |
| 173 | OP_LOOKUPP = 16, |
| 174 | OP_NVERIFY = 17, |
| 175 | OP_OPEN = 18, |
| 176 | OP_OPENATTR = 19, |
| 177 | OP_OPEN_CONFIRM = 20, |
| 178 | OP_OPEN_DOWNGRADE = 21, |
| 179 | OP_PUTFH = 22, |
| 180 | OP_PUTPUBFH = 23, |
| 181 | OP_PUTROOTFH = 24, |
| 182 | OP_READ = 25, |
| 183 | OP_READDIR = 26, |
| 184 | OP_READLINK = 27, |
| 185 | OP_REMOVE = 28, |
| 186 | OP_RENAME = 29, |
| 187 | OP_RENEW = 30, |
| 188 | OP_RESTOREFH = 31, |
| 189 | OP_SAVEFH = 32, |
| 190 | OP_SECINFO = 33, |
| 191 | OP_SETATTR = 34, |
| 192 | OP_SETCLIENTID = 35, |
| 193 | OP_SETCLIENTID_CONFIRM = 36, |
| 194 | OP_VERIFY = 37, |
| 195 | OP_WRITE = 38, |
| 196 | OP_RELEASE_LOCKOWNER = 39, |
Benny Halevy | 18df188 | 2009-04-03 08:27:36 +0300 | [diff] [blame] | 197 | |
| 198 | /* nfs41 */ |
| 199 | OP_BACKCHANNEL_CTL = 40, |
| 200 | OP_BIND_CONN_TO_SESSION = 41, |
| 201 | OP_EXCHANGE_ID = 42, |
| 202 | OP_CREATE_SESSION = 43, |
| 203 | OP_DESTROY_SESSION = 44, |
| 204 | OP_FREE_STATEID = 45, |
| 205 | OP_GET_DIR_DELEGATION = 46, |
| 206 | OP_GETDEVICEINFO = 47, |
| 207 | OP_GETDEVICELIST = 48, |
| 208 | OP_LAYOUTCOMMIT = 49, |
| 209 | OP_LAYOUTGET = 50, |
| 210 | OP_LAYOUTRETURN = 51, |
| 211 | OP_SECINFO_NO_NAME = 52, |
| 212 | OP_SEQUENCE = 53, |
| 213 | OP_SET_SSV = 54, |
| 214 | OP_TEST_STATEID = 55, |
| 215 | OP_WANT_DELEGATION = 56, |
| 216 | OP_DESTROY_CLIENTID = 57, |
| 217 | OP_RECLAIM_COMPLETE = 58, |
| 218 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | OP_ILLEGAL = 10044, |
| 220 | }; |
| 221 | |
Shankar Anand | e2b2095 | 2006-07-10 04:45:44 -0700 | [diff] [blame] | 222 | /*Defining first and last NFS4 operations implemented. |
| 223 | Needs to be updated if more operations are defined in future.*/ |
| 224 | |
| 225 | #define FIRST_NFS4_OP OP_ACCESS |
| 226 | #define LAST_NFS4_OP OP_RELEASE_LOCKOWNER |
| 227 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | enum nfsstat4 { |
| 229 | NFS4_OK = 0, |
| 230 | NFS4ERR_PERM = 1, |
| 231 | NFS4ERR_NOENT = 2, |
| 232 | NFS4ERR_IO = 5, |
| 233 | NFS4ERR_NXIO = 6, |
| 234 | NFS4ERR_ACCESS = 13, |
| 235 | NFS4ERR_EXIST = 17, |
| 236 | NFS4ERR_XDEV = 18, |
| 237 | /* Unused/reserved 19 */ |
| 238 | NFS4ERR_NOTDIR = 20, |
| 239 | NFS4ERR_ISDIR = 21, |
| 240 | NFS4ERR_INVAL = 22, |
| 241 | NFS4ERR_FBIG = 27, |
| 242 | NFS4ERR_NOSPC = 28, |
| 243 | NFS4ERR_ROFS = 30, |
| 244 | NFS4ERR_MLINK = 31, |
| 245 | NFS4ERR_NAMETOOLONG = 63, |
| 246 | NFS4ERR_NOTEMPTY = 66, |
| 247 | NFS4ERR_DQUOT = 69, |
| 248 | NFS4ERR_STALE = 70, |
| 249 | NFS4ERR_BADHANDLE = 10001, |
| 250 | NFS4ERR_BAD_COOKIE = 10003, |
| 251 | NFS4ERR_NOTSUPP = 10004, |
| 252 | NFS4ERR_TOOSMALL = 10005, |
| 253 | NFS4ERR_SERVERFAULT = 10006, |
| 254 | NFS4ERR_BADTYPE = 10007, |
| 255 | NFS4ERR_DELAY = 10008, |
| 256 | NFS4ERR_SAME = 10009, |
| 257 | NFS4ERR_DENIED = 10010, |
| 258 | NFS4ERR_EXPIRED = 10011, |
| 259 | NFS4ERR_LOCKED = 10012, |
| 260 | NFS4ERR_GRACE = 10013, |
| 261 | NFS4ERR_FHEXPIRED = 10014, |
| 262 | NFS4ERR_SHARE_DENIED = 10015, |
| 263 | NFS4ERR_WRONGSEC = 10016, |
| 264 | NFS4ERR_CLID_INUSE = 10017, |
| 265 | NFS4ERR_RESOURCE = 10018, |
| 266 | NFS4ERR_MOVED = 10019, |
| 267 | NFS4ERR_NOFILEHANDLE = 10020, |
| 268 | NFS4ERR_MINOR_VERS_MISMATCH = 10021, |
| 269 | NFS4ERR_STALE_CLIENTID = 10022, |
| 270 | NFS4ERR_STALE_STATEID = 10023, |
| 271 | NFS4ERR_OLD_STATEID = 10024, |
| 272 | NFS4ERR_BAD_STATEID = 10025, |
| 273 | NFS4ERR_BAD_SEQID = 10026, |
| 274 | NFS4ERR_NOT_SAME = 10027, |
| 275 | NFS4ERR_LOCK_RANGE = 10028, |
| 276 | NFS4ERR_SYMLINK = 10029, |
| 277 | NFS4ERR_RESTOREFH = 10030, |
| 278 | NFS4ERR_LEASE_MOVED = 10031, |
| 279 | NFS4ERR_ATTRNOTSUPP = 10032, |
| 280 | NFS4ERR_NO_GRACE = 10033, |
| 281 | NFS4ERR_RECLAIM_BAD = 10034, |
| 282 | NFS4ERR_RECLAIM_CONFLICT = 10035, |
| 283 | NFS4ERR_BADXDR = 10036, |
| 284 | NFS4ERR_LOCKS_HELD = 10037, |
| 285 | NFS4ERR_OPENMODE = 10038, |
| 286 | NFS4ERR_BADOWNER = 10039, |
| 287 | NFS4ERR_BADCHAR = 10040, |
| 288 | NFS4ERR_BADNAME = 10041, |
| 289 | NFS4ERR_BAD_RANGE = 10042, |
| 290 | NFS4ERR_LOCK_NOTSUPP = 10043, |
| 291 | NFS4ERR_OP_ILLEGAL = 10044, |
| 292 | NFS4ERR_DEADLOCK = 10045, |
| 293 | NFS4ERR_FILE_OPEN = 10046, |
| 294 | NFS4ERR_ADMIN_REVOKED = 10047, |
Benny Halevy | 18df188 | 2009-04-03 08:27:36 +0300 | [diff] [blame] | 295 | NFS4ERR_CB_PATH_DOWN = 10048, |
| 296 | |
| 297 | /* nfs41 */ |
| 298 | NFS4ERR_BADIOMODE = 10049, |
| 299 | NFS4ERR_BADLAYOUT = 10050, |
| 300 | NFS4ERR_BAD_SESSION_DIGEST = 10051, |
| 301 | NFS4ERR_BADSESSION = 10052, |
| 302 | NFS4ERR_BADSLOT = 10053, |
| 303 | NFS4ERR_COMPLETE_ALREADY = 10054, |
| 304 | NFS4ERR_CONN_NOT_BOUND_TO_SESSION = 10055, |
| 305 | NFS4ERR_DELEG_ALREADY_WANTED = 10056, |
| 306 | NFS4ERR_BACK_CHAN_BUSY = 10057, /* backchan reqs outstanding */ |
| 307 | NFS4ERR_LAYOUTTRYLATER = 10058, |
| 308 | NFS4ERR_LAYOUTUNAVAILABLE = 10059, |
| 309 | NFS4ERR_NOMATCHING_LAYOUT = 10060, |
| 310 | NFS4ERR_RECALLCONFLICT = 10061, |
| 311 | NFS4ERR_UNKNOWN_LAYOUTTYPE = 10062, |
| 312 | NFS4ERR_SEQ_MISORDERED = 10063, /* unexpected seq.id in req */ |
| 313 | NFS4ERR_SEQUENCE_POS = 10064, /* [CB_]SEQ. op not 1st op */ |
| 314 | NFS4ERR_REQ_TOO_BIG = 10065, /* request too big */ |
| 315 | NFS4ERR_REP_TOO_BIG = 10066, /* reply too big */ |
| 316 | NFS4ERR_REP_TOO_BIG_TO_CACHE = 10067, /* rep. not all cached */ |
| 317 | NFS4ERR_RETRY_UNCACHED_REP = 10068, /* retry & rep. uncached */ |
| 318 | NFS4ERR_UNSAFE_COMPOUND = 10069, /* retry/recovery too hard */ |
| 319 | NFS4ERR_TOO_MANY_OPS = 10070, /* too many ops in [CB_]COMP */ |
| 320 | NFS4ERR_OP_NOT_IN_SESSION = 10071, /* op needs [CB_]SEQ. op */ |
| 321 | NFS4ERR_HASH_ALG_UNSUPP = 10072, /* hash alg. not supp. */ |
| 322 | /* Error 10073 is unused. */ |
| 323 | NFS4ERR_CLIENTID_BUSY = 10074, /* clientid has state */ |
| 324 | NFS4ERR_PNFS_IO_HOLE = 10075, /* IO to _SPARSE file hole */ |
| 325 | NFS4ERR_SEQ_FALSE_RETRY = 10076, /* retry not origional */ |
| 326 | NFS4ERR_BAD_HIGH_SLOT = 10077, /* sequence arg bad */ |
| 327 | NFS4ERR_DEADSESSION = 10078, /* persistent session dead */ |
| 328 | NFS4ERR_ENCR_ALG_UNSUPP = 10079, /* SSV alg mismatch */ |
| 329 | NFS4ERR_PNFS_NO_LAYOUT = 10080, /* direct I/O with no layout */ |
| 330 | NFS4ERR_NOT_ONLY_OP = 10081, /* bad compound */ |
| 331 | NFS4ERR_WRONG_CRED = 10082, /* permissions:state change */ |
| 332 | NFS4ERR_WRONG_TYPE = 10083, /* current operation mismatch */ |
| 333 | NFS4ERR_DIRDELEG_UNAVAIL = 10084, /* no directory delegation */ |
| 334 | NFS4ERR_REJECT_DELEG = 10085, /* on callback */ |
| 335 | NFS4ERR_RETURNCONFLICT = 10086, /* outstanding layoutreturn */ |
| 336 | NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 337 | }; |
| 338 | |
| 339 | /* |
| 340 | * Note: NF4BAD is not actually part of the protocol; it is just used |
| 341 | * internally by nfsd. |
| 342 | */ |
| 343 | enum nfs_ftype4 { |
| 344 | NF4BAD = 0, |
| 345 | NF4REG = 1, /* Regular File */ |
| 346 | NF4DIR = 2, /* Directory */ |
| 347 | NF4BLK = 3, /* Special File - block device */ |
| 348 | NF4CHR = 4, /* Special File - character device */ |
| 349 | NF4LNK = 5, /* Symbolic Link */ |
| 350 | NF4SOCK = 6, /* Special File - socket */ |
| 351 | NF4FIFO = 7, /* Special File - fifo */ |
| 352 | NF4ATTRDIR = 8, /* Attribute Directory */ |
| 353 | NF4NAMEDATTR = 9 /* Named Attribute */ |
| 354 | }; |
| 355 | |
| 356 | enum open_claim_type4 { |
| 357 | NFS4_OPEN_CLAIM_NULL = 0, |
| 358 | NFS4_OPEN_CLAIM_PREVIOUS = 1, |
| 359 | NFS4_OPEN_CLAIM_DELEGATE_CUR = 2, |
| 360 | NFS4_OPEN_CLAIM_DELEGATE_PREV = 3 |
| 361 | }; |
| 362 | |
| 363 | enum opentype4 { |
| 364 | NFS4_OPEN_NOCREATE = 0, |
| 365 | NFS4_OPEN_CREATE = 1 |
| 366 | }; |
| 367 | |
| 368 | enum createmode4 { |
| 369 | NFS4_CREATE_UNCHECKED = 0, |
| 370 | NFS4_CREATE_GUARDED = 1, |
Benny Halevy | 79fb54a | 2009-04-03 08:29:17 +0300 | [diff] [blame] | 371 | NFS4_CREATE_EXCLUSIVE = 2, |
| 372 | /* |
| 373 | * New to NFSv4.1. If session is persistent, |
| 374 | * GUARDED4 MUST be used. Otherwise, use |
| 375 | * EXCLUSIVE4_1 instead of EXCLUSIVE4. |
| 376 | */ |
| 377 | NFS4_CREATE_EXCLUSIVE4_1 = 3 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 378 | }; |
| 379 | |
| 380 | enum limit_by4 { |
| 381 | NFS4_LIMIT_SIZE = 1, |
| 382 | NFS4_LIMIT_BLOCKS = 2 |
| 383 | }; |
| 384 | |
| 385 | enum open_delegation_type4 { |
| 386 | NFS4_OPEN_DELEGATE_NONE = 0, |
| 387 | NFS4_OPEN_DELEGATE_READ = 1, |
| 388 | NFS4_OPEN_DELEGATE_WRITE = 2 |
| 389 | }; |
| 390 | |
| 391 | enum lock_type4 { |
| 392 | NFS4_UNLOCK_LT = 0, |
| 393 | NFS4_READ_LT = 1, |
| 394 | NFS4_WRITE_LT = 2, |
| 395 | NFS4_READW_LT = 3, |
| 396 | NFS4_WRITEW_LT = 4 |
| 397 | }; |
| 398 | |
| 399 | |
| 400 | /* Mandatory Attributes */ |
| 401 | #define FATTR4_WORD0_SUPPORTED_ATTRS (1UL << 0) |
| 402 | #define FATTR4_WORD0_TYPE (1UL << 1) |
| 403 | #define FATTR4_WORD0_FH_EXPIRE_TYPE (1UL << 2) |
| 404 | #define FATTR4_WORD0_CHANGE (1UL << 3) |
| 405 | #define FATTR4_WORD0_SIZE (1UL << 4) |
| 406 | #define FATTR4_WORD0_LINK_SUPPORT (1UL << 5) |
| 407 | #define FATTR4_WORD0_SYMLINK_SUPPORT (1UL << 6) |
| 408 | #define FATTR4_WORD0_NAMED_ATTR (1UL << 7) |
| 409 | #define FATTR4_WORD0_FSID (1UL << 8) |
| 410 | #define FATTR4_WORD0_UNIQUE_HANDLES (1UL << 9) |
| 411 | #define FATTR4_WORD0_LEASE_TIME (1UL << 10) |
| 412 | #define FATTR4_WORD0_RDATTR_ERROR (1UL << 11) |
Benny Halevy | 8c18f20 | 2009-04-03 08:29:14 +0300 | [diff] [blame] | 413 | /* Mandatory in NFSv4.1 */ |
| 414 | #define FATTR4_WORD2_SUPPATTR_EXCLCREAT (1UL << 11) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 415 | |
| 416 | /* Recommended Attributes */ |
| 417 | #define FATTR4_WORD0_ACL (1UL << 12) |
| 418 | #define FATTR4_WORD0_ACLSUPPORT (1UL << 13) |
| 419 | #define FATTR4_WORD0_ARCHIVE (1UL << 14) |
| 420 | #define FATTR4_WORD0_CANSETTIME (1UL << 15) |
| 421 | #define FATTR4_WORD0_CASE_INSENSITIVE (1UL << 16) |
| 422 | #define FATTR4_WORD0_CASE_PRESERVING (1UL << 17) |
| 423 | #define FATTR4_WORD0_CHOWN_RESTRICTED (1UL << 18) |
| 424 | #define FATTR4_WORD0_FILEHANDLE (1UL << 19) |
| 425 | #define FATTR4_WORD0_FILEID (1UL << 20) |
| 426 | #define FATTR4_WORD0_FILES_AVAIL (1UL << 21) |
| 427 | #define FATTR4_WORD0_FILES_FREE (1UL << 22) |
| 428 | #define FATTR4_WORD0_FILES_TOTAL (1UL << 23) |
| 429 | #define FATTR4_WORD0_FS_LOCATIONS (1UL << 24) |
| 430 | #define FATTR4_WORD0_HIDDEN (1UL << 25) |
| 431 | #define FATTR4_WORD0_HOMOGENEOUS (1UL << 26) |
| 432 | #define FATTR4_WORD0_MAXFILESIZE (1UL << 27) |
| 433 | #define FATTR4_WORD0_MAXLINK (1UL << 28) |
| 434 | #define FATTR4_WORD0_MAXNAME (1UL << 29) |
| 435 | #define FATTR4_WORD0_MAXREAD (1UL << 30) |
| 436 | #define FATTR4_WORD0_MAXWRITE (1UL << 31) |
| 437 | #define FATTR4_WORD1_MIMETYPE (1UL << 0) |
| 438 | #define FATTR4_WORD1_MODE (1UL << 1) |
| 439 | #define FATTR4_WORD1_NO_TRUNC (1UL << 2) |
| 440 | #define FATTR4_WORD1_NUMLINKS (1UL << 3) |
| 441 | #define FATTR4_WORD1_OWNER (1UL << 4) |
| 442 | #define FATTR4_WORD1_OWNER_GROUP (1UL << 5) |
| 443 | #define FATTR4_WORD1_QUOTA_HARD (1UL << 6) |
| 444 | #define FATTR4_WORD1_QUOTA_SOFT (1UL << 7) |
| 445 | #define FATTR4_WORD1_QUOTA_USED (1UL << 8) |
| 446 | #define FATTR4_WORD1_RAWDEV (1UL << 9) |
| 447 | #define FATTR4_WORD1_SPACE_AVAIL (1UL << 10) |
| 448 | #define FATTR4_WORD1_SPACE_FREE (1UL << 11) |
| 449 | #define FATTR4_WORD1_SPACE_TOTAL (1UL << 12) |
| 450 | #define FATTR4_WORD1_SPACE_USED (1UL << 13) |
| 451 | #define FATTR4_WORD1_SYSTEM (1UL << 14) |
| 452 | #define FATTR4_WORD1_TIME_ACCESS (1UL << 15) |
| 453 | #define FATTR4_WORD1_TIME_ACCESS_SET (1UL << 16) |
| 454 | #define FATTR4_WORD1_TIME_BACKUP (1UL << 17) |
| 455 | #define FATTR4_WORD1_TIME_CREATE (1UL << 18) |
| 456 | #define FATTR4_WORD1_TIME_DELTA (1UL << 19) |
| 457 | #define FATTR4_WORD1_TIME_METADATA (1UL << 20) |
| 458 | #define FATTR4_WORD1_TIME_MODIFY (1UL << 21) |
| 459 | #define FATTR4_WORD1_TIME_MODIFY_SET (1UL << 22) |
| 460 | #define FATTR4_WORD1_MOUNTED_ON_FILEID (1UL << 23) |
| 461 | |
| 462 | #define NFSPROC4_NULL 0 |
| 463 | #define NFSPROC4_COMPOUND 1 |
| 464 | #define NFS4_MINOR_VERSION 0 |
| 465 | #define NFS4_DEBUG 1 |
| 466 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 467 | /* Index of predefined Linux client operations */ |
| 468 | |
| 469 | enum { |
| 470 | NFSPROC4_CLNT_NULL = 0, /* Unused */ |
| 471 | NFSPROC4_CLNT_READ, |
| 472 | NFSPROC4_CLNT_WRITE, |
| 473 | NFSPROC4_CLNT_COMMIT, |
| 474 | NFSPROC4_CLNT_OPEN, |
| 475 | NFSPROC4_CLNT_OPEN_CONFIRM, |
| 476 | NFSPROC4_CLNT_OPEN_NOATTR, |
| 477 | NFSPROC4_CLNT_OPEN_DOWNGRADE, |
| 478 | NFSPROC4_CLNT_CLOSE, |
| 479 | NFSPROC4_CLNT_SETATTR, |
| 480 | NFSPROC4_CLNT_FSINFO, |
| 481 | NFSPROC4_CLNT_RENEW, |
| 482 | NFSPROC4_CLNT_SETCLIENTID, |
| 483 | NFSPROC4_CLNT_SETCLIENTID_CONFIRM, |
| 484 | NFSPROC4_CLNT_LOCK, |
| 485 | NFSPROC4_CLNT_LOCKT, |
| 486 | NFSPROC4_CLNT_LOCKU, |
| 487 | NFSPROC4_CLNT_ACCESS, |
| 488 | NFSPROC4_CLNT_GETATTR, |
| 489 | NFSPROC4_CLNT_LOOKUP, |
| 490 | NFSPROC4_CLNT_LOOKUP_ROOT, |
| 491 | NFSPROC4_CLNT_REMOVE, |
| 492 | NFSPROC4_CLNT_RENAME, |
| 493 | NFSPROC4_CLNT_LINK, |
| 494 | NFSPROC4_CLNT_SYMLINK, |
| 495 | NFSPROC4_CLNT_CREATE, |
| 496 | NFSPROC4_CLNT_PATHCONF, |
| 497 | NFSPROC4_CLNT_STATFS, |
| 498 | NFSPROC4_CLNT_READLINK, |
| 499 | NFSPROC4_CLNT_READDIR, |
| 500 | NFSPROC4_CLNT_SERVER_CAPS, |
| 501 | NFSPROC4_CLNT_DELEGRETURN, |
J. Bruce Fields | 029d105 | 2005-06-22 17:16:22 +0000 | [diff] [blame] | 502 | NFSPROC4_CLNT_GETACL, |
J. Bruce Fields | 23ec696 | 2005-06-22 17:16:22 +0000 | [diff] [blame] | 503 | NFSPROC4_CLNT_SETACL, |
Trond Myklebust | 683b57b | 2006-06-09 09:34:22 -0400 | [diff] [blame] | 504 | NFSPROC4_CLNT_FS_LOCATIONS, |
Benny Halevy | 18df188 | 2009-04-03 08:27:36 +0300 | [diff] [blame] | 505 | |
| 506 | /* nfs41 */ |
| 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, |
| 512 | }; |
| 513 | |
| 514 | /* nfs41 types */ |
| 515 | struct nfs4_sessionid { |
| 516 | unsigned char data[NFS4_MAX_SESSIONID_LEN]; |
| 517 | }; |
| 518 | |
| 519 | /* Create Session Flags */ |
| 520 | #define SESSION4_PERSIST 0x001 |
| 521 | #define SESSION4_BACK_CHAN 0x002 |
| 522 | #define SESSION4_RDMA 0x004 |
| 523 | |
| 524 | enum state_protect_how4 { |
| 525 | SP4_NONE = 0, |
| 526 | SP4_MACH_CRED = 1, |
| 527 | SP4_SSV = 2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 528 | }; |
| 529 | |
| 530 | #endif |
| 531 | #endif |
| 532 | |
| 533 | /* |
| 534 | * Local variables: |
| 535 | * c-basic-offset: 8 |
| 536 | * End: |
| 537 | */ |