mount.x revision 1.5
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%#include <sys/cdefs.h>
36%#ifndef lint
37%/*static char sccsid[] = "from: @(#)mount.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/
38%/*static char sccsid[] = "from: @(#)mount.x	2.1 88/08/01 4.0 RPCSRC";*/
39%__RCSID("$NetBSD: mount.x,v 1.5 2003/05/07 13:48:47 yamt Exp $");
40%/*	$FreeBSD: src/include/rpcsvc/mount.x,v 1.7 2003/05/04 02:51:42 obrien Exp $	*/
41%#endif /* not lint */
42#endif
43
44const MNTPATHLEN = 1024;	/* maximum bytes in a pathname argument */
45const MNTNAMLEN = 255;		/* maximum bytes in a name argument */
46const FHSIZE = 32;		/* size in bytes of a file handle */
47const FHSIZE3 = 64;		/* size in bytes of a file handle (v3) */
48
49/*
50 * The fhandle is the file handle that the server passes to the client.
51 * All file operations are done using the file handles to refer to a file
52 * or a directory. The file handle can contain whatever information the
53 * server needs to distinguish an individual file.
54 */
55typedef opaque fhandle[FHSIZE];
56typedef opaque fhandle3<FHSIZE3>;
57
58/*
59 * If a status of zero is returned, the call completed successfully, and
60 * a file handle for the directory follows. A non-zero status indicates
61 * some sort of error. The status corresponds with UNIX error numbers.
62 */
63union fhstatus switch (unsigned fhs_status) {
64case 0:
65	fhandle fhs_fhandle;
66default:
67	void;
68};
69
70/*
71 * Status codes returned by the version 3 mount call.
72 */
73enum mountstat3 {
74	MNT3_OK = 0,                 /* no error */
75	MNT3ERR_PERM = 1,            /* Not owner */
76	MNT3ERR_NOENT = 2,           /* No such file or directory */
77	MNT3ERR_IO = 5,              /* I/O error */
78	MNT3ERR_ACCES = 13,          /* Permission denied */
79	MNT3ERR_NOTDIR = 20,         /* Not a directory */
80	MNT3ERR_INVAL = 22,          /* Invalid argument */
81	MNT3ERR_NAMETOOLONG = 63,    /* Filename too long */
82	MNT3ERR_NOTSUPP = 10004,     /* Operation not supported */
83	MNT3ERR_SERVERFAULT = 10006  /* A failure on the server */
84};
85
86struct mountres3_ok {
87	fhandle3	fhandle;
88	int		auth_flavors<>;
89};
90
91union mountres3 switch (mountstat3 fhs_status) {
92case 0:
93	mountres3_ok	mountinfo;
94default:
95	void;
96};
97
98/*
99 * The type dirpath is the pathname of a directory
100 */
101typedef string dirpath<MNTPATHLEN>;
102
103/*
104 * The type name is used for arbitrary names (hostnames, groupnames)
105 */
106typedef string name<MNTNAMLEN>;
107
108/*
109 * A list of who has what mounted
110 */
111typedef struct mountbody *mountlist;
112struct mountbody {
113	name ml_hostname;
114	dirpath ml_directory;
115	mountlist ml_next;
116};
117
118/*
119 * A list of netgroups
120 */
121typedef struct groupnode *groups;
122struct groupnode {
123	name gr_name;
124	groups gr_next;
125};
126
127/*
128 * A list of what is exported and to whom
129 */
130typedef struct exportnode *exports;
131struct exportnode {
132	dirpath ex_dir;
133	groups ex_groups;
134	exports ex_next;
135};
136
137program MOUNTPROG {
138	/*
139	 * Version one of the mount protocol communicates with version two
140	 * of the NFS protocol. Version three communicates with
141	 * version three of the NFS protocol. The only connecting
142	 * point is the fhandle structure, which is the same for both
143	 * protocols.
144	 */
145	version MOUNTVERS {
146		/*
147		 * Does no work. It is made available in all RPC services
148		 * to allow server reponse testing and timing
149		 */
150		void
151		MOUNTPROC_NULL(void) = 0;
152
153		/*
154		 * If fhs_status is 0, then fhs_fhandle contains the
155	 	 * file handle for the directory. This file handle may
156		 * be used in the NFS protocol. This procedure also adds
157		 * a new entry to the mount list for this client mounting
158		 * the directory.
159		 * Unix authentication required.
160		 */
161		fhstatus
162		MOUNTPROC_MNT(dirpath) = 1;
163
164		/*
165		 * Returns the list of remotely mounted filesystems. The
166		 * mountlist contains one entry for each hostname and
167		 * directory pair.
168		 */
169		mountlist
170		MOUNTPROC_DUMP(void) = 2;
171
172		/*
173		 * Removes the mount list entry for the directory
174		 * Unix authentication required.
175		 */
176		void
177		MOUNTPROC_UMNT(dirpath) = 3;
178
179		/*
180		 * Removes all of the mount list entries for this client
181		 * Unix authentication required.
182		 */
183		void
184		MOUNTPROC_UMNTALL(void) = 4;
185
186		/*
187		 * Returns a list of all the exported filesystems, and which
188		 * machines are allowed to import it.
189		 */
190		exports
191		MOUNTPROC_EXPORT(void)  = 5;
192
193		/*
194		 * Identical to MOUNTPROC_EXPORT above
195		 */
196		exports
197		MOUNTPROC_EXPORTALL(void) = 6;
198	} = 1;
199	version MOUNTVERS3 {
200		/*
201		 * Does no work. It is made available in all RPC services
202		 * to allow server reponse testing and timing
203		 */
204		void
205		MOUNTPROC_NULL(void) = 0;
206
207		/*
208		 * If mountres3.fhs_status is MNT3_OK, then
209		 * mountres3.mountinfo contains the file handle for
210		 * the directory and a list of acceptable
211		 * authentication flavors.  This file handle may only
212		 * be used in the NFS version 3 protocol.  This
213		 * procedure also results in the server adding a new
214		 * entry to its mount list recording that this client
215		 * has mounted the directory. AUTH_UNIX authentication
216		 * or better is required.
217		 */
218		mountres3
219		MOUNTPROC_MNT(dirpath) = 1;
220
221		/*
222		 * Returns the list of remotely mounted filesystems. The
223		 * mountlist contains one entry for each hostname and
224		 * directory pair.
225		 */
226		mountlist
227		MOUNTPROC_DUMP(void) = 2;
228
229		/*
230		 * Removes the mount list entry for the directory
231		 * Unix authentication required.
232		 */
233		void
234		MOUNTPROC_UMNT(dirpath) = 3;
235
236		/*
237		 * Removes all of the mount list entries for this client
238		 * Unix authentication required.
239		 */
240		void
241		MOUNTPROC_UMNTALL(void) = 4;
242
243		/*
244		 * Returns a list of all the exported filesystems, and which
245		 * machines are allowed to import it.
246		 */
247		exports
248		MOUNTPROC_EXPORT(void)  = 5;
249	} = 3;
250} = 100005;
251