Skip to content

Commit 31f1bd8

Browse files
amschuma-ntapTrond Myklebust
authored andcommitted
NFSv4.2: Clean up: Move nfs4_xdr_enc_*xattr() functions
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>
1 parent 04b4c9f commit 31f1bd8

1 file changed

Lines changed: 83 additions & 71 deletions

File tree

fs/nfs/nfs42xdr.c

Lines changed: 83 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,89 @@ static void nfs4_xdr_enc_layouterror(struct rpc_rqst *req,
707707
encode_nops(&hdr);
708708
}
709709

710+
/*
711+
* Encode SETXATTR request
712+
*/
713+
static void nfs4_xdr_enc_setxattr(struct rpc_rqst *req, struct xdr_stream *xdr,
714+
const void *data)
715+
{
716+
const struct nfs42_setxattrargs *args = data;
717+
struct compound_hdr hdr = {
718+
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
719+
};
720+
721+
encode_compound_hdr(xdr, req, &hdr);
722+
encode_sequence(xdr, &args->seq_args, &hdr);
723+
encode_putfh(xdr, args->fh, &hdr);
724+
encode_setxattr(xdr, args, &hdr);
725+
encode_nops(&hdr);
726+
}
727+
728+
/*
729+
* Encode GETXATTR request
730+
*/
731+
static void nfs4_xdr_enc_getxattr(struct rpc_rqst *req, struct xdr_stream *xdr,
732+
const void *data)
733+
{
734+
const struct nfs42_getxattrargs *args = data;
735+
struct compound_hdr hdr = {
736+
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
737+
};
738+
uint32_t replen;
739+
740+
encode_compound_hdr(xdr, req, &hdr);
741+
encode_sequence(xdr, &args->seq_args, &hdr);
742+
encode_putfh(xdr, args->fh, &hdr);
743+
replen = hdr.replen + op_decode_hdr_maxsz + 1;
744+
encode_getxattr(xdr, args->xattr_name, &hdr);
745+
746+
rpc_prepare_reply_pages(req, args->xattr_pages, 0, args->xattr_len,
747+
replen);
748+
749+
encode_nops(&hdr);
750+
}
751+
752+
/*
753+
* Encode LISTXATTR request
754+
*/
755+
static void nfs4_xdr_enc_listxattrs(struct rpc_rqst *req,
756+
struct xdr_stream *xdr, const void *data)
757+
{
758+
const struct nfs42_listxattrsargs *args = data;
759+
struct compound_hdr hdr = {
760+
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
761+
};
762+
uint32_t replen;
763+
764+
encode_compound_hdr(xdr, req, &hdr);
765+
encode_sequence(xdr, &args->seq_args, &hdr);
766+
encode_putfh(xdr, args->fh, &hdr);
767+
replen = hdr.replen + op_decode_hdr_maxsz + 2 + 1;
768+
encode_listxattrs(xdr, args, &hdr);
769+
770+
rpc_prepare_reply_pages(req, args->xattr_pages, 0, args->count, replen);
771+
772+
encode_nops(&hdr);
773+
}
774+
775+
/*
776+
* Encode REMOVEXATTR request
777+
*/
778+
static void nfs4_xdr_enc_removexattr(struct rpc_rqst *req,
779+
struct xdr_stream *xdr, const void *data)
780+
{
781+
const struct nfs42_removexattrargs *args = data;
782+
struct compound_hdr hdr = {
783+
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
784+
};
785+
786+
encode_compound_hdr(xdr, req, &hdr);
787+
encode_sequence(xdr, &args->seq_args, &hdr);
788+
encode_putfh(xdr, args->fh, &hdr);
789+
encode_removexattr(xdr, args->xattr_name, &hdr);
790+
encode_nops(&hdr);
791+
}
792+
710793
static int decode_allocate(struct xdr_stream *xdr, struct nfs42_falloc_res *res)
711794
{
712795
return decode_op_hdr(xdr, OP_ALLOCATE);
@@ -1480,21 +1563,6 @@ static int nfs4_xdr_dec_layouterror(struct rpc_rqst *rqstp,
14801563
}
14811564

14821565
#ifdef CONFIG_NFS_V4_2
1483-
static void nfs4_xdr_enc_setxattr(struct rpc_rqst *req, struct xdr_stream *xdr,
1484-
const void *data)
1485-
{
1486-
const struct nfs42_setxattrargs *args = data;
1487-
struct compound_hdr hdr = {
1488-
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
1489-
};
1490-
1491-
encode_compound_hdr(xdr, req, &hdr);
1492-
encode_sequence(xdr, &args->seq_args, &hdr);
1493-
encode_putfh(xdr, args->fh, &hdr);
1494-
encode_setxattr(xdr, args, &hdr);
1495-
encode_nops(&hdr);
1496-
}
1497-
14981566
static int nfs4_xdr_dec_setxattr(struct rpc_rqst *req, struct xdr_stream *xdr,
14991567
void *data)
15001568
{
@@ -1517,27 +1585,6 @@ static int nfs4_xdr_dec_setxattr(struct rpc_rqst *req, struct xdr_stream *xdr,
15171585
return status;
15181586
}
15191587

1520-
static void nfs4_xdr_enc_getxattr(struct rpc_rqst *req, struct xdr_stream *xdr,
1521-
const void *data)
1522-
{
1523-
const struct nfs42_getxattrargs *args = data;
1524-
struct compound_hdr hdr = {
1525-
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
1526-
};
1527-
uint32_t replen;
1528-
1529-
encode_compound_hdr(xdr, req, &hdr);
1530-
encode_sequence(xdr, &args->seq_args, &hdr);
1531-
encode_putfh(xdr, args->fh, &hdr);
1532-
replen = hdr.replen + op_decode_hdr_maxsz + 1;
1533-
encode_getxattr(xdr, args->xattr_name, &hdr);
1534-
1535-
rpc_prepare_reply_pages(req, args->xattr_pages, 0, args->xattr_len,
1536-
replen);
1537-
1538-
encode_nops(&hdr);
1539-
}
1540-
15411588
static int nfs4_xdr_dec_getxattr(struct rpc_rqst *rqstp,
15421589
struct xdr_stream *xdr, void *data)
15431590
{
@@ -1559,26 +1606,6 @@ static int nfs4_xdr_dec_getxattr(struct rpc_rqst *rqstp,
15591606
return status;
15601607
}
15611608

1562-
static void nfs4_xdr_enc_listxattrs(struct rpc_rqst *req,
1563-
struct xdr_stream *xdr, const void *data)
1564-
{
1565-
const struct nfs42_listxattrsargs *args = data;
1566-
struct compound_hdr hdr = {
1567-
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
1568-
};
1569-
uint32_t replen;
1570-
1571-
encode_compound_hdr(xdr, req, &hdr);
1572-
encode_sequence(xdr, &args->seq_args, &hdr);
1573-
encode_putfh(xdr, args->fh, &hdr);
1574-
replen = hdr.replen + op_decode_hdr_maxsz + 2 + 1;
1575-
encode_listxattrs(xdr, args, &hdr);
1576-
1577-
rpc_prepare_reply_pages(req, args->xattr_pages, 0, args->count, replen);
1578-
1579-
encode_nops(&hdr);
1580-
}
1581-
15821609
static int nfs4_xdr_dec_listxattrs(struct rpc_rqst *rqstp,
15831610
struct xdr_stream *xdr, void *data)
15841611
{
@@ -1602,21 +1629,6 @@ static int nfs4_xdr_dec_listxattrs(struct rpc_rqst *rqstp,
16021629
return status;
16031630
}
16041631

1605-
static void nfs4_xdr_enc_removexattr(struct rpc_rqst *req,
1606-
struct xdr_stream *xdr, const void *data)
1607-
{
1608-
const struct nfs42_removexattrargs *args = data;
1609-
struct compound_hdr hdr = {
1610-
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
1611-
};
1612-
1613-
encode_compound_hdr(xdr, req, &hdr);
1614-
encode_sequence(xdr, &args->seq_args, &hdr);
1615-
encode_putfh(xdr, args->fh, &hdr);
1616-
encode_removexattr(xdr, args->xattr_name, &hdr);
1617-
encode_nops(&hdr);
1618-
}
1619-
16201632
static int nfs4_xdr_dec_removexattr(struct rpc_rqst *req,
16211633
struct xdr_stream *xdr, void *data)
16221634
{

0 commit comments

Comments
 (0)