xref: /freebsd/include/rpcsvc/mount.x (revision cf4c5a533126ca1ddb1f070af73f8f53b9e77fd4)
1 /*
2  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3  * unrestricted use provided that this legend is included on all tape
4  * media and as a part of the software program in whole or part.  Users
5  * may copy or modify Sun RPC without charge, but are not authorized
6  * to license or distribute it to anyone else except as part of a product or
7  * program developed by the user.
8  *
9  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12  *
13  * Sun RPC is provided with no support and without any obligation on the
14  * part of Sun Microsystems, Inc. to assist in its use, correction,
15  * modification or enhancement.
16  *
17  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19  * OR ANY PART THEREOF.
20  *
21  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22  * or profits or other special, indirect and consequential damages, even if
23  * Sun has been advised of the possibility of such damages.
24  *
25  * Sun Microsystems, Inc.
26  * 2550 Garcia Avenue
27  * Mountain View, California  94043
28  */
29 
30 /*
31  * Protocol description for the mount program
32  */
33 
34 #ifndef RPC_HDR
35 %#ifndef lint
36 %/*static char sccsid[] = "from: @(#)mount.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/
37 %/*static char sccsid[] = "from: @(#)mount.x	2.1 88/08/01 4.0 RPCSRC";*/
38 %#endif /* not lint */
39 %#include <sys/cdefs.h>
40 %__FBSDID("$FreeBSD$");
41 #endif
42 
43 const MNTPATHLEN = 1024;	/* maximum bytes in a pathname argument */
44 const MNTNAMLEN = 255;		/* maximum bytes in a name argument */
45 const FHSIZE = 32;		/* size in bytes of a file handle */
46 #ifdef WANT_NFS3
47 const FHSIZE3 = 64;		/* size in bytes of a file handle (v3) */
48 #endif
49 
50 /*
51  * The fhandle is the file handle that the server passes to the client.
52  * All file operations are done using the file handles to refer to a file
53  * or a directory. The file handle can contain whatever information the
54  * server needs to distinguish an individual file.
55  */
56 typedef opaque fhandle[FHSIZE];
57 #ifdef WANT_NFS3
58 typedef opaque fhandle3<FHSIZE3>;
59 #endif
60 
61 /*
62  * If a status of zero is returned, the call completed successfully, and
63  * a file handle for the directory follows. A non-zero status indicates
64  * some sort of error. The status corresponds with UNIX error numbers.
65  */
66 union fhstatus switch (unsigned fhs_status) {
67 case 0:
68 	fhandle fhs_fhandle;
69 default:
70 	void;
71 };
72 
73 #ifdef WANT_NFS3
74 /*
75  * Status codes returned by the version 3 mount call.
76  */
77 enum mountstat3 {
78 	MNT3_OK = 0,                 /* no error */
79 	MNT3ERR_PERM = 1,            /* Not owner */
80 	MNT3ERR_NOENT = 2,           /* No such file or directory */
81 	MNT3ERR_IO = 5,              /* I/O error */
82 	MNT3ERR_ACCES = 13,          /* Permission denied */
83 	MNT3ERR_NOTDIR = 20,         /* Not a directory */
84 	MNT3ERR_INVAL = 22,          /* Invalid argument */
85 	MNT3ERR_NAMETOOLONG = 63,    /* Filename too long */
86 	MNT3ERR_NOTSUPP = 10004,     /* Operation not supported */
87 	MNT3ERR_SERVERFAULT = 10006  /* A failure on the server */
88 };
89 
90 struct mountres3_ok {
91 	fhandle3	fhandle;
92 	int		auth_flavors<>;
93 };
94 
95 union mountres3 switch (mountstat3 fhs_status) {
96 case 0:
97 	mountres3_ok	mountinfo;
98 default:
99 	void;
100 };
101 #endif
102 
103 /*
104  * The type dirpath is the pathname of a directory
105  */
106 typedef string dirpath<MNTPATHLEN>;
107 
108 /*
109  * The type name is used for arbitrary names (hostnames, groupnames)
110  */
111 typedef string name<MNTNAMLEN>;
112 
113 /*
114  * A list of who has what mounted
115  */
116 typedef struct mountbody *mountlist;
117 struct mountbody {
118 	name ml_hostname;
119 	dirpath ml_directory;
120 	mountlist ml_next;
121 };
122 
123 /*
124  * A list of netgroups
125  */
126 typedef struct groupnode *groups;
127 struct groupnode {
128 	name gr_name;
129 	groups gr_next;
130 };
131 
132 /*
133  * A list of what is exported and to whom
134  */
135 typedef struct exportnode *exports;
136 struct exportnode {
137 	dirpath ex_dir;
138 	groups ex_groups;
139 	exports ex_next;
140 };
141 
142 program MOUNTPROG {
143 	/*
144 	 * Version one of the mount protocol communicates with version two
145 	 * of the NFS protocol. Version three communicates with
146 	 * version three of the NFS protocol. The only connecting
147 	 * point is the fhandle structure, which is the same for both
148 	 * protocols.
149 	 */
150 	version MOUNTVERS {
151 		/*
152 		 * Does no work. It is made available in all RPC services
153 		 * to allow server reponse testing and timing
154 		 */
155 		void
156 		MOUNTPROC_NULL(void) = 0;
157 
158 		/*
159 		 * If fhs_status is 0, then fhs_fhandle contains the
160 	 	 * file handle for the directory. This file handle may
161 		 * be used in the NFS protocol. This procedure also adds
162 		 * a new entry to the mount list for this client mounting
163 		 * the directory.
164 		 * Unix authentication required.
165 		 */
166 		fhstatus
167 		MOUNTPROC_MNT(dirpath) = 1;
168 
169 		/*
170 		 * Returns the list of remotely mounted filesystems. The
171 		 * mountlist contains one entry for each hostname and
172 		 * directory pair.
173 		 */
174 		mountlist
175 		MOUNTPROC_DUMP(void) = 2;
176 
177 		/*
178 		 * Removes the mount list entry for the directory
179 		 * Unix authentication required.
180 		 */
181 		void
182 		MOUNTPROC_UMNT(dirpath) = 3;
183 
184 		/*
185 		 * Removes all of the mount list entries for this client
186 		 * Unix authentication required.
187 		 */
188 		void
189 		MOUNTPROC_UMNTALL(void) = 4;
190 
191 		/*
192 		 * Returns a list of all the exported filesystems, and which
193 		 * machines are allowed to import it.
194 		 */
195 		exports
196 		MOUNTPROC_EXPORT(void)  = 5;
197 
198 		/*
199 		 * Identical to MOUNTPROC_EXPORT above
200 		 */
201 		exports
202 		MOUNTPROC_EXPORTALL(void) = 6;
203 	} = 1;
204 #ifdef WANT_NFS3
205 	version MOUNTVERS3 {
206 		/*
207 		 * Does no work. It is made available in all RPC services
208 		 * to allow server reponse testing and timing
209 		 */
210 		void
211 		MOUNTPROC_NULL(void) = 0;
212 
213 		/*
214 		 * If mountres3.fhs_status is MNT3_OK, then
215 		 * mountres3.mountinfo contains the file handle for
216 		 * the directory and a list of acceptable
217 		 * authentication flavors.  This file handle may only
218 		 * be used in the NFS version 3 protocol.  This
219 		 * procedure also results in the server adding a new
220 		 * entry to its mount list recording that this client
221 		 * has mounted the directory. AUTH_UNIX authentication
222 		 * or better is required.
223 		 */
224 		mountres3
225 		MOUNTPROC_MNT(dirpath) = 1;
226 
227 		/*
228 		 * Returns the list of remotely mounted filesystems. The
229 		 * mountlist contains one entry for each hostname and
230 		 * directory pair.
231 		 */
232 		mountlist
233 		MOUNTPROC_DUMP(void) = 2;
234 
235 		/*
236 		 * Removes the mount list entry for the directory
237 		 * Unix authentication required.
238 		 */
239 		void
240 		MOUNTPROC_UMNT(dirpath) = 3;
241 
242 		/*
243 		 * Removes all of the mount list entries for this client
244 		 * Unix authentication required.
245 		 */
246 		void
247 		MOUNTPROC_UMNTALL(void) = 4;
248 
249 		/*
250 		 * Returns a list of all the exported filesystems, and which
251 		 * machines are allowed to import it.
252 		 */
253 		exports
254 		MOUNTPROC_EXPORT(void)  = 5;
255 	} = 3;
256 #endif
257 } = 100005;
258