]> git.decadent.org.uk Git - nfs-utils.git/blob - support/export/mount.x
Thu Oct 28 11:27:51 EST 1999 Neil Brown <neilb@cse.unsw.edu.au>
[nfs-utils.git] / support / export / mount.x
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 or with the express written consent of
8 % * Sun Microsystems, Inc.
9 % *
10 % * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
11 % * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
12 % * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
13 % *
14 % * Sun RPC is provided with no support and without any obligation on the
15 % * part of Sun Microsystems, Inc. to assist in its use, correction,
16 % * modification or enhancement.
17 % *
18 % * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
19 % * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
20 % * OR ANY PART THEREOF.
21 % *
22 % * In no event will Sun Microsystems, Inc. be liable for any lost revenue
23 % * or profits or other special, indirect and consequential damages, even if
24 % * Sun has been advised of the possibility of such damages.
25 % *
26 % * Sun Microsystems, Inc.
27 % * 2550 Garcia Avenue
28 % * Mountain View, California  94043
29 % */
30
31 %/*
32 % * Copyright (c) 1985, 1990 by Sun Microsystems, Inc.
33 % */
34 %
35 %/* from @(#)mount.x    1.3 91/03/11 TIRPC 1.0 */
36
37 /*
38  * Protocol description for the mount program
39  */
40
41 #ifdef RPC_HDR
42 %#ifndef _rpcsvc_mount_h
43 %#define _rpcsvc_mount_h
44 %#include <memory.h>
45 #endif
46
47 const MNTPATHLEN = 1024;        /* maximum bytes in a pathname argument */
48 const MNTNAMLEN = 255;          /* maximum bytes in a name argument */
49 const FHSIZE = 32;              /* size in bytes of a file handle */
50
51 /*
52  * The fhandle is the file handle that the server passes to the client.
53  * All file operations are done using the file handles to refer to a file
54  * or a directory. The file handle can contain whatever information the
55  * server needs to distinguish an individual file.
56  */
57 typedef opaque fhandle[FHSIZE]; 
58
59 /*
60  * If a status of zero is returned, the call completed successfully, and 
61  * a file handle for the directory follows. A non-zero status indicates
62  * some sort of error. The status corresponds with UNIX error numbers.
63  */
64 union fhstatus switch (unsigned fhs_status) {
65 case 0:
66         fhandle fhs_fhandle;
67 default:
68         void;
69 };
70
71 /*
72  * The type dirpath is the pathname of a directory
73  */
74 typedef string dirpath<MNTPATHLEN>;
75
76 /*
77  * The type name is used for arbitrary names (hostnames, groupnames)
78  */
79 typedef string name<MNTNAMLEN>;
80
81 /*
82  * A list of who has what mounted
83  */
84 typedef struct mountbody *mountlist;
85 struct mountbody {
86         name ml_hostname;
87         dirpath ml_directory;
88         mountlist ml_next;
89 };
90
91 /*
92  * A list of netgroups
93  */
94 typedef struct groupnode *groups;
95 struct groupnode {
96         name gr_name;
97         groups gr_next;
98 };
99
100 /*
101  * A list of what is exported and to whom
102  */
103 typedef struct exportnode *exports;
104 struct exportnode {
105         dirpath ex_dir;
106         groups ex_groups;
107         exports ex_next;
108 };
109
110 /*
111  * POSIX pathconf information
112  */
113 struct ppathcnf {
114         int     pc_link_max;    /* max links allowed */
115         short   pc_max_canon;   /* max line len for a tty */
116         short   pc_max_input;   /* input a tty can eat all at once */
117         short   pc_name_max;    /* max file name length (dir entry) */
118         short   pc_path_max;    /* max path name length (/x/y/x/.. ) */
119         short   pc_pipe_buf;    /* size of a pipe (bytes) */
120         u_char  pc_vdisable;    /* safe char to turn off c_cc[i] */
121         char    pc_xxx;         /* alignment padding; cc_t == char */
122         short   pc_mask[2];     /* validity and boolean bits */
123 };
124
125 /*
126  * NFSv3 file handle
127  */
128 const FHSIZE3 = 64;             /* max size of NFSv3 file handle in bytes */
129 typedef opaque          fhandle3<FHSIZE3>;
130
131 /*
132  * NFSv3 mount status
133  */
134 enum mountstat3 {
135         MNT_OK                  = 0,    /* no error */
136         MNT3ERR_PERM            = 1,    /* not owner */
137         MNT3ERR_NOENT           = 2,    /* no such file or directory */
138         MNT3ERR_IO              = 5,    /* I/O error */
139         MNT3ERR_ACCES           = 13,   /* Permission denied */
140         MNT3ERR_NOTDIR          = 20,   /* Not a directory */
141         MNT3ERR_INVAL           = 22,   /* Invalid argument */
142         MNT3ERR_NAMETOOLONG     = 63,   /* File name too long */
143         MNT3ERR_NOTSUPP         = 10004,/* Operation not supported */
144         MNT3ERR_SERVERFAULT     = 10006 /* A failure on the server */
145 };
146
147 /*
148  * NFSv3 mount result
149  */
150 struct mountres3_ok {
151         fhandle3        fhandle;
152         int             auth_flavors<>;
153 };
154
155 union mountres3 switch (mountstat3 fhs_status) {
156 case MNT_OK:
157         mountres3_ok    mountinfo; /* File handle and supported flavors */
158 default:
159         void;
160 };
161
162 program MOUNTPROG {
163         /*
164          * Version one of the mount protocol communicates with version two
165          * of the NFS protocol. The only connecting point is the fhandle 
166          * structure, which is the same for both protocols.
167          */
168         version MOUNTVERS {
169                 /*
170                  * Does no work. It is made available in all RPC services
171                  * to allow server reponse testing and timing
172                  */
173                 void
174                 MOUNTPROC_NULL(void) = 0;
175
176                 /*      
177                  * If fhs_status is 0, then fhs_fhandle contains the
178                  * file handle for the directory. This file handle may
179                  * be used in the NFS protocol. This procedure also adds
180                  * a new entry to the mount list for this client mounting
181                  * the directory.
182                  * Unix authentication required.
183                  */
184                 fhstatus 
185                 MOUNTPROC_MNT(dirpath) = 1;
186
187                 /*
188                  * Returns the list of remotely mounted filesystems. The 
189                  * mountlist contains one entry for each hostname and 
190                  * directory pair.
191                  */
192                 mountlist
193                 MOUNTPROC_DUMP(void) = 2;
194
195                 /*
196                  * Removes the mount list entry for the directory
197                  * Unix authentication required.
198                  */
199                 void
200                 MOUNTPROC_UMNT(dirpath) = 3;
201
202                 /*
203                  * Removes all of the mount list entries for this client
204                  * Unix authentication required.
205                  */
206                 void
207                 MOUNTPROC_UMNTALL(void) = 4;
208
209                 /*
210                  * Returns a list of all the exported filesystems, and which
211                  * machines are allowed to import it.
212                  */
213                 exports
214                 MOUNTPROC_EXPORT(void)  = 5;
215
216                 /*
217                  * Identical to MOUNTPROC_EXPORT above
218                  */
219                 exports
220                 MOUNTPROC_EXPORTALL(void) = 6;
221         } = 1;
222
223         /*
224          * Version two of the mount protocol communicates with version two
225          * of the NFS protocol.
226          * The only difference from version one is the addition of a POSIX
227          * pathconf call.
228          */
229         version MOUNTVERS_POSIX {
230                 /*
231                  * Does no work. It is made available in all RPC services
232                  * to allow server reponse testing and timing
233                  */
234                 void
235                 MOUNTPROC_NULL(void) = 0;
236
237                 /*      
238                  * If fhs_status is 0, then fhs_fhandle contains the
239                  * file handle for the directory. This file handle may
240                  * be used in the NFS protocol. This procedure also adds
241                  * a new entry to the mount list for this client mounting
242                  * the directory.
243                  * Unix authentication required.
244                  */
245                 fhstatus 
246                 MOUNTPROC_MNT(dirpath) = 1;
247
248                 /*
249                  * Returns the list of remotely mounted filesystems. The 
250                  * mountlist contains one entry for each hostname and 
251                  * directory pair.
252                  */
253                 mountlist
254                 MOUNTPROC_DUMP(void) = 2;
255
256                 /*
257                  * Removes the mount list entry for the directory
258                  * Unix authentication required.
259                  */
260                 void
261                 MOUNTPROC_UMNT(dirpath) = 3;
262
263                 /*
264                  * Removes all of the mount list entries for this client
265                  * Unix authentication required.
266                  */
267                 void
268                 MOUNTPROC_UMNTALL(void) = 4;
269
270                 /*
271                  * Returns a list of all the exported filesystems, and which
272                  * machines are allowed to import it.
273                  */
274                 exports
275                 MOUNTPROC_EXPORT(void)  = 5;
276
277                 /*
278                  * Identical to MOUNTPROC_EXPORT above
279                  */
280                 exports
281                 MOUNTPROC_EXPORTALL(void) = 6;
282
283                 /*
284                  * POSIX pathconf info (Sun hack)
285                  */
286                 ppathcnf
287                 MOUNTPROC_PATHCONF(dirpath) = 7;
288         } = 2;
289
290         /*
291          * Version 3 of the protocol is for NFSv3
292          */
293         version MOUNTVERS_NFSV3 {
294                 /*
295                  * Does no work. It is made available in all RPC services
296                  * to allow server reponse testing and timing
297                  */
298                 void
299                 MOUNTPROC3_NULL(void) = 0;
300
301                 /*      
302                  * If fhs_status is 0, then fhs_fhandle contains the
303                  * file handle for the directory. This file handle may
304                  * be used in the NFS protocol. This procedure also adds
305                  * a new entry to the mount list for this client mounting
306                  * the directory.
307                  * Unix authentication required.
308                  */
309                 mountres3 
310                 MOUNTPROC3_MNT(dirpath) = 1;
311
312                 /*
313                  * Returns the list of remotely mounted filesystems. The 
314                  * mountlist contains one entry for each hostname and 
315                  * directory pair.
316                  */
317                 mountlist
318                 MOUNTPROC3_DUMP(void) = 2;
319
320                 /*
321                  * Removes the mount list entry for the directory
322                  * Unix authentication required.
323                  */
324                 void
325                 MOUNTPROC3_UMNT(dirpath) = 3;
326
327                 /*
328                  * Removes all of the mount list entries for this client
329                  * Unix authentication required.
330                  */
331                 void
332                 MOUNTPROC3_UMNTALL(void) = 4;
333
334                 /*
335                  * Returns a list of all the exported filesystems, and which
336                  * machines are allowed to import it.
337                  */
338                 exports
339                 MOUNTPROC3_EXPORT(void)  = 5;
340         } = 3;
341 } = 100005;
342
343 #ifdef RPC_HDR
344 %#endif /*!_rpcsvc_mount_h*/
345 #endif