From: Ronnie Sahlberg Date: Fri, 13 Jan 2012 21:18:19 +0000 (+1100) Subject: change rpc_nfs_symlink_async to take a full SYMLINK3args as parameter X-Git-Tag: upstream/1.9.6^2~268 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=8e2558166817abaa94af84afc269899d2b61051c;p=deb_libnfs.git change rpc_nfs_symlink_async to take a full SYMLINK3args as parameter --- diff --git a/include/libnfs-raw.h b/include/libnfs-raw.h index c2f5a4b..060b08c 100644 --- a/include/libnfs-raw.h +++ b/include/libnfs-raw.h @@ -594,7 +594,8 @@ int rpc_nfs_readlink_async(struct rpc_context *rpc, rpc_cb cb, struct READLINK3a * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. * data is NULL. */ -int rpc_nfs_symlink_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *newname, char *oldpath, void *private_data); +struct SYMLINK3args; +int rpc_nfs_symlink_async(struct rpc_context *rpc, rpc_cb cb, struct SYMLINK3args *args, void *private_data); /* diff --git a/lib/libnfs.c b/lib/libnfs.c index 118f1d4..e2f9672 100644 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -2946,8 +2946,17 @@ static void nfs_symlink_cb(struct rpc_context *rpc _U_, int status, void *comman static int nfs_symlink_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data) { struct nfs_symlink_data *symlink_data = data->continue_data; + SYMLINK3args sa; - if (rpc_nfs_symlink_async(nfs->rpc, nfs_symlink_cb, &data->fh, symlink_data->newpathobject, symlink_data->oldpath, data) != 0) { + memset(&sa, 0, sizeof(SYMLINK3args)); + sa.where.dir.data.data_len = data->fh.data.data_len; + sa.where.dir.data.data_val = data->fh.data.data_val; + sa.where.name = symlink_data->newpathobject; + sa.symlink.symlink_attributes.mode.set_it = 1; + sa.symlink.symlink_attributes.mode.set_mode3_u.mode = S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH; + sa.symlink.symlink_data = symlink_data->oldpath; + + if (rpc_nfs_symlink_async(nfs->rpc, nfs_symlink_cb, &sa, data) != 0) { rpc_set_error(nfs->rpc, "RPC error: Failed to send SYMLINK 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 536b35b..b6f2728 100644 --- a/nfs/nfs.c +++ b/nfs/nfs.c @@ -673,10 +673,9 @@ int rpc_nfs_readlink_async(struct rpc_context *rpc, rpc_cb cb, READLINK3args *ar } -int rpc_nfs_symlink_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *newname, char *oldpath, void *private_data) +int rpc_nfs_symlink_async(struct rpc_context *rpc, rpc_cb cb, SYMLINK3args *args, void *private_data) { struct rpc_pdu *pdu; - SYMLINK3args args; pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_SYMLINK, cb, private_data, (xdrproc_t)xdr_SYMLINK3res, sizeof(SYMLINK3res)); if (pdu == NULL) { @@ -684,15 +683,7 @@ int rpc_nfs_symlink_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh return -1; } - memset(&args, 0, sizeof(SYMLINK3args)); - args.where.dir.data.data_len = fh->data.data_len; - args.where.dir.data.data_val = fh->data.data_val; - args.where.name = newname; - args.symlink.symlink_attributes.mode.set_it = 1; - args.symlink.symlink_attributes.mode.set_mode3_u.mode = S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH; - args.symlink.symlink_data = oldpath; - - if (xdr_SYMLINK3args(&pdu->xdr, &args) == 0) { + if (xdr_SYMLINK3args(&pdu->xdr, args) == 0) { rpc_set_error(rpc, "XDR error: Failed to encode SYMLINK3args"); rpc_free_pdu(rpc, pdu); return -2;