Merge from vendor branch BINUTILS:
[dragonfly.git] / include / rpcsvc / 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.
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  * @(#)mount.x 1.2 87/09/18 Copyr 1987 Sun Micro
30  * @(#)mount.x  2.1 88/08/01 4.0 RPCSRC
31  * $FreeBSD: src/include/rpcsvc/mount.x,v 1.6 1999/08/27 23:45:08 peter Exp $
32  * $DragonFly: src/include/rpcsvc/mount.x,v 1.2 2003/06/17 04:25:58 dillon Exp $
33  */
34
35 /*
36  * Protocol description for the mount program
37  */
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 #ifdef WANT_NFS3
43 const FHSIZE3 = 64;             /* size in bytes of a file handle (v3) */
44 #endif
45
46 /*
47  * The fhandle is the file handle that the server passes to the client.
48  * All file operations are done using the file handles to refer to a file
49  * or a directory. The file handle can contain whatever information the
50  * server needs to distinguish an individual file.
51  */
52 typedef opaque fhandle[FHSIZE]; 
53 #ifdef WANT_NFS3
54 typedef opaque fhandle3<FHSIZE3>;
55 #endif
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 #ifdef WANT_NFS3
70 /*
71  * Status codes returned by the version 3 mount call.
72  */
73 enum mountstat3 {
74         MNT3_OK = 0,                 /* no error */
75         MNT3ERR_PERM = 1,            /* Not owner */
76         MNT3ERR_NOENT = 2,           /* No such file or directory */
77         MNT3ERR_IO = 5,              /* I/O error */
78         MNT3ERR_ACCES = 13,          /* Permission denied */
79         MNT3ERR_NOTDIR = 20,         /* Not a directory */
80         MNT3ERR_INVAL = 22,          /* Invalid argument */
81         MNT3ERR_NAMETOOLONG = 63,    /* Filename too long */
82         MNT3ERR_NOTSUPP = 10004,     /* Operation not supported */
83         MNT3ERR_SERVERFAULT = 10006  /* A failure on the server */
84 };
85
86 struct mountres3_ok {
87         fhandle3        fhandle;
88         int             auth_flavors<>;
89 };
90
91 union mountres3 switch (mountstat3 fhs_status) {
92 case 0:
93         mountres3_ok    mountinfo;
94 default:
95         void;
96 };
97 #endif
98
99 /*
100  * The type dirpath is the pathname of a directory
101  */
102 typedef string dirpath<MNTPATHLEN>;
103
104 /*
105  * The type name is used for arbitrary names (hostnames, groupnames)
106  */
107 typedef string name<MNTNAMLEN>;
108
109 /*
110  * A list of who has what mounted
111  */
112 typedef struct mountbody *mountlist;
113 struct mountbody {
114         name ml_hostname;
115         dirpath ml_directory;
116         mountlist ml_next;
117 };
118
119 /*
120  * A list of netgroups
121  */
122 typedef struct groupnode *groups;
123 struct groupnode {
124         name gr_name;
125         groups gr_next;
126 };
127
128 /*
129  * A list of what is exported and to whom
130  */
131 typedef struct exportnode *exports;
132 struct exportnode {
133         dirpath ex_dir;
134         groups ex_groups;
135         exports ex_next;
136 };
137
138 program MOUNTPROG {
139         /*
140          * Version one of the mount protocol communicates with version two
141          * of the NFS protocol. Version three communicates with
142          * version three of the NFS protocol. The only connecting
143          * point is the fhandle structure, which is the same for both
144          * protocols.
145          */
146         version MOUNTVERS {
147                 /*
148                  * Does no work. It is made available in all RPC services
149                  * to allow server reponse testing and timing
150                  */
151                 void
152                 MOUNTPROC_NULL(void) = 0;
153
154                 /*      
155                  * If fhs_status is 0, then fhs_fhandle contains the
156                  * file handle for the directory. This file handle may
157                  * be used in the NFS protocol. This procedure also adds
158                  * a new entry to the mount list for this client mounting
159                  * the directory.
160                  * Unix authentication required.
161                  */
162                 fhstatus 
163                 MOUNTPROC_MNT(dirpath) = 1;
164
165                 /*
166                  * Returns the list of remotely mounted filesystems. The 
167                  * mountlist contains one entry for each hostname and 
168                  * directory pair.
169                  */
170                 mountlist
171                 MOUNTPROC_DUMP(void) = 2;
172
173                 /*
174                  * Removes the mount list entry for the directory
175                  * Unix authentication required.
176                  */
177                 void
178                 MOUNTPROC_UMNT(dirpath) = 3;
179
180                 /*
181                  * Removes all of the mount list entries for this client
182                  * Unix authentication required.
183                  */
184                 void
185                 MOUNTPROC_UMNTALL(void) = 4;
186
187                 /*
188                  * Returns a list of all the exported filesystems, and which
189                  * machines are allowed to import it.
190                  */
191                 exports
192                 MOUNTPROC_EXPORT(void)  = 5;
193
194                 /*
195                  * Identical to MOUNTPROC_EXPORT above
196                  */
197                 exports
198                 MOUNTPROC_EXPORTALL(void) = 6;
199         } = 1;
200 #ifdef WANT_NFS3
201         version MOUNTVERS3 {
202                 /*
203                  * Does no work. It is made available in all RPC services
204                  * to allow server reponse testing and timing
205                  */
206                 void
207                 MOUNTPROC_NULL(void) = 0;
208
209                 /*
210                  * If mountres3.fhs_status is MNT3_OK, then
211                  * mountres3.mountinfo contains the file handle for
212                  * the directory and a list of acceptable
213                  * authentication flavors.  This file handle may only
214                  * be used in the NFS version 3 protocol.  This
215                  * procedure also results in the server adding a new
216                  * entry to its mount list recording that this client
217                  * has mounted the directory. AUTH_UNIX authentication
218                  * or better is required.
219                  */
220                 mountres3
221                 MOUNTPROC_MNT(dirpath) = 1;
222
223                 /*
224                  * Returns the list of remotely mounted filesystems. The 
225                  * mountlist contains one entry for each hostname and 
226                  * directory pair.
227                  */
228                 mountlist
229                 MOUNTPROC_DUMP(void) = 2;
230
231                 /*
232                  * Removes the mount list entry for the directory
233                  * Unix authentication required.
234                  */
235                 void
236                 MOUNTPROC_UMNT(dirpath) = 3;
237
238                 /*
239                  * Removes all of the mount list entries for this client
240                  * Unix authentication required.
241                  */
242                 void
243                 MOUNTPROC_UMNTALL(void) = 4;
244
245                 /*
246                  * Returns a list of all the exported filesystems, and which
247                  * machines are allowed to import it.
248                  */
249                 exports
250                 MOUNTPROC_EXPORT(void)  = 5;
251         } = 3;
252 #endif
253 } = 100005;