4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 /* ident "%Z%%M% %I% %E% SMI" */
25 * Copyright (c) 1988,1990-1992,1998 by Sun Microsystems, Inc.
26 * All rights reserved.
30 * Protocol description for the mount program
33 const MNTPATHLEN = 1024; /* maximum bytes in a pathname argument */
34 const MNTNAMLEN = 255; /* maximum bytes in a name argument */
35 const FHSIZE = 32; /* size in bytes of a v2 file handle */
36 const FHSIZE3 = 64; /* " " " " " v3 " " */
39 * The fhandle is the file handle that the server passes to the client.
40 * All file operations are done using the file handles to refer to a file
41 * or a directory. The file handle can contain whatever information the
42 * server needs to distinguish an individual file.
44 * Versions 1 and 2 of the protocol share a filehandle of 32 bytes.
46 * Version 3 supports a 64 byte filehandle that can be used only
47 * with version 3 of the NFS protocol.
50 typedef opaque fhandle[FHSIZE];
51 typedef opaque fhandle3<FHSIZE3>;
54 * If a V2 status of zero is returned, the call completed successfully, and
55 * a file handle for the directory follows. A non-zero status indicates
56 * some sort of error. The status corresponds with UNIX error numbers.
58 union fhstatus switch (unsigned fhs_status) {
66 * This #define is added for backwards compatability with applications
67 * which reference the old style fhstatus. The second element of that
68 * structure was called fhs_fh, instead of the current fhs_fhandle.
71 %#define fhs_fh fhstatus_u.fhs_fhandle
74 * The following status codes are defined for the V3 mount service:
75 * Note that the precise enum encoding must be followed; the values
76 * are derived from existing implementation practice, and there is
77 * no good reason to disturb them.
80 MNT_OK= 0, /* no error */
81 MNT3ERR_PERM=1, /* Not owner */
82 MNT3ERR_NOENT=2, /* No such file or directory */
83 MNT3ERR_IO=5, /* I/O error */
84 MNT3ERR_ACCES=13, /* Permission denied */
85 MNT3ERR_NOTDIR=20, /* Not a directory*/
86 MNT3ERR_INVAL=22, /* Invalid argument.*/
87 MNT3ERR_NAMETOOLONG=63, /* File name too long */
88 MNT3ERR_NOTSUPP=10004, /* operation not supported */
89 MNT3ERR_SERVERFAULT=10006 /* An i/o or similar failure caused */
90 /* the server to abandon the request */
91 /* No attributes can be returned. The */
92 /* client should translate this into EIO */
96 * A V3 server returns a file handle and a list of the authentication
97 * flavors that the server will accept for this mount. If the list
98 * is empty, AUTH_UNIX is required. Otherwise, any of the flavors
99 * listed in auth_flavors<> may be used (but no others).
100 * The values of the authentication flavors are defined in the
101 * underlying RPC protocol.
103 struct mountres3_ok {
109 * If a V3 status of MNT_OK is returned, the call completed successfully, and
110 * a file handle for the directory follows. Any other status indicates
111 * some sort of error.
114 union mountres3 switch (mountstat3 fhs_status) {
116 mountres3_ok mountinfo;
122 * The type dirpath is the pathname of a directory
124 typedef string dirpath<MNTPATHLEN>;
127 * The type name is used for arbitrary names (hostnames, groupnames)
129 typedef string name<MNTNAMLEN>;
132 * A list of who has what mounted. This information is
133 * strictly advisory, since there is no mechanism to
134 * enforce the removal of stale information. The strongest
135 * assertion that can be made is that if a hostname:directory
136 * pair appears in the list, the server has exported the
137 * directory to that client at some point since the server
138 * export data base was (re)initialized. Note also that there
139 * is no limit on the length of the information returned
140 * in this structure, and this may cause problems if the
141 * mount service is accessed via a connectionless transport.
143 * The ifdef will ensure that these are only carried over to
144 * mount.h - no xdr routines will be generated. We want to
145 * do these by hand, to avoid the recursive stack-blowing ones
146 * that rpcgen will generate.
149 typedef struct mountbody *mountlist;
152 dirpath ml_directory;
158 * A list of netgroups
160 typedef struct groupnode *groups;
167 * A list of what is exported and to whom
169 typedef struct exportnode *exports;
177 * POSIX pathconf information
180 int pc_link_max; /* max links allowed */
181 short pc_max_canon; /* max line len for a tty */
182 short pc_max_input; /* input a tty can eat all at once */
183 short pc_name_max; /* max file name length (dir entry) */
184 short pc_path_max; /* max path name length (/x/y/x/.. ) */
185 short pc_pipe_buf; /* size of a pipe (bytes) */
186 u_char pc_vdisable; /* safe char to turn off c_cc[i] */
187 char pc_xxx; /* alignment padding; cc_t == char */
188 short pc_mask[2]; /* validity and boolean bits */
193 * Version one of the mount protocol communicates with version two
194 * of the NFS protocol. The only connecting point is the fhandle
195 * structure, which is the same for both protocols.
199 * Does no work. It is made available in all RPC services
200 * to allow server reponse testing and timing
203 MOUNTPROC_NULL(void) = 0;
206 * If fhs_status is 0, then fhs_fhandle contains the
207 * file handle for the directory. This file handle may
208 * be used in the NFS protocol. This procedure also adds
209 * a new entry to the mount list for this client mounting
211 * Unix authentication required.
214 MOUNTPROC_MNT(dirpath) = 1;
217 * Returns the list of remotely mounted filesystems. The
218 * mountlist contains one entry for each hostname and
222 MOUNTPROC_DUMP(void) = 2;
225 * Removes the mount list entry for the directory
226 * Unix authentication required.
229 MOUNTPROC_UMNT(dirpath) = 3;
232 * Removes all of the mount list entries for this client
233 * Unix authentication required.
236 MOUNTPROC_UMNTALL(void) = 4;
239 * Returns a list of all the exported filesystems, and which
240 * machines are allowed to import it.
243 MOUNTPROC_EXPORT(void) = 5;
246 * Identical to MOUNTPROC_EXPORT above
249 MOUNTPROC_EXPORTALL(void) = 6;
253 * Version two of the mount protocol communicates with version two
254 * of the NFS protocol. It is identical to version one except for a
255 * new procedure call for posix.
257 version MOUNTVERS_POSIX {
259 * Does no work. It is made available in all RPC services
260 * to allow server reponse testing and timing
263 MOUNTPROC_NULL(void) = 0;
266 * If fhs_status is 0, then fhs_fhandle contains the
267 * file handle for the directory. This file handle may
268 * be used in the NFS protocol. This procedure also adds
269 * a new entry to the mount list for this client mounting
271 * Unix authentication required.
274 MOUNTPROC_MNT(dirpath) = 1;
277 * Returns the list of remotely mounted filesystems. The
278 * mountlist contains one entry for each hostname and
282 MOUNTPROC_DUMP(void) = 2;
285 * Removes the mount list entry for the directory
286 * Unix authentication required.
289 MOUNTPROC_UMNT(dirpath) = 3;
292 * Removes all of the mount list entries for this client
293 * Unix authentication required.
296 MOUNTPROC_UMNTALL(void) = 4;
299 * Returns a list of all the exported filesystems, and which
300 * machines are allowed to import it.
303 MOUNTPROC_EXPORT(void) = 5;
306 * Identical to MOUNTPROC_EXPORT above
309 MOUNTPROC_EXPORTALL(void) = 6;
312 * Posix info over the wire isn't supported in NFS version 2
313 * so we get it here at mount time.
316 MOUNTPROC_PATHCONF(dirpath) = 7;
320 * Version 3 of the mount protocol communicates with version 3
321 * of the NFS protocol. The only connecting point is the nfs_fh3
322 * structure, which is the same for both protocols.
324 * The only significant change over version 2 is that MOUNTPROC_MNT
325 * returns a longer filehandle (64 bytes instead of 32) as well
326 * as authentication information. MOUNTPROC_PATHCONF is subsumed
327 * into V3 of the NFS protocol and MOUNTPROC_EXPORTALL is eliminated.
331 * Does no work. It is made available in all RPC services
332 * to allow server reponse testing and timing
335 MOUNTPROC_NULL(void) = 0;
338 * Mount a file system.
340 * If mountres.fhs_status is NFS_OK, then mountres.mountinfo
341 * contains the file handle for the directory and
342 * a list of acceptable authentication flavors. This file
343 * handle may only be used in version 3 of the NFS protocol.
344 * This procedure also results in the server adding a new
345 * entry to its mount list recording that this client has
346 * mounted the directory. Unix authentication or better
350 MOUNTPROC_MNT(dirpath) = 1;
353 * Returns the list of remotely mounted filesystems. The
354 * mountlist contains one entry for each hostname and
358 MOUNTPROC_DUMP(void) = 2;
361 * Removes the mount list entry for the directory
362 * Unix authentication or better is required.
365 MOUNTPROC_UMNT(dirpath) = 3;
368 * Removes all of the mount list entries for this client
369 * Unix authentication or better is required.
372 MOUNTPROC_UMNTALL(void) = 4;
375 * Returns a list of all the exported filesystems, and which
376 * machines are allowed to import each one.
379 MOUNTPROC_EXPORT(void) = 5;