xref: /titanic_54/usr/src/cmd/fs.d/autofs/automount.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_AUTOMOUNT_H
28*7c478bd9Sstevel@tonic-gate #define	_AUTOMOUNT_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #include <fslib.h>		/* needed for mntlist_t declaration */
33*7c478bd9Sstevel@tonic-gate #include <thread.h>
34*7c478bd9Sstevel@tonic-gate #include <sys/mntent.h>		/*    "    "  MNTTYPE_* declarations */
35*7c478bd9Sstevel@tonic-gate #include <synch.h>		/* needed for mutex_t declaration */
36*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
37*7c478bd9Sstevel@tonic-gate #include <rpc/rpc.h>
38*7c478bd9Sstevel@tonic-gate #include <rpcsvc/autofs_prot.h>
39*7c478bd9Sstevel@tonic-gate #include <netinet/in.h>		/* needed for sockaddr_in declaration */
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate #ifdef MALLOC_DEBUG
42*7c478bd9Sstevel@tonic-gate #include <debug_alloc.h>
43*7c478bd9Sstevel@tonic-gate #endif
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
46*7c478bd9Sstevel@tonic-gate extern "C" {
47*7c478bd9Sstevel@tonic-gate #endif
48*7c478bd9Sstevel@tonic-gate 
49*7c478bd9Sstevel@tonic-gate #ifndef _REENTRANT
50*7c478bd9Sstevel@tonic-gate #define	fork1			vfork
51*7c478bd9Sstevel@tonic-gate #define	rpc_control(a, b)	1
52*7c478bd9Sstevel@tonic-gate #endif
53*7c478bd9Sstevel@tonic-gate 
54*7c478bd9Sstevel@tonic-gate 
55*7c478bd9Sstevel@tonic-gate /*
56*7c478bd9Sstevel@tonic-gate  * Solaris autofs configuration file location
57*7c478bd9Sstevel@tonic-gate  */
58*7c478bd9Sstevel@tonic-gate #define	AUTOFSADMIN	"/etc/default/autofs"
59*7c478bd9Sstevel@tonic-gate 
60*7c478bd9Sstevel@tonic-gate #define	MXHOSTNAMELEN	64
61*7c478bd9Sstevel@tonic-gate #define	MAXNETNAMELEN   255
62*7c478bd9Sstevel@tonic-gate #define	MAXFILENAMELEN  255
63*7c478bd9Sstevel@tonic-gate #define	LINESZ		4096
64*7c478bd9Sstevel@tonic-gate #define	MAXADDRLEN	128		/* max autofs address length */
65*7c478bd9Sstevel@tonic-gate #define	MAXOPTSLEN	1024
66*7c478bd9Sstevel@tonic-gate 
67*7c478bd9Sstevel@tonic-gate #define	AUTOFS_MOUNT_TIMEOUT	600	/* default min time mount will */
68*7c478bd9Sstevel@tonic-gate 					/* remain mounted (in seconds) */
69*7c478bd9Sstevel@tonic-gate #define	AUTOFS_RPC_TIMEOUT	60	/* secs autofs will wait for */
70*7c478bd9Sstevel@tonic-gate 					/* automountd's reply before */
71*7c478bd9Sstevel@tonic-gate 					/* retransmitting */
72*7c478bd9Sstevel@tonic-gate /* stack ops */
73*7c478bd9Sstevel@tonic-gate #define	ERASE		0
74*7c478bd9Sstevel@tonic-gate #define	PUSH		1
75*7c478bd9Sstevel@tonic-gate #define	POP		2
76*7c478bd9Sstevel@tonic-gate #define	INIT		3
77*7c478bd9Sstevel@tonic-gate #define	STACKSIZ	30
78*7c478bd9Sstevel@tonic-gate 
79*7c478bd9Sstevel@tonic-gate #define	DIST_SELF	1
80*7c478bd9Sstevel@tonic-gate #define	DIST_MYSUB	2
81*7c478bd9Sstevel@tonic-gate #define	DIST_MYNET	3
82*7c478bd9Sstevel@tonic-gate #define	DIST_OTHER	4
83*7c478bd9Sstevel@tonic-gate 
84*7c478bd9Sstevel@tonic-gate #define	MAXIFS		32
85*7c478bd9Sstevel@tonic-gate 
86*7c478bd9Sstevel@tonic-gate /*
87*7c478bd9Sstevel@tonic-gate  * Retry operation related definitions.
88*7c478bd9Sstevel@tonic-gate  */
89*7c478bd9Sstevel@tonic-gate #define	RET_OK		0
90*7c478bd9Sstevel@tonic-gate #define	RET_RETRY	32
91*7c478bd9Sstevel@tonic-gate #define	RET_ERR		33
92*7c478bd9Sstevel@tonic-gate #define	INITDELAY	5
93*7c478bd9Sstevel@tonic-gate #define	DELAY_BACKOFF	2
94*7c478bd9Sstevel@tonic-gate #define	MAXDELAY	120
95*7c478bd9Sstevel@tonic-gate #define	DELAY(delay) { \
96*7c478bd9Sstevel@tonic-gate 	(void) sleep(delay); \
97*7c478bd9Sstevel@tonic-gate 	delay *= DELAY_BACKOFF; \
98*7c478bd9Sstevel@tonic-gate 	if (delay > MAXDELAY) \
99*7c478bd9Sstevel@tonic-gate 		delay = MAXDELAY; \
100*7c478bd9Sstevel@tonic-gate }
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate struct mapline {
103*7c478bd9Sstevel@tonic-gate 	char linebuf[LINESZ];
104*7c478bd9Sstevel@tonic-gate 	char lineqbuf[LINESZ];
105*7c478bd9Sstevel@tonic-gate };
106*7c478bd9Sstevel@tonic-gate 
107*7c478bd9Sstevel@tonic-gate /*
108*7c478bd9Sstevel@tonic-gate  * Structure describing a host/filesystem/dir tuple in a NIS map entry
109*7c478bd9Sstevel@tonic-gate  */
110*7c478bd9Sstevel@tonic-gate struct mapfs {
111*7c478bd9Sstevel@tonic-gate 	struct mapfs *mfs_next;	/* next in entry */
112*7c478bd9Sstevel@tonic-gate 	int 	mfs_ignore;	/* ignore this entry */
113*7c478bd9Sstevel@tonic-gate 	char	*mfs_host;	/* host name */
114*7c478bd9Sstevel@tonic-gate 	char	*mfs_dir;	/* dir to mount */
115*7c478bd9Sstevel@tonic-gate 	int	mfs_penalty;	/* mount penalty for this host */
116*7c478bd9Sstevel@tonic-gate 	int	mfs_distance;	/* distance hint */
117*7c478bd9Sstevel@tonic-gate 	struct nfs_args *mfs_args;	/* nfs_args */
118*7c478bd9Sstevel@tonic-gate 	struct netconfig *mfs_nconf;
119*7c478bd9Sstevel@tonic-gate 	rpcvers_t	mfs_version;	/* NFS version */
120*7c478bd9Sstevel@tonic-gate 
121*7c478bd9Sstevel@tonic-gate #define	MFS_ALLOC_DIR		0x1	/* mfs_dir now points to different */
122*7c478bd9Sstevel@tonic-gate 					/* buffer */
123*7c478bd9Sstevel@tonic-gate 
124*7c478bd9Sstevel@tonic-gate #define	MFS_URL			0x2	/* is NFS url listed in this tuple. */
125*7c478bd9Sstevel@tonic-gate #define	MFS_FH_VIA_WEBNFS	0x4	/* got file handle during ping phase */
126*7c478bd9Sstevel@tonic-gate 
127*7c478bd9Sstevel@tonic-gate 	uint_t	mfs_flags;
128*7c478bd9Sstevel@tonic-gate 	uint_t	mfs_port;	/* port# in NFS url */
129*7c478bd9Sstevel@tonic-gate };
130*7c478bd9Sstevel@tonic-gate 
131*7c478bd9Sstevel@tonic-gate /*
132*7c478bd9Sstevel@tonic-gate  * NIS entry - lookup of name in DIR gets us this
133*7c478bd9Sstevel@tonic-gate  */
134*7c478bd9Sstevel@tonic-gate struct mapent {
135*7c478bd9Sstevel@tonic-gate 	char	*map_fstype;	/* file system type e.g. "nfs" */
136*7c478bd9Sstevel@tonic-gate 	char	*map_mounter;	/* base fs e.g. "cachefs" */
137*7c478bd9Sstevel@tonic-gate 	char	*map_root;	/* path to mount root */
138*7c478bd9Sstevel@tonic-gate 	char	*map_mntpnt;	/* path from mount root */
139*7c478bd9Sstevel@tonic-gate 	char	*map_mntopts;	/* mount options */
140*7c478bd9Sstevel@tonic-gate 	char    *map_fsw;	/* mount fs information */
141*7c478bd9Sstevel@tonic-gate 	char    *map_fswq;	/* quoted mountfs information */
142*7c478bd9Sstevel@tonic-gate 	int	map_mntlevel;	/* mapentry hierarchy level */
143*7c478bd9Sstevel@tonic-gate 	bool_t	map_modified;	/* flags modified mapentries */
144*7c478bd9Sstevel@tonic-gate 	bool_t	map_faked;	/* flags faked mapentries */
145*7c478bd9Sstevel@tonic-gate 	int	map_err;	/* flags any bad entries in the map */
146*7c478bd9Sstevel@tonic-gate 	struct mapfs *map_fs;	/* list of replicas for nfs */
147*7c478bd9Sstevel@tonic-gate 	struct mapent *map_next;
148*7c478bd9Sstevel@tonic-gate };
149*7c478bd9Sstevel@tonic-gate 
150*7c478bd9Sstevel@tonic-gate 
151*7c478bd9Sstevel@tonic-gate /*
152*7c478bd9Sstevel@tonic-gate  * Descriptor for each directory served by the automounter
153*7c478bd9Sstevel@tonic-gate  */
154*7c478bd9Sstevel@tonic-gate struct autodir {
155*7c478bd9Sstevel@tonic-gate 	char	*dir_name;		/* mount point */
156*7c478bd9Sstevel@tonic-gate 	char	*dir_map;		/* name of map for dir */
157*7c478bd9Sstevel@tonic-gate 	char	*dir_opts;		/* default mount options */
158*7c478bd9Sstevel@tonic-gate 	int 	dir_direct;		/* direct mountpoint ? */
159*7c478bd9Sstevel@tonic-gate 	int 	dir_remount;		/* a remount */
160*7c478bd9Sstevel@tonic-gate 	struct autodir *dir_next;	/* next entry */
161*7c478bd9Sstevel@tonic-gate 	struct autodir *dir_prev;	/* prev entry */
162*7c478bd9Sstevel@tonic-gate };
163*7c478bd9Sstevel@tonic-gate 
164*7c478bd9Sstevel@tonic-gate /*
165*7c478bd9Sstevel@tonic-gate  * This structure is used to build an array of
166*7c478bd9Sstevel@tonic-gate  * hostnames with associated penalties to be
167*7c478bd9Sstevel@tonic-gate  * passed to the nfs_cast procedure
168*7c478bd9Sstevel@tonic-gate  */
169*7c478bd9Sstevel@tonic-gate struct host_names {
170*7c478bd9Sstevel@tonic-gate 	char *host;
171*7c478bd9Sstevel@tonic-gate 	int  penalty;
172*7c478bd9Sstevel@tonic-gate };
173*7c478bd9Sstevel@tonic-gate 
174*7c478bd9Sstevel@tonic-gate /*
175*7c478bd9Sstevel@tonic-gate  * structure used to build list of contents for a map on
176*7c478bd9Sstevel@tonic-gate  * a readdir request
177*7c478bd9Sstevel@tonic-gate  */
178*7c478bd9Sstevel@tonic-gate struct dir_entry {
179*7c478bd9Sstevel@tonic-gate 	char		*name;		/* name of entry */
180*7c478bd9Sstevel@tonic-gate 	ino_t		nodeid;
181*7c478bd9Sstevel@tonic-gate 	off_t		offset;
182*7c478bd9Sstevel@tonic-gate 	struct dir_entry *next;
183*7c478bd9Sstevel@tonic-gate 	struct dir_entry *left;		/* left element in binary tree */
184*7c478bd9Sstevel@tonic-gate 	struct dir_entry *right;	/* right element in binary tree */
185*7c478bd9Sstevel@tonic-gate };
186*7c478bd9Sstevel@tonic-gate 
187*7c478bd9Sstevel@tonic-gate /*
188*7c478bd9Sstevel@tonic-gate  * offset index table
189*7c478bd9Sstevel@tonic-gate  */
190*7c478bd9Sstevel@tonic-gate struct off_tbl {
191*7c478bd9Sstevel@tonic-gate 	off_t			offset;
192*7c478bd9Sstevel@tonic-gate 	struct dir_entry	*first;
193*7c478bd9Sstevel@tonic-gate 	struct off_tbl		*next;
194*7c478bd9Sstevel@tonic-gate };
195*7c478bd9Sstevel@tonic-gate 
196*7c478bd9Sstevel@tonic-gate #ifndef NO_RDDIR_CACHE
197*7c478bd9Sstevel@tonic-gate /*
198*7c478bd9Sstevel@tonic-gate  * directory cache for 'map'
199*7c478bd9Sstevel@tonic-gate  */
200*7c478bd9Sstevel@tonic-gate struct rddir_cache {
201*7c478bd9Sstevel@tonic-gate 	char			*map;
202*7c478bd9Sstevel@tonic-gate 	struct off_tbl		*offtp;
203*7c478bd9Sstevel@tonic-gate 	ulong_t			bucket_size;
204*7c478bd9Sstevel@tonic-gate 	time_t			ttl;
205*7c478bd9Sstevel@tonic-gate 	struct dir_entry	*entp;
206*7c478bd9Sstevel@tonic-gate 	mutex_t			lock;		/* protects 'in_use' field */
207*7c478bd9Sstevel@tonic-gate 	int			in_use;		/* # threads referencing it */
208*7c478bd9Sstevel@tonic-gate 	rwlock_t		rwlock;		/* protects 'full' and 'next' */
209*7c478bd9Sstevel@tonic-gate 	int			full;		/* full == 1 when cache full */
210*7c478bd9Sstevel@tonic-gate 	struct rddir_cache	*next;
211*7c478bd9Sstevel@tonic-gate };
212*7c478bd9Sstevel@tonic-gate 
213*7c478bd9Sstevel@tonic-gate #define	RDDIR_CACHE_TIME	300		/* in seconds */
214*7c478bd9Sstevel@tonic-gate 
215*7c478bd9Sstevel@tonic-gate #endif /* NO_RDDIR_CACHE */
216*7c478bd9Sstevel@tonic-gate 
217*7c478bd9Sstevel@tonic-gate /*
218*7c478bd9Sstevel@tonic-gate  * structure used to maintain address list for localhost
219*7c478bd9Sstevel@tonic-gate  */
220*7c478bd9Sstevel@tonic-gate 
221*7c478bd9Sstevel@tonic-gate struct myaddrs {
222*7c478bd9Sstevel@tonic-gate 	struct sockaddr_in sin;
223*7c478bd9Sstevel@tonic-gate 	struct myaddrs *myaddrs_next;
224*7c478bd9Sstevel@tonic-gate };
225*7c478bd9Sstevel@tonic-gate 
226*7c478bd9Sstevel@tonic-gate extern time_t timenow;	/* set at start of processing of each RPC call */
227*7c478bd9Sstevel@tonic-gate extern char self[];
228*7c478bd9Sstevel@tonic-gate extern int verbose;
229*7c478bd9Sstevel@tonic-gate extern int trace;
230*7c478bd9Sstevel@tonic-gate extern int automountd_nobrowse;
231*7c478bd9Sstevel@tonic-gate extern int sys_nerr;
232*7c478bd9Sstevel@tonic-gate extern char *sys_errlist[];
233*7c478bd9Sstevel@tonic-gate extern struct autodir *dir_head;
234*7c478bd9Sstevel@tonic-gate extern struct autodir *dir_tail;
235*7c478bd9Sstevel@tonic-gate extern struct mntlist *current_mounts;
236*7c478bd9Sstevel@tonic-gate extern struct autofs_args;
237*7c478bd9Sstevel@tonic-gate extern struct mounta;			/* defined in sys/vfs.h */
238*7c478bd9Sstevel@tonic-gate extern struct myaddrs *myaddrs_head;
239*7c478bd9Sstevel@tonic-gate 
240*7c478bd9Sstevel@tonic-gate extern rwlock_t	cache_lock;
241*7c478bd9Sstevel@tonic-gate extern rwlock_t portmap_cache_lock;
242*7c478bd9Sstevel@tonic-gate extern rwlock_t rddir_cache_lock;
243*7c478bd9Sstevel@tonic-gate 
244*7c478bd9Sstevel@tonic-gate extern mutex_t cleanup_lock;
245*7c478bd9Sstevel@tonic-gate extern cond_t cleanup_start_cv;
246*7c478bd9Sstevel@tonic-gate extern cond_t cleanup_done_cv;
247*7c478bd9Sstevel@tonic-gate 
248*7c478bd9Sstevel@tonic-gate /*
249*7c478bd9Sstevel@tonic-gate  * mnttab handling routines
250*7c478bd9Sstevel@tonic-gate  */
251*7c478bd9Sstevel@tonic-gate extern void free_mapent(struct mapent *);
252*7c478bd9Sstevel@tonic-gate extern struct mntlist *getmntlist(void);
253*7c478bd9Sstevel@tonic-gate extern dev_t get_devid(struct extmnttab *);
254*7c478bd9Sstevel@tonic-gate 
255*7c478bd9Sstevel@tonic-gate /*
256*7c478bd9Sstevel@tonic-gate  * utilities
257*7c478bd9Sstevel@tonic-gate  */
258*7c478bd9Sstevel@tonic-gate extern struct mapent *parse_entry(char *, char *, char *, struct mapline *,
259*7c478bd9Sstevel@tonic-gate 				char *, uint_t, bool_t);
260*7c478bd9Sstevel@tonic-gate extern int macro_expand(char *, char *, char *, int);
261*7c478bd9Sstevel@tonic-gate extern void unquote(char *, char *);
262*7c478bd9Sstevel@tonic-gate extern void trim(char *);
263*7c478bd9Sstevel@tonic-gate extern char *get_line(FILE *, char *, char *, int);
264*7c478bd9Sstevel@tonic-gate extern int getword(char *, char *, char **, char **, char, int);
265*7c478bd9Sstevel@tonic-gate extern int get_retry(char *);
266*7c478bd9Sstevel@tonic-gate extern int str_opt(struct mnttab *, char *, char **);
267*7c478bd9Sstevel@tonic-gate extern void dirinit(char *, char *, char *, int, char **, char ***);
268*7c478bd9Sstevel@tonic-gate extern void pr_msg(const char *, ...);
269*7c478bd9Sstevel@tonic-gate extern void trace_prt(int, char *, ...);
270*7c478bd9Sstevel@tonic-gate extern void free_autofs_args(struct autofs_args *);
271*7c478bd9Sstevel@tonic-gate extern void free_mounta(struct mounta *);
272*7c478bd9Sstevel@tonic-gate 
273*7c478bd9Sstevel@tonic-gate extern int nopt(struct mnttab *, char *, int *);
274*7c478bd9Sstevel@tonic-gate extern int set_versrange(rpcvers_t, rpcvers_t *, rpcvers_t *);
275*7c478bd9Sstevel@tonic-gate extern enum clnt_stat pingnfs(char *, int, rpcvers_t *, rpcvers_t,
276*7c478bd9Sstevel@tonic-gate 	ushort_t, bool_t, char *, char *);
277*7c478bd9Sstevel@tonic-gate 
278*7c478bd9Sstevel@tonic-gate extern int self_check(char *);
279*7c478bd9Sstevel@tonic-gate extern int do_mount1(char *, char *, char *, char *, char *, uint_t,
280*7c478bd9Sstevel@tonic-gate 	action_list **, struct authunix_parms *);
281*7c478bd9Sstevel@tonic-gate extern int do_lookup1(char *, char *, char *, char *, char *, uint_t,
282*7c478bd9Sstevel@tonic-gate 	enum autofs_action *, struct linka *, struct authunix_parms *);
283*7c478bd9Sstevel@tonic-gate extern int do_unmount1(umntrequest *);
284*7c478bd9Sstevel@tonic-gate extern int do_readdir(struct autofs_rddirargs *, struct autofs_rddirres *,
285*7c478bd9Sstevel@tonic-gate 	struct authunix_parms *);
286*7c478bd9Sstevel@tonic-gate extern int nfsunmount(struct mnttab *);
287*7c478bd9Sstevel@tonic-gate extern int loopbackmount(char *, char *, char *, int);
288*7c478bd9Sstevel@tonic-gate extern int mount_nfs(struct mapent *, char *, char *, int,
289*7c478bd9Sstevel@tonic-gate 	struct authunix_parms *);
290*7c478bd9Sstevel@tonic-gate extern int mount_autofs(struct mapent *, char *, action_list *,
291*7c478bd9Sstevel@tonic-gate 	char *root, char *subdir, char *key);
292*7c478bd9Sstevel@tonic-gate extern int mount_generic(char *, char *, char *, char *, int);
293*7c478bd9Sstevel@tonic-gate extern enum clnt_stat nfs_cast(struct mapfs *, struct mapfs **, int);
294*7c478bd9Sstevel@tonic-gate extern int svc_create_local_service(void (*) (), ulong_t, ulong_t,
295*7c478bd9Sstevel@tonic-gate 	char *, char *);
296*7c478bd9Sstevel@tonic-gate 
297*7c478bd9Sstevel@tonic-gate extern bool_t hasrestrictopt(char *);
298*7c478bd9Sstevel@tonic-gate 
299*7c478bd9Sstevel@tonic-gate #ifndef NO_RDDIR_CACHE
300*7c478bd9Sstevel@tonic-gate /*
301*7c478bd9Sstevel@tonic-gate  * readdir handling routines
302*7c478bd9Sstevel@tonic-gate  */
303*7c478bd9Sstevel@tonic-gate extern char *auto_rddir_malloc(unsigned);
304*7c478bd9Sstevel@tonic-gate extern char *auto_rddir_strdup(const char *);
305*7c478bd9Sstevel@tonic-gate extern struct dir_entry *btree_lookup(struct dir_entry *, char *);
306*7c478bd9Sstevel@tonic-gate extern void btree_enter(struct dir_entry **, struct dir_entry *);
307*7c478bd9Sstevel@tonic-gate extern int add_dir_entry(char *, struct dir_entry **, struct dir_entry **);
308*7c478bd9Sstevel@tonic-gate extern void cache_cleanup(void);
309*7c478bd9Sstevel@tonic-gate extern int rddir_cache_lookup(char *, struct rddir_cache **);
310*7c478bd9Sstevel@tonic-gate extern struct dir_entry *rddir_entry_lookup(char *, struct dir_entry *);
311*7c478bd9Sstevel@tonic-gate #endif /* NO_RDDIR_CACHE */
312*7c478bd9Sstevel@tonic-gate 
313*7c478bd9Sstevel@tonic-gate /*
314*7c478bd9Sstevel@tonic-gate  * generic interface to specific name service functions
315*7c478bd9Sstevel@tonic-gate  */
316*7c478bd9Sstevel@tonic-gate extern void ns_setup(char **, char ***);
317*7c478bd9Sstevel@tonic-gate extern int getmapent(char *, char *, struct mapline *, char **, char ***,
318*7c478bd9Sstevel@tonic-gate 			bool_t *, bool_t);
319*7c478bd9Sstevel@tonic-gate extern int getmapkeys(char *, struct dir_entry **, int *, int *, char **,
320*7c478bd9Sstevel@tonic-gate 			char ***, uid_t);
321*7c478bd9Sstevel@tonic-gate extern int loadmaster_map(char *, char *, char **, char ***);
322*7c478bd9Sstevel@tonic-gate extern int loaddirect_map(char *, char *, char *, char **, char ***);
323*7c478bd9Sstevel@tonic-gate 
324*7c478bd9Sstevel@tonic-gate /*
325*7c478bd9Sstevel@tonic-gate  * these name service specific functions should not be
326*7c478bd9Sstevel@tonic-gate  * accessed directly, use the generic functions.
327*7c478bd9Sstevel@tonic-gate  */
328*7c478bd9Sstevel@tonic-gate extern void init_files(char **, char ***);
329*7c478bd9Sstevel@tonic-gate extern int getmapent_files(char *, char *, struct mapline *, char **, char ***,
330*7c478bd9Sstevel@tonic-gate 				bool_t *, bool_t);
331*7c478bd9Sstevel@tonic-gate extern int loadmaster_files(char *, char *, char **, char ***);
332*7c478bd9Sstevel@tonic-gate extern int loaddirect_files(char *, char *, char *, char **, char ***);
333*7c478bd9Sstevel@tonic-gate extern int getmapkeys_files(char *, struct dir_entry **, int *, int *,
334*7c478bd9Sstevel@tonic-gate 	char **, char ***);
335*7c478bd9Sstevel@tonic-gate extern int stack_op(int, char *, char **, char ***);
336*7c478bd9Sstevel@tonic-gate 
337*7c478bd9Sstevel@tonic-gate extern void init_nisplus(char **, char ***);
338*7c478bd9Sstevel@tonic-gate extern int getmapent_nisplus(char *, char *, struct mapline *, char **,
339*7c478bd9Sstevel@tonic-gate 				char ***, bool_t *, bool_t);
340*7c478bd9Sstevel@tonic-gate extern int loadmaster_nisplus(char *, char *, char **, char ***);
341*7c478bd9Sstevel@tonic-gate extern int loaddirect_nisplus(char *, char *, char *, char **, char ***);
342*7c478bd9Sstevel@tonic-gate extern int getmapkeys_nisplus(char *, struct dir_entry **, int *, int *,
343*7c478bd9Sstevel@tonic-gate 	char **, char ***);
344*7c478bd9Sstevel@tonic-gate 
345*7c478bd9Sstevel@tonic-gate extern void init_nis(char **, char ***);
346*7c478bd9Sstevel@tonic-gate extern int getmapent_nis(char *, char *, struct mapline *, char **, char ***,
347*7c478bd9Sstevel@tonic-gate 				bool_t *, bool_t);
348*7c478bd9Sstevel@tonic-gate extern int loadmaster_nis(char *, char *, char **, char ***);
349*7c478bd9Sstevel@tonic-gate extern int loaddirect_nis(char *, char *, char *, char **, char ***);
350*7c478bd9Sstevel@tonic-gate extern int getmapkeys_nis(char *, struct dir_entry **, int *, int *,
351*7c478bd9Sstevel@tonic-gate 	char **, char ***);
352*7c478bd9Sstevel@tonic-gate 
353*7c478bd9Sstevel@tonic-gate extern void init_ldap(char **, char ***);
354*7c478bd9Sstevel@tonic-gate extern int getmapent_ldap(char *, char *, struct mapline *, char **, char ***,
355*7c478bd9Sstevel@tonic-gate 				bool_t *, bool_t);
356*7c478bd9Sstevel@tonic-gate extern int loadmaster_ldap(char *, char *, char **, char ***);
357*7c478bd9Sstevel@tonic-gate extern int loaddirect_ldap(char *, char *, char *, char **, char ***);
358*7c478bd9Sstevel@tonic-gate extern int getmapkeys_ldap(char *, struct dir_entry **, int *, int *,
359*7c478bd9Sstevel@tonic-gate 	char **, char ***);
360*7c478bd9Sstevel@tonic-gate 
361*7c478bd9Sstevel@tonic-gate 
362*7c478bd9Sstevel@tonic-gate /*
363*7c478bd9Sstevel@tonic-gate  * end of name service specific functions
364*7c478bd9Sstevel@tonic-gate  */
365*7c478bd9Sstevel@tonic-gate 
366*7c478bd9Sstevel@tonic-gate /*
367*7c478bd9Sstevel@tonic-gate  * not defined in any header file
368*7c478bd9Sstevel@tonic-gate  */
369*7c478bd9Sstevel@tonic-gate extern bool_t xdr_uid_t(XDR *, uid_t *);
370*7c478bd9Sstevel@tonic-gate extern int __clnt_bindresvport(CLIENT *);
371*7c478bd9Sstevel@tonic-gate extern int getnetmaskbynet(const struct in_addr, struct in_addr *);
372*7c478bd9Sstevel@tonic-gate 
373*7c478bd9Sstevel@tonic-gate /*
374*7c478bd9Sstevel@tonic-gate  * Hidden rpc functions
375*7c478bd9Sstevel@tonic-gate  */
376*7c478bd9Sstevel@tonic-gate extern int __nis_reset_state();
377*7c478bd9Sstevel@tonic-gate extern int __rpc_negotiate_uid(int);
378*7c478bd9Sstevel@tonic-gate extern int __rpc_get_local_uid(SVCXPRT *, uid_t *);
379*7c478bd9Sstevel@tonic-gate 
380*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
381*7c478bd9Sstevel@tonic-gate }
382*7c478bd9Sstevel@tonic-gate #endif
383*7c478bd9Sstevel@tonic-gate 
384*7c478bd9Sstevel@tonic-gate #endif	/* _AUTOMOUNT_H */
385