1 |
|
|
/* |
2 |
|
|
* Please do not edit this file. |
3 |
|
|
* It was generated using rpcgen. |
4 |
|
|
*/ |
5 |
|
|
|
6 |
|
|
#include "nfs_prot.h" |
7 |
|
|
#include "am.h" |
8 |
|
|
#include <arpa/inet.h> |
9 |
|
|
#include <unistd.h> |
10 |
|
|
#include <stdio.h> |
11 |
|
|
#include <stdlib.h>/* getenv, exit */ |
12 |
|
|
#include <rpc/pmap_clnt.h> /* for pmap_unset */ |
13 |
|
|
#include <string.h> /* strcmp */ |
14 |
|
|
#include <netdb.h> |
15 |
|
|
#include <signal.h> |
16 |
|
|
#include <sys/ttycom.h>/* TIOCNOTTY */ |
17 |
|
|
#ifdef __cplusplus |
18 |
|
|
#include <sysent.h> /* getdtablesize, open */ |
19 |
|
|
#endif /* __cplusplus */ |
20 |
|
|
#include <memory.h> |
21 |
|
|
#include <sys/socket.h> |
22 |
|
|
#include <netinet/in.h> |
23 |
|
|
#include <syslog.h> |
24 |
|
|
#include <errno.h> |
25 |
|
|
|
26 |
|
|
#ifdef __STDC__ |
27 |
|
|
#define SIG_PF void(*)(int) |
28 |
|
|
#endif |
29 |
|
|
|
30 |
|
|
#ifdef DEBUG |
31 |
|
|
#define RPC_SVC_FG |
32 |
|
|
#endif |
33 |
|
|
|
34 |
|
|
#define _RPCSVC_CLOSEDOWN 120 |
35 |
|
|
extern int _rpcpmstart; /* Started by a port monitor ? */ |
36 |
|
|
extern int _rpcfdtype; /* Whether Stream or Datagram ? */ |
37 |
|
|
|
38 |
|
|
|
39 |
|
|
void nfs_program_2(struct svc_req *rqstp, SVCXPRT *transp); |
40 |
|
|
|
41 |
|
|
void |
42 |
|
|
nfs_program_2(struct svc_req *rqstp, SVCXPRT *transp) |
43 |
|
|
{ |
44 |
|
|
union { |
45 |
|
|
nfs_fh nfsproc_getattr_2_arg; |
46 |
|
|
sattrargs nfsproc_setattr_2_arg; |
47 |
|
|
diropargs nfsproc_lookup_2_arg; |
48 |
|
|
nfs_fh nfsproc_readlink_2_arg; |
49 |
|
|
readargs nfsproc_read_2_arg; |
50 |
|
|
writeargs nfsproc_write_2_arg; |
51 |
|
|
createargs nfsproc_create_2_arg; |
52 |
|
|
diropargs nfsproc_remove_2_arg; |
53 |
|
|
renameargs nfsproc_rename_2_arg; |
54 |
|
|
linkargs nfsproc_link_2_arg; |
55 |
|
|
symlinkargs nfsproc_symlink_2_arg; |
56 |
|
|
createargs nfsproc_mkdir_2_arg; |
57 |
|
|
diropargs nfsproc_rmdir_2_arg; |
58 |
|
|
readdirargs nfsproc_readdir_2_arg; |
59 |
|
|
nfs_fh nfsproc_statfs_2_arg; |
60 |
|
|
} argument; |
61 |
|
|
char *result; |
62 |
|
|
xdrproc_t xdr_argument, xdr_result; |
63 |
|
|
char *(*local)(char *, struct svc_req *); |
64 |
|
|
|
65 |
|
|
switch (rqstp->rq_proc) { |
66 |
|
|
case NFSPROC_NULL: |
67 |
|
|
xdr_argument = (xdrproc_t) xdr_void; |
68 |
|
|
xdr_result = (xdrproc_t) xdr_void; |
69 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_null_2_svc; |
70 |
|
|
break; |
71 |
|
|
|
72 |
|
|
case NFSPROC_GETATTR: |
73 |
|
|
xdr_argument = (xdrproc_t) xdr_nfs_fh; |
74 |
|
|
xdr_result = (xdrproc_t) xdr_attrstat; |
75 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_getattr_2_svc; |
76 |
|
|
break; |
77 |
|
|
|
78 |
|
|
case NFSPROC_SETATTR: |
79 |
|
|
xdr_argument = (xdrproc_t) xdr_sattrargs; |
80 |
|
|
xdr_result = (xdrproc_t) xdr_attrstat; |
81 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_setattr_2_svc; |
82 |
|
|
break; |
83 |
|
|
|
84 |
|
|
case NFSPROC_ROOT: |
85 |
|
|
xdr_argument = (xdrproc_t) xdr_void; |
86 |
|
|
xdr_result = (xdrproc_t) xdr_void; |
87 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_root_2_svc; |
88 |
|
|
break; |
89 |
|
|
|
90 |
|
|
case NFSPROC_LOOKUP: |
91 |
|
|
xdr_argument = (xdrproc_t) xdr_diropargs; |
92 |
|
|
xdr_result = (xdrproc_t) xdr_diropres; |
93 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_lookup_2_svc; |
94 |
|
|
break; |
95 |
|
|
|
96 |
|
|
case NFSPROC_READLINK: |
97 |
|
|
xdr_argument = (xdrproc_t) xdr_nfs_fh; |
98 |
|
|
xdr_result = (xdrproc_t) xdr_readlinkres; |
99 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_readlink_2_svc; |
100 |
|
|
break; |
101 |
|
|
|
102 |
|
|
case NFSPROC_READ: |
103 |
|
|
xdr_argument = (xdrproc_t) xdr_readargs; |
104 |
|
|
xdr_result = (xdrproc_t) xdr_readres; |
105 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_read_2_svc; |
106 |
|
|
break; |
107 |
|
|
|
108 |
|
|
case NFSPROC_WRITECACHE: |
109 |
|
|
xdr_argument = (xdrproc_t) xdr_void; |
110 |
|
|
xdr_result = (xdrproc_t) xdr_void; |
111 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_writecache_2_svc; |
112 |
|
|
break; |
113 |
|
|
|
114 |
|
|
case NFSPROC_WRITE: |
115 |
|
|
xdr_argument = (xdrproc_t) xdr_writeargs; |
116 |
|
|
xdr_result = (xdrproc_t) xdr_attrstat; |
117 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_write_2_svc; |
118 |
|
|
break; |
119 |
|
|
|
120 |
|
|
case NFSPROC_CREATE: |
121 |
|
|
xdr_argument = (xdrproc_t) xdr_createargs; |
122 |
|
|
xdr_result = (xdrproc_t) xdr_diropres; |
123 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_create_2_svc; |
124 |
|
|
break; |
125 |
|
|
|
126 |
|
|
case NFSPROC_REMOVE: |
127 |
|
|
xdr_argument = (xdrproc_t) xdr_diropargs; |
128 |
|
|
xdr_result = (xdrproc_t) xdr_nfsstat; |
129 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_remove_2_svc; |
130 |
|
|
break; |
131 |
|
|
|
132 |
|
|
case NFSPROC_RENAME: |
133 |
|
|
xdr_argument = (xdrproc_t) xdr_renameargs; |
134 |
|
|
xdr_result = (xdrproc_t) xdr_nfsstat; |
135 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_rename_2_svc; |
136 |
|
|
break; |
137 |
|
|
|
138 |
|
|
case NFSPROC_LINK: |
139 |
|
|
xdr_argument = (xdrproc_t) xdr_linkargs; |
140 |
|
|
xdr_result = (xdrproc_t) xdr_nfsstat; |
141 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_link_2_svc; |
142 |
|
|
break; |
143 |
|
|
|
144 |
|
|
case NFSPROC_SYMLINK: |
145 |
|
|
xdr_argument = (xdrproc_t) xdr_symlinkargs; |
146 |
|
|
xdr_result = (xdrproc_t) xdr_nfsstat; |
147 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_symlink_2_svc; |
148 |
|
|
break; |
149 |
|
|
|
150 |
|
|
case NFSPROC_MKDIR: |
151 |
|
|
xdr_argument = (xdrproc_t) xdr_createargs; |
152 |
|
|
xdr_result = (xdrproc_t) xdr_diropres; |
153 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_mkdir_2_svc; |
154 |
|
|
break; |
155 |
|
|
|
156 |
|
|
case NFSPROC_RMDIR: |
157 |
|
|
xdr_argument = (xdrproc_t) xdr_diropargs; |
158 |
|
|
xdr_result = (xdrproc_t) xdr_nfsstat; |
159 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_rmdir_2_svc; |
160 |
|
|
break; |
161 |
|
|
|
162 |
|
|
case NFSPROC_READDIR: |
163 |
|
|
xdr_argument = (xdrproc_t) xdr_readdirargs; |
164 |
|
|
xdr_result = (xdrproc_t) xdr_readdirres; |
165 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_readdir_2_svc; |
166 |
|
|
break; |
167 |
|
|
|
168 |
|
|
case NFSPROC_STATFS: |
169 |
|
|
xdr_argument = (xdrproc_t) xdr_nfs_fh; |
170 |
|
|
xdr_result = (xdrproc_t) xdr_statfsres; |
171 |
|
|
local = (char *(*)(char *, struct svc_req *)) nfsproc_statfs_2_svc; |
172 |
|
|
break; |
173 |
|
|
|
174 |
|
|
default: |
175 |
|
|
svcerr_noproc(transp); |
176 |
|
|
return; |
177 |
|
|
} |
178 |
|
|
(void) memset((char *)&argument, 0, sizeof (argument)); |
179 |
|
|
if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) { |
180 |
|
|
svcerr_decode(transp); |
181 |
|
|
return; |
182 |
|
|
} |
183 |
|
|
result = (*local)((char *)&argument, rqstp); |
184 |
|
|
if (result != NULL && !svc_sendreply(transp, xdr_result, result)) { |
185 |
|
|
svcerr_systemerr(transp); |
186 |
|
|
} |
187 |
|
|
if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) { |
188 |
|
|
plog(XLOG_FATAL, "unable to free rpc arguments in nfs_program"); |
189 |
|
|
going_down(1); |
190 |
|
|
} |
191 |
|
|
return; |
192 |
|
|
} |