xref: /illumos-gate/usr/src/uts/common/sys/fs/autofs.h (revision a05fd0c9)
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  */
21*a05fd0c9SMarcel Telka 
227c478bd9Sstevel@tonic-gate /*
23*a05fd0c9SMarcel Telka  * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
24f798ee53SJan Kryl  * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_SYS_FS_AUTOFS_H
287c478bd9Sstevel@tonic-gate #define	_SYS_FS_AUTOFS_H
297c478bd9Sstevel@tonic-gate 
3039d3e169Sevanl #include <rpc/clnt.h>
3139d3e169Sevanl #include <gssapi/gssapi.h>
3239d3e169Sevanl #include <sys/vfs.h>
3339d3e169Sevanl #include <sys/dirent.h>
3439d3e169Sevanl #include <sys/types.h>
3539d3e169Sevanl #include <sys/types32.h>
367c478bd9Sstevel@tonic-gate #include <sys/note.h>
377c478bd9Sstevel@tonic-gate #include <sys/time_impl.h>
387c478bd9Sstevel@tonic-gate #include <sys/mntent.h>
3939d3e169Sevanl #include <nfs/mount.h>
4039d3e169Sevanl #include <rpc/rpcsec_gss.h>
417c478bd9Sstevel@tonic-gate #include <sys/zone.h>
4239d3e169Sevanl #include <sys/door.h>
4339d3e169Sevanl #include <rpcsvc/autofs_prot.h>
447c478bd9Sstevel@tonic-gate 
45d67944fbSScott Rotondo #ifdef _KERNEL
46d67944fbSScott Rotondo #include <sys/vfs_opreg.h>
47d67944fbSScott Rotondo #endif
48d67944fbSScott Rotondo 
497c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
507c478bd9Sstevel@tonic-gate extern "C" {
517c478bd9Sstevel@tonic-gate #endif
527c478bd9Sstevel@tonic-gate 
5339d3e169Sevanl 
547c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate /*
587c478bd9Sstevel@tonic-gate  * Tracing macro; expands to nothing for non-debug kernels.
597c478bd9Sstevel@tonic-gate  */
607c478bd9Sstevel@tonic-gate #ifndef DEBUG
617c478bd9Sstevel@tonic-gate #define	AUTOFS_DPRINT(x)
627c478bd9Sstevel@tonic-gate #else
637c478bd9Sstevel@tonic-gate #define	AUTOFS_DPRINT(x)	auto_dprint x
647c478bd9Sstevel@tonic-gate #endif
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate /*
677c478bd9Sstevel@tonic-gate  * Per AUTOFS mountpoint information.
687c478bd9Sstevel@tonic-gate  */
697c478bd9Sstevel@tonic-gate typedef struct fninfo {
707c478bd9Sstevel@tonic-gate 	struct vfs	*fi_mountvfs;		/* mounted-here VFS */
717c478bd9Sstevel@tonic-gate 	struct vnode	*fi_rootvp;		/* root vnode */
727c478bd9Sstevel@tonic-gate 	struct knetconfig fi_knconf;		/* netconfig */
737c478bd9Sstevel@tonic-gate 	struct netbuf	fi_addr;		/* daemon address */
747c478bd9Sstevel@tonic-gate 	char		*fi_path;		/* autofs mountpoint */
757c478bd9Sstevel@tonic-gate 	char 		*fi_map;		/* context/map-name */
767c478bd9Sstevel@tonic-gate 	char		*fi_subdir;		/* subdir within map */
777c478bd9Sstevel@tonic-gate 	char		*fi_key;		/* key to use on direct maps */
787c478bd9Sstevel@tonic-gate 	char		*fi_opts;		/* default mount options */
797c478bd9Sstevel@tonic-gate 	int		fi_pathlen;		/* autofs mountpoint len */
807c478bd9Sstevel@tonic-gate 	int		fi_maplen;		/* size of context */
817c478bd9Sstevel@tonic-gate 	int		fi_subdirlen;
827c478bd9Sstevel@tonic-gate 	int		fi_keylen;
837c478bd9Sstevel@tonic-gate 	int		fi_optslen;		/* default mount options len */
847c478bd9Sstevel@tonic-gate 	int		fi_refcnt;		/* reference count */
857c478bd9Sstevel@tonic-gate 	int		fi_flags;
867c478bd9Sstevel@tonic-gate 	int		fi_mount_to;
877c478bd9Sstevel@tonic-gate 	int		fi_rpc_to;
887c478bd9Sstevel@tonic-gate 	zoneid_t	fi_zoneid;		/* zone mounted in */
897c478bd9Sstevel@tonic-gate } fninfo_t;
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate /*
927c478bd9Sstevel@tonic-gate  * The AUTOFS locking scheme:
937c478bd9Sstevel@tonic-gate  *
947c478bd9Sstevel@tonic-gate  * The locks:
957c478bd9Sstevel@tonic-gate  * 	fn_lock: protects the fn_node. It must be grabbed to change any
967c478bd9Sstevel@tonic-gate  *		 field on the fn_node, except for those protected by
977c478bd9Sstevel@tonic-gate  *		 fn_rwlock.
987c478bd9Sstevel@tonic-gate  *
997c478bd9Sstevel@tonic-gate  * 	fn_rwlock: readers/writers lock to protect the subdirectory and
1007c478bd9Sstevel@tonic-gate  *		   top level list traversal.
1017c478bd9Sstevel@tonic-gate  *		   Protects: fn_dirents
1027c478bd9Sstevel@tonic-gate  *			     fn_next
1037c478bd9Sstevel@tonic-gate  *		             fn_size
1047c478bd9Sstevel@tonic-gate  *		             fn_linkcnt
1057c478bd9Sstevel@tonic-gate  *                 - Grab readers when checking if certain fn_node exists
1067c478bd9Sstevel@tonic-gate  *                   under fn_dirents.
1077c478bd9Sstevel@tonic-gate  *		   - Grab readers when attempting to reference a node
1087c478bd9Sstevel@tonic-gate  *                   pointed to by fn_dirents, fn_next, and fn_parent.
1097c478bd9Sstevel@tonic-gate  *                 - Grab writers to add a new fnnode under fn_dirents and
1107c478bd9Sstevel@tonic-gate  *		     to remove a node pointed to by fn_dirents or fn_next.
1117c478bd9Sstevel@tonic-gate  *
1126bf33d39SJan Kryl  *	Lock ordering:
1136bf33d39SJan Kryl  *		fn_rwlock > fn_lock
1147c478bd9Sstevel@tonic-gate  *
1157c478bd9Sstevel@tonic-gate  * The flags:
1167c478bd9Sstevel@tonic-gate  *	MF_INPROG:
1177c478bd9Sstevel@tonic-gate  *		- Indicates a mount request has been sent to the daemon.
1187c478bd9Sstevel@tonic-gate  *		- If this flag is set, the thread sets MF_WAITING on the
1197c478bd9Sstevel@tonic-gate  *                fnnode and sleeps.
1207c478bd9Sstevel@tonic-gate  *
1217c478bd9Sstevel@tonic-gate  *	MF_WAITING:
1227c478bd9Sstevel@tonic-gate  *		- Set by a thread when it puts itself to sleep waiting for
1237c478bd9Sstevel@tonic-gate  *		  the ongoing operation on this fnnode to be done.
1247c478bd9Sstevel@tonic-gate  *
1257c478bd9Sstevel@tonic-gate  * 	MF_LOOKUP:
1267c478bd9Sstevel@tonic-gate  * 		- Indicates a lookup request has been sent to the daemon.
1277c478bd9Sstevel@tonic-gate  *		- If this flag is set, the thread sets MF_WAITING on the
1287c478bd9Sstevel@tonic-gate  *                fnnode and sleeps.
1297c478bd9Sstevel@tonic-gate  *
1307c478bd9Sstevel@tonic-gate  *	MF_IK_MOUNT:
1317c478bd9Sstevel@tonic-gate  *		- This flag is set to indicate the mount was done in the
1327c478bd9Sstevel@tonic-gate  *		  kernel, and so should the unmount.
1337c478bd9Sstevel@tonic-gate  *
1347c478bd9Sstevel@tonic-gate  *	MF_DIRECT:
1357c478bd9Sstevel@tonic-gate  *		- Direct mountpoint if set, indirect otherwise.
1367c478bd9Sstevel@tonic-gate  *
1377c478bd9Sstevel@tonic-gate  *	MF_TRIGGER:
1387c478bd9Sstevel@tonic-gate  *		- This is a trigger node.
1397c478bd9Sstevel@tonic-gate  *
1407c478bd9Sstevel@tonic-gate  *	MF_THISUID_MATCH_RQD:
1417c478bd9Sstevel@tonic-gate  *		- User-relative context binding kind of node.
1427c478bd9Sstevel@tonic-gate  *		- Node with this flag set requires a name match as well
1437c478bd9Sstevel@tonic-gate  *		  as a cred match in order to be returned from the directory
1447c478bd9Sstevel@tonic-gate  *		  hierarchy.
1457c478bd9Sstevel@tonic-gate  *
1467c478bd9Sstevel@tonic-gate  * 	MF_MOUNTPOINT:
1477c478bd9Sstevel@tonic-gate  * 		- At some point automountd mounted a filesystem on this node.
1487c478bd9Sstevel@tonic-gate  * 		If fn_trigger is non-NULL, v_vfsmountedhere is NULL and this
1497c478bd9Sstevel@tonic-gate  * 		flag is set then the filesystem must have been forcibly
1507c478bd9Sstevel@tonic-gate  * 		unmounted.
1517c478bd9Sstevel@tonic-gate  */
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate /*
1547c478bd9Sstevel@tonic-gate  * The inode of AUTOFS
1557c478bd9Sstevel@tonic-gate  */
1567c478bd9Sstevel@tonic-gate typedef struct fnnode {
1577c478bd9Sstevel@tonic-gate 	char		*fn_name;
1587c478bd9Sstevel@tonic-gate 	char		*fn_symlink;		/* if VLNK, this is what it */
1597c478bd9Sstevel@tonic-gate 						/* points to */
1607c478bd9Sstevel@tonic-gate 	int		fn_namelen;
1617c478bd9Sstevel@tonic-gate 	int		fn_symlinklen;
1627c478bd9Sstevel@tonic-gate 	uint_t		fn_linkcnt;		/* link count */
1637c478bd9Sstevel@tonic-gate 	mode_t		fn_mode;		/* file mode bits */
1647c478bd9Sstevel@tonic-gate 	uid_t		fn_uid;			/* owner's uid */
1657c478bd9Sstevel@tonic-gate 	gid_t		fn_gid;			/* group's uid */
1667c478bd9Sstevel@tonic-gate 	int		fn_error;		/* mount/lookup error */
1677c478bd9Sstevel@tonic-gate 	ino_t		fn_nodeid;
1687c478bd9Sstevel@tonic-gate 	off_t		fn_offset;		/* offset into directory */
1697c478bd9Sstevel@tonic-gate 	int		fn_flags;
1707c478bd9Sstevel@tonic-gate 	uint_t		fn_size;		/* size of directory */
1717c478bd9Sstevel@tonic-gate 	struct vnode	*fn_vnode;
1727c478bd9Sstevel@tonic-gate 	struct fnnode	*fn_parent;
1737c478bd9Sstevel@tonic-gate 	struct fnnode	*fn_next;		/* sibling */
1747c478bd9Sstevel@tonic-gate 	struct fnnode	*fn_dirents;		/* children */
1757c478bd9Sstevel@tonic-gate 	struct fnnode	*fn_trigger; 		/* pointer to next level */
1767c478bd9Sstevel@tonic-gate 						/* AUTOFS trigger nodes */
1777c478bd9Sstevel@tonic-gate 	struct action_list *fn_alp;		/* Pointer to mount info */
1787c478bd9Sstevel@tonic-gate 						/* used for remounting */
1797c478bd9Sstevel@tonic-gate 						/* trigger nodes */
1807c478bd9Sstevel@tonic-gate 	cred_t		*fn_cred;		/* pointer to cred, used for */
1817c478bd9Sstevel@tonic-gate 						/* "thisuser" processing */
1827c478bd9Sstevel@tonic-gate 	krwlock_t	fn_rwlock;		/* protects list traversal */
1837c478bd9Sstevel@tonic-gate 	kmutex_t	fn_lock;		/* protects the fnnode */
1847c478bd9Sstevel@tonic-gate 	timestruc_t	fn_atime;
1857c478bd9Sstevel@tonic-gate 	timestruc_t	fn_mtime;
1867c478bd9Sstevel@tonic-gate 	timestruc_t	fn_ctime;
1877c478bd9Sstevel@tonic-gate 	time_t		fn_ref_time;		/* time last referenced */
1887c478bd9Sstevel@tonic-gate 	time_t		fn_unmount_ref_time;	/* last time unmount was done */
1897c478bd9Sstevel@tonic-gate 	kcondvar_t	fn_cv_mount;		/* mount blocking variable */
1907c478bd9Sstevel@tonic-gate 	struct vnode	*fn_seen;		/* vnode already traversed */
1917c478bd9Sstevel@tonic-gate 	kthread_t	*fn_thread;		/* thread that has currently */
1927c478bd9Sstevel@tonic-gate 						/* modified fn_seen */
1937c478bd9Sstevel@tonic-gate 	struct autofs_globals *fn_globals;	/* global variables */
1947c478bd9Sstevel@tonic-gate } fnnode_t;
1957c478bd9Sstevel@tonic-gate 
19639d3e169Sevanl 
1977c478bd9Sstevel@tonic-gate #define	vntofn(vp)	((struct fnnode *)((vp)->v_data))
1987c478bd9Sstevel@tonic-gate #define	fntovn(fnp)	(((fnp)->fn_vnode))
1997c478bd9Sstevel@tonic-gate #define	vfstofni(vfsp)	((struct fninfo *)((vfsp)->vfs_data))
2007c478bd9Sstevel@tonic-gate 
2017c478bd9Sstevel@tonic-gate #define	MF_DIRECT	0x001
2027c478bd9Sstevel@tonic-gate #define	MF_INPROG	0x002		/* Mount in progress */
2037c478bd9Sstevel@tonic-gate #define	MF_WAITING	0x004
2047c478bd9Sstevel@tonic-gate #define	MF_LOOKUP	0x008		/* Lookup in progress */
2057c478bd9Sstevel@tonic-gate #define	MF_ATTR_WAIT	0x010
2067c478bd9Sstevel@tonic-gate #define	MF_IK_MOUNT	0x040
2077c478bd9Sstevel@tonic-gate #define	MF_TRIGGER	0x080
2087c478bd9Sstevel@tonic-gate #define	MF_THISUID_MATCH_RQD	0x100	/* UID match required for this node */
2097c478bd9Sstevel@tonic-gate 					/* required for thisuser kind of */
2107c478bd9Sstevel@tonic-gate 					/* nodes */
2117c478bd9Sstevel@tonic-gate #define	MF_MOUNTPOINT	0x200		/* Node is/was a mount point */
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate #define	AUTOFS_MODE		0555
2147c478bd9Sstevel@tonic-gate #define	AUTOFS_BLOCKSIZE	1024
2157c478bd9Sstevel@tonic-gate 
2167c478bd9Sstevel@tonic-gate struct autofs_callargs {
2177c478bd9Sstevel@tonic-gate 	fnnode_t	*fnc_fnp;	/* fnnode */
2187c478bd9Sstevel@tonic-gate 	char		*fnc_name;	/* path to lookup/mount */
2197c478bd9Sstevel@tonic-gate 	kthread_t	*fnc_origin;	/* thread that fired up this thread */
2207c478bd9Sstevel@tonic-gate 					/* used for debugging purposes */
2217c478bd9Sstevel@tonic-gate 	cred_t		*fnc_cred;
2227c478bd9Sstevel@tonic-gate };
2237c478bd9Sstevel@tonic-gate 
2247c478bd9Sstevel@tonic-gate struct autofs_globals {
2257c478bd9Sstevel@tonic-gate 	fnnode_t		*fng_rootfnnodep;
2267c478bd9Sstevel@tonic-gate 	int			fng_fnnode_count;
2277c478bd9Sstevel@tonic-gate 	int			fng_printed_not_running_msg;
2287c478bd9Sstevel@tonic-gate 	kmutex_t		fng_unmount_threads_lock;
2297c478bd9Sstevel@tonic-gate 	int			fng_unmount_threads;
2307c478bd9Sstevel@tonic-gate 	int			fng_verbose;
2317c478bd9Sstevel@tonic-gate 	zoneid_t		fng_zoneid;
23239d3e169Sevanl 	pid_t			fng_autofs_pid;
23339d3e169Sevanl 	kmutex_t		fng_autofs_daemon_lock;
23439d3e169Sevanl 	/*
23539d3e169Sevanl 	 * autofs_daemon_lock protects fng_autofs_daemon_dh
23639d3e169Sevanl 	 */
23739d3e169Sevanl 	door_handle_t		fng_autofs_daemon_dh;
2387c478bd9Sstevel@tonic-gate };
2397c478bd9Sstevel@tonic-gate 
240780213fbSevanl extern kmutex_t autofs_minor_lock;
2417c478bd9Sstevel@tonic-gate extern zone_key_t autofs_key;
2427c478bd9Sstevel@tonic-gate 
2437c478bd9Sstevel@tonic-gate /*
2447c478bd9Sstevel@tonic-gate  * Sets the MF_INPROG flag on this fnnode.
2457c478bd9Sstevel@tonic-gate  * fnp->fn_lock should be held before this macro is called,
2467c478bd9Sstevel@tonic-gate  * operation is either MF_INPROG or MF_LOOKUP.
2477c478bd9Sstevel@tonic-gate  */
2487c478bd9Sstevel@tonic-gate #define	AUTOFS_BLOCK_OTHERS(fnp, operation)	{ \
2497c478bd9Sstevel@tonic-gate 	ASSERT(MUTEX_HELD(&(fnp)->fn_lock)); \
2507c478bd9Sstevel@tonic-gate 	ASSERT(!((fnp)->fn_flags & operation)); \
2517c478bd9Sstevel@tonic-gate 	(fnp)->fn_flags |= (operation); \
2527c478bd9Sstevel@tonic-gate }
2537c478bd9Sstevel@tonic-gate 
2547c478bd9Sstevel@tonic-gate #define	AUTOFS_UNBLOCK_OTHERS(fnp, operation)	{ \
2557c478bd9Sstevel@tonic-gate 	auto_unblock_others((fnp), (operation)); \
2567c478bd9Sstevel@tonic-gate }
2577c478bd9Sstevel@tonic-gate 
2587c478bd9Sstevel@tonic-gate extern struct vnodeops *auto_vnodeops;
2597c478bd9Sstevel@tonic-gate extern const struct fs_operation_def auto_vnodeops_template[];
2607c478bd9Sstevel@tonic-gate 
2617c478bd9Sstevel@tonic-gate /*
2627c478bd9Sstevel@tonic-gate  * Utility routines
2637c478bd9Sstevel@tonic-gate  */
2647c478bd9Sstevel@tonic-gate extern int auto_search(fnnode_t *, char *, fnnode_t **, cred_t *);
2657c478bd9Sstevel@tonic-gate extern int auto_enter(fnnode_t *, char *, fnnode_t **, cred_t *);
2667c478bd9Sstevel@tonic-gate extern void auto_unblock_others(fnnode_t *, uint_t);
2677c478bd9Sstevel@tonic-gate extern int auto_wait4mount(fnnode_t *);
2687c478bd9Sstevel@tonic-gate extern fnnode_t *auto_makefnnode(vtype_t, vfs_t *, char *, cred_t *,
2697c478bd9Sstevel@tonic-gate     struct autofs_globals *);
2707c478bd9Sstevel@tonic-gate extern void auto_freefnnode(fnnode_t *);
2717c478bd9Sstevel@tonic-gate extern void auto_disconnect(fnnode_t *, fnnode_t *);
2727c478bd9Sstevel@tonic-gate extern void auto_do_unmount(struct autofs_globals *);
27339d3e169Sevanl /*PRINTFLIKE4*/
27439d3e169Sevanl extern void auto_log(int verbose, zoneid_t zoneid, int level,
27539d3e169Sevanl 	const char *fmt, ...)
27639d3e169Sevanl     __KPRINTFLIKE(4);
2777c478bd9Sstevel@tonic-gate /*PRINTFLIKE2*/
2787c478bd9Sstevel@tonic-gate extern void auto_dprint(int level, const char *fmt, ...)
2797c478bd9Sstevel@tonic-gate     __KPRINTFLIKE(2);
28039d3e169Sevanl extern int auto_calldaemon(zoneid_t, int, xdrproc_t, void *, xdrproc_t,
28139d3e169Sevanl 	void *, int, bool_t);
2827c478bd9Sstevel@tonic-gate extern int auto_lookup_aux(fnnode_t *, char *, cred_t *);
2837c478bd9Sstevel@tonic-gate extern void auto_new_mount_thread(fnnode_t *, char *, cred_t *);
2847c478bd9Sstevel@tonic-gate extern int auto_nobrowse_option(char *);
2857c478bd9Sstevel@tonic-gate 
286f798ee53SJan Kryl extern int unmount_subtree(fnnode_t *, boolean_t);
287f798ee53SJan Kryl extern void unmount_tree(struct autofs_globals *, boolean_t);
2887c478bd9Sstevel@tonic-gate extern void autofs_free_globals(struct autofs_globals *);
2897c478bd9Sstevel@tonic-gate extern void autofs_shutdown_zone(struct autofs_globals *);
2907c478bd9Sstevel@tonic-gate 
2917c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
2927c478bd9Sstevel@tonic-gate 
29339d3e169Sevanl /*
29439d3e169Sevanl  * autofs structures and defines needed for use with doors.
29539d3e169Sevanl  */
29639d3e169Sevanl #define	AUTOFS_NULL	0
29739d3e169Sevanl #define	AUTOFS_MOUNT	1
29839d3e169Sevanl #define	AUTOFS_UNMOUNT	2
29939d3e169Sevanl #define	AUTOFS_READDIR	3
30039d3e169Sevanl #define	AUTOFS_LOOKUP	4
30139d3e169Sevanl #define	AUTOFS_SRVINFO	5
30239d3e169Sevanl #define	AUTOFS_MNTINFO	6
30339d3e169Sevanl 
30439d3e169Sevanl /*
30539d3e169Sevanl  * autofs_door_args is a generic structure used to grab the command
30639d3e169Sevanl  * from any of the argument structures passed in.
30739d3e169Sevanl  */
30839d3e169Sevanl 
30939d3e169Sevanl typedef struct {
31039d3e169Sevanl 	int cmd;
31139d3e169Sevanl 	int xdr_len;
31239d3e169Sevanl 	char xdr_arg[1];	/* buffer holding xdr encoded data */
31339d3e169Sevanl } autofs_door_args_t;
31439d3e169Sevanl 
31539d3e169Sevanl 
31639d3e169Sevanl typedef struct {
31739d3e169Sevanl 	int res_status;
31839d3e169Sevanl 	int xdr_len;
31939d3e169Sevanl 	char xdr_res[1];	/* buffer holding xdr encoded data */
32039d3e169Sevanl } autofs_door_res_t;
32139d3e169Sevanl 
32239d3e169Sevanl typedef enum autofs_res autofs_res_t;
32339d3e169Sevanl typedef enum autofs_stat autofs_stat_t;
32439d3e169Sevanl typedef enum autofs_action autofs_action_t;
32539d3e169Sevanl 
32639d3e169Sevanl typedef struct {
32739d3e169Sevanl 	void *	atsd_buf;
32839d3e169Sevanl 	size_t	atsd_len;
32939d3e169Sevanl } autofs_tsd_t;
33039d3e169Sevanl 
33139d3e169Sevanl typedef struct sec_desdata {
33239d3e169Sevanl 	int		nd_sec_syncaddr_len;
33339d3e169Sevanl 	int		nd_sec_knc_semantics;
33439d3e169Sevanl 	int		nd_sec_netnamelen;
33539d3e169Sevanl 	uint64_t	nd_sec_knc_rdev;
33639d3e169Sevanl 	int		nd_sec_knc_unused[8];
33739d3e169Sevanl } sec_desdata_t;
33839d3e169Sevanl 
33939d3e169Sevanl typedef struct sec_gssdata {
34039d3e169Sevanl 	int			element_length;
34139d3e169Sevanl 	rpc_gss_service_t	service;
34239d3e169Sevanl 	char			uname[MAX_NAME_LEN];
34339d3e169Sevanl 	char			inst[MAX_NAME_LEN];
34439d3e169Sevanl 	char			realm[MAX_NAME_LEN];
34539d3e169Sevanl 	uint_t			qop;
34639d3e169Sevanl } sec_gssdata_t;
34739d3e169Sevanl 
34839d3e169Sevanl typedef struct nfs_secdata  {
34939d3e169Sevanl 	sec_desdata_t	nfs_des_clntdata;
35039d3e169Sevanl 	sec_gssdata_t	nfs_gss_clntdata;
35139d3e169Sevanl } nfs_secdata_t;
35239d3e169Sevanl 
3537c478bd9Sstevel@tonic-gate /*
3547c478bd9Sstevel@tonic-gate  * Comma separated list of mntoptions which are inherited when the
3557c478bd9Sstevel@tonic-gate  * "restrict" option is present.  The RESTRICT option must be first!
3567c478bd9Sstevel@tonic-gate  * This define is shared between the kernel and the automount daemon.
3577c478bd9Sstevel@tonic-gate  */
3587c478bd9Sstevel@tonic-gate #define	RESTRICTED_MNTOPTS	\
3597c478bd9Sstevel@tonic-gate 	MNTOPT_RESTRICT, MNTOPT_NOSUID, MNTOPT_NOSETUID, MNTOPT_NODEVICES
3607c478bd9Sstevel@tonic-gate 
3617c478bd9Sstevel@tonic-gate /*
3627c478bd9Sstevel@tonic-gate  * AUTOFS syscall entry point
3637c478bd9Sstevel@tonic-gate  */
36439d3e169Sevanl enum autofssys_op { AUTOFS_UNMOUNTALL, AUTOFS_SETDOOR };
3657c478bd9Sstevel@tonic-gate 
3667c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
3677c478bd9Sstevel@tonic-gate extern int autofssys(enum autofssys_op, uintptr_t);
3687c478bd9Sstevel@tonic-gate 
3697c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
3707c478bd9Sstevel@tonic-gate 
3717c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3727c478bd9Sstevel@tonic-gate }
3737c478bd9Sstevel@tonic-gate #endif
3747c478bd9Sstevel@tonic-gate 
3757c478bd9Sstevel@tonic-gate #endif	/* _SYS_FS_AUTOFS_H */
376