From: Ronnie Sahlberg Date: Fri, 13 Jan 2012 21:11:09 +0000 (+1100) Subject: make low level readlink_async function take READLINK3args as argument X-Git-Tag: upstream/1.9.6^2~269 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=16104b27bd8deedc07a23aec33b4ef3cde82808f;p=deb_libnfs.git make low level readlink_async function take READLINK3args as argument --- 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;