xref: /openbsd/lib/librpcsvc/mount.x (revision 17df1aa7)
1 /*	$OpenBSD: mount.x,v 1.4 2009/10/27 23:59:30 deraadt Exp $	*/
2 
3 /*
4  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
5  * unrestricted use provided that this legend is included on all tape
6  * media and as a part of the software program in whole or part.  Users
7  * may copy or modify Sun RPC without charge, but are not authorized
8  * to license or distribute it to anyone else except as part of a product or
9  * program developed by the user.
10  *
11  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
12  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
13  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
14  *
15  * Sun RPC is provided with no support and without any obligation on the
16  * part of Sun Microsystems, Inc. to assist in its use, correction,
17  * modification or enhancement.
18  *
19  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
20  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
21  * OR ANY PART THEREOF.
22  *
23  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
24  * or profits or other special, indirect and consequential damages, even if
25  * Sun has been advised of the possibility of such damages.
26  *
27  * Sun Microsystems, Inc.
28  * 2550 Garcia Avenue
29  * Mountain View, California  94043
30  */
31 
32 /*
33  * Protocol description for the mount program
34  */
35 
36 #ifndef RPC_HDR
37 #endif
38 
39 const MNTPATHLEN = 1024;	/* maximum bytes in a pathname argument */
40 const MNTNAMLEN = 255;		/* maximum bytes in a name argument */
41 const FHSIZE = 32;		/* size in bytes of a file handle */
42 
43 /*
44  * The fhandle is the file handle that the server passes to the client.
45  * All file operations are done using the file handles to refer to a file
46  * or a directory. The file handle can contain whatever information the
47  * server needs to distinguish an individual file.
48  */
49 typedef opaque fhandle[FHSIZE];
50 
51 /*
52  * If a status of zero is returned, the call completed successfully, and
53  * a file handle for the directory follows. A non-zero status indicates
54  * some sort of error. The status corresponds with UNIX error numbers.
55  */
56 union fhstatus switch (unsigned fhs_status) {
57 case 0:
58 	fhandle fhs_fhandle;
59 default:
60 	void;
61 };
62 
63 /*
64  * The type dirpath is the pathname of a directory
65  */
66 typedef string dirpath<MNTPATHLEN>;
67 
68 /*
69  * The type name is used for arbitrary names (hostnames, groupnames)
70  */
71 typedef string name<MNTNAMLEN>;
72 
73 /*
74  * A list of who has what mounted
75  */
76 typedef struct mountbody *mountlist;
77 struct mountbody {
78 	name ml_hostname;
79 	dirpath ml_directory;
80 	mountlist ml_next;
81 };
82 
83 /*
84  * A list of netgroups
85  */
86 typedef struct groupnode *groups;
87 struct groupnode {
88 	name gr_name;
89 	groups gr_next;
90 };
91 
92 /*
93  * A list of what is exported and to whom
94  */
95 typedef struct exportnode *exports;
96 struct exportnode {
97 	dirpath ex_dir;
98 	groups ex_groups;
99 	exports ex_next;
100 };
101 
102 program MOUNTPROG {
103 	/*
104 	 * Version one of the mount protocol communicates with version two
105 	 * of the NFS protocol. The only connecting point is the fhandle
106 	 * structure, which is the same for both protocols.
107 	 */
108 	version MOUNTVERS {
109 		/*
110 		 * Does no work. It is made available in all RPC services
111 		 * to allow server reponse testing and timing
112 		 */
113 		void
114 		MOUNTPROC_NULL(void) = 0;
115 
116 		/*
117 		 * If fhs_status is 0, then fhs_fhandle contains the
118 		 * file handle for the directory. This file handle may
119 		 * be used in the NFS protocol. This procedure also adds
120 		 * a new entry to the mount list for this client mounting
121 		 * the directory.
122 		 * Unix authentication required.
123 		 */
124 		fhstatus
125 		MOUNTPROC_MNT(dirpath) = 1;
126 
127 		/*
128 		 * Returns the list of remotely mounted filesystems. The
129 		 * mountlist contains one entry for each hostname and
130 		 * directory pair.
131 		 */
132 		mountlist
133 		MOUNTPROC_DUMP(void) = 2;
134 
135 		/*
136 		 * Removes the mount list entry for the directory
137 		 * Unix authentication required.
138 		 */
139 		void
140 		MOUNTPROC_UMNT(dirpath) = 3;
141 
142 		/*
143 		 * Removes all of the mount list entries for this client
144 		 * Unix authentication required.
145 		 */
146 		void
147 		MOUNTPROC_UMNTALL(void) = 4;
148 
149 		/*
150 		 * Returns a list of all the exported filesystems, and which
151 		 * machines are allowed to import it.
152 		 */
153 		exports
154 		MOUNTPROC_EXPORT(void)  = 5;
155 
156 		/*
157 		 * Identical to MOUNTPROC_EXPORT above
158 		 */
159 		exports
160 		MOUNTPROC_EXPORTALL(void) = 6;
161 	} = 1;
162 } = 100005;
163