4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 % * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 % * Use is subject to license terms.
26 %#pragma ident "%Z%%M% %I% %E% SMI"
29 %#include <sys/dirent.h>
30 %#include <sys/types.h>
31 %#include <sys/types32.h>
33 %#define xdr_dev_t xdr_u_int
34 %#define xdr_bool_t xdr_bool
37 * Autofs/automountd communication protocol.
40 const AUTOFS_MAXPATHLEN = 1024;
41 const AUTOFS_MAXCOMPONENTLEN = 255;
42 const AUTOFS_MAXOPTSLEN = 1024;
43 const AUTOFS_DAEMONCOOKIE = 100000;
47 * Automountd replies to autofs indicating whether the operation is done,
48 * or further action needs to be taken by autofs.
51 AUTOFS_ACTION=0, /* list of actions included */
52 AUTOFS_DONE=1 /* no further action required by kernel */
56 * Used by autofs to either create a link, or mount a new filesystem.
59 AUTOFS_MOUNT_RQ=0, /* mount request */
60 AUTOFS_LINK_RQ=1, /* link create */
61 AUTOFS_NONE=2 /* no action */
74 * Lookup/Mount request.
75 * Argument structure passed to both autofs_lookup() and autofs_mount().
77 * Query automountd if 'path/subdir/name' exists in 'map'
79 * Request automountd to mount the map entry associated with
80 * 'path/subdir/name' in 'map' given 'opts' options.
82 struct autofs_lookupargs {
83 string map<AUTOFS_MAXPATHLEN>; /* context or map name */
84 string path<AUTOFS_MAXPATHLEN>; /* mountpoint */
85 string name<AUTOFS_MAXCOMPONENTLEN>; /* entry we're looking for */
86 string subdir<AUTOFS_MAXPATHLEN>; /* subdir within map */
87 string opts<AUTOFS_MAXOPTSLEN>;
88 bool_t isdirect; /* direct mountpoint? */
89 uid_t uid; /* uid of caller */
93 * Symbolic link information.
96 string dir<AUTOFS_MAXPATHLEN>; /* original name */
97 string link<AUTOFS_MAXPATHLEN>; /* link (new) name */
101 * We don't define netbuf in RPCL, we include the header file that
102 * includes it, and implement the xdr function ourselves.
106 * Autofs Mount specific information - used to mount a new
110 struct netbuf addr; /* daemon address */
111 string path<AUTOFS_MAXPATHLEN>; /* autofs mountpoint */
112 string opts<AUTOFS_MAXOPTSLEN>; /* default mount options */
113 string map<AUTOFS_MAXPATHLEN>; /* name of map */
114 string subdir<AUTOFS_MAXPATHLEN>; /* subdir within map */
115 string key<AUTOFS_MAXCOMPONENTLEN>; /* used in direct mounts only */
116 int mount_to; /* time in sec the fs is to remain */
117 /* mounted after last reference */
118 int rpc_to; /* timeout for rpc calls */
119 int direct; /* 1 = direct mount */
124 % * This is an LP64 representation of the ILP32 autofs_args data structure
125 % * for use by autofs_mount which may receive the data structure "raw"
126 % * from a 32-bit program without being processed by XDR. rpcgen doesn't
127 % * need to see this structure since RPC/XDR only deals with the "native"
128 % * version of autofs_args. If this isn't hidden from rpcgen then it will
129 % * insist on generating unnecessary code to deal with it.
131 %struct autofs_args32 {
132 % struct netbuf32 addr; /* daemon address */
133 % caddr32_t path; /* autofs mountpoint */
134 % caddr32_t opts; /* default mount options */
135 % caddr32_t map; /* name of map */
136 % caddr32_t subdir; /* subdir within map */
137 % caddr32_t key; /* used in direct mounts */
138 % int32_t mount_to; /* time in sec the fs is to remain */
139 % /* mounted after last reference */
140 % int32_t rpc_to; /* timeout for rpc calls */
141 % int32_t direct; /* 1 = direct mount */
143 %#endif /* _SYSCALL32 */
146 * Contains the necessary information to notify autofs to
147 * perfom either a new mount or create a symbolic link.
149 union action_list_entry switch (autofs_action action) {
150 case AUTOFS_MOUNT_RQ:
151 struct mounta mounta;
159 * List of actions that need to be performed by autofs to
160 * finish the requested operation.
163 action_list_entry action;
167 union mount_result_type switch (autofs_stat status) {
177 * Result from mount operation.
179 struct autofs_mountres {
180 mount_result_type mr_type;
184 union lookup_result_type switch (autofs_action action) {
186 struct linka lt_linka;
187 case AUTOFS_MOUNT_RQ:
194 * Result from lookup operation.
196 struct autofs_lookupres {
197 enum autofs_res lu_res;
198 lookup_result_type lu_type;
203 * Unmount operation request
204 * Automountd will issue unmount system call for the
205 * given fstype on the given mntpnt.
209 bool_t isdirect; /* direct mount? */
210 string mntresource<AUTOFS_MAXPATHLEN>; /* mntpnt source */
211 string mntpnt<AUTOFS_MAXPATHLEN>; /* mntpnt to unmount */
212 string fstype<AUTOFS_MAXCOMPONENTLEN>; /* filesystem type to umount */
213 string mntopts<AUTOFS_MAXOPTSLEN>; /* mntpnt options */
214 struct umntrequest *next; /* next unmount */
218 * Unmount operation result
219 * status = 0 if unmount was successful,
220 * otherwise status = errno.
227 * AUTOFS readdir request
228 * Request list of entries in 'rda_map' map starting at the given
229 * offset 'rda_offset', for 'rda_count' bytes.
231 struct autofs_rddirargs {
232 string rda_map<AUTOFS_MAXPATHLEN>;
233 u_int rda_offset; /* starting offset */
234 u_int rda_count; /* total size requested */
235 uid_t uid; /* uid of caller */
239 u_int rddir_offset; /* last offset in list */
240 u_int rddir_size; /* size in bytes of entries */
241 bool_t rddir_eof; /* TRUE if last entry in result */
242 struct dirent64 *rddir_entries; /* variable number of entries */
246 * AUTOFS readdir result.
248 struct autofs_rddirres {
249 enum autofs_res rd_status;
250 u_int rd_bufsize; /* autofs request size (not xdr'ed) */
251 struct autofsrddir rd_rddir;