xref: /titanic_54/usr/src/cmd/fs.d/autofs/automount.h (revision 8548bf79039833dba8615afdf63258b2cb122121)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
539d3e169Sevanl  * Common Development and Distribution License (the "License").
639d3e169Sevanl  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
223bfb48feSsemery  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_AUTOMOUNT_H
277c478bd9Sstevel@tonic-gate #define	_AUTOMOUNT_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #include <fslib.h>		/* needed for mntlist_t declaration */
327c478bd9Sstevel@tonic-gate #include <thread.h>
337c478bd9Sstevel@tonic-gate #include <sys/mntent.h>		/*    "    "  MNTTYPE_* declarations */
347c478bd9Sstevel@tonic-gate #include <synch.h>		/* needed for mutex_t declaration */
357c478bd9Sstevel@tonic-gate #include <sys/types.h>
367c478bd9Sstevel@tonic-gate #include <rpc/rpc.h>
3739d3e169Sevanl #include <sys/fs/autofs.h>
387c478bd9Sstevel@tonic-gate #include <netinet/in.h>		/* needed for sockaddr_in declaration */
39*8548bf79Snr123932 #include <door.h>
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #ifdef MALLOC_DEBUG
427c478bd9Sstevel@tonic-gate #include <debug_alloc.h>
437c478bd9Sstevel@tonic-gate #endif
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate #ifdef __cplusplus
467c478bd9Sstevel@tonic-gate extern "C" {
477c478bd9Sstevel@tonic-gate #endif
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate #ifndef _REENTRANT
507c478bd9Sstevel@tonic-gate #define	fork1			vfork
517c478bd9Sstevel@tonic-gate #define	rpc_control(a, b)	1
527c478bd9Sstevel@tonic-gate #endif
537c478bd9Sstevel@tonic-gate 
5439d3e169Sevanl #define	DOMOUNT_USER	1
5539d3e169Sevanl #define	DOMOUNT_KERNEL	2
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate /*
587c478bd9Sstevel@tonic-gate  * Solaris autofs configuration file location
597c478bd9Sstevel@tonic-gate  */
607c478bd9Sstevel@tonic-gate #define	AUTOFSADMIN	"/etc/default/autofs"
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate #define	MXHOSTNAMELEN	64
637c478bd9Sstevel@tonic-gate #define	MAXNETNAMELEN   255
647c478bd9Sstevel@tonic-gate #define	MAXFILENAMELEN  255
657c478bd9Sstevel@tonic-gate #define	LINESZ		4096
667c478bd9Sstevel@tonic-gate #define	MAXADDRLEN	128		/* max autofs address length */
677c478bd9Sstevel@tonic-gate #define	MAXOPTSLEN	1024
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate #define	AUTOFS_MOUNT_TIMEOUT	600	/* default min time mount will */
707c478bd9Sstevel@tonic-gate 					/* remain mounted (in seconds) */
717c478bd9Sstevel@tonic-gate #define	AUTOFS_RPC_TIMEOUT	60	/* secs autofs will wait for */
727c478bd9Sstevel@tonic-gate 					/* automountd's reply before */
737c478bd9Sstevel@tonic-gate 					/* retransmitting */
747c478bd9Sstevel@tonic-gate /* stack ops */
757c478bd9Sstevel@tonic-gate #define	ERASE		0
767c478bd9Sstevel@tonic-gate #define	PUSH		1
777c478bd9Sstevel@tonic-gate #define	POP		2
787c478bd9Sstevel@tonic-gate #define	INIT		3
797c478bd9Sstevel@tonic-gate #define	STACKSIZ	30
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate #define	DIST_SELF	1
827c478bd9Sstevel@tonic-gate #define	DIST_MYSUB	2
837c478bd9Sstevel@tonic-gate #define	DIST_MYNET	3
847c478bd9Sstevel@tonic-gate #define	DIST_OTHER	4
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate #define	MAXIFS		32
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate /*
897c478bd9Sstevel@tonic-gate  * Retry operation related definitions.
907c478bd9Sstevel@tonic-gate  */
917c478bd9Sstevel@tonic-gate #define	RET_OK		0
927c478bd9Sstevel@tonic-gate #define	RET_RETRY	32
937c478bd9Sstevel@tonic-gate #define	RET_ERR		33
947c478bd9Sstevel@tonic-gate #define	INITDELAY	5
957c478bd9Sstevel@tonic-gate #define	DELAY_BACKOFF	2
967c478bd9Sstevel@tonic-gate #define	MAXDELAY	120
97*8548bf79Snr123932 #define	ARGV_MAX	16
98*8548bf79Snr123932 #define	VFS_PATH	"/usr/lib/fs"
997c478bd9Sstevel@tonic-gate #define	DELAY(delay) { \
1007c478bd9Sstevel@tonic-gate 	(void) sleep(delay); \
1017c478bd9Sstevel@tonic-gate 	delay *= DELAY_BACKOFF; \
1027c478bd9Sstevel@tonic-gate 	if (delay > MAXDELAY) \
1037c478bd9Sstevel@tonic-gate 		delay = MAXDELAY; \
1047c478bd9Sstevel@tonic-gate }
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate struct mapline {
1077c478bd9Sstevel@tonic-gate 	char linebuf[LINESZ];
1087c478bd9Sstevel@tonic-gate 	char lineqbuf[LINESZ];
1097c478bd9Sstevel@tonic-gate };
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate /*
1127c478bd9Sstevel@tonic-gate  * Structure describing a host/filesystem/dir tuple in a NIS map entry
1137c478bd9Sstevel@tonic-gate  */
1147c478bd9Sstevel@tonic-gate struct mapfs {
1157c478bd9Sstevel@tonic-gate 	struct mapfs *mfs_next;	/* next in entry */
1167c478bd9Sstevel@tonic-gate 	int 	mfs_ignore;	/* ignore this entry */
1177c478bd9Sstevel@tonic-gate 	char	*mfs_host;	/* host name */
1187c478bd9Sstevel@tonic-gate 	char	*mfs_dir;	/* dir to mount */
1197c478bd9Sstevel@tonic-gate 	int	mfs_penalty;	/* mount penalty for this host */
1207c478bd9Sstevel@tonic-gate 	int	mfs_distance;	/* distance hint */
1217c478bd9Sstevel@tonic-gate 	struct nfs_args *mfs_args;	/* nfs_args */
1227c478bd9Sstevel@tonic-gate 	struct netconfig *mfs_nconf;
1237c478bd9Sstevel@tonic-gate 	rpcvers_t	mfs_version;	/* NFS version */
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate #define	MFS_ALLOC_DIR		0x1	/* mfs_dir now points to different */
1267c478bd9Sstevel@tonic-gate 					/* buffer */
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate #define	MFS_URL			0x2	/* is NFS url listed in this tuple. */
1297c478bd9Sstevel@tonic-gate #define	MFS_FH_VIA_WEBNFS	0x4	/* got file handle during ping phase */
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate 	uint_t	mfs_flags;
1327c478bd9Sstevel@tonic-gate 	uint_t	mfs_port;	/* port# in NFS url */
1337c478bd9Sstevel@tonic-gate };
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate /*
1367c478bd9Sstevel@tonic-gate  * NIS entry - lookup of name in DIR gets us this
1377c478bd9Sstevel@tonic-gate  */
1387c478bd9Sstevel@tonic-gate struct mapent {
1397c478bd9Sstevel@tonic-gate 	char	*map_fstype;	/* file system type e.g. "nfs" */
1407c478bd9Sstevel@tonic-gate 	char	*map_mounter;	/* base fs e.g. "cachefs" */
1417c478bd9Sstevel@tonic-gate 	char	*map_root;	/* path to mount root */
1427c478bd9Sstevel@tonic-gate 	char	*map_mntpnt;	/* path from mount root */
1437c478bd9Sstevel@tonic-gate 	char	*map_mntopts;	/* mount options */
1447c478bd9Sstevel@tonic-gate 	char    *map_fsw;	/* mount fs information */
1457c478bd9Sstevel@tonic-gate 	char    *map_fswq;	/* quoted mountfs information */
1467c478bd9Sstevel@tonic-gate 	int	map_mntlevel;	/* mapentry hierarchy level */
1477c478bd9Sstevel@tonic-gate 	bool_t	map_modified;	/* flags modified mapentries */
1487c478bd9Sstevel@tonic-gate 	bool_t	map_faked;	/* flags faked mapentries */
1497c478bd9Sstevel@tonic-gate 	int	map_err;	/* flags any bad entries in the map */
1507c478bd9Sstevel@tonic-gate 	struct mapfs *map_fs;	/* list of replicas for nfs */
1517c478bd9Sstevel@tonic-gate 	struct mapent *map_next;
1527c478bd9Sstevel@tonic-gate };
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate 
1557c478bd9Sstevel@tonic-gate /*
1567c478bd9Sstevel@tonic-gate  * Descriptor for each directory served by the automounter
1577c478bd9Sstevel@tonic-gate  */
1587c478bd9Sstevel@tonic-gate struct autodir {
1597c478bd9Sstevel@tonic-gate 	char	*dir_name;		/* mount point */
1607c478bd9Sstevel@tonic-gate 	char	*dir_map;		/* name of map for dir */
1617c478bd9Sstevel@tonic-gate 	char	*dir_opts;		/* default mount options */
1627c478bd9Sstevel@tonic-gate 	int 	dir_direct;		/* direct mountpoint ? */
1637c478bd9Sstevel@tonic-gate 	int 	dir_remount;		/* a remount */
1647c478bd9Sstevel@tonic-gate 	struct autodir *dir_next;	/* next entry */
1657c478bd9Sstevel@tonic-gate 	struct autodir *dir_prev;	/* prev entry */
1667c478bd9Sstevel@tonic-gate };
1677c478bd9Sstevel@tonic-gate 
1687c478bd9Sstevel@tonic-gate /*
1697c478bd9Sstevel@tonic-gate  * This structure is used to build an array of
1707c478bd9Sstevel@tonic-gate  * hostnames with associated penalties to be
1717c478bd9Sstevel@tonic-gate  * passed to the nfs_cast procedure
1727c478bd9Sstevel@tonic-gate  */
1737c478bd9Sstevel@tonic-gate struct host_names {
1747c478bd9Sstevel@tonic-gate 	char *host;
1757c478bd9Sstevel@tonic-gate 	int  penalty;
1767c478bd9Sstevel@tonic-gate };
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate /*
1797c478bd9Sstevel@tonic-gate  * structure used to build list of contents for a map on
1807c478bd9Sstevel@tonic-gate  * a readdir request
1817c478bd9Sstevel@tonic-gate  */
1827c478bd9Sstevel@tonic-gate struct dir_entry {
1837c478bd9Sstevel@tonic-gate 	char		*name;		/* name of entry */
1847c478bd9Sstevel@tonic-gate 	ino_t		nodeid;
1857c478bd9Sstevel@tonic-gate 	off_t		offset;
1867c478bd9Sstevel@tonic-gate 	struct dir_entry *next;
1877c478bd9Sstevel@tonic-gate 	struct dir_entry *left;		/* left element in binary tree */
1887c478bd9Sstevel@tonic-gate 	struct dir_entry *right;	/* right element in binary tree */
1897c478bd9Sstevel@tonic-gate };
1907c478bd9Sstevel@tonic-gate 
1917c478bd9Sstevel@tonic-gate /*
1927c478bd9Sstevel@tonic-gate  * offset index table
1937c478bd9Sstevel@tonic-gate  */
1947c478bd9Sstevel@tonic-gate struct off_tbl {
1957c478bd9Sstevel@tonic-gate 	off_t			offset;
1967c478bd9Sstevel@tonic-gate 	struct dir_entry	*first;
1977c478bd9Sstevel@tonic-gate 	struct off_tbl		*next;
1987c478bd9Sstevel@tonic-gate };
1997c478bd9Sstevel@tonic-gate 
2007c478bd9Sstevel@tonic-gate #ifndef NO_RDDIR_CACHE
2017c478bd9Sstevel@tonic-gate /*
2027c478bd9Sstevel@tonic-gate  * directory cache for 'map'
2037c478bd9Sstevel@tonic-gate  */
20439d3e169Sevanl struct autofs_rddir_cache {
2057c478bd9Sstevel@tonic-gate 	char			*map;
2067c478bd9Sstevel@tonic-gate 	struct off_tbl		*offtp;
2077c478bd9Sstevel@tonic-gate 	ulong_t			bucket_size;
2087c478bd9Sstevel@tonic-gate 	time_t			ttl;
2097c478bd9Sstevel@tonic-gate 	struct dir_entry	*entp;
2107c478bd9Sstevel@tonic-gate 	mutex_t			lock;		/* protects 'in_use' field */
2117c478bd9Sstevel@tonic-gate 	int			in_use;		/* # threads referencing it */
2127c478bd9Sstevel@tonic-gate 	rwlock_t		rwlock;		/* protects 'full' and 'next' */
2137c478bd9Sstevel@tonic-gate 	int			full;		/* full == 1 when cache full */
21439d3e169Sevanl 	struct autofs_rddir_cache	*next;
2157c478bd9Sstevel@tonic-gate };
2167c478bd9Sstevel@tonic-gate 
2177c478bd9Sstevel@tonic-gate #define	RDDIR_CACHE_TIME	300		/* in seconds */
2187c478bd9Sstevel@tonic-gate 
2197c478bd9Sstevel@tonic-gate #endif /* NO_RDDIR_CACHE */
2207c478bd9Sstevel@tonic-gate 
2217c478bd9Sstevel@tonic-gate /*
2227c478bd9Sstevel@tonic-gate  * structure used to maintain address list for localhost
2237c478bd9Sstevel@tonic-gate  */
2247c478bd9Sstevel@tonic-gate 
2257c478bd9Sstevel@tonic-gate struct myaddrs {
2267c478bd9Sstevel@tonic-gate 	struct sockaddr_in sin;
2277c478bd9Sstevel@tonic-gate 	struct myaddrs *myaddrs_next;
2287c478bd9Sstevel@tonic-gate };
2297c478bd9Sstevel@tonic-gate 
230*8548bf79Snr123932 /*
231*8548bf79Snr123932  * structure used to pass commands to the door servers
232*8548bf79Snr123932  */
233*8548bf79Snr123932 
234*8548bf79Snr123932 typedef struct command {
235*8548bf79Snr123932 	char file[MAXPATHLEN];
236*8548bf79Snr123932 	char argv[ARGV_MAX][MAXOPTSLEN];
237*8548bf79Snr123932 	char key[MAXOPTSLEN];
238*8548bf79Snr123932 	int console;
239*8548bf79Snr123932 } command_t;
240*8548bf79Snr123932 
241*8548bf79Snr123932 /*
242*8548bf79Snr123932  * globally visible door_server file descriptor
243*8548bf79Snr123932  */
244*8548bf79Snr123932 int did_exec_map;
245*8548bf79Snr123932 int did_fork_exec;
246*8548bf79Snr123932 
2477c478bd9Sstevel@tonic-gate extern time_t timenow;	/* set at start of processing of each RPC call */
2487c478bd9Sstevel@tonic-gate extern char self[];
2497c478bd9Sstevel@tonic-gate extern int verbose;
2507c478bd9Sstevel@tonic-gate extern int trace;
2517c478bd9Sstevel@tonic-gate extern int automountd_nobrowse;
2527c478bd9Sstevel@tonic-gate extern struct autodir *dir_head;
2537c478bd9Sstevel@tonic-gate extern struct autodir *dir_tail;
2547c478bd9Sstevel@tonic-gate extern struct mntlist *current_mounts;
25511606941Sjwahlig struct mounta;			/* defined in sys/vfs.h */
2567c478bd9Sstevel@tonic-gate extern struct myaddrs *myaddrs_head;
2577c478bd9Sstevel@tonic-gate 
2587c478bd9Sstevel@tonic-gate extern rwlock_t	cache_lock;
2597c478bd9Sstevel@tonic-gate extern rwlock_t portmap_cache_lock;
26039d3e169Sevanl extern rwlock_t autofs_rddir_cache_lock;
2617c478bd9Sstevel@tonic-gate 
2627c478bd9Sstevel@tonic-gate extern mutex_t cleanup_lock;
2637c478bd9Sstevel@tonic-gate extern cond_t cleanup_start_cv;
2647c478bd9Sstevel@tonic-gate extern cond_t cleanup_done_cv;
2657c478bd9Sstevel@tonic-gate 
2667c478bd9Sstevel@tonic-gate /*
2677c478bd9Sstevel@tonic-gate  * mnttab handling routines
2687c478bd9Sstevel@tonic-gate  */
2697c478bd9Sstevel@tonic-gate extern void free_mapent(struct mapent *);
2707c478bd9Sstevel@tonic-gate extern struct mntlist *getmntlist(void);
2717c478bd9Sstevel@tonic-gate extern dev_t get_devid(struct extmnttab *);
2727c478bd9Sstevel@tonic-gate 
2737c478bd9Sstevel@tonic-gate /*
2747c478bd9Sstevel@tonic-gate  * utilities
2757c478bd9Sstevel@tonic-gate  */
2767c478bd9Sstevel@tonic-gate extern struct mapent *parse_entry(char *, char *, char *, struct mapline *,
2777c478bd9Sstevel@tonic-gate 				char *, uint_t, bool_t);
2787c478bd9Sstevel@tonic-gate extern int macro_expand(char *, char *, char *, int);
2797c478bd9Sstevel@tonic-gate extern void unquote(char *, char *);
2806a6d3e5eSjs195444 extern void unbracket(char **);
2817c478bd9Sstevel@tonic-gate extern void trim(char *);
2827c478bd9Sstevel@tonic-gate extern char *get_line(FILE *, char *, char *, int);
2837c478bd9Sstevel@tonic-gate extern int getword(char *, char *, char **, char **, char, int);
2847c478bd9Sstevel@tonic-gate extern int get_retry(char *);
2857c478bd9Sstevel@tonic-gate extern int str_opt(struct mnttab *, char *, char **);
2866012a713Spetede extern void put_automountd_env(void);
2877c478bd9Sstevel@tonic-gate extern void dirinit(char *, char *, char *, int, char **, char ***);
2887c478bd9Sstevel@tonic-gate extern void pr_msg(const char *, ...);
2897c478bd9Sstevel@tonic-gate extern void trace_prt(int, char *, ...);
29039d3e169Sevanl extern void free_autofs_args(autofs_args *);
29139d3e169Sevanl extern void free_nfs_args(struct nfs_args *);
2927c478bd9Sstevel@tonic-gate extern void free_mounta(struct mounta *);
2937c478bd9Sstevel@tonic-gate 
2947c478bd9Sstevel@tonic-gate extern int nopt(struct mnttab *, char *, int *);
2957c478bd9Sstevel@tonic-gate extern int set_versrange(rpcvers_t, rpcvers_t *, rpcvers_t *);
2967c478bd9Sstevel@tonic-gate extern enum clnt_stat pingnfs(char *, int, rpcvers_t *, rpcvers_t,
2977c478bd9Sstevel@tonic-gate 	ushort_t, bool_t, char *, char *);
2987c478bd9Sstevel@tonic-gate 
29939d3e169Sevanl extern void *autofs_get_buffer(size_t);
3007c478bd9Sstevel@tonic-gate extern int self_check(char *);
3013bfb48feSsemery extern int do_mount1(char *, char *, char *, char *, char *, uint_t, uid_t,
3023bfb48feSsemery 	action_list **, int);
3033bfb48feSsemery extern int do_lookup1(char *, char *, char *, char *, char *, uint_t, uid_t,
3043bfb48feSsemery 	autofs_action_t *, struct linka *);
3057c478bd9Sstevel@tonic-gate extern int do_unmount1(umntrequest *);
3063bfb48feSsemery extern int do_readdir(autofs_rddirargs *, autofs_rddirres *);
3077c478bd9Sstevel@tonic-gate extern int nfsunmount(struct mnttab *);
3087c478bd9Sstevel@tonic-gate extern int loopbackmount(char *, char *, char *, int);
3093bfb48feSsemery extern int mount_nfs(struct mapent *, char *, char *, int, uid_t,
3103bfb48feSsemery 	action_list **);
3117c478bd9Sstevel@tonic-gate extern int mount_autofs(struct mapent *, char *, action_list *,
31239d3e169Sevanl 	char *rootp, char *subdir, char *key);
3137c478bd9Sstevel@tonic-gate extern int mount_generic(char *, char *, char *, char *, int);
3147c478bd9Sstevel@tonic-gate extern enum clnt_stat nfs_cast(struct mapfs *, struct mapfs **, int);
3157c478bd9Sstevel@tonic-gate 
3167c478bd9Sstevel@tonic-gate extern bool_t hasrestrictopt(char *);
3177c478bd9Sstevel@tonic-gate 
3187c478bd9Sstevel@tonic-gate #ifndef NO_RDDIR_CACHE
3197c478bd9Sstevel@tonic-gate /*
3207c478bd9Sstevel@tonic-gate  * readdir handling routines
3217c478bd9Sstevel@tonic-gate  */
3227c478bd9Sstevel@tonic-gate extern char *auto_rddir_malloc(unsigned);
3237c478bd9Sstevel@tonic-gate extern char *auto_rddir_strdup(const char *);
3247c478bd9Sstevel@tonic-gate extern struct dir_entry *btree_lookup(struct dir_entry *, char *);
3257c478bd9Sstevel@tonic-gate extern void btree_enter(struct dir_entry **, struct dir_entry *);
3267c478bd9Sstevel@tonic-gate extern int add_dir_entry(char *, struct dir_entry **, struct dir_entry **);
3277c478bd9Sstevel@tonic-gate extern void cache_cleanup(void);
32839d3e169Sevanl extern int autofs_rddir_cache_lookup(char *, struct autofs_rddir_cache **);
3297c478bd9Sstevel@tonic-gate extern struct dir_entry *rddir_entry_lookup(char *, struct dir_entry *);
3307c478bd9Sstevel@tonic-gate #endif /* NO_RDDIR_CACHE */
3317c478bd9Sstevel@tonic-gate 
3327c478bd9Sstevel@tonic-gate /*
3337c478bd9Sstevel@tonic-gate  * generic interface to specific name service functions
3347c478bd9Sstevel@tonic-gate  */
3357c478bd9Sstevel@tonic-gate extern void ns_setup(char **, char ***);
3367c478bd9Sstevel@tonic-gate extern int getmapent(char *, char *, struct mapline *, char **, char ***,
3377c478bd9Sstevel@tonic-gate 			bool_t *, bool_t);
3387c478bd9Sstevel@tonic-gate extern int getmapkeys(char *, struct dir_entry **, int *, int *, char **,
3397c478bd9Sstevel@tonic-gate 			char ***, uid_t);
3407c478bd9Sstevel@tonic-gate extern int loadmaster_map(char *, char *, char **, char ***);
3417c478bd9Sstevel@tonic-gate extern int loaddirect_map(char *, char *, char *, char **, char ***);
3427c478bd9Sstevel@tonic-gate 
3437c478bd9Sstevel@tonic-gate /*
3447c478bd9Sstevel@tonic-gate  * these name service specific functions should not be
3457c478bd9Sstevel@tonic-gate  * accessed directly, use the generic functions.
3467c478bd9Sstevel@tonic-gate  */
3477c478bd9Sstevel@tonic-gate extern void init_files(char **, char ***);
3487c478bd9Sstevel@tonic-gate extern int getmapent_files(char *, char *, struct mapline *, char **, char ***,
3497c478bd9Sstevel@tonic-gate 				bool_t *, bool_t);
3507c478bd9Sstevel@tonic-gate extern int loadmaster_files(char *, char *, char **, char ***);
3517c478bd9Sstevel@tonic-gate extern int loaddirect_files(char *, char *, char *, char **, char ***);
3527c478bd9Sstevel@tonic-gate extern int getmapkeys_files(char *, struct dir_entry **, int *, int *,
3537c478bd9Sstevel@tonic-gate 	char **, char ***);
3547c478bd9Sstevel@tonic-gate extern int stack_op(int, char *, char **, char ***);
3557c478bd9Sstevel@tonic-gate 
3567c478bd9Sstevel@tonic-gate extern void init_nisplus(char **, char ***);
3577c478bd9Sstevel@tonic-gate extern int getmapent_nisplus(char *, char *, struct mapline *, char **,
3587c478bd9Sstevel@tonic-gate 				char ***, bool_t *, bool_t);
3597c478bd9Sstevel@tonic-gate extern int loadmaster_nisplus(char *, char *, char **, char ***);
3607c478bd9Sstevel@tonic-gate extern int loaddirect_nisplus(char *, char *, char *, char **, char ***);
3617c478bd9Sstevel@tonic-gate extern int getmapkeys_nisplus(char *, struct dir_entry **, int *, int *,
3627c478bd9Sstevel@tonic-gate 	char **, char ***);
3637c478bd9Sstevel@tonic-gate 
3647c478bd9Sstevel@tonic-gate extern void init_nis(char **, char ***);
3657c478bd9Sstevel@tonic-gate extern int getmapent_nis(char *, char *, struct mapline *, char **, char ***,
3667c478bd9Sstevel@tonic-gate 				bool_t *, bool_t);
3677c478bd9Sstevel@tonic-gate extern int loadmaster_nis(char *, char *, char **, char ***);
3687c478bd9Sstevel@tonic-gate extern int loaddirect_nis(char *, char *, char *, char **, char ***);
3697c478bd9Sstevel@tonic-gate extern int getmapkeys_nis(char *, struct dir_entry **, int *, int *,
3707c478bd9Sstevel@tonic-gate 	char **, char ***);
3717c478bd9Sstevel@tonic-gate 
3727c478bd9Sstevel@tonic-gate extern void init_ldap(char **, char ***);
3737c478bd9Sstevel@tonic-gate extern int getmapent_ldap(char *, char *, struct mapline *, char **, char ***,
3747c478bd9Sstevel@tonic-gate 				bool_t *, bool_t);
3757c478bd9Sstevel@tonic-gate extern int loadmaster_ldap(char *, char *, char **, char ***);
3767c478bd9Sstevel@tonic-gate extern int loaddirect_ldap(char *, char *, char *, char **, char ***);
3777c478bd9Sstevel@tonic-gate extern int getmapkeys_ldap(char *, struct dir_entry **, int *, int *,
3787c478bd9Sstevel@tonic-gate 	char **, char ***);
3797c478bd9Sstevel@tonic-gate 
3807c478bd9Sstevel@tonic-gate 
3817c478bd9Sstevel@tonic-gate /*
3827c478bd9Sstevel@tonic-gate  * end of name service specific functions
3837c478bd9Sstevel@tonic-gate  */
3847c478bd9Sstevel@tonic-gate 
3857c478bd9Sstevel@tonic-gate /*
3867c478bd9Sstevel@tonic-gate  * not defined in any header file
3877c478bd9Sstevel@tonic-gate  */
3887c478bd9Sstevel@tonic-gate extern bool_t xdr_uid_t(XDR *, uid_t *);
3897c478bd9Sstevel@tonic-gate extern int __clnt_bindresvport(CLIENT *);
3907c478bd9Sstevel@tonic-gate extern int getnetmaskbynet(const struct in_addr, struct in_addr *);
3917c478bd9Sstevel@tonic-gate 
3927c478bd9Sstevel@tonic-gate /*
3937c478bd9Sstevel@tonic-gate  * Hidden rpc functions
3947c478bd9Sstevel@tonic-gate  */
3957c478bd9Sstevel@tonic-gate extern int __nis_reset_state();
3967c478bd9Sstevel@tonic-gate extern int __rpc_negotiate_uid(int);
3977c478bd9Sstevel@tonic-gate 
398*8548bf79Snr123932 /*
399*8548bf79Snr123932  * door_server functions to handle fork activity within the automounter
400*8548bf79Snr123932  */
401*8548bf79Snr123932 void automountd_do_fork_exec(void *, char *, size_t, door_desc_t *, uint_t);
402*8548bf79Snr123932 void automountd_do_exec_map(void *, char *, size_t, door_desc_t *, uint_t);
403*8548bf79Snr123932 
4047c478bd9Sstevel@tonic-gate #ifdef __cplusplus
4057c478bd9Sstevel@tonic-gate }
4067c478bd9Sstevel@tonic-gate #endif
4077c478bd9Sstevel@tonic-gate 
4087c478bd9Sstevel@tonic-gate #endif	/* _AUTOMOUNT_H */
409