]> git.decadent.org.uk Git - nfs-utils.git/blob - support/export/mount.x
mountd: Replace "struct hostent" with "struct addrinfo"
[nfs-utils.git] / support / export / mount.x
1 %/*
2 % * Copyright (c) 2009, Sun Microsystems, Inc.
3 % * All rights reserved.
4 % *
5 % * Redistribution and use in source and binary forms, with or without
6 % * modification, are permitted provided that the following conditions are met:
7 % * - Redistributions of source code must retain the above copyright notice,
8 % *   this list of conditions and the following disclaimer.
9 % * - Redistributions in binary form must reproduce the above copyright notice,
10 % *   this list of conditions and the following disclaimer in the documentation
11 % *   and/or other materials provided with the distribution.
12 % * - Neither the name of Sun Microsystems, Inc. nor the names of its
13 % *   contributors may be used to endorse or promote products derived
14 % *   from this software without specific prior written permission.
15 % *
16 % * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 % * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 % * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 % * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 % * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 % * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 % * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 % * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 % * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 % * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 % * POSSIBILITY OF SUCH DAMAGE.
27 % */
28
29 %/*
30 % * Copyright (c) 1985, 1990 by Sun Microsystems, Inc.
31 % */
32 %
33 %/* from @(#)mount.x    1.3 91/03/11 TIRPC 1.0 */
34
35 /*
36  * Protocol description for the mount program
37  */
38
39 #ifdef RPC_HDR
40 %#ifndef _rpcsvc_mount_h
41 %#define _rpcsvc_mount_h
42 %#include <memory.h>
43 #endif
44
45 const MNTPATHLEN = 1024;        /* maximum bytes in a pathname argument */
46 const MNTNAMLEN = 255;          /* maximum bytes in a name argument */
47 const FHSIZE = 32;              /* size in bytes of a file handle */
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  */
55 typedef opaque fhandle[FHSIZE]; 
56
57 /*
58  * If a status of zero is returned, the call completed successfully, and 
59  * a file handle for the directory follows. A non-zero status indicates
60  * some sort of error. The status corresponds with UNIX error numbers.
61  */
62 union fhstatus switch (unsigned fhs_status) {
63 case 0:
64         fhandle fhs_fhandle;
65 default:
66         void;
67 };
68
69 /*
70  * The type dirpath is the pathname of a directory
71  */
72 typedef string dirpath<MNTPATHLEN>;
73
74 /*
75  * The type name is used for arbitrary names (hostnames, groupnames)
76  */
77 typedef string name<MNTNAMLEN>;
78
79 /*
80  * A list of who has what mounted
81  */
82 typedef struct mountbody *mountlist;
83 struct mountbody {
84         name ml_hostname;
85         dirpath ml_directory;
86         mountlist ml_next;
87 };
88
89 /*
90  * A list of netgroups
91  */
92 typedef struct groupnode *groups;
93 struct groupnode {
94         name gr_name;
95         groups gr_next;
96 };
97
98 /*
99  * A list of what is exported and to whom
100  */
101 typedef struct exportnode *exports;
102 struct exportnode {
103         dirpath ex_dir;
104         groups ex_groups;
105         exports ex_next;
106 };
107
108 /*
109  * POSIX pathconf information
110  */
111 struct ppathcnf {
112         int     pc_link_max;    /* max links allowed */
113         short   pc_max_canon;   /* max line len for a tty */
114         short   pc_max_input;   /* input a tty can eat all at once */
115         short   pc_name_max;    /* max file name length (dir entry) */
116         short   pc_path_max;    /* max path name length (/x/y/x/.. ) */
117         short   pc_pipe_buf;    /* size of a pipe (bytes) */
118         u_char  pc_vdisable;    /* safe char to turn off c_cc[i] */
119         char    pc_xxx;         /* alignment padding; cc_t == char */
120         short   pc_mask[2];     /* validity and boolean bits */
121 };
122
123 /*
124  * NFSv3 file handle
125  */
126 const FHSIZE3 = 64;             /* max size of NFSv3 file handle in bytes */
127 typedef opaque          fhandle3<FHSIZE3>;
128
129 /*
130  * NFSv3 mount status
131  */
132 enum mountstat3 {
133         MNT_OK                  = 0,    /* no error */
134         MNT3ERR_PERM            = 1,    /* not owner */
135         MNT3ERR_NOENT           = 2,    /* no such file or directory */
136         MNT3ERR_IO              = 5,    /* I/O error */
137         MNT3ERR_ACCES           = 13,   /* Permission denied */
138         MNT3ERR_NOTDIR          = 20,   /* Not a directory */
139         MNT3ERR_INVAL           = 22,   /* Invalid argument */
140         MNT3ERR_NAMETOOLONG     = 63,   /* File name too long */
141         MNT3ERR_NOTSUPP         = 10004,/* Operation not supported */
142         MNT3ERR_SERVERFAULT     = 10006 /* A failure on the server */
143 };
144
145 /*
146  * NFSv3 mount result
147  */
148 struct mountres3_ok {
149         fhandle3        fhandle;
150         int             auth_flavors<>;
151 };
152
153 union mountres3 switch (mountstat3 fhs_status) {
154 case MNT_OK:
155         mountres3_ok    mountinfo; /* File handle and supported flavors */
156 default:
157         void;
158 };
159
160 program MOUNTPROG {
161         /*
162          * Version one of the mount protocol communicates with version two
163          * of the NFS protocol. The only connecting point is the fhandle 
164          * structure, which is the same for both protocols.
165          */
166         version MOUNTVERS {
167                 /*
168                  * Does no work. It is made available in all RPC services
169                  * to allow server reponse testing and timing
170                  */
171                 void
172                 MOUNTPROC_NULL(void) = 0;
173
174                 /*      
175                  * If fhs_status is 0, then fhs_fhandle contains the
176                  * file handle for the directory. This file handle may
177                  * be used in the NFS protocol. This procedure also adds
178                  * a new entry to the mount list for this client mounting
179                  * the directory.
180                  * Unix authentication required.
181                  */
182                 fhstatus 
183                 MOUNTPROC_MNT(dirpath) = 1;
184
185                 /*
186                  * Returns the list of remotely mounted filesystems. The 
187                  * mountlist contains one entry for each hostname and 
188                  * directory pair.
189                  */
190                 mountlist
191                 MOUNTPROC_DUMP(void) = 2;
192
193                 /*
194                  * Removes the mount list entry for the directory
195                  * Unix authentication required.
196                  */
197                 void
198                 MOUNTPROC_UMNT(dirpath) = 3;
199
200                 /*
201                  * Removes all of the mount list entries for this client
202                  * Unix authentication required.
203                  */
204                 void
205                 MOUNTPROC_UMNTALL(void) = 4;
206
207                 /*
208                  * Returns a list of all the exported filesystems, and which
209                  * machines are allowed to import it.
210                  */
211                 exports
212                 MOUNTPROC_EXPORT(void)  = 5;
213
214                 /*
215                  * Identical to MOUNTPROC_EXPORT above
216                  */
217                 exports
218                 MOUNTPROC_EXPORTALL(void) = 6;
219         } = 1;
220
221         /*
222          * Version two of the mount protocol communicates with version two
223          * of the NFS protocol.
224          * The only difference from version one is the addition of a POSIX
225          * pathconf call.
226          */
227         version MOUNTVERS_POSIX {
228                 /*
229                  * Does no work. It is made available in all RPC services
230                  * to allow server reponse testing and timing
231                  */
232                 void
233                 MOUNTPROC_NULL(void) = 0;
234
235                 /*      
236                  * If fhs_status is 0, then fhs_fhandle contains the
237                  * file handle for the directory. This file handle may
238                  * be used in the NFS protocol. This procedure also adds
239                  * a new entry to the mount list for this client mounting
240                  * the directory.
241                  * Unix authentication required.
242                  */
243                 fhstatus 
244                 MOUNTPROC_MNT(dirpath) = 1;
245
246                 /*
247                  * Returns the list of remotely mounted filesystems. The 
248                  * mountlist contains one entry for each hostname and 
249                  * directory pair.
250                  */
251                 mountlist
252                 MOUNTPROC_DUMP(void) = 2;
253
254                 /*
255                  * Removes the mount list entry for the directory
256                  * Unix authentication required.
257                  */
258                 void
259                 MOUNTPROC_UMNT(dirpath) = 3;
260
261                 /*
262                  * Removes all of the mount list entries for this client
263                  * Unix authentication required.
264                  */
265                 void
266                 MOUNTPROC_UMNTALL(void) = 4;
267
268                 /*
269                  * Returns a list of all the exported filesystems, and which
270                  * machines are allowed to import it.
271                  */
272                 exports
273                 MOUNTPROC_EXPORT(void)  = 5;
274
275                 /*
276                  * Identical to MOUNTPROC_EXPORT above
277                  */
278                 exports
279                 MOUNTPROC_EXPORTALL(void) = 6;
280
281                 /*
282                  * POSIX pathconf info (Sun hack)
283                  */
284                 ppathcnf
285                 MOUNTPROC_PATHCONF(dirpath) = 7;
286         } = 2;
287
288         /*
289          * Version 3 of the protocol is for NFSv3
290          */
291         version MOUNTVERS_NFSV3 {
292                 /*
293                  * Does no work. It is made available in all RPC services
294                  * to allow server reponse testing and timing
295                  */
296                 void
297                 MOUNTPROC3_NULL(void) = 0;
298
299                 /*      
300                  * If fhs_status is 0, then fhs_fhandle contains the
301                  * file handle for the directory. This file handle may
302                  * be used in the NFS protocol. This procedure also adds
303                  * a new entry to the mount list for this client mounting
304                  * the directory.
305                  * Unix authentication required.
306                  */
307                 mountres3 
308                 MOUNTPROC3_MNT(dirpath) = 1;
309
310                 /*
311                  * Returns the list of remotely mounted filesystems. The 
312                  * mountlist contains one entry for each hostname and 
313                  * directory pair.
314                  */
315                 mountlist
316                 MOUNTPROC3_DUMP(void) = 2;
317
318                 /*
319                  * Removes the mount list entry for the directory
320                  * Unix authentication required.
321                  */
322                 void
323                 MOUNTPROC3_UMNT(dirpath) = 3;
324
325                 /*
326                  * Removes all of the mount list entries for this client
327                  * Unix authentication required.
328                  */
329                 void
330                 MOUNTPROC3_UMNTALL(void) = 4;
331
332                 /*
333                  * Returns a list of all the exported filesystems, and which
334                  * machines are allowed to import it.
335                  */
336                 exports
337                 MOUNTPROC3_EXPORT(void)  = 5;
338         } = 3;
339 } = 100005;
340
341 #ifdef RPC_HDR
342 %#endif /*!_rpcsvc_mount_h*/
343 #endif