linux/include/linux/nfs4.h
<<
>>
Prefs
   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>
  17
  18#define NFS4_BITMAP_SIZE        2
  19#define NFS4_VERIFIER_SIZE      8
  20#define NFS4_STATEID_SEQID_SIZE 4
  21#define NFS4_STATEID_OTHER_SIZE 12
  22#define NFS4_STATEID_SIZE       (NFS4_STATEID_SEQID_SIZE + NFS4_STATEID_OTHER_SIZE)
  23#define NFS4_FHSIZE             128
  24#define NFS4_MAXPATHLEN         PATH_MAX
  25#define NFS4_MAXNAMLEN          NAME_MAX
  26#define NFS4_OPAQUE_LIMIT       1024
  27#define NFS4_MAX_SESSIONID_LEN  16
  28
  29#define NFS4_ACCESS_READ        0x0001
  30#define NFS4_ACCESS_LOOKUP      0x0002
  31#define NFS4_ACCESS_MODIFY      0x0004
  32#define NFS4_ACCESS_EXTEND      0x0008
  33#define NFS4_ACCESS_DELETE      0x0010
  34#define NFS4_ACCESS_EXECUTE     0x0020
  35
  36#define NFS4_FH_PERSISTENT              0x0000
  37#define NFS4_FH_NOEXPIRE_WITH_OPEN      0x0001
  38#define NFS4_FH_VOLATILE_ANY            0x0002
  39#define NFS4_FH_VOL_MIGRATION           0x0004
  40#define NFS4_FH_VOL_RENAME              0x0008
  41
  42#define NFS4_OPEN_RESULT_CONFIRM 0x0002
  43#define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004
  44
  45#define NFS4_SHARE_ACCESS_MASK  0x000F
  46#define NFS4_SHARE_ACCESS_READ  0x0001
  47#define NFS4_SHARE_ACCESS_WRITE 0x0002
  48#define NFS4_SHARE_ACCESS_BOTH  0x0003
  49#define NFS4_SHARE_DENY_READ    0x0001
  50#define NFS4_SHARE_DENY_WRITE   0x0002
  51#define NFS4_SHARE_DENY_BOTH    0x0003
  52
  53/* nfs41 */
  54#define NFS4_SHARE_WANT_MASK            0xFF00
  55#define NFS4_SHARE_WANT_NO_PREFERENCE   0x0000
  56#define NFS4_SHARE_WANT_READ_DELEG      0x0100
  57#define NFS4_SHARE_WANT_WRITE_DELEG     0x0200
  58#define NFS4_SHARE_WANT_ANY_DELEG       0x0300
  59#define NFS4_SHARE_WANT_NO_DELEG        0x0400
  60#define NFS4_SHARE_WANT_CANCEL          0x0500
  61
  62#define NFS4_SHARE_WHEN_MASK            0xF0000
  63#define NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL        0x10000
  64#define NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED          0x20000
  65
  66#define NFS4_CDFC4_FORE 0x1
  67#define NFS4_CDFC4_BACK 0x2
  68#define NFS4_CDFC4_BOTH 0x3
  69#define NFS4_CDFC4_FORE_OR_BOTH 0x3
  70#define NFS4_CDFC4_BACK_OR_BOTH 0x7
  71
  72#define NFS4_CDFS4_FORE 0x1
  73#define NFS4_CDFS4_BACK 0x2
  74#define NFS4_CDFS4_BOTH 0x3
  75
  76#define NFS4_SET_TO_SERVER_TIME 0
  77#define NFS4_SET_TO_CLIENT_TIME 1
  78
  79#define NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE 0
  80#define NFS4_ACE_ACCESS_DENIED_ACE_TYPE  1
  81#define NFS4_ACE_SYSTEM_AUDIT_ACE_TYPE   2
  82#define NFS4_ACE_SYSTEM_ALARM_ACE_TYPE   3
  83
  84#define ACL4_SUPPORT_ALLOW_ACL 0x01
  85#define ACL4_SUPPORT_DENY_ACL  0x02
  86#define ACL4_SUPPORT_AUDIT_ACL 0x04
  87#define ACL4_SUPPORT_ALARM_ACL 0x08
  88
  89#define NFS4_ACE_FILE_INHERIT_ACE             0x00000001
  90#define NFS4_ACE_DIRECTORY_INHERIT_ACE        0x00000002
  91#define NFS4_ACE_NO_PROPAGATE_INHERIT_ACE     0x00000004
  92#define NFS4_ACE_INHERIT_ONLY_ACE             0x00000008
  93#define NFS4_ACE_SUCCESSFUL_ACCESS_ACE_FLAG   0x00000010
  94#define NFS4_ACE_FAILED_ACCESS_ACE_FLAG       0x00000020
  95#define NFS4_ACE_IDENTIFIER_GROUP             0x00000040
  96
  97#define NFS4_ACE_READ_DATA                    0x00000001
  98#define NFS4_ACE_LIST_DIRECTORY               0x00000001
  99#define NFS4_ACE_WRITE_DATA                   0x00000002
 100#define NFS4_ACE_ADD_FILE                     0x00000002
 101#define NFS4_ACE_APPEND_DATA                  0x00000004
 102#define NFS4_ACE_ADD_SUBDIRECTORY             0x00000004
 103#define NFS4_ACE_READ_NAMED_ATTRS             0x00000008
 104#define NFS4_ACE_WRITE_NAMED_ATTRS            0x00000010
 105#define NFS4_ACE_EXECUTE                      0x00000020
 106#define NFS4_ACE_DELETE_CHILD                 0x00000040
 107#define NFS4_ACE_READ_ATTRIBUTES              0x00000080
 108#define NFS4_ACE_WRITE_ATTRIBUTES             0x00000100
 109#define NFS4_ACE_DELETE                       0x00010000
 110#define NFS4_ACE_READ_ACL                     0x00020000
 111#define NFS4_ACE_WRITE_ACL                    0x00040000
 112#define NFS4_ACE_WRITE_OWNER                  0x00080000
 113#define NFS4_ACE_SYNCHRONIZE                  0x00100000
 114#define NFS4_ACE_GENERIC_READ                 0x00120081
 115#define NFS4_ACE_GENERIC_WRITE                0x00160106
 116#define NFS4_ACE_GENERIC_EXECUTE              0x001200A0
 117#define NFS4_ACE_MASK_ALL                     0x001F01FF
 118
 119#define EXCHGID4_FLAG_SUPP_MOVED_REFER          0x00000001
 120#define EXCHGID4_FLAG_SUPP_MOVED_MIGR           0x00000002
 121#define EXCHGID4_FLAG_BIND_PRINC_STATEID        0x00000100
 122
 123#define EXCHGID4_FLAG_USE_NON_PNFS              0x00010000
 124#define EXCHGID4_FLAG_USE_PNFS_MDS              0x00020000
 125#define EXCHGID4_FLAG_USE_PNFS_DS               0x00040000
 126#define EXCHGID4_FLAG_MASK_PNFS                 0x00070000
 127
 128#define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A       0x40000000
 129#define EXCHGID4_FLAG_CONFIRMED_R               0x80000000
 130/*
 131 * Since the validity of these bits depends on whether
 132 * they're set in the argument or response, have separate
 133 * invalid flag masks for arg (_A) and resp (_R).
 134 */
 135#define EXCHGID4_FLAG_MASK_A                    0x40070103
 136#define EXCHGID4_FLAG_MASK_R                    0x80070103
 137
 138#define SEQ4_STATUS_CB_PATH_DOWN                0x00000001
 139#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING    0x00000002
 140#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED     0x00000004
 141#define SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED   0x00000008
 142#define SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED  0x00000010
 143#define SEQ4_STATUS_ADMIN_STATE_REVOKED         0x00000020
 144#define SEQ4_STATUS_RECALLABLE_STATE_REVOKED    0x00000040
 145#define SEQ4_STATUS_LEASE_MOVED                 0x00000080
 146#define SEQ4_STATUS_RESTART_RECLAIM_NEEDED      0x00000100
 147#define SEQ4_STATUS_CB_PATH_DOWN_SESSION        0x00000200
 148#define SEQ4_STATUS_BACKCHANNEL_FAULT           0x00000400
 149
 150#define NFS4_SECINFO_STYLE4_CURRENT_FH  0
 151#define NFS4_SECINFO_STYLE4_PARENT      1
 152
 153#define NFS4_MAX_UINT64 (~(u64)0)
 154
 155/* An NFS4 sessions server must support at least NFS4_MAX_OPS operations.
 156 * If a compound requires more operations, adjust NFS4_MAX_OPS accordingly.
 157 */
 158#define NFS4_MAX_OPS   8
 159
 160/* Our NFS4 client back channel server only wants the cb_sequene and the
 161 * actual operation per compound
 162 */
 163#define NFS4_MAX_BACK_CHANNEL_OPS 2
 164
 165enum nfs4_acl_whotype {
 166        NFS4_ACL_WHO_NAMED = 0,
 167        NFS4_ACL_WHO_OWNER,
 168        NFS4_ACL_WHO_GROUP,
 169        NFS4_ACL_WHO_EVERYONE,
 170};
 171
 172#ifdef __KERNEL__
 173#include <linux/list.h>
 174
 175struct nfs4_ace {
 176        uint32_t        type;
 177        uint32_t        flag;
 178        uint32_t        access_mask;
 179        int             whotype;
 180        uid_t           who;
 181};
 182
 183struct nfs4_acl {
 184        uint32_t        naces;
 185        struct nfs4_ace aces[0];
 186};
 187
 188typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier;
 189
 190struct nfs_stateid4 {
 191        __be32 seqid;
 192        char other[NFS4_STATEID_OTHER_SIZE];
 193} __attribute__ ((packed));
 194
 195typedef struct nfs_stateid4 nfs4_stateid;
 196
 197enum nfs_opnum4 {
 198        OP_ACCESS = 3,
 199        OP_CLOSE = 4,
 200        OP_COMMIT = 5,
 201        OP_CREATE = 6,
 202        OP_DELEGPURGE = 7,
 203        OP_DELEGRETURN = 8,
 204        OP_GETATTR = 9,
 205        OP_GETFH = 10,
 206        OP_LINK = 11,
 207        OP_LOCK = 12,
 208        OP_LOCKT = 13,
 209        OP_LOCKU = 14,
 210        OP_LOOKUP = 15,
 211        OP_LOOKUPP = 16,
 212        OP_NVERIFY = 17,
 213        OP_OPEN = 18,
 214        OP_OPENATTR = 19,
 215        OP_OPEN_CONFIRM = 20,
 216        OP_OPEN_DOWNGRADE = 21,
 217        OP_PUTFH = 22,
 218        OP_PUTPUBFH = 23,
 219        OP_PUTROOTFH = 24,
 220        OP_READ = 25,
 221        OP_READDIR = 26,
 222        OP_READLINK = 27,
 223        OP_REMOVE = 28,
 224        OP_RENAME = 29,
 225        OP_RENEW = 30,
 226        OP_RESTOREFH = 31,
 227        OP_SAVEFH = 32,
 228        OP_SECINFO = 33,
 229        OP_SETATTR = 34,
 230        OP_SETCLIENTID = 35,
 231        OP_SETCLIENTID_CONFIRM = 36,
 232        OP_VERIFY = 37,
 233        OP_WRITE = 38,
 234        OP_RELEASE_LOCKOWNER = 39,
 235
 236        /* nfs41 */
 237        OP_BACKCHANNEL_CTL = 40,
 238        OP_BIND_CONN_TO_SESSION = 41,
 239        OP_EXCHANGE_ID = 42,
 240        OP_CREATE_SESSION = 43,
 241        OP_DESTROY_SESSION = 44,
 242        OP_FREE_STATEID = 45,
 243        OP_GET_DIR_DELEGATION = 46,
 244        OP_GETDEVICEINFO = 47,
 245        OP_GETDEVICELIST = 48,
 246        OP_LAYOUTCOMMIT = 49,
 247        OP_LAYOUTGET = 50,
 248        OP_LAYOUTRETURN = 51,
 249        OP_SECINFO_NO_NAME = 52,
 250        OP_SEQUENCE = 53,
 251        OP_SET_SSV = 54,
 252        OP_TEST_STATEID = 55,
 253        OP_WANT_DELEGATION = 56,
 254        OP_DESTROY_CLIENTID = 57,
 255        OP_RECLAIM_COMPLETE = 58,
 256
 257        OP_ILLEGAL = 10044,
 258};
 259
 260/*Defining first and last NFS4 operations implemented.
 261Needs to be updated if more operations are defined in future.*/
 262
 263#define FIRST_NFS4_OP   OP_ACCESS
 264#define LAST_NFS4_OP    OP_RECLAIM_COMPLETE
 265
 266enum nfsstat4 {
 267        NFS4_OK = 0,
 268        NFS4ERR_PERM = 1,
 269        NFS4ERR_NOENT = 2,
 270        NFS4ERR_IO = 5,
 271        NFS4ERR_NXIO = 6,
 272        NFS4ERR_ACCESS = 13,
 273        NFS4ERR_EXIST = 17,
 274        NFS4ERR_XDEV = 18,
 275        /* Unused/reserved 19 */
 276        NFS4ERR_NOTDIR = 20,
 277        NFS4ERR_ISDIR = 21,
 278        NFS4ERR_INVAL = 22,
 279        NFS4ERR_FBIG = 27,
 280        NFS4ERR_NOSPC = 28,
 281        NFS4ERR_ROFS = 30,
 282        NFS4ERR_MLINK = 31,
 283        NFS4ERR_NAMETOOLONG = 63,
 284        NFS4ERR_NOTEMPTY = 66,
 285        NFS4ERR_DQUOT = 69,
 286        NFS4ERR_STALE = 70,
 287        NFS4ERR_BADHANDLE = 10001,
 288        NFS4ERR_BAD_COOKIE = 10003,
 289        NFS4ERR_NOTSUPP = 10004,
 290        NFS4ERR_TOOSMALL = 10005,
 291        NFS4ERR_SERVERFAULT = 10006,
 292        NFS4ERR_BADTYPE = 10007,
 293        NFS4ERR_DELAY = 10008,
 294        NFS4ERR_SAME = 10009,
 295        NFS4ERR_DENIED = 10010,
 296        NFS4ERR_EXPIRED = 10011,
 297        NFS4ERR_LOCKED = 10012,
 298        NFS4ERR_GRACE = 10013,
 299        NFS4ERR_FHEXPIRED = 10014,
 300        NFS4ERR_SHARE_DENIED = 10015,
 301        NFS4ERR_WRONGSEC = 10016,
 302        NFS4ERR_CLID_INUSE = 10017,
 303        NFS4ERR_RESOURCE = 10018,
 304        NFS4ERR_MOVED = 10019,
 305        NFS4ERR_NOFILEHANDLE = 10020,
 306        NFS4ERR_MINOR_VERS_MISMATCH = 10021,
 307        NFS4ERR_STALE_CLIENTID = 10022,
 308        NFS4ERR_STALE_STATEID = 10023,
 309        NFS4ERR_OLD_STATEID = 10024,
 310        NFS4ERR_BAD_STATEID = 10025,
 311        NFS4ERR_BAD_SEQID = 10026,
 312        NFS4ERR_NOT_SAME = 10027,
 313        NFS4ERR_LOCK_RANGE = 10028,
 314        NFS4ERR_SYMLINK = 10029,
 315        NFS4ERR_RESTOREFH = 10030,
 316        NFS4ERR_LEASE_MOVED = 10031,
 317        NFS4ERR_ATTRNOTSUPP = 10032,
 318        NFS4ERR_NO_GRACE = 10033,
 319        NFS4ERR_RECLAIM_BAD = 10034,
 320        NFS4ERR_RECLAIM_CONFLICT = 10035,
 321        NFS4ERR_BADXDR = 10036,
 322        NFS4ERR_LOCKS_HELD = 10037,
 323        NFS4ERR_OPENMODE = 10038,
 324        NFS4ERR_BADOWNER = 10039,
 325        NFS4ERR_BADCHAR = 10040,
 326        NFS4ERR_BADNAME = 10041,
 327        NFS4ERR_BAD_RANGE = 10042,
 328        NFS4ERR_LOCK_NOTSUPP = 10043,
 329        NFS4ERR_OP_ILLEGAL = 10044,
 330        NFS4ERR_DEADLOCK = 10045,
 331        NFS4ERR_FILE_OPEN = 10046,
 332        NFS4ERR_ADMIN_REVOKED = 10047,
 333        NFS4ERR_CB_PATH_DOWN = 10048,
 334
 335        /* nfs41 */
 336        NFS4ERR_BADIOMODE       = 10049,
 337        NFS4ERR_BADLAYOUT       = 10050,
 338        NFS4ERR_BAD_SESSION_DIGEST = 10051,
 339        NFS4ERR_BADSESSION      = 10052,
 340        NFS4ERR_BADSLOT         = 10053,
 341        NFS4ERR_COMPLETE_ALREADY = 10054,
 342        NFS4ERR_CONN_NOT_BOUND_TO_SESSION = 10055,
 343        NFS4ERR_DELEG_ALREADY_WANTED = 10056,
 344        NFS4ERR_BACK_CHAN_BUSY  = 10057,        /* backchan reqs outstanding */
 345        NFS4ERR_LAYOUTTRYLATER  = 10058,
 346        NFS4ERR_LAYOUTUNAVAILABLE = 10059,
 347        NFS4ERR_NOMATCHING_LAYOUT = 10060,
 348        NFS4ERR_RECALLCONFLICT  = 10061,
 349        NFS4ERR_UNKNOWN_LAYOUTTYPE = 10062,
 350        NFS4ERR_SEQ_MISORDERED = 10063,         /* unexpected seq.id in req */
 351        NFS4ERR_SEQUENCE_POS    = 10064,        /* [CB_]SEQ. op not 1st op */
 352        NFS4ERR_REQ_TOO_BIG     = 10065,        /* request too big */
 353        NFS4ERR_REP_TOO_BIG     = 10066,        /* reply too big */
 354        NFS4ERR_REP_TOO_BIG_TO_CACHE = 10067,   /* rep. not all cached */
 355        NFS4ERR_RETRY_UNCACHED_REP = 10068,     /* retry & rep. uncached */
 356        NFS4ERR_UNSAFE_COMPOUND = 10069,        /* retry/recovery too hard */
 357        NFS4ERR_TOO_MANY_OPS    = 10070,        /* too many ops in [CB_]COMP */
 358        NFS4ERR_OP_NOT_IN_SESSION = 10071,      /* op needs [CB_]SEQ. op */
 359        NFS4ERR_HASH_ALG_UNSUPP = 10072,        /* hash alg. not supp. */
 360                                                /* Error 10073 is unused. */
 361        NFS4ERR_CLIENTID_BUSY   = 10074,        /* clientid has state */
 362        NFS4ERR_PNFS_IO_HOLE    = 10075,        /* IO to _SPARSE file hole */
 363        NFS4ERR_SEQ_FALSE_RETRY = 10076,        /* retry not original */
 364        NFS4ERR_BAD_HIGH_SLOT   = 10077,        /* sequence arg bad */
 365        NFS4ERR_DEADSESSION     = 10078,        /* persistent session dead */
 366        NFS4ERR_ENCR_ALG_UNSUPP = 10079,        /* SSV alg mismatch */
 367        NFS4ERR_PNFS_NO_LAYOUT  = 10080,        /* direct I/O with no layout */
 368        NFS4ERR_NOT_ONLY_OP     = 10081,        /* bad compound */
 369        NFS4ERR_WRONG_CRED      = 10082,        /* permissions:state change */
 370        NFS4ERR_WRONG_TYPE      = 10083,        /* current operation mismatch */
 371        NFS4ERR_DIRDELEG_UNAVAIL = 10084,       /* no directory delegation */
 372        NFS4ERR_REJECT_DELEG    = 10085,        /* on callback */
 373        NFS4ERR_RETURNCONFLICT  = 10086,        /* outstanding layoutreturn */
 374        NFS4ERR_DELEG_REVOKED   = 10087,        /* deleg./layout revoked */
 375};
 376
 377static inline bool seqid_mutating_err(u32 err)
 378{
 379        /* rfc 3530 section 8.1.5: */
 380        switch (err) {
 381        case NFS4ERR_STALE_CLIENTID:
 382        case NFS4ERR_STALE_STATEID:
 383        case NFS4ERR_BAD_STATEID:
 384        case NFS4ERR_BAD_SEQID:
 385        case NFS4ERR_BADXDR:
 386        case NFS4ERR_RESOURCE:
 387        case NFS4ERR_NOFILEHANDLE:
 388                return false;
 389        };
 390        return true;
 391}
 392
 393/*
 394 * Note: NF4BAD is not actually part of the protocol; it is just used
 395 * internally by nfsd.
 396 */
 397enum nfs_ftype4 {
 398        NF4BAD          = 0,
 399        NF4REG          = 1,    /* Regular File */
 400        NF4DIR          = 2,    /* Directory */
 401        NF4BLK          = 3,    /* Special File - block device */
 402        NF4CHR          = 4,    /* Special File - character device */
 403        NF4LNK          = 5,    /* Symbolic Link */
 404        NF4SOCK         = 6,    /* Special File - socket */
 405        NF4FIFO         = 7,    /* Special File - fifo */
 406        NF4ATTRDIR      = 8,    /* Attribute Directory */
 407        NF4NAMEDATTR    = 9     /* Named Attribute */
 408};
 409
 410enum open_claim_type4 {
 411        NFS4_OPEN_CLAIM_NULL = 0,
 412        NFS4_OPEN_CLAIM_PREVIOUS = 1,
 413        NFS4_OPEN_CLAIM_DELEGATE_CUR = 2,
 414        NFS4_OPEN_CLAIM_DELEGATE_PREV = 3,
 415        NFS4_OPEN_CLAIM_FH = 4, /* 4.1 */
 416        NFS4_OPEN_CLAIM_DELEG_CUR_FH = 5, /* 4.1 */
 417        NFS4_OPEN_CLAIM_DELEG_PREV_FH = 6, /* 4.1 */
 418};
 419
 420enum opentype4 {
 421        NFS4_OPEN_NOCREATE = 0,
 422        NFS4_OPEN_CREATE = 1
 423};
 424
 425enum createmode4 {
 426        NFS4_CREATE_UNCHECKED = 0,
 427        NFS4_CREATE_GUARDED = 1,
 428        NFS4_CREATE_EXCLUSIVE = 2,
 429        /*
 430         * New to NFSv4.1. If session is persistent,
 431         * GUARDED4 MUST be used. Otherwise, use
 432         * EXCLUSIVE4_1 instead of EXCLUSIVE4.
 433         */
 434        NFS4_CREATE_EXCLUSIVE4_1 = 3
 435};
 436
 437enum limit_by4 {
 438        NFS4_LIMIT_SIZE = 1,
 439        NFS4_LIMIT_BLOCKS = 2
 440};
 441
 442enum open_delegation_type4 {
 443        NFS4_OPEN_DELEGATE_NONE = 0,
 444        NFS4_OPEN_DELEGATE_READ = 1,
 445        NFS4_OPEN_DELEGATE_WRITE = 2,
 446        NFS4_OPEN_DELEGATE_NONE_EXT = 3, /* 4.1 */
 447};
 448
 449enum why_no_delegation4 { /* new to v4.1 */
 450        WND4_NOT_WANTED = 0,
 451        WND4_CONTENTION = 1,
 452        WND4_RESOURCE = 2,
 453        WND4_NOT_SUPP_FTYPE = 3,
 454        WND4_WRITE_DELEG_NOT_SUPP_FTYPE = 4,
 455        WND4_NOT_SUPP_UPGRADE = 5,
 456        WND4_NOT_SUPP_DOWNGRADE = 6,
 457        WND4_CANCELLED = 7,
 458        WND4_IS_DIR = 8,
 459};
 460
 461enum lock_type4 {
 462        NFS4_UNLOCK_LT = 0,
 463        NFS4_READ_LT = 1,
 464        NFS4_WRITE_LT = 2,
 465        NFS4_READW_LT = 3,
 466        NFS4_WRITEW_LT = 4
 467};
 468
 469
 470/* Mandatory Attributes */
 471#define FATTR4_WORD0_SUPPORTED_ATTRS    (1UL << 0)
 472#define FATTR4_WORD0_TYPE               (1UL << 1)
 473#define FATTR4_WORD0_FH_EXPIRE_TYPE     (1UL << 2)
 474#define FATTR4_WORD0_CHANGE             (1UL << 3)
 475#define FATTR4_WORD0_SIZE               (1UL << 4)
 476#define FATTR4_WORD0_LINK_SUPPORT       (1UL << 5)
 477#define FATTR4_WORD0_SYMLINK_SUPPORT    (1UL << 6)
 478#define FATTR4_WORD0_NAMED_ATTR         (1UL << 7)
 479#define FATTR4_WORD0_FSID               (1UL << 8)
 480#define FATTR4_WORD0_UNIQUE_HANDLES     (1UL << 9)
 481#define FATTR4_WORD0_LEASE_TIME         (1UL << 10)
 482#define FATTR4_WORD0_RDATTR_ERROR       (1UL << 11)
 483/* Mandatory in NFSv4.1 */
 484#define FATTR4_WORD2_SUPPATTR_EXCLCREAT (1UL << 11)
 485
 486/* Recommended Attributes */
 487#define FATTR4_WORD0_ACL                (1UL << 12)
 488#define FATTR4_WORD0_ACLSUPPORT         (1UL << 13)
 489#define FATTR4_WORD0_ARCHIVE            (1UL << 14)
 490#define FATTR4_WORD0_CANSETTIME         (1UL << 15)
 491#define FATTR4_WORD0_CASE_INSENSITIVE   (1UL << 16)
 492#define FATTR4_WORD0_CASE_PRESERVING    (1UL << 17)
 493#define FATTR4_WORD0_CHOWN_RESTRICTED   (1UL << 18)
 494#define FATTR4_WORD0_FILEHANDLE         (1UL << 19)
 495#define FATTR4_WORD0_FILEID             (1UL << 20)
 496#define FATTR4_WORD0_FILES_AVAIL        (1UL << 21)
 497#define FATTR4_WORD0_FILES_FREE         (1UL << 22)
 498#define FATTR4_WORD0_FILES_TOTAL        (1UL << 23)
 499#define FATTR4_WORD0_FS_LOCATIONS       (1UL << 24)
 500#define FATTR4_WORD0_HIDDEN             (1UL << 25)
 501#define FATTR4_WORD0_HOMOGENEOUS        (1UL << 26)
 502#define FATTR4_WORD0_MAXFILESIZE        (1UL << 27)
 503#define FATTR4_WORD0_MAXLINK            (1UL << 28)
 504#define FATTR4_WORD0_MAXNAME            (1UL << 29)
 505#define FATTR4_WORD0_MAXREAD            (1UL << 30)
 506#define FATTR4_WORD0_MAXWRITE           (1UL << 31)
 507#define FATTR4_WORD1_MIMETYPE           (1UL << 0)
 508#define FATTR4_WORD1_MODE               (1UL << 1)
 509#define FATTR4_WORD1_NO_TRUNC           (1UL << 2)
 510#define FATTR4_WORD1_NUMLINKS           (1UL << 3)
 511#define FATTR4_WORD1_OWNER              (1UL << 4)
 512#define FATTR4_WORD1_OWNER_GROUP        (1UL << 5)
 513#define FATTR4_WORD1_QUOTA_HARD         (1UL << 6)
 514#define FATTR4_WORD1_QUOTA_SOFT         (1UL << 7)
 515#define FATTR4_WORD1_QUOTA_USED         (1UL << 8)
 516#define FATTR4_WORD1_RAWDEV             (1UL << 9)
 517#define FATTR4_WORD1_SPACE_AVAIL        (1UL << 10)
 518#define FATTR4_WORD1_SPACE_FREE         (1UL << 11)
 519#define FATTR4_WORD1_SPACE_TOTAL        (1UL << 12)
 520#define FATTR4_WORD1_SPACE_USED         (1UL << 13)
 521#define FATTR4_WORD1_SYSTEM             (1UL << 14)
 522#define FATTR4_WORD1_TIME_ACCESS        (1UL << 15)
 523#define FATTR4_WORD1_TIME_ACCESS_SET    (1UL << 16)
 524#define FATTR4_WORD1_TIME_BACKUP        (1UL << 17)
 525#define FATTR4_WORD1_TIME_CREATE        (1UL << 18)
 526#define FATTR4_WORD1_TIME_DELTA         (1UL << 19)
 527#define FATTR4_WORD1_TIME_METADATA      (1UL << 20)
 528#define FATTR4_WORD1_TIME_MODIFY        (1UL << 21)
 529#define FATTR4_WORD1_TIME_MODIFY_SET    (1UL << 22)
 530#define FATTR4_WORD1_MOUNTED_ON_FILEID  (1UL << 23)
 531#define FATTR4_WORD1_FS_LAYOUT_TYPES    (1UL << 30)
 532#define FATTR4_WORD2_LAYOUT_BLKSIZE     (1UL << 1)
 533#define FATTR4_WORD2_MDSTHRESHOLD       (1UL << 4)
 534
 535/* MDS threshold bitmap bits */
 536#define THRESHOLD_RD                    (1UL << 0)
 537#define THRESHOLD_WR                    (1UL << 1)
 538#define THRESHOLD_RD_IO                 (1UL << 2)
 539#define THRESHOLD_WR_IO                 (1UL << 3)
 540
 541#define NFSPROC4_NULL 0
 542#define NFSPROC4_COMPOUND 1
 543#define NFS4_VERSION 4
 544#define NFS4_MINOR_VERSION 0
 545
 546#if defined(CONFIG_NFS_V4_1)
 547#define NFS4_MAX_MINOR_VERSION 1
 548#else
 549#define NFS4_MAX_MINOR_VERSION 0
 550#endif /* CONFIG_NFS_V4_1 */
 551
 552#define NFS4_DEBUG 1
 553
 554/* Index of predefined Linux client operations */
 555
 556enum {
 557        NFSPROC4_CLNT_NULL = 0,         /* Unused */
 558        NFSPROC4_CLNT_READ,
 559        NFSPROC4_CLNT_WRITE,
 560        NFSPROC4_CLNT_COMMIT,
 561        NFSPROC4_CLNT_OPEN,
 562        NFSPROC4_CLNT_OPEN_CONFIRM,
 563        NFSPROC4_CLNT_OPEN_NOATTR,
 564        NFSPROC4_CLNT_OPEN_DOWNGRADE,
 565        NFSPROC4_CLNT_CLOSE,
 566        NFSPROC4_CLNT_SETATTR,
 567        NFSPROC4_CLNT_FSINFO,
 568        NFSPROC4_CLNT_RENEW,
 569        NFSPROC4_CLNT_SETCLIENTID,
 570        NFSPROC4_CLNT_SETCLIENTID_CONFIRM,
 571        NFSPROC4_CLNT_LOCK,
 572        NFSPROC4_CLNT_LOCKT,
 573        NFSPROC4_CLNT_LOCKU,
 574        NFSPROC4_CLNT_ACCESS,
 575        NFSPROC4_CLNT_GETATTR,
 576        NFSPROC4_CLNT_LOOKUP,
 577        NFSPROC4_CLNT_LOOKUP_ROOT,
 578        NFSPROC4_CLNT_REMOVE,
 579        NFSPROC4_CLNT_RENAME,
 580        NFSPROC4_CLNT_LINK,
 581        NFSPROC4_CLNT_SYMLINK,
 582        NFSPROC4_CLNT_CREATE,
 583        NFSPROC4_CLNT_PATHCONF,
 584        NFSPROC4_CLNT_STATFS,
 585        NFSPROC4_CLNT_READLINK,
 586        NFSPROC4_CLNT_READDIR,
 587        NFSPROC4_CLNT_SERVER_CAPS,
 588        NFSPROC4_CLNT_DELEGRETURN,
 589        NFSPROC4_CLNT_GETACL,
 590        NFSPROC4_CLNT_SETACL,
 591        NFSPROC4_CLNT_FS_LOCATIONS,
 592        NFSPROC4_CLNT_RELEASE_LOCKOWNER,
 593        NFSPROC4_CLNT_SECINFO,
 594
 595        /* nfs41 */
 596        NFSPROC4_CLNT_EXCHANGE_ID,
 597        NFSPROC4_CLNT_CREATE_SESSION,
 598        NFSPROC4_CLNT_DESTROY_SESSION,
 599        NFSPROC4_CLNT_SEQUENCE,
 600        NFSPROC4_CLNT_GET_LEASE_TIME,
 601        NFSPROC4_CLNT_RECLAIM_COMPLETE,
 602        NFSPROC4_CLNT_LAYOUTGET,
 603        NFSPROC4_CLNT_GETDEVICEINFO,
 604        NFSPROC4_CLNT_LAYOUTCOMMIT,
 605        NFSPROC4_CLNT_LAYOUTRETURN,
 606        NFSPROC4_CLNT_SECINFO_NO_NAME,
 607        NFSPROC4_CLNT_TEST_STATEID,
 608        NFSPROC4_CLNT_FREE_STATEID,
 609        NFSPROC4_CLNT_GETDEVICELIST,
 610        NFSPROC4_CLNT_BIND_CONN_TO_SESSION,
 611        NFSPROC4_CLNT_DESTROY_CLIENTID,
 612};
 613
 614/* nfs41 types */
 615struct nfs4_sessionid {
 616        unsigned char data[NFS4_MAX_SESSIONID_LEN];
 617};
 618
 619/* Create Session Flags */
 620#define SESSION4_PERSIST        0x001
 621#define SESSION4_BACK_CHAN      0x002
 622#define SESSION4_RDMA           0x004
 623
 624#define SESSION4_FLAG_MASK_A    0x007
 625
 626enum state_protect_how4 {
 627        SP4_NONE        = 0,
 628        SP4_MACH_CRED   = 1,
 629        SP4_SSV         = 2
 630};
 631
 632enum pnfs_layouttype {
 633        LAYOUT_NFSV4_1_FILES  = 1,
 634        LAYOUT_OSD2_OBJECTS = 2,
 635        LAYOUT_BLOCK_VOLUME = 3,
 636};
 637
 638/* used for both layout return and recall */
 639enum pnfs_layoutreturn_type {
 640        RETURN_FILE = 1,
 641        RETURN_FSID = 2,
 642        RETURN_ALL  = 3
 643};
 644
 645enum pnfs_iomode {
 646        IOMODE_READ = 1,
 647        IOMODE_RW = 2,
 648        IOMODE_ANY = 3,
 649};
 650
 651enum pnfs_notify_deviceid_type4 {
 652        NOTIFY_DEVICEID4_CHANGE = 1 << 1,
 653        NOTIFY_DEVICEID4_DELETE = 1 << 2,
 654};
 655
 656#define NFL4_UFLG_MASK                  0x0000003F
 657#define NFL4_UFLG_DENSE                 0x00000001
 658#define NFL4_UFLG_COMMIT_THRU_MDS       0x00000002
 659#define NFL4_UFLG_STRIPE_UNIT_SIZE_MASK 0xFFFFFFC0
 660
 661/* Encoded in the loh_body field of type layouthint4 */
 662enum filelayout_hint_care4 {
 663        NFLH4_CARE_DENSE                = NFL4_UFLG_DENSE,
 664        NFLH4_CARE_COMMIT_THRU_MDS      = NFL4_UFLG_COMMIT_THRU_MDS,
 665        NFLH4_CARE_STRIPE_UNIT_SIZE     = 0x00000040,
 666        NFLH4_CARE_STRIPE_COUNT         = 0x00000080
 667};
 668
 669#define NFS4_DEVICEID4_SIZE 16
 670
 671struct nfs4_deviceid {
 672        char data[NFS4_DEVICEID4_SIZE];
 673};
 674
 675#endif
 676#endif
 677
 678/*
 679 * Local variables:
 680 *  c-basic-offset: 8
 681 * End:
 682 */
 683
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.