xref: /illumos-gate/usr/src/cmd/fs.d/autofs/automount.h (revision bfbf29e2)
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  */
21a05fd0c9SMarcel Telka 
22a05fd0c9SMarcel Telka /*
23bd93c05dSAlexander Eremin  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
24a05fd0c9SMarcel Telka  */
25a05fd0c9SMarcel Telka 
267c478bd9Sstevel@tonic-gate /*
2736e852a1SRaja Andra  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
287c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
297c478bd9Sstevel@tonic-gate  */
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifndef	_AUTOMOUNT_H
327c478bd9Sstevel@tonic-gate #define	_AUTOMOUNT_H
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #include <fslib.h>		/* needed for mntlist_t declaration */
357c478bd9Sstevel@tonic-gate #include <thread.h>
367c478bd9Sstevel@tonic-gate #include <sys/mntent.h>		/*    "    "  MNTTYPE_* declarations */
377c478bd9Sstevel@tonic-gate #include <synch.h>		/* needed for mutex_t declaration */
387c478bd9Sstevel@tonic-gate #include <sys/types.h>
397c478bd9Sstevel@tonic-gate #include <rpc/rpc.h>
4039d3e169Sevanl #include <sys/fs/autofs.h>
417c478bd9Sstevel@tonic-gate #include <netinet/in.h>		/* needed for sockaddr_in declaration */
428548bf79Snr #include <door.h>
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate #ifdef MALLOC_DEBUG
457c478bd9Sstevel@tonic-gate #include <debug_alloc.h>
467c478bd9Sstevel@tonic-gate #endif
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate #ifdef __cplusplus
497c478bd9Sstevel@tonic-gate extern "C" {
507c478bd9Sstevel@tonic-gate #endif
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate #ifndef _REENTRANT
537c478bd9Sstevel@tonic-gate #define	fork1			vfork
547c478bd9Sstevel@tonic-gate #define	rpc_control(a, b)	1
557c478bd9Sstevel@tonic-gate #endif
567c478bd9Sstevel@tonic-gate 
5739d3e169Sevanl #define	DOMOUNT_USER	1
5839d3e169Sevanl #define	DOMOUNT_KERNEL	2
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate /*
617c478bd9Sstevel@tonic-gate  * Solaris autofs configuration file location
627c478bd9Sstevel@tonic-gate  */
637c478bd9Sstevel@tonic-gate #define	AUTOFSADMIN	"/etc/default/autofs"
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate #define	MXHOSTNAMELEN	64
667c478bd9Sstevel@tonic-gate #define	MAXNETNAMELEN   255
677c478bd9Sstevel@tonic-gate #define	MAXFILENAMELEN  255
687c478bd9Sstevel@tonic-gate #define	LINESZ		4096
697c478bd9Sstevel@tonic-gate #define	MAXADDRLEN	128		/* max autofs address length */
707c478bd9Sstevel@tonic-gate #define	MAXOPTSLEN	1024
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate #define	AUTOFS_MOUNT_TIMEOUT	600	/* default min time mount will */
737c478bd9Sstevel@tonic-gate 					/* remain mounted (in seconds) */
747c478bd9Sstevel@tonic-gate #define	AUTOFS_RPC_TIMEOUT	60	/* secs autofs will wait for */
757c478bd9Sstevel@tonic-gate 					/* automountd's reply before */
767c478bd9Sstevel@tonic-gate 					/* retransmitting */
777c478bd9Sstevel@tonic-gate /* stack ops */
787c478bd9Sstevel@tonic-gate #define	ERASE		0
797c478bd9Sstevel@tonic-gate #define	PUSH		1
807c478bd9Sstevel@tonic-gate #define	POP		2
817c478bd9Sstevel@tonic-gate #define	INIT		3
827c478bd9Sstevel@tonic-gate #define	STACKSIZ	30
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate #define	DIST_SELF	1
857c478bd9Sstevel@tonic-gate #define	DIST_MYSUB	2
867c478bd9Sstevel@tonic-gate #define	DIST_MYNET	3
877c478bd9Sstevel@tonic-gate #define	DIST_OTHER	4
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate #define	MAXIFS		32
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate /*
927c478bd9Sstevel@tonic-gate  * Retry operation related definitions.
937c478bd9Sstevel@tonic-gate  */
947c478bd9Sstevel@tonic-gate #define	RET_OK		0
957c478bd9Sstevel@tonic-gate #define	RET_RETRY	32
967c478bd9Sstevel@tonic-gate #define	RET_ERR		33
977c478bd9Sstevel@tonic-gate #define	INITDELAY	5
987c478bd9Sstevel@tonic-gate #define	DELAY_BACKOFF	2
997c478bd9Sstevel@tonic-gate #define	MAXDELAY	120
1008548bf79Snr #define	ARGV_MAX	16
1018548bf79Snr #define	VFS_PATH	"/usr/lib/fs"
1027c478bd9Sstevel@tonic-gate #define	DELAY(delay) { \
1037c478bd9Sstevel@tonic-gate 	(void) sleep(delay); \
1047c478bd9Sstevel@tonic-gate 	delay *= DELAY_BACKOFF; \
1057c478bd9Sstevel@tonic-gate 	if (delay > MAXDELAY) \
1067c478bd9Sstevel@tonic-gate 		delay = MAXDELAY; \
1077c478bd9Sstevel@tonic-gate }
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate struct mapline {
1107c478bd9Sstevel@tonic-gate 	char linebuf[LINESZ];
1117c478bd9Sstevel@tonic-gate 	char lineqbuf[LINESZ];
1127c478bd9Sstevel@tonic-gate };
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate /*
1157c478bd9Sstevel@tonic-gate  * Structure describing a host/filesystem/dir tuple in a NIS map entry
1167c478bd9Sstevel@tonic-gate  */
1177c478bd9Sstevel@tonic-gate struct mapfs {
1187c478bd9Sstevel@tonic-gate 	struct mapfs *mfs_next;	/* next in entry */
119*bfbf29e2SToomas Soome 	int	mfs_ignore;	/* ignore this entry */
1207c478bd9Sstevel@tonic-gate 	char	*mfs_host;	/* host name */
1217c478bd9Sstevel@tonic-gate 	char	*mfs_dir;	/* dir to mount */
1227c478bd9Sstevel@tonic-gate 	int	mfs_penalty;	/* mount penalty for this host */
1237c478bd9Sstevel@tonic-gate 	int	mfs_distance;	/* distance hint */
1247c478bd9Sstevel@tonic-gate 	struct nfs_args *mfs_args;	/* nfs_args */
1257c478bd9Sstevel@tonic-gate 	struct netconfig *mfs_nconf;
1267c478bd9Sstevel@tonic-gate 	rpcvers_t	mfs_version;	/* NFS version */
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate #define	MFS_ALLOC_DIR		0x1	/* mfs_dir now points to different */
1297c478bd9Sstevel@tonic-gate 					/* buffer */
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate #define	MFS_URL			0x2	/* is NFS url listed in this tuple. */
1327c478bd9Sstevel@tonic-gate #define	MFS_FH_VIA_WEBNFS	0x4	/* got file handle during ping phase */
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate 	uint_t	mfs_flags;
1357c478bd9Sstevel@tonic-gate 	uint_t	mfs_port;	/* port# in NFS url */
1367c478bd9Sstevel@tonic-gate };
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate /*
1397c478bd9Sstevel@tonic-gate  * NIS entry - lookup of name in DIR gets us this
1407c478bd9Sstevel@tonic-gate  */
1417c478bd9Sstevel@tonic-gate struct mapent {
1427c478bd9Sstevel@tonic-gate 	char	*map_fstype;	/* file system type e.g. "nfs" */
143bd93c05dSAlexander Eremin 	char	*map_mounter;	/* base fs */
1447c478bd9Sstevel@tonic-gate 	char	*map_root;	/* path to mount root */
1457c478bd9Sstevel@tonic-gate 	char	*map_mntpnt;	/* path from mount root */
1467c478bd9Sstevel@tonic-gate 	char	*map_mntopts;	/* mount options */
1477c478bd9Sstevel@tonic-gate 	char    *map_fsw;	/* mount fs information */
1487c478bd9Sstevel@tonic-gate 	char    *map_fswq;	/* quoted mountfs information */
1497c478bd9Sstevel@tonic-gate 	int	map_mntlevel;	/* mapentry hierarchy level */
1507c478bd9Sstevel@tonic-gate 	bool_t	map_modified;	/* flags modified mapentries */
1517c478bd9Sstevel@tonic-gate 	bool_t	map_faked;	/* flags faked mapentries */
1527c478bd9Sstevel@tonic-gate 	int	map_err;	/* flags any bad entries in the map */
1537c478bd9Sstevel@tonic-gate 	struct mapfs *map_fs;	/* list of replicas for nfs */
1547c478bd9Sstevel@tonic-gate 	struct mapent *map_next;
1557c478bd9Sstevel@tonic-gate };
1567c478bd9Sstevel@tonic-gate 
1577c478bd9Sstevel@tonic-gate 
1587c478bd9Sstevel@tonic-gate /*
1597c478bd9Sstevel@tonic-gate  * Descriptor for each directory served by the automounter
1607c478bd9Sstevel@tonic-gate  */
1617c478bd9Sstevel@tonic-gate struct autodir {
1627c478bd9Sstevel@tonic-gate 	char	*dir_name;		/* mount point */
1637c478bd9Sstevel@tonic-gate 	char	*dir_map;		/* name of map for dir */
1647c478bd9Sstevel@tonic-gate 	char	*dir_opts;		/* default mount options */
165*bfbf29e2SToomas Soome 	int	dir_direct;		/* direct mountpoint ? */
166*bfbf29e2SToomas Soome 	int	dir_remount;		/* a remount */
1677c478bd9Sstevel@tonic-gate 	struct autodir *dir_next;	/* next entry */
1687c478bd9Sstevel@tonic-gate 	struct autodir *dir_prev;	/* prev entry */
1697c478bd9Sstevel@tonic-gate };
1707c478bd9Sstevel@tonic-gate 
1717c478bd9Sstevel@tonic-gate /*
1727c478bd9Sstevel@tonic-gate  * This structure is used to build an array of
1737c478bd9Sstevel@tonic-gate  * hostnames with associated penalties to be
1747c478bd9Sstevel@tonic-gate  * passed to the nfs_cast procedure
1757c478bd9Sstevel@tonic-gate  */
1767c478bd9Sstevel@tonic-gate struct host_names {
1777c478bd9Sstevel@tonic-gate 	char *host;
1787c478bd9Sstevel@tonic-gate 	int  penalty;
1797c478bd9Sstevel@tonic-gate };
1807c478bd9Sstevel@tonic-gate 
1817c478bd9Sstevel@tonic-gate /*
1827c478bd9Sstevel@tonic-gate  * structure used to build list of contents for a map on
1837c478bd9Sstevel@tonic-gate  * a readdir request
1847c478bd9Sstevel@tonic-gate  */
1857c478bd9Sstevel@tonic-gate struct dir_entry {
1867c478bd9Sstevel@tonic-gate 	char		*name;		/* name of entry */
1877c478bd9Sstevel@tonic-gate 	ino_t		nodeid;
1887c478bd9Sstevel@tonic-gate 	off_t		offset;
1897c478bd9Sstevel@tonic-gate 	struct dir_entry *next;
1907c478bd9Sstevel@tonic-gate 	struct dir_entry *left;		/* left element in binary tree */
1917c478bd9Sstevel@tonic-gate 	struct dir_entry *right;	/* right element in binary tree */
1927c478bd9Sstevel@tonic-gate };
1937c478bd9Sstevel@tonic-gate 
1947c478bd9Sstevel@tonic-gate /*
1957c478bd9Sstevel@tonic-gate  * offset index table
1967c478bd9Sstevel@tonic-gate  */
1977c478bd9Sstevel@tonic-gate struct off_tbl {
1987c478bd9Sstevel@tonic-gate 	off_t			offset;
1997c478bd9Sstevel@tonic-gate 	struct dir_entry	*first;
2007c478bd9Sstevel@tonic-gate 	struct off_tbl		*next;
2017c478bd9Sstevel@tonic-gate };
2027c478bd9Sstevel@tonic-gate 
2037c478bd9Sstevel@tonic-gate #ifndef NO_RDDIR_CACHE
2047c478bd9Sstevel@tonic-gate /*
2057c478bd9Sstevel@tonic-gate  * directory cache for 'map'
2067c478bd9Sstevel@tonic-gate  */
20739d3e169Sevanl struct autofs_rddir_cache {
2087c478bd9Sstevel@tonic-gate 	char			*map;
2097c478bd9Sstevel@tonic-gate 	struct off_tbl		*offtp;
2107c478bd9Sstevel@tonic-gate 	ulong_t			bucket_size;
2117c478bd9Sstevel@tonic-gate 	time_t			ttl;
2127c478bd9Sstevel@tonic-gate 	struct dir_entry	*entp;
2137c478bd9Sstevel@tonic-gate 	mutex_t			lock;		/* protects 'in_use' field */
2147c478bd9Sstevel@tonic-gate 	int			in_use;		/* # threads referencing it */
2157c478bd9Sstevel@tonic-gate 	rwlock_t		rwlock;		/* protects 'full' and 'next' */
2167c478bd9Sstevel@tonic-gate 	int			full;		/* full == 1 when cache full */
21739d3e169Sevanl 	struct autofs_rddir_cache	*next;
2187c478bd9Sstevel@tonic-gate };
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate #define	RDDIR_CACHE_TIME	300		/* in seconds */
2217c478bd9Sstevel@tonic-gate 
2227c478bd9Sstevel@tonic-gate #endif /* NO_RDDIR_CACHE */
2237c478bd9Sstevel@tonic-gate 
2247c478bd9Sstevel@tonic-gate /*
2257c478bd9Sstevel@tonic-gate  * structure used to maintain address list for localhost
2267c478bd9Sstevel@tonic-gate  */
2277c478bd9Sstevel@tonic-gate 
2287c478bd9Sstevel@tonic-gate struct myaddrs {
2297c478bd9Sstevel@tonic-gate 	struct sockaddr_in sin;
2307c478bd9Sstevel@tonic-gate 	struct myaddrs *myaddrs_next;
2317c478bd9Sstevel@tonic-gate };
2327c478bd9Sstevel@tonic-gate 
2338548bf79Snr /*
2348548bf79Snr  * structure used to pass commands to the door servers
2358548bf79Snr  */
2368548bf79Snr 
2378548bf79Snr typedef struct command {
2388548bf79Snr 	char file[MAXPATHLEN];
2398548bf79Snr 	char argv[ARGV_MAX][MAXOPTSLEN];
2408548bf79Snr 	char key[MAXOPTSLEN];
2418548bf79Snr 	int console;
2428548bf79Snr } command_t;
2438548bf79Snr 
2448548bf79Snr /*
2458548bf79Snr  * globally visible door_server file descriptor
2468548bf79Snr  */
247*bfbf29e2SToomas Soome extern int did_exec_map;
248*bfbf29e2SToomas Soome extern int did_fork_exec;
2498548bf79Snr 
2507c478bd9Sstevel@tonic-gate extern time_t timenow;	/* set at start of processing of each RPC call */
2517c478bd9Sstevel@tonic-gate extern char self[];
2527c478bd9Sstevel@tonic-gate extern int verbose;
2537c478bd9Sstevel@tonic-gate extern int trace;
2547c478bd9Sstevel@tonic-gate extern int automountd_nobrowse;
2557c478bd9Sstevel@tonic-gate extern struct autodir *dir_head;
2567c478bd9Sstevel@tonic-gate extern struct autodir *dir_tail;
2577c478bd9Sstevel@tonic-gate extern struct mntlist *current_mounts;
25811606941Sjwahlig struct mounta;			/* defined in sys/vfs.h */
2597c478bd9Sstevel@tonic-gate extern struct myaddrs *myaddrs_head;
2607c478bd9Sstevel@tonic-gate 
2617c478bd9Sstevel@tonic-gate extern rwlock_t	cache_lock;
2627c478bd9Sstevel@tonic-gate extern rwlock_t portmap_cache_lock;
26339d3e169Sevanl extern rwlock_t autofs_rddir_cache_lock;
2647c478bd9Sstevel@tonic-gate 
2657c478bd9Sstevel@tonic-gate extern mutex_t cleanup_lock;
2667c478bd9Sstevel@tonic-gate extern cond_t cleanup_start_cv;
2677c478bd9Sstevel@tonic-gate extern cond_t cleanup_done_cv;
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate /*
2707c478bd9Sstevel@tonic-gate  * mnttab handling routines
2717c478bd9Sstevel@tonic-gate  */
2727c478bd9Sstevel@tonic-gate extern void free_mapent(struct mapent *);
2737c478bd9Sstevel@tonic-gate extern struct mntlist *getmntlist(void);
2747c478bd9Sstevel@tonic-gate extern dev_t get_devid(struct extmnttab *);
2757c478bd9Sstevel@tonic-gate 
2767c478bd9Sstevel@tonic-gate /*
2777c478bd9Sstevel@tonic-gate  * utilities
2787c478bd9Sstevel@tonic-gate  */
2797c478bd9Sstevel@tonic-gate extern struct mapent *parse_entry(char *, char *, char *, struct mapline *,
2807c478bd9Sstevel@tonic-gate 				char *, uint_t, bool_t);
2817c478bd9Sstevel@tonic-gate extern int macro_expand(char *, char *, char *, int);
2827c478bd9Sstevel@tonic-gate extern void unquote(char *, char *);
2836a6d3e5eSjs extern void unbracket(char **);
2847c478bd9Sstevel@tonic-gate extern void trim(char *);
2857c478bd9Sstevel@tonic-gate extern char *get_line(FILE *, char *, char *, int);
2867c478bd9Sstevel@tonic-gate extern int getword(char *, char *, char **, char **, char, int);
2877c478bd9Sstevel@tonic-gate extern int get_retry(char *);
2887c478bd9Sstevel@tonic-gate extern int str_opt(struct mnttab *, char *, char **);
2896012a713Spetede extern void put_automountd_env(void);
2907c478bd9Sstevel@tonic-gate extern void dirinit(char *, char *, char *, int, char **, char ***);
2917c478bd9Sstevel@tonic-gate extern void pr_msg(const char *, ...);
2927c478bd9Sstevel@tonic-gate extern void trace_prt(int, char *, ...);
29339d3e169Sevanl extern void free_autofs_args(autofs_args *);
29439d3e169Sevanl extern void free_nfs_args(struct nfs_args *);
2957c478bd9Sstevel@tonic-gate extern void free_mounta(struct mounta *);
2967c478bd9Sstevel@tonic-gate 
2977c478bd9Sstevel@tonic-gate extern int nopt(struct mnttab *, char *, int *);
2987c478bd9Sstevel@tonic-gate extern int set_versrange(rpcvers_t, rpcvers_t *, rpcvers_t *);
2997c478bd9Sstevel@tonic-gate extern enum clnt_stat pingnfs(char *, int, rpcvers_t *, rpcvers_t,
3007c478bd9Sstevel@tonic-gate 	ushort_t, bool_t, char *, char *);
3017c478bd9Sstevel@tonic-gate 
30239d3e169Sevanl extern void *autofs_get_buffer(size_t);
3037c478bd9Sstevel@tonic-gate extern int self_check(char *);
3043bfb48feSsemery extern int do_mount1(char *, char *, char *, char *, char *, uint_t, uid_t,
3053bfb48feSsemery 	action_list **, int);
3063bfb48feSsemery extern int do_lookup1(char *, char *, char *, char *, char *, uint_t, uid_t,
3073bfb48feSsemery 	autofs_action_t *, struct linka *);
3087c478bd9Sstevel@tonic-gate extern int do_unmount1(umntrequest *);
3093bfb48feSsemery extern int do_readdir(autofs_rddirargs *, autofs_rddirres *);
3107c478bd9Sstevel@tonic-gate extern int nfsunmount(struct mnttab *);
3117c478bd9Sstevel@tonic-gate extern int loopbackmount(char *, char *, char *, int);
3123bfb48feSsemery extern int mount_nfs(struct mapent *, char *, char *, int, uid_t,
3133bfb48feSsemery 	action_list **);
3147c478bd9Sstevel@tonic-gate extern int mount_autofs(struct mapent *, char *, action_list *,
31539d3e169Sevanl 	char *rootp, char *subdir, char *key);
3167c478bd9Sstevel@tonic-gate extern int mount_generic(char *, char *, char *, char *, int);
3177c478bd9Sstevel@tonic-gate extern enum clnt_stat nfs_cast(struct mapfs *, struct mapfs **, int);
3187c478bd9Sstevel@tonic-gate 
3197c478bd9Sstevel@tonic-gate extern bool_t hasrestrictopt(char *);
3207c478bd9Sstevel@tonic-gate 
3217c478bd9Sstevel@tonic-gate #ifndef NO_RDDIR_CACHE
3227c478bd9Sstevel@tonic-gate /*
3237c478bd9Sstevel@tonic-gate  * readdir handling routines
3247c478bd9Sstevel@tonic-gate  */
3257c478bd9Sstevel@tonic-gate extern char *auto_rddir_malloc(unsigned);
3267c478bd9Sstevel@tonic-gate extern char *auto_rddir_strdup(const char *);
3277c478bd9Sstevel@tonic-gate extern struct dir_entry *btree_lookup(struct dir_entry *, char *);
3287c478bd9Sstevel@tonic-gate extern void btree_enter(struct dir_entry **, struct dir_entry *);
3297c478bd9Sstevel@tonic-gate extern int add_dir_entry(char *, struct dir_entry **, struct dir_entry **);
3307c478bd9Sstevel@tonic-gate extern void cache_cleanup(void);
33139d3e169Sevanl extern int autofs_rddir_cache_lookup(char *, struct autofs_rddir_cache **);
3327c478bd9Sstevel@tonic-gate extern struct dir_entry *rddir_entry_lookup(char *, struct dir_entry *);
3337c478bd9Sstevel@tonic-gate #endif /* NO_RDDIR_CACHE */
3347c478bd9Sstevel@tonic-gate 
3357c478bd9Sstevel@tonic-gate /*
3367c478bd9Sstevel@tonic-gate  * generic interface to specific name service functions
3377c478bd9Sstevel@tonic-gate  */
3387c478bd9Sstevel@tonic-gate extern void ns_setup(char **, char ***);
3397c478bd9Sstevel@tonic-gate extern int getmapent(char *, char *, struct mapline *, char **, char ***,
3407c478bd9Sstevel@tonic-gate 			bool_t *, bool_t);
3417c478bd9Sstevel@tonic-gate extern int getmapkeys(char *, struct dir_entry **, int *, int *, char **,
3427c478bd9Sstevel@tonic-gate 			char ***, uid_t);
3437c478bd9Sstevel@tonic-gate extern int loadmaster_map(char *, char *, char **, char ***);
3447c478bd9Sstevel@tonic-gate extern int loaddirect_map(char *, char *, char *, char **, char ***);
3457c478bd9Sstevel@tonic-gate 
3467c478bd9Sstevel@tonic-gate /*
3477c478bd9Sstevel@tonic-gate  * these name service specific functions should not be
3487c478bd9Sstevel@tonic-gate  * accessed directly, use the generic functions.
3497c478bd9Sstevel@tonic-gate  */
3507c478bd9Sstevel@tonic-gate extern void init_files(char **, char ***);
3517c478bd9Sstevel@tonic-gate extern int getmapent_files(char *, char *, struct mapline *, char **, char ***,
3527c478bd9Sstevel@tonic-gate 				bool_t *, bool_t);
3537c478bd9Sstevel@tonic-gate extern int loadmaster_files(char *, char *, char **, char ***);
3547c478bd9Sstevel@tonic-gate extern int loaddirect_files(char *, char *, char *, char **, char ***);
3557c478bd9Sstevel@tonic-gate extern int getmapkeys_files(char *, struct dir_entry **, int *, int *,
3567c478bd9Sstevel@tonic-gate 	char **, char ***);
3577c478bd9Sstevel@tonic-gate extern int stack_op(int, char *, char **, char ***);
3587c478bd9Sstevel@tonic-gate 
3597c478bd9Sstevel@tonic-gate extern void init_nis(char **, char ***);
3607c478bd9Sstevel@tonic-gate extern int getmapent_nis(char *, char *, struct mapline *, char **, char ***,
3617c478bd9Sstevel@tonic-gate 				bool_t *, bool_t);
3627c478bd9Sstevel@tonic-gate extern int loadmaster_nis(char *, char *, char **, char ***);
3637c478bd9Sstevel@tonic-gate extern int loaddirect_nis(char *, char *, char *, char **, char ***);
3647c478bd9Sstevel@tonic-gate extern int getmapkeys_nis(char *, struct dir_entry **, int *, int *,
3657c478bd9Sstevel@tonic-gate 	char **, char ***);
3667c478bd9Sstevel@tonic-gate 
3677c478bd9Sstevel@tonic-gate extern void init_ldap(char **, char ***);
3687c478bd9Sstevel@tonic-gate extern int getmapent_ldap(char *, char *, struct mapline *, char **, char ***,
3697c478bd9Sstevel@tonic-gate 				bool_t *, bool_t);
3707c478bd9Sstevel@tonic-gate extern int loadmaster_ldap(char *, char *, char **, char ***);
3717c478bd9Sstevel@tonic-gate extern int loaddirect_ldap(char *, char *, char *, char **, char ***);
3727c478bd9Sstevel@tonic-gate extern int getmapkeys_ldap(char *, struct dir_entry **, int *, int *,
3737c478bd9Sstevel@tonic-gate 	char **, char ***);
3747c478bd9Sstevel@tonic-gate 
3757c478bd9Sstevel@tonic-gate 
3767c478bd9Sstevel@tonic-gate /*
3777c478bd9Sstevel@tonic-gate  * end of name service specific functions
3787c478bd9Sstevel@tonic-gate  */
3797c478bd9Sstevel@tonic-gate 
3807c478bd9Sstevel@tonic-gate /*
3817c478bd9Sstevel@tonic-gate  * not defined in any header file
3827c478bd9Sstevel@tonic-gate  */
3837c478bd9Sstevel@tonic-gate extern int __clnt_bindresvport(CLIENT *);
3847c478bd9Sstevel@tonic-gate extern int getnetmaskbynet(const struct in_addr, struct in_addr *);
3857c478bd9Sstevel@tonic-gate 
3867c478bd9Sstevel@tonic-gate /*
3877c478bd9Sstevel@tonic-gate  * Hidden rpc functions
3887c478bd9Sstevel@tonic-gate  */
3897c478bd9Sstevel@tonic-gate extern int __nis_reset_state();
3907c478bd9Sstevel@tonic-gate extern int __rpc_negotiate_uid(int);
3917c478bd9Sstevel@tonic-gate 
3928548bf79Snr /*
3938548bf79Snr  * door_server functions to handle fork activity within the automounter
3948548bf79Snr  */
3958548bf79Snr void automountd_do_fork_exec(void *, char *, size_t, door_desc_t *, uint_t);
3968548bf79Snr void automountd_do_exec_map(void *, char *, size_t, door_desc_t *, uint_t);
3978548bf79Snr 
3987c478bd9Sstevel@tonic-gate #ifdef __cplusplus
3997c478bd9Sstevel@tonic-gate }
4007c478bd9Sstevel@tonic-gate #endif
4017c478bd9Sstevel@tonic-gate 
4027c478bd9Sstevel@tonic-gate #endif	/* _AUTOMOUNT_H */
403