xref: /netbsd/lib/librpcsvc/mount.x (revision bf9ec67e)
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.4 1999/07/02 15:44:13 simonb Exp $");
40 %#endif /* not lint */
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 
47 /*
48  * The fhandle is the file handle that the server passes to the client.
49  * All file operations are done using the file handles to refer to a file
50  * or a directory. The file handle can contain whatever information the
51  * server needs to distinguish an individual file.
52  */
53 typedef opaque fhandle[FHSIZE];
54 
55 /*
56  * If a status of zero is returned, the call completed successfully, and
57  * a file handle for the directory follows. A non-zero status indicates
58  * some sort of error. The status corresponds with UNIX error numbers.
59  */
60 union fhstatus switch (unsigned fhs_status) {
61 case 0:
62 	fhandle fhs_fhandle;
63 default:
64 	void;
65 };
66 
67 /*
68  * The type dirpath is the pathname of a directory
69  */
70 typedef string dirpath<MNTPATHLEN>;
71 
72 /*
73  * The type name is used for arbitrary names (hostnames, groupnames)
74  */
75 typedef string name<MNTNAMLEN>;
76 
77 /*
78  * A list of who has what mounted
79  */
80 typedef struct mountbody *mountlist;
81 struct mountbody {
82 	name ml_hostname;
83 	dirpath ml_directory;
84 	mountlist ml_next;
85 };
86 
87 /*
88  * A list of netgroups
89  */
90 typedef struct groupnode *groups;
91 struct groupnode {
92 	name gr_name;
93 	groups gr_next;
94 };
95 
96 /*
97  * A list of what is exported and to whom
98  */
99 typedef struct exportnode *exports;
100 struct exportnode {
101 	dirpath ex_dir;
102 	groups ex_groups;
103 	exports ex_next;
104 };
105 
106 program MOUNTPROG {
107 	/*
108 	 * Version one of the mount protocol communicates with version two
109 	 * of the NFS protocol. The only connecting point is the fhandle
110 	 * structure, which is the same for both protocols.
111 	 */
112 	version MOUNTVERS {
113 		/*
114 		 * Does no work. It is made available in all RPC services
115 		 * to allow server reponse testing and timing
116 		 */
117 		void
118 		MOUNTPROC_NULL(void) = 0;
119 
120 		/*
121 		 * If fhs_status is 0, then fhs_fhandle contains the
122 	 	 * file handle for the directory. This file handle may
123 		 * be used in the NFS protocol. This procedure also adds
124 		 * a new entry to the mount list for this client mounting
125 		 * the directory.
126 		 * Unix authentication required.
127 		 */
128 		fhstatus
129 		MOUNTPROC_MNT(dirpath) = 1;
130 
131 		/*
132 		 * Returns the list of remotely mounted filesystems. The
133 		 * mountlist contains one entry for each hostname and
134 		 * directory pair.
135 		 */
136 		mountlist
137 		MOUNTPROC_DUMP(void) = 2;
138 
139 		/*
140 		 * Removes the mount list entry for the directory
141 		 * Unix authentication required.
142 		 */
143 		void
144 		MOUNTPROC_UMNT(dirpath) = 3;
145 
146 		/*
147 		 * Removes all of the mount list entries for this client
148 		 * Unix authentication required.
149 		 */
150 		void
151 		MOUNTPROC_UMNTALL(void) = 4;
152 
153 		/*
154 		 * Returns a list of all the exported filesystems, and which
155 		 * machines are allowed to import it.
156 		 */
157 		exports
158 		MOUNTPROC_EXPORT(void)  = 5;
159 
160 		/*
161 		 * Identical to MOUNTPROC_EXPORT above
162 		 */
163 		exports
164 		MOUNTPROC_EXPORTALL(void) = 6;
165 	} = 1;
166 } = 100005;
167