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 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #ifndef _LINUX_NFS4_H |
| 13 | #define _LINUX_NFS4_H |
| 14 | |
David Woodhouse | 997b7af | 2006-04-25 14:51:45 +0100 | [diff] [blame] | 15 | #include <linux/list.h> |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 16 | #include <uapi/linux/nfs4.h> |
David Woodhouse | 997b7af | 2006-04-25 14:51:45 +0100 | [diff] [blame] | 17 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | struct nfs4_ace { |
| 19 | uint32_t type; |
| 20 | uint32_t flag; |
| 21 | uint32_t access_mask; |
| 22 | int whotype; |
| 23 | uid_t who; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | }; |
| 25 | |
| 26 | struct nfs4_acl { |
| 27 | uint32_t naces; |
J. Bruce Fields | 28e05dd | 2007-02-16 01:28:30 -0800 | [diff] [blame] | 28 | struct nfs4_ace aces[0]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | }; |
| 30 | |
| 31 | typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; |
Alexandros Batsakis | 9449925 | 2010-10-20 00:17:56 -0400 | [diff] [blame] | 32 | |
Trond Myklebust | 2d2f24a | 2012-03-04 18:13:57 -0500 | [diff] [blame] | 33 | struct nfs_stateid4 { |
Alexandros Batsakis | 9449925 | 2010-10-20 00:17:56 -0400 | [diff] [blame] | 34 | __be32 seqid; |
| 35 | char other[NFS4_STATEID_OTHER_SIZE]; |
| 36 | } __attribute__ ((packed)); |
| 37 | |
Trond Myklebust | 2d2f24a | 2012-03-04 18:13:57 -0500 | [diff] [blame] | 38 | typedef struct nfs_stateid4 nfs4_stateid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | enum nfs_opnum4 { |
| 41 | OP_ACCESS = 3, |
| 42 | OP_CLOSE = 4, |
| 43 | OP_COMMIT = 5, |
| 44 | OP_CREATE = 6, |
| 45 | OP_DELEGPURGE = 7, |
| 46 | OP_DELEGRETURN = 8, |
| 47 | OP_GETATTR = 9, |
| 48 | OP_GETFH = 10, |
| 49 | OP_LINK = 11, |
| 50 | OP_LOCK = 12, |
| 51 | OP_LOCKT = 13, |
| 52 | OP_LOCKU = 14, |
| 53 | OP_LOOKUP = 15, |
| 54 | OP_LOOKUPP = 16, |
| 55 | OP_NVERIFY = 17, |
| 56 | OP_OPEN = 18, |
| 57 | OP_OPENATTR = 19, |
| 58 | OP_OPEN_CONFIRM = 20, |
| 59 | OP_OPEN_DOWNGRADE = 21, |
| 60 | OP_PUTFH = 22, |
| 61 | OP_PUTPUBFH = 23, |
| 62 | OP_PUTROOTFH = 24, |
| 63 | OP_READ = 25, |
| 64 | OP_READDIR = 26, |
| 65 | OP_READLINK = 27, |
| 66 | OP_REMOVE = 28, |
| 67 | OP_RENAME = 29, |
| 68 | OP_RENEW = 30, |
| 69 | OP_RESTOREFH = 31, |
| 70 | OP_SAVEFH = 32, |
| 71 | OP_SECINFO = 33, |
| 72 | OP_SETATTR = 34, |
| 73 | OP_SETCLIENTID = 35, |
| 74 | OP_SETCLIENTID_CONFIRM = 36, |
| 75 | OP_VERIFY = 37, |
| 76 | OP_WRITE = 38, |
| 77 | OP_RELEASE_LOCKOWNER = 39, |
Benny Halevy | 18df188 | 2009-04-03 08:27:36 +0300 | [diff] [blame] | 78 | |
| 79 | /* nfs41 */ |
| 80 | OP_BACKCHANNEL_CTL = 40, |
| 81 | OP_BIND_CONN_TO_SESSION = 41, |
| 82 | OP_EXCHANGE_ID = 42, |
| 83 | OP_CREATE_SESSION = 43, |
| 84 | OP_DESTROY_SESSION = 44, |
| 85 | OP_FREE_STATEID = 45, |
| 86 | OP_GET_DIR_DELEGATION = 46, |
| 87 | OP_GETDEVICEINFO = 47, |
| 88 | OP_GETDEVICELIST = 48, |
| 89 | OP_LAYOUTCOMMIT = 49, |
| 90 | OP_LAYOUTGET = 50, |
| 91 | OP_LAYOUTRETURN = 51, |
| 92 | OP_SECINFO_NO_NAME = 52, |
| 93 | OP_SEQUENCE = 53, |
| 94 | OP_SET_SSV = 54, |
| 95 | OP_TEST_STATEID = 55, |
| 96 | OP_WANT_DELEGATION = 56, |
| 97 | OP_DESTROY_CLIENTID = 57, |
| 98 | OP_RECLAIM_COMPLETE = 58, |
| 99 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | OP_ILLEGAL = 10044, |
| 101 | }; |
| 102 | |
Shankar Anand | e2b2095 | 2006-07-10 04:45:44 -0700 | [diff] [blame] | 103 | /*Defining first and last NFS4 operations implemented. |
| 104 | Needs to be updated if more operations are defined in future.*/ |
| 105 | |
| 106 | #define FIRST_NFS4_OP OP_ACCESS |
Benny Halevy | 5a421ce | 2009-07-10 12:37:40 +0300 | [diff] [blame] | 107 | #define LAST_NFS4_OP OP_RECLAIM_COMPLETE |
Shankar Anand | e2b2095 | 2006-07-10 04:45:44 -0700 | [diff] [blame] | 108 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | enum nfsstat4 { |
| 110 | NFS4_OK = 0, |
| 111 | NFS4ERR_PERM = 1, |
| 112 | NFS4ERR_NOENT = 2, |
| 113 | NFS4ERR_IO = 5, |
| 114 | NFS4ERR_NXIO = 6, |
| 115 | NFS4ERR_ACCESS = 13, |
| 116 | NFS4ERR_EXIST = 17, |
| 117 | NFS4ERR_XDEV = 18, |
| 118 | /* Unused/reserved 19 */ |
| 119 | NFS4ERR_NOTDIR = 20, |
| 120 | NFS4ERR_ISDIR = 21, |
| 121 | NFS4ERR_INVAL = 22, |
| 122 | NFS4ERR_FBIG = 27, |
| 123 | NFS4ERR_NOSPC = 28, |
| 124 | NFS4ERR_ROFS = 30, |
| 125 | NFS4ERR_MLINK = 31, |
| 126 | NFS4ERR_NAMETOOLONG = 63, |
| 127 | NFS4ERR_NOTEMPTY = 66, |
| 128 | NFS4ERR_DQUOT = 69, |
| 129 | NFS4ERR_STALE = 70, |
| 130 | NFS4ERR_BADHANDLE = 10001, |
| 131 | NFS4ERR_BAD_COOKIE = 10003, |
| 132 | NFS4ERR_NOTSUPP = 10004, |
| 133 | NFS4ERR_TOOSMALL = 10005, |
| 134 | NFS4ERR_SERVERFAULT = 10006, |
| 135 | NFS4ERR_BADTYPE = 10007, |
| 136 | NFS4ERR_DELAY = 10008, |
| 137 | NFS4ERR_SAME = 10009, |
| 138 | NFS4ERR_DENIED = 10010, |
| 139 | NFS4ERR_EXPIRED = 10011, |
| 140 | NFS4ERR_LOCKED = 10012, |
| 141 | NFS4ERR_GRACE = 10013, |
| 142 | NFS4ERR_FHEXPIRED = 10014, |
| 143 | NFS4ERR_SHARE_DENIED = 10015, |
| 144 | NFS4ERR_WRONGSEC = 10016, |
| 145 | NFS4ERR_CLID_INUSE = 10017, |
| 146 | NFS4ERR_RESOURCE = 10018, |
| 147 | NFS4ERR_MOVED = 10019, |
| 148 | NFS4ERR_NOFILEHANDLE = 10020, |
| 149 | NFS4ERR_MINOR_VERS_MISMATCH = 10021, |
| 150 | NFS4ERR_STALE_CLIENTID = 10022, |
| 151 | NFS4ERR_STALE_STATEID = 10023, |
| 152 | NFS4ERR_OLD_STATEID = 10024, |
| 153 | NFS4ERR_BAD_STATEID = 10025, |
| 154 | NFS4ERR_BAD_SEQID = 10026, |
| 155 | NFS4ERR_NOT_SAME = 10027, |
| 156 | NFS4ERR_LOCK_RANGE = 10028, |
| 157 | NFS4ERR_SYMLINK = 10029, |
| 158 | NFS4ERR_RESTOREFH = 10030, |
| 159 | NFS4ERR_LEASE_MOVED = 10031, |
| 160 | NFS4ERR_ATTRNOTSUPP = 10032, |
| 161 | NFS4ERR_NO_GRACE = 10033, |
| 162 | NFS4ERR_RECLAIM_BAD = 10034, |
| 163 | NFS4ERR_RECLAIM_CONFLICT = 10035, |
| 164 | NFS4ERR_BADXDR = 10036, |
| 165 | NFS4ERR_LOCKS_HELD = 10037, |
| 166 | NFS4ERR_OPENMODE = 10038, |
| 167 | NFS4ERR_BADOWNER = 10039, |
| 168 | NFS4ERR_BADCHAR = 10040, |
| 169 | NFS4ERR_BADNAME = 10041, |
| 170 | NFS4ERR_BAD_RANGE = 10042, |
| 171 | NFS4ERR_LOCK_NOTSUPP = 10043, |
| 172 | NFS4ERR_OP_ILLEGAL = 10044, |
| 173 | NFS4ERR_DEADLOCK = 10045, |
| 174 | NFS4ERR_FILE_OPEN = 10046, |
| 175 | NFS4ERR_ADMIN_REVOKED = 10047, |
Benny Halevy | 18df188 | 2009-04-03 08:27:36 +0300 | [diff] [blame] | 176 | NFS4ERR_CB_PATH_DOWN = 10048, |
| 177 | |
| 178 | /* nfs41 */ |
| 179 | NFS4ERR_BADIOMODE = 10049, |
| 180 | NFS4ERR_BADLAYOUT = 10050, |
| 181 | NFS4ERR_BAD_SESSION_DIGEST = 10051, |
| 182 | NFS4ERR_BADSESSION = 10052, |
| 183 | NFS4ERR_BADSLOT = 10053, |
| 184 | NFS4ERR_COMPLETE_ALREADY = 10054, |
| 185 | NFS4ERR_CONN_NOT_BOUND_TO_SESSION = 10055, |
| 186 | NFS4ERR_DELEG_ALREADY_WANTED = 10056, |
| 187 | NFS4ERR_BACK_CHAN_BUSY = 10057, /* backchan reqs outstanding */ |
| 188 | NFS4ERR_LAYOUTTRYLATER = 10058, |
| 189 | NFS4ERR_LAYOUTUNAVAILABLE = 10059, |
| 190 | NFS4ERR_NOMATCHING_LAYOUT = 10060, |
| 191 | NFS4ERR_RECALLCONFLICT = 10061, |
| 192 | NFS4ERR_UNKNOWN_LAYOUTTYPE = 10062, |
| 193 | NFS4ERR_SEQ_MISORDERED = 10063, /* unexpected seq.id in req */ |
| 194 | NFS4ERR_SEQUENCE_POS = 10064, /* [CB_]SEQ. op not 1st op */ |
| 195 | NFS4ERR_REQ_TOO_BIG = 10065, /* request too big */ |
| 196 | NFS4ERR_REP_TOO_BIG = 10066, /* reply too big */ |
| 197 | NFS4ERR_REP_TOO_BIG_TO_CACHE = 10067, /* rep. not all cached */ |
| 198 | NFS4ERR_RETRY_UNCACHED_REP = 10068, /* retry & rep. uncached */ |
| 199 | NFS4ERR_UNSAFE_COMPOUND = 10069, /* retry/recovery too hard */ |
| 200 | NFS4ERR_TOO_MANY_OPS = 10070, /* too many ops in [CB_]COMP */ |
| 201 | NFS4ERR_OP_NOT_IN_SESSION = 10071, /* op needs [CB_]SEQ. op */ |
| 202 | NFS4ERR_HASH_ALG_UNSUPP = 10072, /* hash alg. not supp. */ |
| 203 | /* Error 10073 is unused. */ |
| 204 | NFS4ERR_CLIENTID_BUSY = 10074, /* clientid has state */ |
| 205 | NFS4ERR_PNFS_IO_HOLE = 10075, /* IO to _SPARSE file hole */ |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 206 | NFS4ERR_SEQ_FALSE_RETRY = 10076, /* retry not original */ |
Benny Halevy | 18df188 | 2009-04-03 08:27:36 +0300 | [diff] [blame] | 207 | NFS4ERR_BAD_HIGH_SLOT = 10077, /* sequence arg bad */ |
| 208 | NFS4ERR_DEADSESSION = 10078, /* persistent session dead */ |
| 209 | NFS4ERR_ENCR_ALG_UNSUPP = 10079, /* SSV alg mismatch */ |
| 210 | NFS4ERR_PNFS_NO_LAYOUT = 10080, /* direct I/O with no layout */ |
| 211 | NFS4ERR_NOT_ONLY_OP = 10081, /* bad compound */ |
| 212 | NFS4ERR_WRONG_CRED = 10082, /* permissions:state change */ |
| 213 | NFS4ERR_WRONG_TYPE = 10083, /* current operation mismatch */ |
| 214 | NFS4ERR_DIRDELEG_UNAVAIL = 10084, /* no directory delegation */ |
| 215 | NFS4ERR_REJECT_DELEG = 10085, /* on callback */ |
| 216 | NFS4ERR_RETURNCONFLICT = 10086, /* outstanding layoutreturn */ |
| 217 | NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | }; |
| 219 | |
J. Bruce Fields | a9004ab | 2011-08-23 15:43:04 -0400 | [diff] [blame] | 220 | static inline bool seqid_mutating_err(u32 err) |
| 221 | { |
| 222 | /* rfc 3530 section 8.1.5: */ |
| 223 | switch (err) { |
| 224 | case NFS4ERR_STALE_CLIENTID: |
| 225 | case NFS4ERR_STALE_STATEID: |
| 226 | case NFS4ERR_BAD_STATEID: |
| 227 | case NFS4ERR_BAD_SEQID: |
| 228 | case NFS4ERR_BADXDR: |
| 229 | case NFS4ERR_RESOURCE: |
| 230 | case NFS4ERR_NOFILEHANDLE: |
| 231 | return false; |
| 232 | }; |
| 233 | return true; |
| 234 | } |
| 235 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | /* |
| 237 | * Note: NF4BAD is not actually part of the protocol; it is just used |
| 238 | * internally by nfsd. |
| 239 | */ |
| 240 | enum nfs_ftype4 { |
| 241 | NF4BAD = 0, |
| 242 | NF4REG = 1, /* Regular File */ |
| 243 | NF4DIR = 2, /* Directory */ |
| 244 | NF4BLK = 3, /* Special File - block device */ |
| 245 | NF4CHR = 4, /* Special File - character device */ |
| 246 | NF4LNK = 5, /* Symbolic Link */ |
| 247 | NF4SOCK = 6, /* Special File - socket */ |
| 248 | NF4FIFO = 7, /* Special File - fifo */ |
| 249 | NF4ATTRDIR = 8, /* Attribute Directory */ |
| 250 | NF4NAMEDATTR = 9 /* Named Attribute */ |
| 251 | }; |
| 252 | |
| 253 | enum open_claim_type4 { |
| 254 | NFS4_OPEN_CLAIM_NULL = 0, |
| 255 | NFS4_OPEN_CLAIM_PREVIOUS = 1, |
| 256 | NFS4_OPEN_CLAIM_DELEGATE_CUR = 2, |
J. Bruce Fields | 8b289b2 | 2011-10-19 11:52:12 -0400 | [diff] [blame] | 257 | NFS4_OPEN_CLAIM_DELEGATE_PREV = 3, |
| 258 | NFS4_OPEN_CLAIM_FH = 4, /* 4.1 */ |
| 259 | NFS4_OPEN_CLAIM_DELEG_CUR_FH = 5, /* 4.1 */ |
| 260 | NFS4_OPEN_CLAIM_DELEG_PREV_FH = 6, /* 4.1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | }; |
| 262 | |
| 263 | enum opentype4 { |
| 264 | NFS4_OPEN_NOCREATE = 0, |
| 265 | NFS4_OPEN_CREATE = 1 |
| 266 | }; |
| 267 | |
| 268 | enum createmode4 { |
| 269 | NFS4_CREATE_UNCHECKED = 0, |
| 270 | NFS4_CREATE_GUARDED = 1, |
Benny Halevy | 79fb54a | 2009-04-03 08:29:17 +0300 | [diff] [blame] | 271 | NFS4_CREATE_EXCLUSIVE = 2, |
| 272 | /* |
| 273 | * New to NFSv4.1. If session is persistent, |
| 274 | * GUARDED4 MUST be used. Otherwise, use |
| 275 | * EXCLUSIVE4_1 instead of EXCLUSIVE4. |
| 276 | */ |
| 277 | NFS4_CREATE_EXCLUSIVE4_1 = 3 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | }; |
| 279 | |
| 280 | enum limit_by4 { |
| 281 | NFS4_LIMIT_SIZE = 1, |
| 282 | NFS4_LIMIT_BLOCKS = 2 |
| 283 | }; |
| 284 | |
| 285 | enum open_delegation_type4 { |
| 286 | NFS4_OPEN_DELEGATE_NONE = 0, |
| 287 | NFS4_OPEN_DELEGATE_READ = 1, |
Benny Halevy | d24433c | 2012-02-16 20:57:17 +0200 | [diff] [blame] | 288 | NFS4_OPEN_DELEGATE_WRITE = 2, |
| 289 | NFS4_OPEN_DELEGATE_NONE_EXT = 3, /* 4.1 */ |
| 290 | }; |
| 291 | |
| 292 | enum why_no_delegation4 { /* new to v4.1 */ |
| 293 | WND4_NOT_WANTED = 0, |
| 294 | WND4_CONTENTION = 1, |
| 295 | WND4_RESOURCE = 2, |
| 296 | WND4_NOT_SUPP_FTYPE = 3, |
| 297 | WND4_WRITE_DELEG_NOT_SUPP_FTYPE = 4, |
| 298 | WND4_NOT_SUPP_UPGRADE = 5, |
| 299 | WND4_NOT_SUPP_DOWNGRADE = 6, |
| 300 | WND4_CANCELLED = 7, |
| 301 | WND4_IS_DIR = 8, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | }; |
| 303 | |
| 304 | enum lock_type4 { |
| 305 | NFS4_UNLOCK_LT = 0, |
| 306 | NFS4_READ_LT = 1, |
| 307 | NFS4_WRITE_LT = 2, |
| 308 | NFS4_READW_LT = 3, |
| 309 | NFS4_WRITEW_LT = 4 |
| 310 | }; |
| 311 | |
| 312 | |
| 313 | /* Mandatory Attributes */ |
| 314 | #define FATTR4_WORD0_SUPPORTED_ATTRS (1UL << 0) |
| 315 | #define FATTR4_WORD0_TYPE (1UL << 1) |
| 316 | #define FATTR4_WORD0_FH_EXPIRE_TYPE (1UL << 2) |
| 317 | #define FATTR4_WORD0_CHANGE (1UL << 3) |
| 318 | #define FATTR4_WORD0_SIZE (1UL << 4) |
| 319 | #define FATTR4_WORD0_LINK_SUPPORT (1UL << 5) |
| 320 | #define FATTR4_WORD0_SYMLINK_SUPPORT (1UL << 6) |
| 321 | #define FATTR4_WORD0_NAMED_ATTR (1UL << 7) |
| 322 | #define FATTR4_WORD0_FSID (1UL << 8) |
| 323 | #define FATTR4_WORD0_UNIQUE_HANDLES (1UL << 9) |
| 324 | #define FATTR4_WORD0_LEASE_TIME (1UL << 10) |
| 325 | #define FATTR4_WORD0_RDATTR_ERROR (1UL << 11) |
Benny Halevy | 8c18f20 | 2009-04-03 08:29:14 +0300 | [diff] [blame] | 326 | /* Mandatory in NFSv4.1 */ |
| 327 | #define FATTR4_WORD2_SUPPATTR_EXCLCREAT (1UL << 11) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | |
| 329 | /* Recommended Attributes */ |
| 330 | #define FATTR4_WORD0_ACL (1UL << 12) |
| 331 | #define FATTR4_WORD0_ACLSUPPORT (1UL << 13) |
| 332 | #define FATTR4_WORD0_ARCHIVE (1UL << 14) |
| 333 | #define FATTR4_WORD0_CANSETTIME (1UL << 15) |
| 334 | #define FATTR4_WORD0_CASE_INSENSITIVE (1UL << 16) |
| 335 | #define FATTR4_WORD0_CASE_PRESERVING (1UL << 17) |
| 336 | #define FATTR4_WORD0_CHOWN_RESTRICTED (1UL << 18) |
| 337 | #define FATTR4_WORD0_FILEHANDLE (1UL << 19) |
| 338 | #define FATTR4_WORD0_FILEID (1UL << 20) |
| 339 | #define FATTR4_WORD0_FILES_AVAIL (1UL << 21) |
| 340 | #define FATTR4_WORD0_FILES_FREE (1UL << 22) |
| 341 | #define FATTR4_WORD0_FILES_TOTAL (1UL << 23) |
| 342 | #define FATTR4_WORD0_FS_LOCATIONS (1UL << 24) |
| 343 | #define FATTR4_WORD0_HIDDEN (1UL << 25) |
| 344 | #define FATTR4_WORD0_HOMOGENEOUS (1UL << 26) |
| 345 | #define FATTR4_WORD0_MAXFILESIZE (1UL << 27) |
| 346 | #define FATTR4_WORD0_MAXLINK (1UL << 28) |
| 347 | #define FATTR4_WORD0_MAXNAME (1UL << 29) |
| 348 | #define FATTR4_WORD0_MAXREAD (1UL << 30) |
| 349 | #define FATTR4_WORD0_MAXWRITE (1UL << 31) |
| 350 | #define FATTR4_WORD1_MIMETYPE (1UL << 0) |
| 351 | #define FATTR4_WORD1_MODE (1UL << 1) |
| 352 | #define FATTR4_WORD1_NO_TRUNC (1UL << 2) |
| 353 | #define FATTR4_WORD1_NUMLINKS (1UL << 3) |
| 354 | #define FATTR4_WORD1_OWNER (1UL << 4) |
| 355 | #define FATTR4_WORD1_OWNER_GROUP (1UL << 5) |
| 356 | #define FATTR4_WORD1_QUOTA_HARD (1UL << 6) |
| 357 | #define FATTR4_WORD1_QUOTA_SOFT (1UL << 7) |
| 358 | #define FATTR4_WORD1_QUOTA_USED (1UL << 8) |
| 359 | #define FATTR4_WORD1_RAWDEV (1UL << 9) |
| 360 | #define FATTR4_WORD1_SPACE_AVAIL (1UL << 10) |
| 361 | #define FATTR4_WORD1_SPACE_FREE (1UL << 11) |
| 362 | #define FATTR4_WORD1_SPACE_TOTAL (1UL << 12) |
| 363 | #define FATTR4_WORD1_SPACE_USED (1UL << 13) |
| 364 | #define FATTR4_WORD1_SYSTEM (1UL << 14) |
| 365 | #define FATTR4_WORD1_TIME_ACCESS (1UL << 15) |
| 366 | #define FATTR4_WORD1_TIME_ACCESS_SET (1UL << 16) |
| 367 | #define FATTR4_WORD1_TIME_BACKUP (1UL << 17) |
| 368 | #define FATTR4_WORD1_TIME_CREATE (1UL << 18) |
| 369 | #define FATTR4_WORD1_TIME_DELTA (1UL << 19) |
| 370 | #define FATTR4_WORD1_TIME_METADATA (1UL << 20) |
| 371 | #define FATTR4_WORD1_TIME_MODIFY (1UL << 21) |
| 372 | #define FATTR4_WORD1_TIME_MODIFY_SET (1UL << 22) |
| 373 | #define FATTR4_WORD1_MOUNTED_ON_FILEID (1UL << 23) |
Dean Hildebrand | c772567d | 2010-10-20 00:17:55 -0400 | [diff] [blame] | 374 | #define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30) |
| 375 | #define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) |
Andy Adamson | 88034c3 | 2012-05-23 05:02:34 -0400 | [diff] [blame] | 376 | #define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4) |
| 377 | |
| 378 | /* MDS threshold bitmap bits */ |
| 379 | #define THRESHOLD_RD (1UL << 0) |
| 380 | #define THRESHOLD_WR (1UL << 1) |
| 381 | #define THRESHOLD_RD_IO (1UL << 2) |
| 382 | #define THRESHOLD_WR_IO (1UL << 3) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | |
| 384 | #define NFSPROC4_NULL 0 |
| 385 | #define NFSPROC4_COMPOUND 1 |
Chuck Lever | 764302c | 2009-09-08 19:50:03 -0400 | [diff] [blame] | 386 | #define NFS4_VERSION 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 387 | #define NFS4_MINOR_VERSION 0 |
Mike Sager | 44549df | 2009-04-01 09:21:47 -0400 | [diff] [blame] | 388 | |
| 389 | #if defined(CONFIG_NFS_V4_1) |
| 390 | #define NFS4_MAX_MINOR_VERSION 1 |
| 391 | #else |
| 392 | #define NFS4_MAX_MINOR_VERSION 0 |
| 393 | #endif /* CONFIG_NFS_V4_1 */ |
| 394 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 395 | #define NFS4_DEBUG 1 |
| 396 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 397 | /* Index of predefined Linux client operations */ |
| 398 | |
| 399 | enum { |
| 400 | NFSPROC4_CLNT_NULL = 0, /* Unused */ |
| 401 | NFSPROC4_CLNT_READ, |
| 402 | NFSPROC4_CLNT_WRITE, |
| 403 | NFSPROC4_CLNT_COMMIT, |
| 404 | NFSPROC4_CLNT_OPEN, |
| 405 | NFSPROC4_CLNT_OPEN_CONFIRM, |
| 406 | NFSPROC4_CLNT_OPEN_NOATTR, |
| 407 | NFSPROC4_CLNT_OPEN_DOWNGRADE, |
| 408 | NFSPROC4_CLNT_CLOSE, |
| 409 | NFSPROC4_CLNT_SETATTR, |
| 410 | NFSPROC4_CLNT_FSINFO, |
| 411 | NFSPROC4_CLNT_RENEW, |
| 412 | NFSPROC4_CLNT_SETCLIENTID, |
| 413 | NFSPROC4_CLNT_SETCLIENTID_CONFIRM, |
| 414 | NFSPROC4_CLNT_LOCK, |
| 415 | NFSPROC4_CLNT_LOCKT, |
| 416 | NFSPROC4_CLNT_LOCKU, |
| 417 | NFSPROC4_CLNT_ACCESS, |
| 418 | NFSPROC4_CLNT_GETATTR, |
| 419 | NFSPROC4_CLNT_LOOKUP, |
| 420 | NFSPROC4_CLNT_LOOKUP_ROOT, |
| 421 | NFSPROC4_CLNT_REMOVE, |
| 422 | NFSPROC4_CLNT_RENAME, |
| 423 | NFSPROC4_CLNT_LINK, |
| 424 | NFSPROC4_CLNT_SYMLINK, |
| 425 | NFSPROC4_CLNT_CREATE, |
| 426 | NFSPROC4_CLNT_PATHCONF, |
| 427 | NFSPROC4_CLNT_STATFS, |
| 428 | NFSPROC4_CLNT_READLINK, |
| 429 | NFSPROC4_CLNT_READDIR, |
| 430 | NFSPROC4_CLNT_SERVER_CAPS, |
| 431 | NFSPROC4_CLNT_DELEGRETURN, |
J. Bruce Fields | 029d105 | 2005-06-22 17:16:22 +0000 | [diff] [blame] | 432 | NFSPROC4_CLNT_GETACL, |
J. Bruce Fields | 23ec696 | 2005-06-22 17:16:22 +0000 | [diff] [blame] | 433 | NFSPROC4_CLNT_SETACL, |
Trond Myklebust | 683b57b | 2006-06-09 09:34:22 -0400 | [diff] [blame] | 434 | NFSPROC4_CLNT_FS_LOCATIONS, |
Trond Myklebust | d3c7b7c | 2010-07-01 12:49:01 -0400 | [diff] [blame] | 435 | NFSPROC4_CLNT_RELEASE_LOCKOWNER, |
Bryan Schumaker | 5a5ea0d | 2011-03-24 17:12:29 +0000 | [diff] [blame] | 436 | NFSPROC4_CLNT_SECINFO, |
Benny Halevy | 18df188 | 2009-04-03 08:27:36 +0300 | [diff] [blame] | 437 | |
| 438 | /* nfs41 */ |
| 439 | NFSPROC4_CLNT_EXCHANGE_ID, |
| 440 | NFSPROC4_CLNT_CREATE_SESSION, |
| 441 | NFSPROC4_CLNT_DESTROY_SESSION, |
| 442 | NFSPROC4_CLNT_SEQUENCE, |
| 443 | NFSPROC4_CLNT_GET_LEASE_TIME, |
Ricardo Labiaga | 18019753 | 2009-12-05 16:08:40 -0500 | [diff] [blame] | 444 | NFSPROC4_CLNT_RECLAIM_COMPLETE, |
Andy Adamson | b1f69b7 | 2010-10-20 00:18:03 -0400 | [diff] [blame] | 445 | NFSPROC4_CLNT_LAYOUTGET, |
| 446 | NFSPROC4_CLNT_GETDEVICEINFO, |
Andy Adamson | 863a3c6 | 2011-03-23 13:27:54 +0000 | [diff] [blame] | 447 | NFSPROC4_CLNT_LAYOUTCOMMIT, |
Benny Halevy | cbe8260 | 2011-05-22 19:52:37 +0300 | [diff] [blame] | 448 | NFSPROC4_CLNT_LAYOUTRETURN, |
Bryan Schumaker | fca78d6 | 2011-06-02 14:59:07 -0400 | [diff] [blame] | 449 | NFSPROC4_CLNT_SECINFO_NO_NAME, |
Bryan Schumaker | 7d97479 | 2011-06-02 14:59:08 -0400 | [diff] [blame] | 450 | NFSPROC4_CLNT_TEST_STATEID, |
Bryan Schumaker | 9aeda35 | 2011-06-02 14:59:09 -0400 | [diff] [blame] | 451 | NFSPROC4_CLNT_FREE_STATEID, |
Andy Adamson | 7f11d8d | 2011-07-30 20:52:35 -0400 | [diff] [blame] | 452 | NFSPROC4_CLNT_GETDEVICELIST, |
Trond Myklebust | ad24ecf | 2012-05-25 17:11:42 -0400 | [diff] [blame] | 453 | NFSPROC4_CLNT_BIND_CONN_TO_SESSION, |
Trond Myklebust | 6624553 | 2012-05-25 17:18:09 -0400 | [diff] [blame] | 454 | NFSPROC4_CLNT_DESTROY_CLIENTID, |
Benny Halevy | 18df188 | 2009-04-03 08:27:36 +0300 | [diff] [blame] | 455 | }; |
| 456 | |
| 457 | /* nfs41 types */ |
| 458 | struct nfs4_sessionid { |
| 459 | unsigned char data[NFS4_MAX_SESSIONID_LEN]; |
| 460 | }; |
| 461 | |
| 462 | /* Create Session Flags */ |
Mi Jinlong | a62573d | 2011-03-23 17:57:07 +0800 | [diff] [blame] | 463 | #define SESSION4_PERSIST 0x001 |
| 464 | #define SESSION4_BACK_CHAN 0x002 |
| 465 | #define SESSION4_RDMA 0x004 |
| 466 | |
| 467 | #define SESSION4_FLAG_MASK_A 0x007 |
Benny Halevy | 18df188 | 2009-04-03 08:27:36 +0300 | [diff] [blame] | 468 | |
| 469 | enum state_protect_how4 { |
| 470 | SP4_NONE = 0, |
| 471 | SP4_MACH_CRED = 1, |
| 472 | SP4_SSV = 2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | }; |
| 474 | |
Dean Hildebrand | c772567d | 2010-10-20 00:17:55 -0400 | [diff] [blame] | 475 | enum pnfs_layouttype { |
| 476 | LAYOUT_NFSV4_1_FILES = 1, |
| 477 | LAYOUT_OSD2_OBJECTS = 2, |
| 478 | LAYOUT_BLOCK_VOLUME = 3, |
| 479 | }; |
| 480 | |
| 481 | /* used for both layout return and recall */ |
| 482 | enum pnfs_layoutreturn_type { |
| 483 | RETURN_FILE = 1, |
| 484 | RETURN_FSID = 2, |
| 485 | RETURN_ALL = 3 |
| 486 | }; |
| 487 | |
| 488 | enum pnfs_iomode { |
| 489 | IOMODE_READ = 1, |
| 490 | IOMODE_RW = 2, |
| 491 | IOMODE_ANY = 3, |
| 492 | }; |
| 493 | |
| 494 | enum pnfs_notify_deviceid_type4 { |
| 495 | NOTIFY_DEVICEID4_CHANGE = 1 << 1, |
| 496 | NOTIFY_DEVICEID4_DELETE = 1 << 2, |
| 497 | }; |
| 498 | |
| 499 | #define NFL4_UFLG_MASK 0x0000003F |
| 500 | #define NFL4_UFLG_DENSE 0x00000001 |
| 501 | #define NFL4_UFLG_COMMIT_THRU_MDS 0x00000002 |
| 502 | #define NFL4_UFLG_STRIPE_UNIT_SIZE_MASK 0xFFFFFFC0 |
| 503 | |
| 504 | /* Encoded in the loh_body field of type layouthint4 */ |
| 505 | enum filelayout_hint_care4 { |
| 506 | NFLH4_CARE_DENSE = NFL4_UFLG_DENSE, |
| 507 | NFLH4_CARE_COMMIT_THRU_MDS = NFL4_UFLG_COMMIT_THRU_MDS, |
| 508 | NFLH4_CARE_STRIPE_UNIT_SIZE = 0x00000040, |
| 509 | NFLH4_CARE_STRIPE_COUNT = 0x00000080 |
| 510 | }; |
| 511 | |
| 512 | #define NFS4_DEVICEID4_SIZE 16 |
| 513 | |
| 514 | struct nfs4_deviceid { |
| 515 | char data[NFS4_DEVICEID4_SIZE]; |
| 516 | }; |
| 517 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 518 | #endif |