Skip to content

Commit

Permalink
nfs,nfsd: NFSv4.2 extended attribute protocol definitions
Browse files Browse the repository at this point in the history
Add definitions for the new operations, errors and flags as defined
in RFC 8276 (File System Extended Attributes in NFSv4).

Signed-off-by: Frank van der Linden <[email protected]>
Signed-off-by: Chuck Lever <[email protected]>
  • Loading branch information
fllinden authored and chucklever committed Jul 13, 2020
1 parent 11ba468 commit c132621
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions include/linux/nfs4.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ enum nfs_opnum4 {
OP_WRITE_SAME = 70,
OP_CLONE = 71,

/* xattr support (RFC8726) */
OP_GETXATTR = 72,
OP_SETXATTR = 73,
OP_LISTXATTRS = 74,
OP_REMOVEXATTR = 75,

OP_ILLEGAL = 10044,
};

Expand Down Expand Up @@ -280,6 +286,10 @@ enum nfsstat4 {
NFS4ERR_WRONG_LFS = 10092,
NFS4ERR_BADLABEL = 10093,
NFS4ERR_OFFLOAD_NO_REQS = 10094,

/* xattr (RFC8276) */
NFS4ERR_NOXATTR = 10095,
NFS4ERR_XATTR2BIG = 10096,
};

static inline bool seqid_mutating_err(u32 err)
Expand Down Expand Up @@ -452,6 +462,7 @@ enum change_attr_type4 {
#define FATTR4_WORD2_CHANGE_ATTR_TYPE (1UL << 15)
#define FATTR4_WORD2_SECURITY_LABEL (1UL << 16)
#define FATTR4_WORD2_MODE_UMASK (1UL << 17)
#define FATTR4_WORD2_XATTR_SUPPORT (1UL << 18)

/* MDS threshold bitmap bits */
#define THRESHOLD_RD (1UL << 0)
Expand Down Expand Up @@ -700,4 +711,13 @@ struct nl4_server {
struct nfs42_netaddr nl4_addr; /* NL4_NETADDR */
} u;
};

/*
* Options for setxattr. These match the flags for setxattr(2).
*/
enum nfs4_setxattr_options {
SETXATTR4_EITHER = 0,
SETXATTR4_CREATE = 1,
SETXATTR4_REPLACE = 2,
};
#endif
3 changes: 3 additions & 0 deletions include/uapi/linux/nfs4.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
#define NFS4_ACCESS_EXTEND 0x0008
#define NFS4_ACCESS_DELETE 0x0010
#define NFS4_ACCESS_EXECUTE 0x0020
#define NFS4_ACCESS_XAREAD 0x0040
#define NFS4_ACCESS_XAWRITE 0x0080
#define NFS4_ACCESS_XALIST 0x0100

#define NFS4_FH_PERSISTENT 0x0000
#define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001
Expand Down

0 comments on commit c132621

Please sign in to comment.