NFSv4.2: Clean up: Move nfs4_xdr_enc_*xattr() functions
authorAnna Schumaker <Anna.Schumaker@Netapp.com>
Thu, 4 May 2023 20:47:13 +0000 (16:47 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 19 Jun 2023 16:08:40 +0000 (12:08 -0400)
They should be in the nfs4_xdr_enc_*() section, and not at the bottom of
the file.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/nfs42xdr.c

index 09e735b..51560c7 100644 (file)
@@ -707,6 +707,89 @@ static void nfs4_xdr_enc_layouterror(struct rpc_rqst *req,
        encode_nops(&hdr);
 }
 
+/*
+ * Encode SETXATTR request
+ */
+static void nfs4_xdr_enc_setxattr(struct rpc_rqst *req, struct xdr_stream *xdr,
+                                 const void *data)
+{
+       const struct nfs42_setxattrargs *args = data;
+       struct compound_hdr hdr = {
+               .minorversion = nfs4_xdr_minorversion(&args->seq_args),
+       };
+
+       encode_compound_hdr(xdr, req, &hdr);
+       encode_sequence(xdr, &args->seq_args, &hdr);
+       encode_putfh(xdr, args->fh, &hdr);
+       encode_setxattr(xdr, args, &hdr);
+       encode_nops(&hdr);
+}
+
+/*
+ * Encode GETXATTR request
+ */
+static void nfs4_xdr_enc_getxattr(struct rpc_rqst *req, struct xdr_stream *xdr,
+                                 const void *data)
+{
+       const struct nfs42_getxattrargs *args = data;
+       struct compound_hdr hdr = {
+               .minorversion = nfs4_xdr_minorversion(&args->seq_args),
+       };
+       uint32_t replen;
+
+       encode_compound_hdr(xdr, req, &hdr);
+       encode_sequence(xdr, &args->seq_args, &hdr);
+       encode_putfh(xdr, args->fh, &hdr);
+       replen = hdr.replen + op_decode_hdr_maxsz + 1;
+       encode_getxattr(xdr, args->xattr_name, &hdr);
+
+       rpc_prepare_reply_pages(req, args->xattr_pages, 0, args->xattr_len,
+                               replen);
+
+       encode_nops(&hdr);
+}
+
+/*
+ * Encode LISTXATTR request
+ */
+static void nfs4_xdr_enc_listxattrs(struct rpc_rqst *req,
+                                   struct xdr_stream *xdr, const void *data)
+{
+       const struct nfs42_listxattrsargs *args = data;
+       struct compound_hdr hdr = {
+               .minorversion = nfs4_xdr_minorversion(&args->seq_args),
+       };
+       uint32_t replen;
+
+       encode_compound_hdr(xdr, req, &hdr);
+       encode_sequence(xdr, &args->seq_args, &hdr);
+       encode_putfh(xdr, args->fh, &hdr);
+       replen = hdr.replen + op_decode_hdr_maxsz + 2 + 1;
+       encode_listxattrs(xdr, args, &hdr);
+
+       rpc_prepare_reply_pages(req, args->xattr_pages, 0, args->count, replen);
+
+       encode_nops(&hdr);
+}
+
+/*
+ * Encode REMOVEXATTR request
+ */
+static void nfs4_xdr_enc_removexattr(struct rpc_rqst *req,
+                                    struct xdr_stream *xdr, const void *data)
+{
+       const struct nfs42_removexattrargs *args = data;
+       struct compound_hdr hdr = {
+               .minorversion = nfs4_xdr_minorversion(&args->seq_args),
+       };
+
+       encode_compound_hdr(xdr, req, &hdr);
+       encode_sequence(xdr, &args->seq_args, &hdr);
+       encode_putfh(xdr, args->fh, &hdr);
+       encode_removexattr(xdr, args->xattr_name, &hdr);
+       encode_nops(&hdr);
+}
+
 static int decode_allocate(struct xdr_stream *xdr, struct nfs42_falloc_res *res)
 {
        return decode_op_hdr(xdr, OP_ALLOCATE);
@@ -1480,21 +1563,6 @@ out:
 }
 
 #ifdef CONFIG_NFS_V4_2
-static void nfs4_xdr_enc_setxattr(struct rpc_rqst *req, struct xdr_stream *xdr,
-                                 const void *data)
-{
-       const struct nfs42_setxattrargs *args = data;
-       struct compound_hdr hdr = {
-               .minorversion = nfs4_xdr_minorversion(&args->seq_args),
-       };
-
-       encode_compound_hdr(xdr, req, &hdr);
-       encode_sequence(xdr, &args->seq_args, &hdr);
-       encode_putfh(xdr, args->fh, &hdr);
-       encode_setxattr(xdr, args, &hdr);
-       encode_nops(&hdr);
-}
-
 static int nfs4_xdr_dec_setxattr(struct rpc_rqst *req, struct xdr_stream *xdr,
                                 void *data)
 {
@@ -1517,27 +1585,6 @@ out:
        return status;
 }
 
-static void nfs4_xdr_enc_getxattr(struct rpc_rqst *req, struct xdr_stream *xdr,
-                                 const void *data)
-{
-       const struct nfs42_getxattrargs *args = data;
-       struct compound_hdr hdr = {
-               .minorversion = nfs4_xdr_minorversion(&args->seq_args),
-       };
-       uint32_t replen;
-
-       encode_compound_hdr(xdr, req, &hdr);
-       encode_sequence(xdr, &args->seq_args, &hdr);
-       encode_putfh(xdr, args->fh, &hdr);
-       replen = hdr.replen + op_decode_hdr_maxsz + 1;
-       encode_getxattr(xdr, args->xattr_name, &hdr);
-
-       rpc_prepare_reply_pages(req, args->xattr_pages, 0, args->xattr_len,
-                               replen);
-
-       encode_nops(&hdr);
-}
-
 static int nfs4_xdr_dec_getxattr(struct rpc_rqst *rqstp,
                                 struct xdr_stream *xdr, void *data)
 {
@@ -1559,26 +1606,6 @@ out:
        return status;
 }
 
-static void nfs4_xdr_enc_listxattrs(struct rpc_rqst *req,
-                                   struct xdr_stream *xdr, const void *data)
-{
-       const struct nfs42_listxattrsargs *args = data;
-       struct compound_hdr hdr = {
-               .minorversion = nfs4_xdr_minorversion(&args->seq_args),
-       };
-       uint32_t replen;
-
-       encode_compound_hdr(xdr, req, &hdr);
-       encode_sequence(xdr, &args->seq_args, &hdr);
-       encode_putfh(xdr, args->fh, &hdr);
-       replen = hdr.replen + op_decode_hdr_maxsz + 2 + 1;
-       encode_listxattrs(xdr, args, &hdr);
-
-       rpc_prepare_reply_pages(req, args->xattr_pages, 0, args->count, replen);
-
-       encode_nops(&hdr);
-}
-
 static int nfs4_xdr_dec_listxattrs(struct rpc_rqst *rqstp,
                                   struct xdr_stream *xdr, void *data)
 {
@@ -1602,21 +1629,6 @@ out:
        return status;
 }
 
-static void nfs4_xdr_enc_removexattr(struct rpc_rqst *req,
-                                    struct xdr_stream *xdr, const void *data)
-{
-       const struct nfs42_removexattrargs *args = data;
-       struct compound_hdr hdr = {
-               .minorversion = nfs4_xdr_minorversion(&args->seq_args),
-       };
-
-       encode_compound_hdr(xdr, req, &hdr);
-       encode_sequence(xdr, &args->seq_args, &hdr);
-       encode_putfh(xdr, args->fh, &hdr);
-       encode_removexattr(xdr, args->xattr_name, &hdr);
-       encode_nops(&hdr);
-}
-
 static int nfs4_xdr_dec_removexattr(struct rpc_rqst *req,
                                    struct xdr_stream *xdr, void *data)
 {