hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/include/linux/nfs4.h
....@@ -16,6 +16,7 @@
1616 #include <linux/list.h>
1717 #include <linux/uidgid.h>
1818 #include <uapi/linux/nfs4.h>
19
+#include <linux/sunrpc/msg_prot.h>
1920
2021 enum nfs4_acl_whotype {
2122 NFS4_ACL_WHO_NAMED = 0,
....@@ -37,7 +38,7 @@
3738
3839 struct nfs4_acl {
3940 uint32_t naces;
40
- struct nfs4_ace aces[0];
41
+ struct nfs4_ace aces[];
4142 };
4243
4344 #define NFS4_MAXLABELLEN 2048
....@@ -149,6 +150,12 @@
149150 OP_WRITE_SAME = 70,
150151 OP_CLONE = 71,
151152
153
+ /* xattr support (RFC8726) */
154
+ OP_GETXATTR = 72,
155
+ OP_SETXATTR = 73,
156
+ OP_LISTXATTRS = 74,
157
+ OP_REMOVEXATTR = 75,
158
+
152159 OP_ILLEGAL = 10044,
153160 };
154161
....@@ -158,7 +165,7 @@
158165 #define FIRST_NFS4_OP OP_ACCESS
159166 #define LAST_NFS40_OP OP_RELEASE_LOCKOWNER
160167 #define LAST_NFS41_OP OP_RECLAIM_COMPLETE
161
-#define LAST_NFS42_OP OP_CLONE
168
+#define LAST_NFS42_OP OP_REMOVEXATTR
162169 #define LAST_NFS4_OP LAST_NFS42_OP
163170
164171 enum nfsstat4 {
....@@ -279,6 +286,10 @@
279286 NFS4ERR_WRONG_LFS = 10092,
280287 NFS4ERR_BADLABEL = 10093,
281288 NFS4ERR_OFFLOAD_NO_REQS = 10094,
289
+
290
+ /* xattr (RFC8276) */
291
+ NFS4ERR_NOXATTR = 10095,
292
+ NFS4ERR_XATTR2BIG = 10096,
282293 };
283294
284295 static inline bool seqid_mutating_err(u32 err)
....@@ -294,7 +305,7 @@
294305 case NFS4ERR_NOFILEHANDLE:
295306 case NFS4ERR_MOVED:
296307 return false;
297
- };
308
+ }
298309 return true;
299310 }
300311
....@@ -451,6 +462,7 @@
451462 #define FATTR4_WORD2_CHANGE_ATTR_TYPE (1UL << 15)
452463 #define FATTR4_WORD2_SECURITY_LABEL (1UL << 16)
453464 #define FATTR4_WORD2_MODE_UMASK (1UL << 17)
465
+#define FATTR4_WORD2_XATTR_SUPPORT (1UL << 18)
454466
455467 /* MDS threshold bitmap bits */
456468 #define THRESHOLD_RD (1UL << 0)
....@@ -538,6 +550,14 @@
538550 NFSPROC4_CLNT_OFFLOAD_CANCEL,
539551
540552 NFSPROC4_CLNT_LOOKUPP,
553
+ NFSPROC4_CLNT_LAYOUTERROR,
554
+ NFSPROC4_CLNT_COPY_NOTIFY,
555
+
556
+ NFSPROC4_CLNT_GETXATTR,
557
+ NFSPROC4_CLNT_SETXATTR,
558
+ NFSPROC4_CLNT_LISTXATTRS,
559
+ NFSPROC4_CLNT_REMOVEXATTR,
560
+ NFSPROC4_CLNT_READ_PLUS,
541561 };
542562
543563 /* nfs41 types */
....@@ -659,6 +679,7 @@
659679 PNFS_UPDATE_LAYOUT_BLOCKED,
660680 PNFS_UPDATE_LAYOUT_INVALID_OPEN,
661681 PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET,
682
+ PNFS_UPDATE_LAYOUT_EXIT,
662683 };
663684
664685 #define NFS4_OP_MAP_NUM_LONGS \
....@@ -672,4 +693,36 @@
672693 } u;
673694 };
674695
696
+struct nfs42_netaddr {
697
+ char netid[RPCBIND_MAXNETIDLEN];
698
+ char addr[RPCBIND_MAXUADDRLEN + 1];
699
+ u32 netid_len;
700
+ u32 addr_len;
701
+};
702
+
703
+enum netloc_type4 {
704
+ NL4_NAME = 1,
705
+ NL4_URL = 2,
706
+ NL4_NETADDR = 3,
707
+};
708
+
709
+struct nl4_server {
710
+ enum netloc_type4 nl4_type;
711
+ union {
712
+ struct { /* NL4_NAME, NL4_URL */
713
+ int nl4_str_sz;
714
+ char nl4_str[NFS4_OPAQUE_LIMIT + 1];
715
+ };
716
+ struct nfs42_netaddr nl4_addr; /* NL4_NETADDR */
717
+ } u;
718
+};
719
+
720
+/*
721
+ * Options for setxattr. These match the flags for setxattr(2).
722
+ */
723
+enum nfs4_setxattr_options {
724
+ SETXATTR4_EITHER = 0,
725
+ SETXATTR4_CREATE = 1,
726
+ SETXATTR4_REPLACE = 2,
727
+};
675728 #endif