1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
23 * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27/*
28 * Portions Copyright 2007-2011 Apple Inc.
29 */
30
31/*
32 * Information kept for each trigger vnode.
33 */
34typedef struct trigger_info trigger_info_t;
35
36extern trigger_info_t *trigger_new(struct vnode_trigger_param *vnt,
37    void *(*get_mount_args)(vnode_t, vfs_context_t, int *),
38    void (*rel_mount_args)(void *));
39extern void trigger_free(trigger_info_t *ti);
40
41/*
42 * The arguments passed to the thread routine that calls up to automountd
43 * to resolve the trigger are assumed to be in a structure the first
44 * element of which is one of these structures.
45 */
46struct trigger_callargs {
47	vnode_t		tc_vp;		/* trigger vnode */
48	fsid_t		tc_this_fsid;	/* fsid of file system with trigger vnode */
49	trigger_info_t	*tc_ti;		/* trigger information */
50	thread_t	tc_origin;	/* thread that fired up this thread */
51					/* used for debugging purposes */
52	uid_t		tc_uid;         /* Calling threads uid */
53	au_asid_t	tc_asid;	/* and audit session id. */
54					/* The two above fields are so that we can set a worker */
55					/* processes to have the same uid and audit session */
56					/* and thus be in the right security session for authentication */
57	fsid_t		tc_mounted_fsid;/* fsid of newly-mounted file system */
58	uint32_t	tc_retflags;	/* assorted MOUNT_RETF_ flags */
59};
60
61/*
62 * Arguments passed to thread routine to call up to automountd to mount
63 * an arbitrary URL on an arbitrary path.
64 */
65struct mount_url_callargs {
66	struct trigger_callargs muc_t;	/* common args */
67	char		*muc_url;	/* URL to mount */
68	char		*muc_mountpoint; /* where to mount it */
69	char		*muc_opts;	/* mount options to use; null string if none */
70};
71
72#define muc_this_fsid		muc_t.tc_this_fsid
73#define muc_origin		muc_t.tc_origin
74#define muc_uid			muc_t.tc_uid
75#define muc_asid		muc_t.tc_asid
76#define muc_mounted_fsid	muc_t.tc_mounted_fsid
77#define muc_retflags		muc_t.tc_retflags
78
79/*
80 * Make an upcall to automountd to call SMBRemountServer() from the
81 * SMB client framework.
82 */
83extern int SMBRemountServer(const void *ptr, size_t len, au_asid_t asid);
84