Remove some residuals from the nlm.c->nsm.c copy
[deb_libnfs.git] / nsm / nsm.c
1 /*
2 Copyright (C) 2013 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifdef WIN32
19 #include "win32_compat.h"
20 #endif/*WIN32*/
21
22 #include <stdio.h>
23 #include <errno.h>
24 #include "libnfs-zdr.h"
25 #include "libnfs.h"
26 #include "libnfs-raw.h"
27 #include "libnfs-private.h"
28 #include "libnfs-raw-nsm.h"
29
30 int rpc_nsm1_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
31 {
32 struct rpc_pdu *pdu;
33
34 pdu = rpc_allocate_pdu(rpc, NSM_PROGRAM, NSM_V1, NSM1_NULL, cb, private_data, (zdrproc_t)zdr_void, 0);
35 if (pdu == NULL) {
36 rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nsm/null call");
37 return -1;
38 }
39
40 if (rpc_queue_pdu(rpc, pdu) != 0) {
41 rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nsm/null call");
42 rpc_free_pdu(rpc, pdu);
43 return -1;
44 }
45
46 return 0;
47 }
48
49 char *nsmstat1_to_str(int st)
50 {
51 enum nsmstat1 stat = st;
52
53 char *str = "unknown n1m stat";
54 switch (stat) {
55 case NSM_STAT_SUCC: str="NSM_STAT_SUCC";break;
56 case NSM_STAT_FAIL: str="NSM_STAT_FAIL";break;
57 }
58 return str;
59 }