From 16104b27bd8deedc07a23aec33b4ef3cde82808f Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sat, 14 Jan 2012 08:11:09 +1100 Subject: [PATCH] make low level readlink_async function take READLINK3args as argument --- include/libnfs-raw.h | 3 ++- lib/libnfs.c | 7 ++++++- nfs/nfs.c | 8 ++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/libnfs-raw.h b/include/libnfs-raw.h index 3deffc8..c2f5a4b 100644 --- a/include/libnfs-raw.h +++ b/include/libnfs-raw.h @@ -575,7 +575,8 @@ int rpc_nfs_fsinfo_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. * data is NULL. */ -int rpc_nfs_readlink_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data); +struct READLINK3args; +int rpc_nfs_readlink_async(struct rpc_context *rpc, rpc_cb cb, struct READLINK3args *args, void *private_data); diff --git a/lib/libnfs.c b/lib/libnfs.c index 3c150ac..118f1d4 100644 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -2420,7 +2420,12 @@ static void nfs_readlink_1_cb(struct rpc_context *rpc _U_, int status, void *com static int nfs_readlink_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) { - if (rpc_nfs_readlink_async(nfs->rpc, nfs_readlink_1_cb, &data->fh, data) != 0) { + READLINK3args args; + + args.symlink.data.data_len = data->fh.data.data_len; + args.symlink.data.data_val = data->fh.data.data_val; + + if (rpc_nfs_readlink_async(nfs->rpc, nfs_readlink_1_cb, &args, data) != 0) { rpc_set_error(nfs->rpc, "RPC error: Failed to send READLINK call for %s", data->path); data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data); free_nfs_cb_data(data); diff --git a/nfs/nfs.c b/nfs/nfs.c index 099e291..536b35b 100644 --- a/nfs/nfs.c +++ b/nfs/nfs.c @@ -647,10 +647,9 @@ int rpc_nfs_fsinfo_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, return 0; } -int rpc_nfs_readlink_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data) +int rpc_nfs_readlink_async(struct rpc_context *rpc, rpc_cb cb, READLINK3args *args, void *private_data) { struct rpc_pdu *pdu; - READLINK3args args; pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_READLINK, cb, private_data, (xdrproc_t)xdr_READLINK3res, sizeof(READLINK3res)); if (pdu == NULL) { @@ -658,10 +657,7 @@ int rpc_nfs_readlink_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *f return -1; } - args.symlink.data.data_len = fh->data.data_len; - args.symlink.data.data_val = fh->data.data_val; - - if (xdr_READLINK3args(&pdu->xdr, &args) == 0) { + if (xdr_READLINK3args(&pdu->xdr, args) == 0) { rpc_set_error(rpc, "XDR error: Failed to encode READLINK3args"); rpc_free_pdu(rpc, pdu); return -2; -- 2.34.1