From 0118a5f0de4a611963f0fe669f450167a7569694 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Thu, 8 Mar 2012 22:52:20 +1100 Subject: [PATCH] GETACL: change the signature for the raw getacl3 function to take GETACL3args pointer instead of a discrete arguments --- examples/nfsclient-raw.c | 5 ++++- include/libnfs-raw.h | 3 ++- nfs/nfsacl.c | 9 ++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/examples/nfsclient-raw.c b/examples/nfsclient-raw.c index b125581..19881d0 100644 --- a/examples/nfsclient-raw.c +++ b/examples/nfsclient-raw.c @@ -117,11 +117,14 @@ void acl_getacl_cb(struct rpc_context *rpc _U_, int status, void *data, void *pr void acl_null_cb(struct rpc_context *rpc _U_, int status, void *data, void *private_data) { struct client *client = private_data; + GETACL3args args; printf("Got NFSACL/NULL reply\n"); printf("Get ACL for root handle\n"); - if (rpc_nfsacl_getacl_async(rpc, acl_getacl_cb, &client->rootfh, NFSACL_MASK_ACL_ENTRY|NFSACL_MASK_ACL_COUNT|NFSACL_MASK_ACL_DEFAULT_ENTRY|NFSACL_MASK_ACL_DEFAULT_COUNT, client) != 0) { + args.dir = client->rootfh; + args.mask = NFSACL_MASK_ACL_ENTRY|NFSACL_MASK_ACL_COUNT|NFSACL_MASK_ACL_DEFAULT_ENTRY|NFSACL_MASK_ACL_DEFAULT_COUNT; + if (rpc_nfsacl_getacl_async(rpc, acl_getacl_cb, &args, client) != 0) { printf("Failed to send getacl request\n"); exit(10); } diff --git a/include/libnfs-raw.h b/include/libnfs-raw.h index c577aa5..423d1d7 100644 --- a/include/libnfs-raw.h +++ b/include/libnfs-raw.h @@ -785,7 +785,8 @@ int rpc_nfsacl_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. * data is NULL. */ -int rpc_nfsacl_getacl_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint32_t mask, void *private_data); +struct GETACL3args; +int rpc_nfsacl_getacl_async(struct rpc_context *rpc, rpc_cb cb, struct GETACL3args *args, void *private_data); diff --git a/nfs/nfsacl.c b/nfs/nfsacl.c index 4561589..a3c3ede 100644 --- a/nfs/nfsacl.c +++ b/nfs/nfsacl.c @@ -51,10 +51,9 @@ int rpc_nfsacl_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data } -int rpc_nfsacl_getacl_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint32_t mask, void *private_data) +int rpc_nfsacl_getacl_async(struct rpc_context *rpc, rpc_cb cb, struct GETACL3args *args, void *private_data) { struct rpc_pdu *pdu; - GETACL3args args; pdu = rpc_allocate_pdu(rpc, NFSACL_PROGRAM, NFSACL_V3, NFSACL3_GETACL, cb, private_data, (xdrproc_t)xdr_GETACL3res, sizeof(GETACL3res)); if (pdu == NULL) { @@ -62,11 +61,7 @@ int rpc_nfsacl_getacl_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 * return -1; } - args.dir.data.data_len = fh->data.data_len; - args.dir.data.data_val = fh->data.data_val; - args.mask = mask; - - if (xdr_GETACL3args(&pdu->xdr, &args) == 0) { + if (xdr_GETACL3args(&pdu->xdr, args) == 0) { rpc_set_error(rpc, "XDR error: Failed to encode GETACL3args"); rpc_free_pdu(rpc, pdu); return -2; -- 2.34.1