-
Notifications
You must be signed in to change notification settings - Fork 0
/
fuse_rpc_svc.c
269 lines (236 loc) · 7.66 KB
/
fuse_rpc_svc.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
/*
* Please do not edit this file.
* It was generated using rpcgen.
*/
#include "fuse_rpc.h"
#include <stdio.h>
#include <stdlib.h>
#include <rpc/pmap_clnt.h>
#include <string.h>
#include <memory.h>
#include <sys/socket.h>
#include <netinet/in.h>
#ifndef SIG_PF
#define SIG_PF void(*)(int)
#endif
static void
compute_6(struct svc_req *rqstp, register SVCXPRT *transp)
{
union {
init_arg init_rootdir_6_arg;
getattr_arg bb_getattr_6_arg;
access_arg bb_access_6_arg;
mkdir_arg bb_mkdir_6_arg;
rmdir_arg bb_rmdir_6_arg;
opendir_arg bb_opendir_6_arg;
readdir_arg bb_readdir_6_arg;
releasedir_arg bb_releasedir_6_arg;
rename_arg bb_rename_6_arg;
symlink_arg bb_symlink_6_arg;
link_arg bb_link_6_arg;
readlink_arg bb_readlink_6_arg;
mknod_arg bb_mknod_6_arg;
truncate_arg bb_truncate_6_arg;
unlink_arg bb_unlink_6_arg;
utime_arg bb_utime_6_arg;
chmod_arg bb_chmod_6_arg;
chown_arg bb_chown_6_arg;
open_arg bb_open_6_arg;
release_arg bb_release_6_arg;
read_arg bb_read_6_arg;
write_arg bb_write_6_arg;
statfs_arg bb_statfs_6_arg;
} argument;
union {
init_ret init_rootdir_6_res;
getattr_ret bb_getattr_6_res;
access_ret bb_access_6_res;
mkdir_ret bb_mkdir_6_res;
rmdir_ret bb_rmdir_6_res;
opendir_ret bb_opendir_6_res;
readdir_ret bb_readdir_6_res;
releasedir_ret bb_releasedir_6_res;
rename_ret bb_rename_6_res;
symlink_ret bb_symlink_6_res;
link_ret bb_link_6_res;
readlink_ret bb_readlink_6_res;
mknod_ret bb_mknod_6_res;
truncate_ret bb_truncate_6_res;
unlink_ret bb_unlink_6_res;
utime_ret bb_utime_6_res;
chmod_ret bb_chmod_6_res;
chown_ret bb_chown_6_res;
open_ret bb_open_6_res;
release_ret bb_release_6_res;
read_ret bb_read_6_res;
write_ret bb_write_6_res;
statfs_ret bb_statfs_6_res;
} result;
bool_t retval;
xdrproc_t _xdr_argument, _xdr_result;
bool_t (*local)(char *, void *, struct svc_req *);
switch (rqstp->rq_proc) {
case INIT_ROOTDIR:
_xdr_argument = (xdrproc_t) xdr_init_arg;
_xdr_result = (xdrproc_t) xdr_init_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))init_rootdir_6_svc;
break;
case BB_GETATTR:
_xdr_argument = (xdrproc_t) xdr_getattr_arg;
_xdr_result = (xdrproc_t) xdr_getattr_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_getattr_6_svc;
break;
case BB_ACCESS:
_xdr_argument = (xdrproc_t) xdr_access_arg;
_xdr_result = (xdrproc_t) xdr_access_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_access_6_svc;
break;
case BB_MKDIR:
_xdr_argument = (xdrproc_t) xdr_mkdir_arg;
_xdr_result = (xdrproc_t) xdr_mkdir_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_mkdir_6_svc;
break;
case BB_RMDIR:
_xdr_argument = (xdrproc_t) xdr_rmdir_arg;
_xdr_result = (xdrproc_t) xdr_rmdir_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_rmdir_6_svc;
break;
case BB_OPENDIR:
_xdr_argument = (xdrproc_t) xdr_opendir_arg;
_xdr_result = (xdrproc_t) xdr_opendir_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_opendir_6_svc;
break;
case BB_READDIR:
_xdr_argument = (xdrproc_t) xdr_readdir_arg;
_xdr_result = (xdrproc_t) xdr_readdir_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_readdir_6_svc;
break;
case BB_RELEASEDIR:
_xdr_argument = (xdrproc_t) xdr_releasedir_arg;
_xdr_result = (xdrproc_t) xdr_releasedir_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_releasedir_6_svc;
break;
case BB_RENAME:
_xdr_argument = (xdrproc_t) xdr_rename_arg;
_xdr_result = (xdrproc_t) xdr_rename_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_rename_6_svc;
break;
case BB_SYMLINK:
_xdr_argument = (xdrproc_t) xdr_symlink_arg;
_xdr_result = (xdrproc_t) xdr_symlink_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_symlink_6_svc;
break;
case BB_LINK:
_xdr_argument = (xdrproc_t) xdr_link_arg;
_xdr_result = (xdrproc_t) xdr_link_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_link_6_svc;
break;
case BB_READLINK:
_xdr_argument = (xdrproc_t) xdr_readlink_arg;
_xdr_result = (xdrproc_t) xdr_readlink_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_readlink_6_svc;
break;
case BB_MKNOD:
_xdr_argument = (xdrproc_t) xdr_mknod_arg;
_xdr_result = (xdrproc_t) xdr_mknod_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_mknod_6_svc;
break;
case BB_TRUNCATE:
_xdr_argument = (xdrproc_t) xdr_truncate_arg;
_xdr_result = (xdrproc_t) xdr_truncate_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_truncate_6_svc;
break;
case BB_UNLINK:
_xdr_argument = (xdrproc_t) xdr_unlink_arg;
_xdr_result = (xdrproc_t) xdr_unlink_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_unlink_6_svc;
break;
case BB_UTIME:
_xdr_argument = (xdrproc_t) xdr_utime_arg;
_xdr_result = (xdrproc_t) xdr_utime_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_utime_6_svc;
break;
case BB_CHMOD:
_xdr_argument = (xdrproc_t) xdr_chmod_arg;
_xdr_result = (xdrproc_t) xdr_chmod_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_chmod_6_svc;
break;
case BB_CHOWN:
_xdr_argument = (xdrproc_t) xdr_chown_arg;
_xdr_result = (xdrproc_t) xdr_chown_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_chown_6_svc;
break;
case BB_OPEN:
_xdr_argument = (xdrproc_t) xdr_open_arg;
_xdr_result = (xdrproc_t) xdr_open_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_open_6_svc;
break;
case BB_RELEASE:
_xdr_argument = (xdrproc_t) xdr_release_arg;
_xdr_result = (xdrproc_t) xdr_release_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_release_6_svc;
break;
case BB_READ:
_xdr_argument = (xdrproc_t) xdr_read_arg;
_xdr_result = (xdrproc_t) xdr_read_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_read_6_svc;
break;
case BB_WRITE:
_xdr_argument = (xdrproc_t) xdr_write_arg;
_xdr_result = (xdrproc_t) xdr_write_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_write_6_svc;
break;
case BB_STATFS:
_xdr_argument = (xdrproc_t) xdr_statfs_arg;
_xdr_result = (xdrproc_t) xdr_statfs_ret;
local = (bool_t (*) (char *, void *, struct svc_req *))bb_statfs_6_svc;
break;
default:
svcerr_noproc (transp);
return;
}
memset ((char *)&argument, 0, sizeof (argument));
if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
svcerr_decode (transp);
return;
}
retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
svcerr_systemerr (transp);
}
if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
fprintf (stderr, "%s", "unable to free arguments");
exit (1);
}
if (!compute_6_freeresult (transp, _xdr_result, (caddr_t) &result))
fprintf (stderr, "%s", "unable to free results");
return;
}
int
main (int argc, char **argv)
{
register SVCXPRT *transp;
pmap_unset (COMPUTE, COMPUTE_VERS);
transp = svcudp_create(RPC_ANYSOCK);
if (transp == NULL) {
fprintf (stderr, "%s", "cannot create udp service.");
exit(1);
}
if (!svc_register(transp, COMPUTE, COMPUTE_VERS, compute_6, IPPROTO_UDP)) {
fprintf (stderr, "%s", "unable to register (COMPUTE, COMPUTE_VERS, udp).");
exit(1);
}
transp = svctcp_create(RPC_ANYSOCK, 0, 0);
if (transp == NULL) {
fprintf (stderr, "%s", "cannot create tcp service.");
exit(1);
}
if (!svc_register(transp, COMPUTE, COMPUTE_VERS, compute_6, IPPROTO_TCP)) {
fprintf (stderr, "%s", "unable to register (COMPUTE, COMPUTE_VERS, tcp).");
exit(1);
}
svc_run ();
fprintf (stderr, "%s", "svc_run returned");
exit (1);
/* NOTREACHED */
}