1 /* @(#)mount.x	2.1 88/08/01 4.0 RPCSRC */
2 
3 /*
4  * Copyright (c) 2010, Oracle America, Inc.
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  *     * Redistributions of source code must retain the above copyright
10  *       notice, this list of conditions and the following disclaimer.
11  *     * Redistributions in binary form must reproduce the above
12  *       copyright notice, this list of conditions and the following
13  *       disclaimer in the documentation and/or other materials
14  *       provided with the distribution.
15  *     * Neither the name of the "Oracle America, Inc." nor the names of its
16  *       contributors may be used to endorse or promote products derived
17  *       from this software without specific prior written permission.
18  *
19  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24  *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
26  *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29  *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 /*
34  * Protocol description for the mount program
35  */
36 
37 
38 const MNTPATHLEN = 1024;	/* maximum bytes in a pathname argument */
39 const MNTNAMLEN = 255;		/* maximum bytes in a name argument */
40 const FHSIZE = 32;		/* size in bytes of a file handle */
41 
42 /*
43  * The fhandle is the file handle that the server passes to the client.
44  * All file operations are done using the file handles to refer to a file
45  * or a directory. The file handle can contain whatever information the
46  * server needs to distinguish an individual file.
47  */
48 typedef opaque fhandle[FHSIZE];
49 
50 /*
51  * If a status of zero is returned, the call completed successfully, and
52  * a file handle for the directory follows. A non-zero status indicates
53  * some sort of error. The status corresponds with UNIX error numbers.
54  */
55 union fhstatus switch (unsigned fhs_status) {
56 case 0:
57 	fhandle fhs_fhandle;
58 default:
59 	void;
60 };
61 
62 /*
63  * The type dirpath is the pathname of a directory
64  */
65 typedef string dirpath<MNTPATHLEN>;
66 
67 /*
68  * The type name is used for arbitrary names (hostnames, groupnames)
69  */
70 typedef string name<MNTNAMLEN>;
71 
72 /*
73  * A list of who has what mounted
74  */
75 typedef struct mountbody *mountlist;
76 struct mountbody {
77 	name ml_hostname;
78 	dirpath ml_directory;
79 	mountlist ml_next;
80 };
81 
82 /*
83  * A list of netgroups
84  */
85 typedef struct groupnode *groups;
86 struct groupnode {
87 	name gr_name;
88 	groups gr_next;
89 };
90 
91 /*
92  * A list of what is exported and to whom
93  */
94 typedef struct exportnode *exports;
95 struct exportnode {
96 	dirpath ex_dir;
97 	groups ex_groups;
98 	exports ex_next;
99 };
100 
101 program MOUNTPROG {
102 	/*
103 	 * Version one of the mount protocol communicates with version two
104 	 * of the NFS protocol. The only connecting point is the fhandle
105 	 * structure, which is the same for both protocols.
106 	 */
107 	version MOUNTVERS {
108 		/*
109 		 * Does no work. It is made available in all RPC services
110 		 * to allow server response testing and timing
111 		 */
112 		void
113 		MOUNTPROC_NULL(void) = 0;
114 
115 		/*
116 		 * If fhs_status is 0, then fhs_fhandle contains the
117 		 * file handle for the directory. This file handle may
118 		 * be used in the NFS protocol. This procedure also adds
119 		 * a new entry to the mount list for this client mounting
120 		 * the directory.
121 		 * Unix authentication required.
122 		 */
123 		fhstatus
124 		MOUNTPROC_MNT(dirpath) = 1;
125 
126 		/*
127 		 * Returns the list of remotely mounted filesystems. The
128 		 * mountlist contains one entry for each hostname and
129 		 * directory pair.
130 		 */
131 		mountlist
132 		MOUNTPROC_DUMP(void) = 2;
133 
134 		/*
135 		 * Removes the mount list entry for the directory
136 		 * Unix authentication required.
137 		 */
138 		void
139 		MOUNTPROC_UMNT(dirpath) = 3;
140 
141 		/*
142 		 * Removes all of the mount list entries for this client
143 		 * Unix authentication required.
144 		 */
145 		void
146 		MOUNTPROC_UMNTALL(void) = 4;
147 
148 		/*
149 		 * Returns a list of all the exported filesystems, and which
150 		 * machines are allowed to import it.
151 		 */
152 		exports
153 		MOUNTPROC_EXPORT(void)  = 5;
154 
155 		/*
156 		 * Identical to MOUNTPROC_EXPORT above
157 		 */
158 		exports
159 		MOUNTPROC_EXPORTALL(void) = 6;
160 	} = 1;
161 } = 100005;
162