Commit 947c6e43 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Anna Schumaker

nfs: don't cast callback decode/proc/encode routines

Instead declare all functions with the proper methods signature.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJeff Layton <jlayton@redhat.com>
Acked-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent fc016483
...@@ -114,8 +114,7 @@ struct cb_sequenceres { ...@@ -114,8 +114,7 @@ struct cb_sequenceres {
uint32_t csr_target_highestslotid; uint32_t csr_target_highestslotid;
}; };
extern __be32 nfs4_callback_sequence(struct cb_sequenceargs *args, extern __be32 nfs4_callback_sequence(void *argp, void *resp,
struct cb_sequenceres *res,
struct cb_process_state *cps); struct cb_process_state *cps);
#define RCA4_TYPE_MASK_RDATA_DLG 0 #define RCA4_TYPE_MASK_RDATA_DLG 0
...@@ -134,15 +133,13 @@ struct cb_recallanyargs { ...@@ -134,15 +133,13 @@ struct cb_recallanyargs {
uint32_t craa_type_mask; uint32_t craa_type_mask;
}; };
extern __be32 nfs4_callback_recallany(struct cb_recallanyargs *args, extern __be32 nfs4_callback_recallany(void *argp, void *resp,
void *dummy,
struct cb_process_state *cps); struct cb_process_state *cps);
struct cb_recallslotargs { struct cb_recallslotargs {
uint32_t crsa_target_highest_slotid; uint32_t crsa_target_highest_slotid;
}; };
extern __be32 nfs4_callback_recallslot(struct cb_recallslotargs *args, extern __be32 nfs4_callback_recallslot(void *argp, void *resp,
void *dummy,
struct cb_process_state *cps); struct cb_process_state *cps);
struct cb_layoutrecallargs { struct cb_layoutrecallargs {
...@@ -159,9 +156,8 @@ struct cb_layoutrecallargs { ...@@ -159,9 +156,8 @@ struct cb_layoutrecallargs {
}; };
}; };
extern __be32 nfs4_callback_layoutrecall( extern __be32 nfs4_callback_layoutrecall(void *argp, void *resp,
struct cb_layoutrecallargs *args, struct cb_process_state *cps);
void *dummy, struct cb_process_state *cps);
struct cb_devicenotifyitem { struct cb_devicenotifyitem {
uint32_t cbd_notify_type; uint32_t cbd_notify_type;
...@@ -175,9 +171,8 @@ struct cb_devicenotifyargs { ...@@ -175,9 +171,8 @@ struct cb_devicenotifyargs {
struct cb_devicenotifyitem *devs; struct cb_devicenotifyitem *devs;
}; };
extern __be32 nfs4_callback_devicenotify( extern __be32 nfs4_callback_devicenotify(void *argp, void *resp,
struct cb_devicenotifyargs *args, struct cb_process_state *cps);
void *dummy, struct cb_process_state *cps);
struct cb_notify_lock_args { struct cb_notify_lock_args {
struct nfs_fh cbnl_fh; struct nfs_fh cbnl_fh;
...@@ -185,15 +180,13 @@ struct cb_notify_lock_args { ...@@ -185,15 +180,13 @@ struct cb_notify_lock_args {
bool cbnl_valid; bool cbnl_valid;
}; };
extern __be32 nfs4_callback_notify_lock(struct cb_notify_lock_args *args, extern __be32 nfs4_callback_notify_lock(void *argp, void *resp,
void *dummy,
struct cb_process_state *cps); struct cb_process_state *cps);
#endif /* CONFIG_NFS_V4_1 */ #endif /* CONFIG_NFS_V4_1 */
extern int check_gss_callback_principal(struct nfs_client *, struct svc_rqst *); extern int check_gss_callback_principal(struct nfs_client *, struct svc_rqst *);
extern __be32 nfs4_callback_getattr(struct cb_getattrargs *args, extern __be32 nfs4_callback_getattr(void *argp, void *resp,
struct cb_getattrres *res,
struct cb_process_state *cps); struct cb_process_state *cps);
extern __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy, extern __be32 nfs4_callback_recall(void *argp, void *resp,
struct cb_process_state *cps); struct cb_process_state *cps);
#if IS_ENABLED(CONFIG_NFS_V4) #if IS_ENABLED(CONFIG_NFS_V4)
extern int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt); extern int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt);
......
...@@ -19,10 +19,11 @@ ...@@ -19,10 +19,11 @@
#define NFSDBG_FACILITY NFSDBG_CALLBACK #define NFSDBG_FACILITY NFSDBG_CALLBACK
__be32 nfs4_callback_getattr(struct cb_getattrargs *args, __be32 nfs4_callback_getattr(void *argp, void *resp,
struct cb_getattrres *res,
struct cb_process_state *cps) struct cb_process_state *cps)
{ {
struct cb_getattrargs *args = argp;
struct cb_getattrres *res = resp;
struct nfs_delegation *delegation; struct nfs_delegation *delegation;
struct nfs_inode *nfsi; struct nfs_inode *nfsi;
struct inode *inode; struct inode *inode;
...@@ -68,9 +69,10 @@ __be32 nfs4_callback_getattr(struct cb_getattrargs *args, ...@@ -68,9 +69,10 @@ __be32 nfs4_callback_getattr(struct cb_getattrargs *args,
return res->status; return res->status;
} }
__be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy, __be32 nfs4_callback_recall(void *argp, void *resp,
struct cb_process_state *cps) struct cb_process_state *cps)
{ {
struct cb_recallargs *args = argp;
struct inode *inode; struct inode *inode;
__be32 res; __be32 res;
...@@ -324,9 +326,10 @@ static u32 do_callback_layoutrecall(struct nfs_client *clp, ...@@ -324,9 +326,10 @@ static u32 do_callback_layoutrecall(struct nfs_client *clp,
return initiate_bulk_draining(clp, args); return initiate_bulk_draining(clp, args);
} }
__be32 nfs4_callback_layoutrecall(struct cb_layoutrecallargs *args, __be32 nfs4_callback_layoutrecall(void *argp, void *resp,
void *dummy, struct cb_process_state *cps) struct cb_process_state *cps)
{ {
struct cb_layoutrecallargs *args = argp;
u32 res = NFS4ERR_OP_NOT_IN_SESSION; u32 res = NFS4ERR_OP_NOT_IN_SESSION;
if (cps->clp) if (cps->clp)
...@@ -345,9 +348,10 @@ static void pnfs_recall_all_layouts(struct nfs_client *clp) ...@@ -345,9 +348,10 @@ static void pnfs_recall_all_layouts(struct nfs_client *clp)
do_callback_layoutrecall(clp, &args); do_callback_layoutrecall(clp, &args);
} }
__be32 nfs4_callback_devicenotify(struct cb_devicenotifyargs *args, __be32 nfs4_callback_devicenotify(void *argp, void *resp,
void *dummy, struct cb_process_state *cps) struct cb_process_state *cps)
{ {
struct cb_devicenotifyargs *args = argp;
int i; int i;
__be32 res = 0; __be32 res = 0;
struct nfs_client *clp = cps->clp; struct nfs_client *clp = cps->clp;
...@@ -469,10 +473,11 @@ static bool referring_call_exists(struct nfs_client *clp, ...@@ -469,10 +473,11 @@ static bool referring_call_exists(struct nfs_client *clp,
return status; return status;
} }
__be32 nfs4_callback_sequence(struct cb_sequenceargs *args, __be32 nfs4_callback_sequence(void *argp, void *resp,
struct cb_sequenceres *res,
struct cb_process_state *cps) struct cb_process_state *cps)
{ {
struct cb_sequenceargs *args = argp;
struct cb_sequenceres *res = resp;
struct nfs4_slot_table *tbl; struct nfs4_slot_table *tbl;
struct nfs4_slot *slot; struct nfs4_slot *slot;
struct nfs_client *clp; struct nfs_client *clp;
...@@ -571,9 +576,10 @@ validate_bitmap_values(unsigned long mask) ...@@ -571,9 +576,10 @@ validate_bitmap_values(unsigned long mask)
return (mask & ~RCA4_TYPE_MASK_ALL) == 0; return (mask & ~RCA4_TYPE_MASK_ALL) == 0;
} }
__be32 nfs4_callback_recallany(struct cb_recallanyargs *args, void *dummy, __be32 nfs4_callback_recallany(void *argp, void *resp,
struct cb_process_state *cps) struct cb_process_state *cps)
{ {
struct cb_recallanyargs *args = argp;
__be32 status; __be32 status;
fmode_t flags = 0; fmode_t flags = 0;
...@@ -606,9 +612,10 @@ __be32 nfs4_callback_recallany(struct cb_recallanyargs *args, void *dummy, ...@@ -606,9 +612,10 @@ __be32 nfs4_callback_recallany(struct cb_recallanyargs *args, void *dummy,
} }
/* Reduce the fore channel's max_slots to the target value */ /* Reduce the fore channel's max_slots to the target value */
__be32 nfs4_callback_recallslot(struct cb_recallslotargs *args, void *dummy, __be32 nfs4_callback_recallslot(void *argp, void *resp,
struct cb_process_state *cps) struct cb_process_state *cps)
{ {
struct cb_recallslotargs *args = argp;
struct nfs4_slot_table *fc_tbl; struct nfs4_slot_table *fc_tbl;
__be32 status; __be32 status;
...@@ -631,9 +638,11 @@ __be32 nfs4_callback_recallslot(struct cb_recallslotargs *args, void *dummy, ...@@ -631,9 +638,11 @@ __be32 nfs4_callback_recallslot(struct cb_recallslotargs *args, void *dummy,
return status; return status;
} }
__be32 nfs4_callback_notify_lock(struct cb_notify_lock_args *args, void *dummy, __be32 nfs4_callback_notify_lock(void *argp, void *resp,
struct cb_process_state *cps) struct cb_process_state *cps)
{ {
struct cb_notify_lock_args *args = argp;
if (!cps->clp) /* set in cb_sequence */ if (!cps->clp) /* set in cb_sequence */
return htonl(NFS4ERR_OP_NOT_IN_SESSION); return htonl(NFS4ERR_OP_NOT_IN_SESSION);
......
...@@ -43,16 +43,11 @@ ...@@ -43,16 +43,11 @@
/* Internal error code */ /* Internal error code */
#define NFS4ERR_RESOURCE_HDR 11050 #define NFS4ERR_RESOURCE_HDR 11050
typedef __be32 (*callback_process_op_t)(void *, void *,
struct cb_process_state *);
typedef __be32 (*callback_decode_arg_t)(struct svc_rqst *, struct xdr_stream *, void *);
typedef __be32 (*callback_encode_res_t)(struct svc_rqst *, struct xdr_stream *, void *);
struct callback_op { struct callback_op {
callback_process_op_t process_op; __be32 (*process_op)(void *, void *, struct cb_process_state *);
callback_decode_arg_t decode_args; __be32 (*decode_args)(struct svc_rqst *, struct xdr_stream *, void *);
callback_encode_res_t encode_res; __be32 (*encode_res)(struct svc_rqst *, struct xdr_stream *,
const void *);
long res_maxsize; long res_maxsize;
}; };
...@@ -184,8 +179,10 @@ static __be32 decode_op_hdr(struct xdr_stream *xdr, unsigned int *op) ...@@ -184,8 +179,10 @@ static __be32 decode_op_hdr(struct xdr_stream *xdr, unsigned int *op)
return 0; return 0;
} }
static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_getattrargs *args) static __be32 decode_getattr_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr, void *argp)
{ {
struct cb_getattrargs *args = argp;
__be32 status; __be32 status;
status = decode_fh(xdr, &args->fh); status = decode_fh(xdr, &args->fh);
...@@ -194,8 +191,10 @@ static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr ...@@ -194,8 +191,10 @@ static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr
return decode_bitmap(xdr, args->bitmap); return decode_bitmap(xdr, args->bitmap);
} }
static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_recallargs *args) static __be32 decode_recall_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr, void *argp)
{ {
struct cb_recallargs *args = argp;
__be32 *p; __be32 *p;
__be32 status; __be32 status;
...@@ -217,9 +216,9 @@ static __be32 decode_layout_stateid(struct xdr_stream *xdr, nfs4_stateid *statei ...@@ -217,9 +216,9 @@ static __be32 decode_layout_stateid(struct xdr_stream *xdr, nfs4_stateid *statei
} }
static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp, static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr, void *argp)
struct cb_layoutrecallargs *args)
{ {
struct cb_layoutrecallargs *args = argp;
__be32 *p; __be32 *p;
__be32 status = 0; __be32 status = 0;
uint32_t iomode; uint32_t iomode;
...@@ -262,8 +261,9 @@ static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp, ...@@ -262,8 +261,9 @@ static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp,
static static
__be32 decode_devicenotify_args(struct svc_rqst *rqstp, __be32 decode_devicenotify_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct cb_devicenotifyargs *args) void *argp)
{ {
struct cb_devicenotifyargs *args = argp;
__be32 *p; __be32 *p;
__be32 status = 0; __be32 status = 0;
u32 tmp; u32 tmp;
...@@ -403,8 +403,9 @@ static __be32 decode_rc_list(struct xdr_stream *xdr, ...@@ -403,8 +403,9 @@ static __be32 decode_rc_list(struct xdr_stream *xdr,
static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp, static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct cb_sequenceargs *args) void *argp)
{ {
struct cb_sequenceargs *args = argp;
__be32 *p; __be32 *p;
int i; int i;
__be32 status; __be32 status;
...@@ -450,8 +451,9 @@ static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp, ...@@ -450,8 +451,9 @@ static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp,
static __be32 decode_recallany_args(struct svc_rqst *rqstp, static __be32 decode_recallany_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct cb_recallanyargs *args) void *argp)
{ {
struct cb_recallanyargs *args = argp;
uint32_t bitmap[2]; uint32_t bitmap[2];
__be32 *p, status; __be32 *p, status;
...@@ -469,8 +471,9 @@ static __be32 decode_recallany_args(struct svc_rqst *rqstp, ...@@ -469,8 +471,9 @@ static __be32 decode_recallany_args(struct svc_rqst *rqstp,
static __be32 decode_recallslot_args(struct svc_rqst *rqstp, static __be32 decode_recallslot_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct cb_recallslotargs *args) void *argp)
{ {
struct cb_recallslotargs *args = argp;
__be32 *p; __be32 *p;
p = read_buf(xdr, 4); p = read_buf(xdr, 4);
...@@ -510,8 +513,10 @@ static __be32 decode_lockowner(struct xdr_stream *xdr, struct cb_notify_lock_arg ...@@ -510,8 +513,10 @@ static __be32 decode_lockowner(struct xdr_stream *xdr, struct cb_notify_lock_arg
return 0; return 0;
} }
static __be32 decode_notify_lock_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_notify_lock_args *args) static __be32 decode_notify_lock_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr, void *argp)
{ {
struct cb_notify_lock_args *args = argp;
__be32 status; __be32 status;
status = decode_fh(xdr, &args->cbnl_fh); status = decode_fh(xdr, &args->cbnl_fh);
...@@ -641,8 +646,10 @@ static __be32 encode_op_hdr(struct xdr_stream *xdr, uint32_t op, __be32 res) ...@@ -641,8 +646,10 @@ static __be32 encode_op_hdr(struct xdr_stream *xdr, uint32_t op, __be32 res)
return 0; return 0;
} }
static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr, const struct cb_getattrres *res) static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr,
const void *resp)
{ {
const struct cb_getattrres *res = resp;
__be32 *savep = NULL; __be32 *savep = NULL;
__be32 status = res->status; __be32 status = res->status;
...@@ -683,8 +690,9 @@ static __be32 encode_sessionid(struct xdr_stream *xdr, ...@@ -683,8 +690,9 @@ static __be32 encode_sessionid(struct xdr_stream *xdr,
static __be32 encode_cb_sequence_res(struct svc_rqst *rqstp, static __be32 encode_cb_sequence_res(struct svc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct cb_sequenceres *res) const void *resp)
{ {
const struct cb_sequenceres *res = resp;
__be32 *p; __be32 *p;
__be32 status = res->csr_status; __be32 status = res->csr_status;
...@@ -938,48 +946,46 @@ static struct callback_op callback_ops[] = { ...@@ -938,48 +946,46 @@ static struct callback_op callback_ops[] = {
.res_maxsize = CB_OP_HDR_RES_MAXSZ, .res_maxsize = CB_OP_HDR_RES_MAXSZ,
}, },
[OP_CB_GETATTR] = { [OP_CB_GETATTR] = {
.process_op = (callback_process_op_t)nfs4_callback_getattr, .process_op = nfs4_callback_getattr,
.decode_args = (callback_decode_arg_t)decode_getattr_args, .decode_args = decode_getattr_args,
.encode_res = (callback_encode_res_t)encode_getattr_res, .encode_res = encode_getattr_res,
.res_maxsize = CB_OP_GETATTR_RES_MAXSZ, .res_maxsize = CB_OP_GETATTR_RES_MAXSZ,
}, },
[OP_CB_RECALL] = { [OP_CB_RECALL] = {
.process_op = (callback_process_op_t)nfs4_callback_recall, .process_op = nfs4_callback_recall,
.decode_args = (callback_decode_arg_t)decode_recall_args, .decode_args = decode_recall_args,
.res_maxsize = CB_OP_RECALL_RES_MAXSZ, .res_maxsize = CB_OP_RECALL_RES_MAXSZ,
}, },
#if defined(CONFIG_NFS_V4_1) #if defined(CONFIG_NFS_V4_1)
[OP_CB_LAYOUTRECALL] = { [OP_CB_LAYOUTRECALL] = {
.process_op = (callback_process_op_t)nfs4_callback_layoutrecall, .process_op = nfs4_callback_layoutrecall,
.decode_args = .decode_args = decode_layoutrecall_args,
(callback_decode_arg_t)decode_layoutrecall_args,
.res_maxsize = CB_OP_LAYOUTRECALL_RES_MAXSZ, .res_maxsize = CB_OP_LAYOUTRECALL_RES_MAXSZ,
}, },
[OP_CB_NOTIFY_DEVICEID] = { [OP_CB_NOTIFY_DEVICEID] = {
.process_op = (callback_process_op_t)nfs4_callback_devicenotify, .process_op = nfs4_callback_devicenotify,
.decode_args = .decode_args = decode_devicenotify_args,
(callback_decode_arg_t)decode_devicenotify_args,
.res_maxsize = CB_OP_DEVICENOTIFY_RES_MAXSZ, .res_maxsize = CB_OP_DEVICENOTIFY_RES_MAXSZ,
}, },
[OP_CB_SEQUENCE] = { [OP_CB_SEQUENCE] = {
.process_op = (callback_process_op_t)nfs4_callback_sequence, .process_op = nfs4_callback_sequence,
.decode_args = (callback_decode_arg_t)decode_cb_sequence_args, .decode_args = decode_cb_sequence_args,
.encode_res = (callback_encode_res_t)encode_cb_sequence_res, .encode_res = encode_cb_sequence_res,
.res_maxsize = CB_OP_SEQUENCE_RES_MAXSZ, .res_maxsize = CB_OP_SEQUENCE_RES_MAXSZ,
}, },
[OP_CB_RECALL_ANY] = { [OP_CB_RECALL_ANY] = {
.process_op = (callback_process_op_t)nfs4_callback_recallany, .process_op = nfs4_callback_recallany,
.decode_args = (callback_decode_arg_t)decode_recallany_args, .decode_args = decode_recallany_args,
.res_maxsize = CB_OP_RECALLANY_RES_MAXSZ, .res_maxsize = CB_OP_RECALLANY_RES_MAXSZ,
}, },
[OP_CB_RECALL_SLOT] = { [OP_CB_RECALL_SLOT] = {
.process_op = (callback_process_op_t)nfs4_callback_recallslot, .process_op = nfs4_callback_recallslot,
.decode_args = (callback_decode_arg_t)decode_recallslot_args, .decode_args = decode_recallslot_args,
.res_maxsize = CB_OP_RECALLSLOT_RES_MAXSZ, .res_maxsize = CB_OP_RECALLSLOT_RES_MAXSZ,
}, },
[OP_CB_NOTIFY_LOCK] = { [OP_CB_NOTIFY_LOCK] = {
.process_op = (callback_process_op_t)nfs4_callback_notify_lock, .process_op = nfs4_callback_notify_lock,
.decode_args = (callback_decode_arg_t)decode_notify_lock_args, .decode_args = decode_notify_lock_args,
.res_maxsize = CB_OP_NOTIFY_LOCK_RES_MAXSZ, .res_maxsize = CB_OP_NOTIFY_LOCK_RES_MAXSZ,
}, },
#endif /* CONFIG_NFS_V4_1 */ #endif /* CONFIG_NFS_V4_1 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment