Skip to content

Commit

Permalink
nfs: fix decoder callback prototypes
Browse files Browse the repository at this point in the history
Declare the p_decode callbacks with the proper prototype instead of
casting to kxdrdproc_t and losing all type safety.

Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
Acked-by: Trond Myklebust <[email protected]>
  • Loading branch information
Christoph Hellwig authored and amschuma-ntap committed Jul 13, 2017
1 parent 0400056 commit fc01648
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 84 deletions.
10 changes: 6 additions & 4 deletions fs/nfs/mount_clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,9 @@ static int decode_fhandle(struct xdr_stream *xdr, struct mountres *res)

static int mnt_xdr_dec_mountres(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct mountres *res)
void *data)
{
struct mountres *res = data;
int status;

status = decode_status(xdr, res);
Expand Down Expand Up @@ -449,8 +450,9 @@ static int decode_auth_flavors(struct xdr_stream *xdr, struct mountres *res)

static int mnt_xdr_dec_mountres3(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct mountres *res)
void *data)
{
struct mountres *res = data;
int status;

status = decode_fhs_status(xdr, res);
Expand All @@ -468,7 +470,7 @@ static struct rpc_procinfo mnt_procedures[] = {
[MOUNTPROC_MNT] = {
.p_proc = MOUNTPROC_MNT,
.p_encode = mnt_xdr_enc_dirpath,
.p_decode = (kxdrdproc_t)mnt_xdr_dec_mountres,
.p_decode = mnt_xdr_dec_mountres,
.p_arglen = MNT_enc_dirpath_sz,
.p_replen = MNT_dec_mountres_sz,
.p_statidx = MOUNTPROC_MNT,
Expand All @@ -487,7 +489,7 @@ static struct rpc_procinfo mnt3_procedures[] = {
[MOUNTPROC3_MNT] = {
.p_proc = MOUNTPROC3_MNT,
.p_encode = mnt_xdr_enc_dirpath,
.p_decode = (kxdrdproc_t)mnt_xdr_dec_mountres3,
.p_decode = mnt_xdr_dec_mountres3,
.p_arglen = MNT_enc_dirpath_sz,
.p_replen = MNT_dec_mountres3_sz,
.p_statidx = MOUNTPROC3_MNT,
Expand Down
15 changes: 9 additions & 6 deletions fs/nfs/nfs2xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,13 +832,13 @@ static int nfs2_xdr_dec_stat(struct rpc_rqst *req, struct xdr_stream *xdr,
}

static int nfs2_xdr_dec_attrstat(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_fattr *result)
void *result)
{
return decode_attrstat(xdr, result, NULL);
}

static int nfs2_xdr_dec_diropres(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_diropok *result)
void *result)
{
return decode_diropres(xdr, result);
}
Expand Down Expand Up @@ -883,8 +883,9 @@ static int nfs2_xdr_dec_readlinkres(struct rpc_rqst *req,
* };
*/
static int nfs2_xdr_dec_readres(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_pgio_res *result)
void *data)
{
struct nfs_pgio_res *result = data;
enum nfs_stat status;
int error;

Expand All @@ -905,8 +906,10 @@ static int nfs2_xdr_dec_readres(struct rpc_rqst *req, struct xdr_stream *xdr,
}

static int nfs2_xdr_dec_writeres(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_pgio_res *result)
void *data)
{
struct nfs_pgio_res *result = data;

/* All NFSv2 writes are "file sync" writes */
result->verf->committed = NFS_FILE_SYNC;
return decode_attrstat(xdr, result->fattr, &result->op_status);
Expand Down Expand Up @@ -1057,7 +1060,7 @@ static int decode_info(struct xdr_stream *xdr, struct nfs2_fsstat *result)
}

static int nfs2_xdr_dec_statfsres(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs2_fsstat *result)
void *result)
{
enum nfs_stat status;
int error;
Expand Down Expand Up @@ -1142,7 +1145,7 @@ static int nfs_stat_to_errno(enum nfs_stat status)
[NFSPROC_##proc] = { \
.p_proc = NFSPROC_##proc, \
.p_encode = nfs2_xdr_enc_##argtype, \
.p_decode = (kxdrdproc_t)nfs2_xdr_dec_##restype, \
.p_decode = nfs2_xdr_dec_##restype, \
.p_arglen = NFS_##argtype##_sz, \
.p_replen = NFS_##restype##_sz, \
.p_timer = timer, \
Expand Down
55 changes: 34 additions & 21 deletions fs/nfs/nfs3xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req,
*/
static int nfs3_xdr_dec_getattr3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs_fattr *result)
void *result)
{
enum nfs_stat status;
int error;
Expand Down Expand Up @@ -1456,7 +1456,7 @@ static int nfs3_xdr_dec_getattr3res(struct rpc_rqst *req,
*/
static int nfs3_xdr_dec_setattr3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs_fattr *result)
void *result)
{
enum nfs_stat status;
int error;
Expand Down Expand Up @@ -1497,8 +1497,9 @@ static int nfs3_xdr_dec_setattr3res(struct rpc_rqst *req,
*/
static int nfs3_xdr_dec_lookup3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs3_diropres *result)
void *data)
{
struct nfs3_diropres *result = data;
enum nfs_stat status;
int error;

Expand Down Expand Up @@ -1544,8 +1545,9 @@ static int nfs3_xdr_dec_lookup3res(struct rpc_rqst *req,
*/
static int nfs3_xdr_dec_access3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs3_accessres *result)
void *data)
{
struct nfs3_accessres *result = data;
enum nfs_stat status;
int error;

Expand Down Expand Up @@ -1585,7 +1587,7 @@ static int nfs3_xdr_dec_access3res(struct rpc_rqst *req,
*/
static int nfs3_xdr_dec_readlink3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs_fattr *result)
void *result)
{
enum nfs_stat status;
int error;
Expand Down Expand Up @@ -1663,8 +1665,9 @@ static int decode_read3resok(struct xdr_stream *xdr,
}

static int nfs3_xdr_dec_read3res(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_pgio_res *result)
void *data)
{
struct nfs_pgio_res *result = data;
enum nfs_stat status;
int error;

Expand Down Expand Up @@ -1736,8 +1739,9 @@ static int decode_write3resok(struct xdr_stream *xdr,
}

static int nfs3_xdr_dec_write3res(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_pgio_res *result)
void *data)
{
struct nfs_pgio_res *result = data;
enum nfs_stat status;
int error;

Expand Down Expand Up @@ -1801,8 +1805,9 @@ static int decode_create3resok(struct xdr_stream *xdr,

static int nfs3_xdr_dec_create3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs3_diropres *result)
void *data)
{
struct nfs3_diropres *result = data;
enum nfs_stat status;
int error;

Expand Down Expand Up @@ -1841,8 +1846,9 @@ static int nfs3_xdr_dec_create3res(struct rpc_rqst *req,
*/
static int nfs3_xdr_dec_remove3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs_removeres *result)
void *data)
{
struct nfs_removeres *result = data;
enum nfs_stat status;
int error;

Expand Down Expand Up @@ -1882,8 +1888,9 @@ static int nfs3_xdr_dec_remove3res(struct rpc_rqst *req,
*/
static int nfs3_xdr_dec_rename3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs_renameres *result)
void *data)
{
struct nfs_renameres *result = data;
enum nfs_stat status;
int error;

Expand Down Expand Up @@ -1925,8 +1932,9 @@ static int nfs3_xdr_dec_rename3res(struct rpc_rqst *req,
* };
*/
static int nfs3_xdr_dec_link3res(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs3_linkres *result)
void *data)
{
struct nfs3_linkres *result = data;
enum nfs_stat status;
int error;

Expand Down Expand Up @@ -2109,8 +2117,9 @@ static int decode_readdir3resok(struct xdr_stream *xdr,

static int nfs3_xdr_dec_readdir3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs3_readdirres *result)
void *data)
{
struct nfs3_readdirres *result = data;
enum nfs_stat status;
int error;

Expand Down Expand Up @@ -2177,8 +2186,9 @@ static int decode_fsstat3resok(struct xdr_stream *xdr,

static int nfs3_xdr_dec_fsstat3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs_fsstat *result)
void *data)
{
struct nfs_fsstat *result = data;
enum nfs_stat status;
int error;

Expand Down Expand Up @@ -2253,8 +2263,9 @@ static int decode_fsinfo3resok(struct xdr_stream *xdr,

static int nfs3_xdr_dec_fsinfo3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs_fsinfo *result)
void *data)
{
struct nfs_fsinfo *result = data;
enum nfs_stat status;
int error;

Expand Down Expand Up @@ -2316,8 +2327,9 @@ static int decode_pathconf3resok(struct xdr_stream *xdr,

static int nfs3_xdr_dec_pathconf3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs_pathconf *result)
void *data)
{
struct nfs_pathconf *result = data;
enum nfs_stat status;
int error;

Expand Down Expand Up @@ -2357,8 +2369,9 @@ static int nfs3_xdr_dec_pathconf3res(struct rpc_rqst *req,
*/
static int nfs3_xdr_dec_commit3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs_commitres *result)
void *data)
{
struct nfs_commitres *result = data;
enum nfs_stat status;
int error;

Expand Down Expand Up @@ -2426,7 +2439,7 @@ static inline int decode_getacl3resok(struct xdr_stream *xdr,

static int nfs3_xdr_dec_getacl3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs3_getaclres *result)
void *result)
{
enum nfs_stat status;
int error;
Expand All @@ -2445,7 +2458,7 @@ static int nfs3_xdr_dec_getacl3res(struct rpc_rqst *req,

static int nfs3_xdr_dec_setacl3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs_fattr *result)
void *result)
{
enum nfs_stat status;
int error;
Expand Down Expand Up @@ -2533,7 +2546,7 @@ static int nfs3_stat_to_errno(enum nfs_stat status)
[NFS3PROC_##proc] = { \
.p_proc = NFS3PROC_##proc, \
.p_encode = nfs3_xdr_enc_##argtype##3args, \
.p_decode = (kxdrdproc_t)nfs3_xdr_dec_##restype##3res, \
.p_decode = nfs3_xdr_dec_##restype##3res, \
.p_arglen = NFS3_##argtype##args_sz, \
.p_replen = NFS3_##restype##res_sz, \
.p_timer = timer, \
Expand Down Expand Up @@ -2576,7 +2589,7 @@ static struct rpc_procinfo nfs3_acl_procedures[] = {
[ACLPROC3_GETACL] = {
.p_proc = ACLPROC3_GETACL,
.p_encode = nfs3_xdr_enc_getacl3args,
.p_decode = (kxdrdproc_t)nfs3_xdr_dec_getacl3res,
.p_decode = nfs3_xdr_dec_getacl3res,
.p_arglen = ACL3_getaclargs_sz,
.p_replen = ACL3_getaclres_sz,
.p_timer = 1,
Expand All @@ -2585,7 +2598,7 @@ static struct rpc_procinfo nfs3_acl_procedures[] = {
[ACLPROC3_SETACL] = {
.p_proc = ACLPROC3_SETACL,
.p_encode = nfs3_xdr_enc_setacl3args,
.p_decode = (kxdrdproc_t)nfs3_xdr_dec_setacl3res,
.p_decode = nfs3_xdr_dec_setacl3res,
.p_arglen = ACL3_setaclargs_sz,
.p_replen = ACL3_setaclres_sz,
.p_timer = 0,
Expand Down
18 changes: 12 additions & 6 deletions fs/nfs/nfs42xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,9 @@ static int decode_clone(struct xdr_stream *xdr)
*/
static int nfs4_xdr_dec_allocate(struct rpc_rqst *rqstp,
struct xdr_stream *xdr,
struct nfs42_falloc_res *res)
void *data)
{
struct nfs42_falloc_res *res = data;
struct compound_hdr hdr;
int status;

Expand All @@ -481,8 +482,9 @@ static int nfs4_xdr_dec_allocate(struct rpc_rqst *rqstp,
*/
static int nfs4_xdr_dec_copy(struct rpc_rqst *rqstp,
struct xdr_stream *xdr,
struct nfs42_copy_res *res)
void *data)
{
struct nfs42_copy_res *res = data;
struct compound_hdr hdr;
int status;

Expand Down Expand Up @@ -514,8 +516,9 @@ static int nfs4_xdr_dec_copy(struct rpc_rqst *rqstp,
*/
static int nfs4_xdr_dec_deallocate(struct rpc_rqst *rqstp,
struct xdr_stream *xdr,
struct nfs42_falloc_res *res)
void *data)
{
struct nfs42_falloc_res *res = data;
struct compound_hdr hdr;
int status;

Expand All @@ -541,8 +544,9 @@ static int nfs4_xdr_dec_deallocate(struct rpc_rqst *rqstp,
*/
static int nfs4_xdr_dec_seek(struct rpc_rqst *rqstp,
struct xdr_stream *xdr,
struct nfs42_seek_res *res)
void *data)
{
struct nfs42_seek_res *res = data;
struct compound_hdr hdr;
int status;

Expand All @@ -565,8 +569,9 @@ static int nfs4_xdr_dec_seek(struct rpc_rqst *rqstp,
*/
static int nfs4_xdr_dec_layoutstats(struct rpc_rqst *rqstp,
struct xdr_stream *xdr,
struct nfs42_layoutstat_res *res)
void *data)
{
struct nfs42_layoutstat_res *res = data;
struct compound_hdr hdr;
int status, i;

Expand Down Expand Up @@ -595,8 +600,9 @@ static int nfs4_xdr_dec_layoutstats(struct rpc_rqst *rqstp,
*/
static int nfs4_xdr_dec_clone(struct rpc_rqst *rqstp,
struct xdr_stream *xdr,
struct nfs42_clone_res *res)
void *data)
{
struct nfs42_clone_res *res = data;
struct compound_hdr hdr;
int status;

Expand Down
Loading

0 comments on commit fc01648

Please sign in to comment.