xref: /freebsd/include/rpcsvc/mount.x (revision eba230afba4932f02a1ca44efc797cf7499a5cb0)
1 /*-
2  * Copyright (c) 2010, Oracle America, Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  *     * Redistributions of source code must retain the above copyright
9  *       notice, this list of conditions and the following disclaimer.
10  *     * Redistributions in binary form must reproduce the above
11  *       copyright notice, this list of conditions and the following
12  *       disclaimer in the documentation and/or other materials
13  *       provided with the distribution.
14  *     * Neither the name of the "Oracle America, Inc." nor the names of its
15  *       contributors may be used to endorse or promote products derived
16  *       from this software without specific prior written permission.
17  *
18  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22  *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23  *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25  *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27  *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28  *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 /*
33  * Protocol description for the mount program
34  */
35 
36 #ifndef RPC_HDR
37 %#ifndef lint
38 %/*static char sccsid[] = "from: @(#)mount.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/
39 %/*static char sccsid[] = "from: @(#)mount.x	2.1 88/08/01 4.0 RPCSRC";*/
40 %#endif /* not lint */
41 %#include <sys/cdefs.h>
42 #endif
43 
44 const MNTPATHLEN = 1024;	/* maximum bytes in a pathname argument */
45 const MNTNAMLEN = 255;		/* maximum bytes in a name argument */
46 const FHSIZE = 32;		/* size in bytes of a file handle */
47 #ifdef WANT_NFS3
48 const FHSIZE3 = 64;		/* size in bytes of a file handle (v3) */
49 #endif
50 
51 /*
52  * The fhandle is the file handle that the server passes to the client.
53  * All file operations are done using the file handles to refer to a file
54  * or a directory. The file handle can contain whatever information the
55  * server needs to distinguish an individual file.
56  */
57 typedef opaque fhandle[FHSIZE];
58 #ifdef WANT_NFS3
59 typedef opaque fhandle3<FHSIZE3>;
60 #endif
61 
62 /*
63  * If a status of zero is returned, the call completed successfully, and
64  * a file handle for the directory follows. A non-zero status indicates
65  * some sort of error. The status corresponds with UNIX error numbers.
66  */
67 union fhstatus switch (unsigned fhs_status) {
68 case 0:
69 	fhandle fhs_fhandle;
70 default:
71 	void;
72 };
73 
74 #ifdef WANT_NFS3
75 /*
76  * Status codes returned by the version 3 mount call.
77  */
78 enum mountstat3 {
79 	MNT3_OK = 0,                 /* no error */
80 	MNT3ERR_PERM = 1,            /* Not owner */
81 	MNT3ERR_NOENT = 2,           /* No such file or directory */
82 	MNT3ERR_IO = 5,              /* I/O error */
83 	MNT3ERR_ACCES = 13,          /* Permission denied */
84 	MNT3ERR_NOTDIR = 20,         /* Not a directory */
85 	MNT3ERR_INVAL = 22,          /* Invalid argument */
86 	MNT3ERR_NAMETOOLONG = 63,    /* Filename too long */
87 	MNT3ERR_NOTSUPP = 10004,     /* Operation not supported */
88 	MNT3ERR_SERVERFAULT = 10006  /* A failure on the server */
89 };
90 
91 struct mountres3_ok {
92 	fhandle3	fhandle;
93 	int		auth_flavors<>;
94 };
95 
96 union mountres3 switch (mountstat3 fhs_status) {
97 case 0:
98 	mountres3_ok	mountinfo;
99 default:
100 	void;
101 };
102 #endif
103 
104 /*
105  * The type dirpath is the pathname of a directory
106  */
107 typedef string dirpath<MNTPATHLEN>;
108 
109 /*
110  * The type name is used for arbitrary names (hostnames, groupnames)
111  */
112 typedef string name<MNTNAMLEN>;
113 
114 /*
115  * A list of who has what mounted
116  */
117 typedef struct mountbody *mountlist;
118 struct mountbody {
119 	name ml_hostname;
120 	dirpath ml_directory;
121 	mountlist ml_next;
122 };
123 
124 /*
125  * A list of netgroups
126  */
127 typedef struct groupnode *groups;
128 struct groupnode {
129 	name gr_name;
130 	groups gr_next;
131 };
132 
133 /*
134  * A list of what is exported and to whom
135  */
136 typedef struct exportnode *exports;
137 struct exportnode {
138 	dirpath ex_dir;
139 	groups ex_groups;
140 	exports ex_next;
141 };
142 
143 program MOUNTPROG {
144 	/*
145 	 * Version one of the mount protocol communicates with version two
146 	 * of the NFS protocol. Version three communicates with
147 	 * version three of the NFS protocol. The only connecting
148 	 * point is the fhandle structure, which is the same for both
149 	 * protocols.
150 	 */
151 	version MOUNTVERS {
152 		/*
153 		 * Does no work. It is made available in all RPC services
154 		 * to allow server response testing and timing
155 		 */
156 		void
157 		MOUNTPROC_NULL(void) = 0;
158 
159 		/*
160 		 * If fhs_status is 0, then fhs_fhandle contains the
161 	 	 * file handle for the directory. This file handle may
162 		 * be used in the NFS protocol. This procedure also adds
163 		 * a new entry to the mount list for this client mounting
164 		 * the directory.
165 		 * Unix authentication required.
166 		 */
167 		fhstatus
168 		MOUNTPROC_MNT(dirpath) = 1;
169 
170 		/*
171 		 * Returns the list of remotely mounted filesystems. The
172 		 * mountlist contains one entry for each hostname and
173 		 * directory pair.
174 		 */
175 		mountlist
176 		MOUNTPROC_DUMP(void) = 2;
177 
178 		/*
179 		 * Removes the mount list entry for the directory
180 		 * Unix authentication required.
181 		 */
182 		void
183 		MOUNTPROC_UMNT(dirpath) = 3;
184 
185 		/*
186 		 * Removes all of the mount list entries for this client
187 		 * Unix authentication required.
188 		 */
189 		void
190 		MOUNTPROC_UMNTALL(void) = 4;
191 
192 		/*
193 		 * Returns a list of all the exported filesystems, and which
194 		 * machines are allowed to import it.
195 		 */
196 		exports
197 		MOUNTPROC_EXPORT(void)  = 5;
198 
199 		/*
200 		 * Identical to MOUNTPROC_EXPORT above
201 		 */
202 		exports
203 		MOUNTPROC_EXPORTALL(void) = 6;
204 	} = 1;
205 #ifdef WANT_NFS3
206 	version MOUNTVERS3 {
207 		/*
208 		 * Does no work. It is made available in all RPC services
209 		 * to allow server response testing and timing
210 		 */
211 		void
212 		MOUNTPROC_NULL(void) = 0;
213 
214 		/*
215 		 * If mountres3.fhs_status is MNT3_OK, then
216 		 * mountres3.mountinfo contains the file handle for
217 		 * the directory and a list of acceptable
218 		 * authentication flavors.  This file handle may only
219 		 * be used in the NFS version 3 protocol.  This
220 		 * procedure also results in the server adding a new
221 		 * entry to its mount list recording that this client
222 		 * has mounted the directory. AUTH_UNIX authentication
223 		 * or better is required.
224 		 */
225 		mountres3
226 		MOUNTPROC_MNT(dirpath) = 1;
227 
228 		/*
229 		 * Returns the list of remotely mounted filesystems. The
230 		 * mountlist contains one entry for each hostname and
231 		 * directory pair.
232 		 */
233 		mountlist
234 		MOUNTPROC_DUMP(void) = 2;
235 
236 		/*
237 		 * Removes the mount list entry for the directory
238 		 * Unix authentication required.
239 		 */
240 		void
241 		MOUNTPROC_UMNT(dirpath) = 3;
242 
243 		/*
244 		 * Removes all of the mount list entries for this client
245 		 * Unix authentication required.
246 		 */
247 		void
248 		MOUNTPROC_UMNTALL(void) = 4;
249 
250 		/*
251 		 * Returns a list of all the exported filesystems, and which
252 		 * machines are allowed to import it.
253 		 */
254 		exports
255 		MOUNTPROC_EXPORT(void)  = 5;
256 	} = 3;
257 #endif
258 } = 100005;
259