xref: /openbsd/usr.sbin/amd/rpcx/amq_clnt.c (revision 404b540a)
1 /*
2  * Copyright (c) 1990 Jan-Simon Pendry
3  * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
4  * Copyright (c) 1990, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley by
8  * Jan-Simon Pendry at Imperial College, London.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. Neither the name of the University nor the names of its contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  *
34  *	from: @(#)amq_clnt.c	8.1 (Berkeley) 6/6/93
35  *	$Id: amq_clnt.c,v 1.5 2003/06/02 23:36:52 millert Exp $
36  *
37  */
38 
39 #include "am.h"
40 #include "amq.h"
41 
42 static struct timeval TIMEOUT = { ALLOWED_MOUNT_TIME, 0 };
43 
44 void *
45 amqproc_null_1(void *argp, CLIENT *clnt)
46 {
47 	static char res;
48 
49 	bzero((char *)&res, sizeof(res));
50 	if (clnt_call(clnt, AMQPROC_NULL, xdr_void, argp, xdr_void,
51 	    &res, TIMEOUT) != RPC_SUCCESS) {
52 		return (NULL);
53 	}
54 	return ((void *)&res);
55 }
56 
57 
58 amq_mount_tree_p *
59 amqproc_mnttree_1(amq_string *argp, CLIENT *clnt)
60 {
61 	static amq_mount_tree_p res;
62 
63 	bzero((char *)&res, sizeof(res));
64 	if (clnt_call(clnt, AMQPROC_MNTTREE, xdr_amq_string, argp,
65 	    xdr_amq_mount_tree_p, &res, TIMEOUT) != RPC_SUCCESS) {
66 		return (NULL);
67 	}
68 	return (&res);
69 }
70 
71 
72 void *
73 amqproc_umnt_1(amq_string *argp, CLIENT *clnt)
74 {
75 	static char res;
76 
77 	bzero((char *)&res, sizeof(res));
78 	if (clnt_call(clnt, AMQPROC_UMNT, xdr_amq_string, argp,
79 	    xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
80 		return (NULL);
81 	}
82 	return ((void *)&res);
83 }
84 
85 
86 amq_mount_stats *
87 amqproc_stats_1(void *argp, CLIENT *clnt)
88 {
89 	static amq_mount_stats res;
90 
91 	bzero((char *)&res, sizeof(res));
92 	if (clnt_call(clnt, AMQPROC_STATS, xdr_void, argp,
93 	    xdr_amq_mount_stats, &res, TIMEOUT) != RPC_SUCCESS) {
94 		return (NULL);
95 	}
96 	return (&res);
97 }
98 
99 
100 amq_mount_tree_list *
101 amqproc_export_1(void *argp, CLIENT *clnt)
102 {
103 	static amq_mount_tree_list res;
104 
105 	bzero((char *)&res, sizeof(res));
106 	if (clnt_call(clnt, AMQPROC_EXPORT, xdr_void, argp,
107 	    xdr_amq_mount_tree_list, &res, TIMEOUT) != RPC_SUCCESS) {
108 		return (NULL);
109 	}
110 	return (&res);
111 }
112 
113 int *
114 amqproc_setopt_1(amq_setopt *argp, CLIENT *clnt)
115 {
116 	static int res;
117 
118 	bzero((char *)&res, sizeof(res));
119 	if (clnt_call(clnt, AMQPROC_SETOPT, xdr_amq_setopt, argp,
120 	    xdr_int, &res, TIMEOUT) != RPC_SUCCESS) {
121 		return (NULL);
122 	}
123 	return (&res);
124 }
125 
126 
127 amq_mount_info_list *
128 amqproc_getmntfs_1(void *argp, CLIENT *clnt)
129 {
130 	static amq_mount_info_list res;
131 
132 	bzero((char *)&res, sizeof(res));
133 	if (clnt_call(clnt, AMQPROC_GETMNTFS, xdr_void, argp,
134 	    xdr_amq_mount_info_list, &res, TIMEOUT) != RPC_SUCCESS) {
135 		return (NULL);
136 	}
137 	return (&res);
138 }
139 
140 
141 int *
142 amqproc_mount_1(void *argp, CLIENT *clnt)
143 {
144 	static int res;
145 
146 	bzero((char *)&res, sizeof(res));
147 	if (clnt_call(clnt, AMQPROC_MOUNT, xdr_amq_string, argp,
148 	    xdr_int, &res, TIMEOUT) != RPC_SUCCESS) {
149 		return (NULL);
150 	}
151 	return (&res);
152 }
153 
154 
155 amq_string *
156 amqproc_getvers_1(void *argp, CLIENT *clnt)
157 {
158 	static amq_string res;
159 
160 	bzero((char *)&res, sizeof(res));
161 	if (clnt_call(clnt, AMQPROC_GETVERS, xdr_void, argp,
162 	    xdr_amq_string, &res, TIMEOUT) != RPC_SUCCESS) {
163 		return (NULL);
164 	}
165 	return (&res);
166 }
167