aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs3xdr.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-05-08 13:42:02 -0400
committerChristoph Hellwig <hch@lst.de>2017-05-15 11:42:25 -0400
commit63f8de37951a64cc24479eafd33085537e088075 (patch)
treee572e2542ef9370c9dfec6795660d52b72f77712 /fs/nfsd/nfs3xdr.c
parent026fec7e7c4723b5f26a753bbcad69f68c8299d4 (diff)
sunrpc: properly type pc_encode callbacks
Drop the resp argument as it can trivially be derived from the rqstp argument. With that all functions now have the same prototype, and we can remove the unsafe casting to kxdrproc_t. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfsd/nfs3xdr.c')
-rw-r--r--fs/nfsd/nfs3xdr.c74
1 files changed, 43 insertions, 31 deletions
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index be8bf8af9917..349e355edc73 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -645,16 +645,17 @@ nfs3svc_decode_commitargs(struct svc_rqst *rqstp, __be32 *p)
645 * will work properly. 645 * will work properly.
646 */ 646 */
647int 647int
648nfs3svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy) 648nfs3svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p)
649{ 649{
650 return xdr_ressize_check(rqstp, p); 650 return xdr_ressize_check(rqstp, p);
651} 651}
652 652
653/* GETATTR */ 653/* GETATTR */
654int 654int
655nfs3svc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p, 655nfs3svc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p)
656 struct nfsd3_attrstat *resp)
657{ 656{
657 struct nfsd3_attrstat *resp = rqstp->rq_resp;
658
658 if (resp->status == 0) { 659 if (resp->status == 0) {
659 lease_get_mtime(d_inode(resp->fh.fh_dentry), 660 lease_get_mtime(d_inode(resp->fh.fh_dentry),
660 &resp->stat.mtime); 661 &resp->stat.mtime);
@@ -665,18 +666,20 @@ nfs3svc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p,
665 666
666/* SETATTR, REMOVE, RMDIR */ 667/* SETATTR, REMOVE, RMDIR */
667int 668int
668nfs3svc_encode_wccstat(struct svc_rqst *rqstp, __be32 *p, 669nfs3svc_encode_wccstat(struct svc_rqst *rqstp, __be32 *p)
669 struct nfsd3_attrstat *resp)
670{ 670{
671 struct nfsd3_attrstat *resp = rqstp->rq_resp;
672
671 p = encode_wcc_data(rqstp, p, &resp->fh); 673 p = encode_wcc_data(rqstp, p, &resp->fh);
672 return xdr_ressize_check(rqstp, p); 674 return xdr_ressize_check(rqstp, p);
673} 675}
674 676
675/* LOOKUP */ 677/* LOOKUP */
676int 678int
677nfs3svc_encode_diropres(struct svc_rqst *rqstp, __be32 *p, 679nfs3svc_encode_diropres(struct svc_rqst *rqstp, __be32 *p)
678 struct nfsd3_diropres *resp)
679{ 680{
681 struct nfsd3_diropres *resp = rqstp->rq_resp;
682
680 if (resp->status == 0) { 683 if (resp->status == 0) {
681 p = encode_fh(p, &resp->fh); 684 p = encode_fh(p, &resp->fh);
682 p = encode_post_op_attr(rqstp, p, &resp->fh); 685 p = encode_post_op_attr(rqstp, p, &resp->fh);
@@ -687,9 +690,10 @@ nfs3svc_encode_diropres(struct svc_rqst *rqstp, __be32 *p,
687 690
688/* ACCESS */ 691/* ACCESS */
689int 692int
690nfs3svc_encode_accessres(struct svc_rqst *rqstp, __be32 *p, 693nfs3svc_encode_accessres(struct svc_rqst *rqstp, __be32 *p)
691 struct nfsd3_accessres *resp)
692{ 694{
695 struct nfsd3_accessres *resp = rqstp->rq_resp;
696
693 p = encode_post_op_attr(rqstp, p, &resp->fh); 697 p = encode_post_op_attr(rqstp, p, &resp->fh);
694 if (resp->status == 0) 698 if (resp->status == 0)
695 *p++ = htonl(resp->access); 699 *p++ = htonl(resp->access);
@@ -698,9 +702,10 @@ nfs3svc_encode_accessres(struct svc_rqst *rqstp, __be32 *p,
698 702
699/* READLINK */ 703/* READLINK */
700int 704int
701nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p, 705nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p)
702 struct nfsd3_readlinkres *resp)
703{ 706{
707 struct nfsd3_readlinkres *resp = rqstp->rq_resp;
708
704 p = encode_post_op_attr(rqstp, p, &resp->fh); 709 p = encode_post_op_attr(rqstp, p, &resp->fh);
705 if (resp->status == 0) { 710 if (resp->status == 0) {
706 *p++ = htonl(resp->len); 711 *p++ = htonl(resp->len);
@@ -719,9 +724,10 @@ nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p,
719 724
720/* READ */ 725/* READ */
721int 726int
722nfs3svc_encode_readres(struct svc_rqst *rqstp, __be32 *p, 727nfs3svc_encode_readres(struct svc_rqst *rqstp, __be32 *p)
723 struct nfsd3_readres *resp)
724{ 728{
729 struct nfsd3_readres *resp = rqstp->rq_resp;
730
725 p = encode_post_op_attr(rqstp, p, &resp->fh); 731 p = encode_post_op_attr(rqstp, p, &resp->fh);
726 if (resp->status == 0) { 732 if (resp->status == 0) {
727 *p++ = htonl(resp->count); 733 *p++ = htonl(resp->count);
@@ -743,9 +749,9 @@ nfs3svc_encode_readres(struct svc_rqst *rqstp, __be32 *p,
743 749
744/* WRITE */ 750/* WRITE */
745int 751int
746nfs3svc_encode_writeres(struct svc_rqst *rqstp, __be32 *p, 752nfs3svc_encode_writeres(struct svc_rqst *rqstp, __be32 *p)
747 struct nfsd3_writeres *resp)
748{ 753{
754 struct nfsd3_writeres *resp = rqstp->rq_resp;
749 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); 755 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
750 756
751 p = encode_wcc_data(rqstp, p, &resp->fh); 757 p = encode_wcc_data(rqstp, p, &resp->fh);
@@ -760,9 +766,10 @@ nfs3svc_encode_writeres(struct svc_rqst *rqstp, __be32 *p,
760 766
761/* CREATE, MKDIR, SYMLINK, MKNOD */ 767/* CREATE, MKDIR, SYMLINK, MKNOD */
762int 768int
763nfs3svc_encode_createres(struct svc_rqst *rqstp, __be32 *p, 769nfs3svc_encode_createres(struct svc_rqst *rqstp, __be32 *p)
764 struct nfsd3_diropres *resp)
765{ 770{
771 struct nfsd3_diropres *resp = rqstp->rq_resp;
772
766 if (resp->status == 0) { 773 if (resp->status == 0) {
767 *p++ = xdr_one; 774 *p++ = xdr_one;
768 p = encode_fh(p, &resp->fh); 775 p = encode_fh(p, &resp->fh);
@@ -774,9 +781,10 @@ nfs3svc_encode_createres(struct svc_rqst *rqstp, __be32 *p,
774 781
775/* RENAME */ 782/* RENAME */
776int 783int
777nfs3svc_encode_renameres(struct svc_rqst *rqstp, __be32 *p, 784nfs3svc_encode_renameres(struct svc_rqst *rqstp, __be32 *p)
778 struct nfsd3_renameres *resp)
779{ 785{
786 struct nfsd3_renameres *resp = rqstp->rq_resp;
787
780 p = encode_wcc_data(rqstp, p, &resp->ffh); 788 p = encode_wcc_data(rqstp, p, &resp->ffh);
781 p = encode_wcc_data(rqstp, p, &resp->tfh); 789 p = encode_wcc_data(rqstp, p, &resp->tfh);
782 return xdr_ressize_check(rqstp, p); 790 return xdr_ressize_check(rqstp, p);
@@ -784,9 +792,10 @@ nfs3svc_encode_renameres(struct svc_rqst *rqstp, __be32 *p,
784 792
785/* LINK */ 793/* LINK */
786int 794int
787nfs3svc_encode_linkres(struct svc_rqst *rqstp, __be32 *p, 795nfs3svc_encode_linkres(struct svc_rqst *rqstp, __be32 *p)
788 struct nfsd3_linkres *resp)
789{ 796{
797 struct nfsd3_linkres *resp = rqstp->rq_resp;
798
790 p = encode_post_op_attr(rqstp, p, &resp->fh); 799 p = encode_post_op_attr(rqstp, p, &resp->fh);
791 p = encode_wcc_data(rqstp, p, &resp->tfh); 800 p = encode_wcc_data(rqstp, p, &resp->tfh);
792 return xdr_ressize_check(rqstp, p); 801 return xdr_ressize_check(rqstp, p);
@@ -794,9 +803,10 @@ nfs3svc_encode_linkres(struct svc_rqst *rqstp, __be32 *p,
794 803
795/* READDIR */ 804/* READDIR */
796int 805int
797nfs3svc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p, 806nfs3svc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p)
798 struct nfsd3_readdirres *resp)
799{ 807{
808 struct nfsd3_readdirres *resp = rqstp->rq_resp;
809
800 p = encode_post_op_attr(rqstp, p, &resp->fh); 810 p = encode_post_op_attr(rqstp, p, &resp->fh);
801 811
802 if (resp->status == 0) { 812 if (resp->status == 0) {
@@ -1044,9 +1054,9 @@ nfs3svc_encode_entry_plus(void *cd, const char *name,
1044 1054
1045/* FSSTAT */ 1055/* FSSTAT */
1046int 1056int
1047nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, __be32 *p, 1057nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, __be32 *p)
1048 struct nfsd3_fsstatres *resp)
1049{ 1058{
1059 struct nfsd3_fsstatres *resp = rqstp->rq_resp;
1050 struct kstatfs *s = &resp->stats; 1060 struct kstatfs *s = &resp->stats;
1051 u64 bs = s->f_bsize; 1061 u64 bs = s->f_bsize;
1052 1062
@@ -1066,9 +1076,10 @@ nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, __be32 *p,
1066 1076
1067/* FSINFO */ 1077/* FSINFO */
1068int 1078int
1069nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, __be32 *p, 1079nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, __be32 *p)
1070 struct nfsd3_fsinfores *resp)
1071{ 1080{
1081 struct nfsd3_fsinfores *resp = rqstp->rq_resp;
1082
1072 *p++ = xdr_zero; /* no post_op_attr */ 1083 *p++ = xdr_zero; /* no post_op_attr */
1073 1084
1074 if (resp->status == 0) { 1085 if (resp->status == 0) {
@@ -1090,9 +1101,10 @@ nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, __be32 *p,
1090 1101
1091/* PATHCONF */ 1102/* PATHCONF */
1092int 1103int
1093nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, __be32 *p, 1104nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, __be32 *p)
1094 struct nfsd3_pathconfres *resp)
1095{ 1105{
1106 struct nfsd3_pathconfres *resp = rqstp->rq_resp;
1107
1096 *p++ = xdr_zero; /* no post_op_attr */ 1108 *p++ = xdr_zero; /* no post_op_attr */
1097 1109
1098 if (resp->status == 0) { 1110 if (resp->status == 0) {
@@ -1109,9 +1121,9 @@ nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, __be32 *p,
1109 1121
1110/* COMMIT */ 1122/* COMMIT */
1111int 1123int
1112nfs3svc_encode_commitres(struct svc_rqst *rqstp, __be32 *p, 1124nfs3svc_encode_commitres(struct svc_rqst *rqstp, __be32 *p)
1113 struct nfsd3_commitres *resp)
1114{ 1125{
1126 struct nfsd3_commitres *resp = rqstp->rq_resp;
1115 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); 1127 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
1116 1128
1117 p = encode_wcc_data(rqstp, p, &resp->fh); 1129 p = encode_wcc_data(rqstp, p, &resp->fh);