Skip to content

Commit c132621

Browse files
fllindenchucklever
authored andcommitted
nfs,nfsd: NFSv4.2 extended attribute protocol definitions
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]>
1 parent 11ba468 commit c132621

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

include/linux/nfs4.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ enum nfs_opnum4 {
150150
OP_WRITE_SAME = 70,
151151
OP_CLONE = 71,
152152

153+
/* xattr support (RFC8726) */
154+
OP_GETXATTR = 72,
155+
OP_SETXATTR = 73,
156+
OP_LISTXATTRS = 74,
157+
OP_REMOVEXATTR = 75,
158+
153159
OP_ILLEGAL = 10044,
154160
};
155161

@@ -280,6 +286,10 @@ enum nfsstat4 {
280286
NFS4ERR_WRONG_LFS = 10092,
281287
NFS4ERR_BADLABEL = 10093,
282288
NFS4ERR_OFFLOAD_NO_REQS = 10094,
289+
290+
/* xattr (RFC8276) */
291+
NFS4ERR_NOXATTR = 10095,
292+
NFS4ERR_XATTR2BIG = 10096,
283293
};
284294

285295
static inline bool seqid_mutating_err(u32 err)
@@ -452,6 +462,7 @@ enum change_attr_type4 {
452462
#define FATTR4_WORD2_CHANGE_ATTR_TYPE (1UL << 15)
453463
#define FATTR4_WORD2_SECURITY_LABEL (1UL << 16)
454464
#define FATTR4_WORD2_MODE_UMASK (1UL << 17)
465+
#define FATTR4_WORD2_XATTR_SUPPORT (1UL << 18)
455466

456467
/* MDS threshold bitmap bits */
457468
#define THRESHOLD_RD (1UL << 0)
@@ -700,4 +711,13 @@ struct nl4_server {
700711
struct nfs42_netaddr nl4_addr; /* NL4_NETADDR */
701712
} u;
702713
};
714+
715+
/*
716+
* Options for setxattr. These match the flags for setxattr(2).
717+
*/
718+
enum nfs4_setxattr_options {
719+
SETXATTR4_EITHER = 0,
720+
SETXATTR4_CREATE = 1,
721+
SETXATTR4_REPLACE = 2,
722+
};
703723
#endif

include/uapi/linux/nfs4.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
#define NFS4_ACCESS_EXTEND 0x0008
3434
#define NFS4_ACCESS_DELETE 0x0010
3535
#define NFS4_ACCESS_EXECUTE 0x0020
36+
#define NFS4_ACCESS_XAREAD 0x0040
37+
#define NFS4_ACCESS_XAWRITE 0x0080
38+
#define NFS4_ACCESS_XALIST 0x0100
3639

3740
#define NFS4_FH_PERSISTENT 0x0000
3841
#define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001

0 commit comments

Comments
 (0)