SUNRPC: New xdr_streams XDR encoder API
Now that all client-side XDR encoder routines use xdr_streams, there should be no need to support the legacy calling sequence [rpc_rqst *, __be32 *, RPC arg *] anywhere. We can construct an xdr_stream in the generic RPC code, instead of in each encoder function. Also, all the client-side encoder functions return 0 now, making a return value superfluous. Take this opportunity to convert them to return void instead. This is a refactoring change. It should not cause different behavior. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Tested-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:

committed by
Trond Myklebust

parent
1ac7c23e4a
commit
9f06c719f4
@@ -110,7 +110,7 @@ struct rpc_credops {
|
||||
__be32 * (*crmarshal)(struct rpc_task *, __be32 *);
|
||||
int (*crrefresh)(struct rpc_task *);
|
||||
__be32 * (*crvalidate)(struct rpc_task *, __be32 *);
|
||||
int (*crwrap_req)(struct rpc_task *, kxdrproc_t,
|
||||
int (*crwrap_req)(struct rpc_task *, kxdreproc_t,
|
||||
void *, __be32 *, void *);
|
||||
int (*crunwrap_resp)(struct rpc_task *, kxdrproc_t,
|
||||
void *, __be32 *, void *);
|
||||
@@ -139,7 +139,7 @@ struct rpc_cred * rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *
|
||||
void put_rpccred(struct rpc_cred *);
|
||||
__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *);
|
||||
__be32 * rpcauth_checkverf(struct rpc_task *, __be32 *);
|
||||
int rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, __be32 *data, void *obj);
|
||||
int rpcauth_wrap_req(struct rpc_task *task, kxdreproc_t encode, void *rqstp, __be32 *data, void *obj);
|
||||
int rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, __be32 *data, void *obj);
|
||||
int rpcauth_refreshcred(struct rpc_task *);
|
||||
void rpcauth_invalcred(struct rpc_task *);
|
||||
|
@@ -89,7 +89,7 @@ struct rpc_version {
|
||||
*/
|
||||
struct rpc_procinfo {
|
||||
u32 p_proc; /* RPC procedure number */
|
||||
kxdrproc_t p_encode; /* XDR encode function */
|
||||
kxdreproc_t p_encode; /* XDR encode function */
|
||||
kxdrproc_t p_decode; /* XDR decode function */
|
||||
unsigned int p_arglen; /* argument hdr length (u32) */
|
||||
unsigned int p_replen; /* reply hdr length (u32) */
|
||||
|
@@ -33,8 +33,8 @@ struct xdr_netobj {
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the generic XDR function. rqstp is either a rpc_rqst (client
|
||||
* side) or svc_rqst pointer (server side).
|
||||
* This is the legacy generic XDR function. rqstp is either a rpc_rqst
|
||||
* (client side) or svc_rqst pointer (server side).
|
||||
* Encode functions always assume there's enough room in the buffer.
|
||||
*/
|
||||
typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj);
|
||||
@@ -203,6 +203,11 @@ struct xdr_stream {
|
||||
struct kvec *iov; /* pointer to the current kvec */
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the xdr_stream style generic XDR function.
|
||||
*/
|
||||
typedef void (*kxdreproc_t)(void *rqstp, struct xdr_stream *xdr, void *obj);
|
||||
|
||||
extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p);
|
||||
extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes);
|
||||
extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages,
|
||||
|
Reference in New Issue
Block a user