X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=nlm%2Fnlm.c;h=4d0bee7f5e1c6d542d6a3a38ad730b70f443f5ac;hb=e01ed6a239175772baf904d66105766f825fc1d4;hp=73d5c2d0a29092ee33ab2d8d8ad863bf586fc543;hpb=6916a66546035da5c1c82c3c85e387061a758b74;p=deb_libnfs.git diff --git a/nlm/nlm.c b/nlm/nlm.c index 73d5c2d..4d0bee7 100644 --- a/nlm/nlm.c +++ b/nlm/nlm.c @@ -28,7 +28,7 @@ #include "libnfs-private.h" #include "libnfs-raw-nlm.h" -int rpc_nlm_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data) +int rpc_nlm4_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data) { struct rpc_pdu *pdu; @@ -47,6 +47,31 @@ int rpc_nlm_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data) return 0; } +int rpc_nlm4_test_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_TESTargs *args, void *private_data) +{ + struct rpc_pdu *pdu; + + pdu = rpc_allocate_pdu(rpc, NLM_PROGRAM, NLM_V4, NLM4_TEST, cb, private_data, (xdrproc_t)xdr_NLM4_TESTres, sizeof(NLM4_TESTres)); + if (pdu == NULL) { + rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nlm/test call"); + return -1; + } + + if (xdr_NLM4_TESTargs(&pdu->xdr, args) == 0) { + rpc_set_error(rpc, "XDR error: Failed to encode NLM4_TESTargs"); + 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 nlm/test call"); + rpc_free_pdu(rpc, pdu); + return -1; + } + + return 0; +} + char *nlmstat4_to_str(int st) { enum nlmstat4 stat = st;