|
|
1.1 root 1: /*
2: * $Id: nfs_prot_svc.c,v 5.2 90/06/23 22:20:25 jsp Rel $
3: *
4: * Copyright (c) 1989 Jan-Simon Pendry
5: * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
6: * Copyright (c) 1989 The Regents of the University of California.
7: * All rights reserved.
8: *
9: * This code is derived from software contributed to Berkeley by
10: * Jan-Simon Pendry at Imperial College, London.
11: *
12: * Redistribution and use in source and binary forms are permitted provided
13: * that: (1) source distributions retain this entire copyright notice and
14: * comment, and (2) distributions including binaries display the following
15: * acknowledgement: ``This product includes software developed by the
16: * University of California, Berkeley and its contributors'' in the
17: * documentation or other materials provided with the distribution and in
18: * all advertising materials mentioning features or use of this software.
19: * Neither the name of the University nor the names of its contributors may
20: * be used to endorse or promote products derived from this software without
21: * specific prior written permission.
22: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
23: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
24: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25: *
26: * @(#)nfs_prot_svc.c 5.1 (Berkeley) 7/19/90
27: */
28:
29: #include "am.h"
30:
31: void nfs_program_2(rqstp, transp)
32: struct svc_req *rqstp;
33: SVCXPRT *transp;
34: {
35: union {
36: nfs_fh nfsproc_getattr_2_arg;
37: sattrargs nfsproc_setattr_2_arg;
38: diropargs nfsproc_lookup_2_arg;
39: nfs_fh nfsproc_readlink_2_arg;
40: readargs nfsproc_read_2_arg;
41: writeargs nfsproc_write_2_arg;
42: createargs nfsproc_create_2_arg;
43: diropargs nfsproc_remove_2_arg;
44: renameargs nfsproc_rename_2_arg;
45: linkargs nfsproc_link_2_arg;
46: symlinkargs nfsproc_symlink_2_arg;
47: createargs nfsproc_mkdir_2_arg;
48: diropargs nfsproc_rmdir_2_arg;
49: readdirargs nfsproc_readdir_2_arg;
50: nfs_fh nfsproc_statfs_2_arg;
51: } argument;
52: char *result;
53: bool_t (*xdr_argument)(), (*xdr_result)();
54: char *(*local)();
55:
56: switch (rqstp->rq_proc) {
57: case NFSPROC_NULL:
58: xdr_argument = xdr_void;
59: xdr_result = xdr_void;
60: local = (char *(*)()) nfsproc_null_2;
61: break;
62:
63: case NFSPROC_GETATTR:
64: xdr_argument = xdr_nfs_fh;
65: xdr_result = xdr_attrstat;
66: local = (char *(*)()) nfsproc_getattr_2;
67: break;
68:
69: case NFSPROC_SETATTR:
70: xdr_argument = xdr_sattrargs;
71: xdr_result = xdr_attrstat;
72: local = (char *(*)()) nfsproc_setattr_2;
73: break;
74:
75: case NFSPROC_ROOT:
76: xdr_argument = xdr_void;
77: xdr_result = xdr_void;
78: local = (char *(*)()) nfsproc_root_2;
79: break;
80:
81: case NFSPROC_LOOKUP:
82: xdr_argument = xdr_diropargs;
83: xdr_result = xdr_diropres;
84: local = (char *(*)()) nfsproc_lookup_2;
85: break;
86:
87: case NFSPROC_READLINK:
88: xdr_argument = xdr_nfs_fh;
89: xdr_result = xdr_readlinkres;
90: local = (char *(*)()) nfsproc_readlink_2;
91: break;
92:
93: case NFSPROC_READ:
94: xdr_argument = xdr_readargs;
95: xdr_result = xdr_readres;
96: local = (char *(*)()) nfsproc_read_2;
97: break;
98:
99: case NFSPROC_WRITECACHE:
100: xdr_argument = xdr_void;
101: xdr_result = xdr_void;
102: local = (char *(*)()) nfsproc_writecache_2;
103: break;
104:
105: case NFSPROC_WRITE:
106: xdr_argument = xdr_writeargs;
107: xdr_result = xdr_attrstat;
108: local = (char *(*)()) nfsproc_write_2;
109: break;
110:
111: case NFSPROC_CREATE:
112: xdr_argument = xdr_createargs;
113: xdr_result = xdr_diropres;
114: local = (char *(*)()) nfsproc_create_2;
115: break;
116:
117: case NFSPROC_REMOVE:
118: xdr_argument = xdr_diropargs;
119: xdr_result = xdr_nfsstat;
120: local = (char *(*)()) nfsproc_remove_2;
121: break;
122:
123: case NFSPROC_RENAME:
124: xdr_argument = xdr_renameargs;
125: xdr_result = xdr_nfsstat;
126: local = (char *(*)()) nfsproc_rename_2;
127: break;
128:
129: case NFSPROC_LINK:
130: xdr_argument = xdr_linkargs;
131: xdr_result = xdr_nfsstat;
132: local = (char *(*)()) nfsproc_link_2;
133: break;
134:
135: case NFSPROC_SYMLINK:
136: xdr_argument = xdr_symlinkargs;
137: xdr_result = xdr_nfsstat;
138: local = (char *(*)()) nfsproc_symlink_2;
139: break;
140:
141: case NFSPROC_MKDIR:
142: xdr_argument = xdr_createargs;
143: xdr_result = xdr_diropres;
144: local = (char *(*)()) nfsproc_mkdir_2;
145: break;
146:
147: case NFSPROC_RMDIR:
148: xdr_argument = xdr_diropargs;
149: xdr_result = xdr_nfsstat;
150: local = (char *(*)()) nfsproc_rmdir_2;
151: break;
152:
153: case NFSPROC_READDIR:
154: xdr_argument = xdr_readdirargs;
155: xdr_result = xdr_readdirres;
156: local = (char *(*)()) nfsproc_readdir_2;
157: break;
158:
159: case NFSPROC_STATFS:
160: xdr_argument = xdr_nfs_fh;
161: xdr_result = xdr_statfsres;
162: local = (char *(*)()) nfsproc_statfs_2;
163: break;
164:
165: default:
166: svcerr_noproc(transp);
167: return;
168: }
169: bzero((char *)&argument, sizeof(argument));
170: if (!svc_getargs(transp, xdr_argument, &argument)) {
171: svcerr_decode(transp);
172: return;
173: }
174: result = (*local)(&argument, rqstp);
175: if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
176: svcerr_systemerr(transp);
177: }
178: if (!svc_freeargs(transp, xdr_argument, &argument)) {
179: plog(XLOG_FATAL, "unable to free rpc arguments in nfs_program_1");
180: going_down(1);
181: }
182: }
183:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.