Add support for NFS/PATHCONF

libnfs-4.0.0-vitalif
Ronnie Sahlberg 2013-10-20 10:07:19 -07:00
parent 6683cec917
commit 6f914247fb
3 changed files with 47 additions and 2 deletions

View File

@ -312,6 +312,22 @@ int rpc_nfs_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
*/
int rpc_nfs_getattr_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data);
/*
* Call NFS/PATHCONF
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
*
* When the callback is invoked, status indicates the result:
* RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
* data is PATHCONF3res
* RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
* data is the error string.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
int rpc_nfs_pathconf_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data);
/*
* Call NFS/LOOKUP
* Function returns

View File

@ -628,7 +628,7 @@ zdr_set_mode3 (ZDR *zdrs, set_mode3 *objp)
register int32_t *buf;
buf = NULL;
if (!zdr_bool (zdrs, &objp->set_it))
if (!zdr_bool (zdrs, &objp->set_it))
return FALSE;
switch (objp->set_it) {
case TRUE:

View File

@ -143,7 +143,36 @@ int rpc_nfs_getattr_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/null call");
rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/getattr call");
rpc_free_pdu(rpc, pdu);
return -3;
}
return 0;
}
int rpc_nfs_pathconf_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data)
{
struct rpc_pdu *pdu;
PATHCONF3args args;
pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_PATHCONF, cb, private_data, (zdrproc_t)zdr_PATHCONF3res, sizeof(PATHCONF3res));
if (pdu == NULL) {
rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/pathconf call");
return -1;
}
args.object.data.data_len = fh->data.data_len;
args.object.data.data_val = fh->data.data_val;
if (zdr_PATHCONF3args(&pdu->zdr, &args) == 0) {
rpc_set_error(rpc, "ZDR error: Failed to encode PATHCONF3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/pathconf call");
rpc_free_pdu(rpc, pdu);
return -3;
}