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 1993-1999, 2002 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27/*
28 * From OpenSolaris
29 *
30 * #pragma ident	"@(#)autofs_prot.x	1.20	05/06/08 SMI"
31 */
32
33/*
34 * Portions Copyright 2007-2011 Apple Inc.
35 */
36
37subsystem KernelUser autofs 666;
38
39#include <mach/std_types.defs>
40#include <mach/mach_types.defs>
41
42#include <sys/syslimits.h>
43#include "autofs_defs.h"
44#include "autofs_migtypes.h"
45
46import <autofs_types.h>;
47
48/*
49 * AUTOFS routines.
50 */
51
52/*
53 * Mount request.
54 * Request automountd to mount the map entry associated with
55 * 'path/subdir/name' in 'map' given 'opts' options.
56 */
57routine autofs_mount(
58	server		: mach_port_t;
59	in map		: autofs_pathname;	/* context or map name */
60	in path		: autofs_pathname;	/* mountpoint */
61	in name		: autofs_component;	/* entry we're looking for */
62	in subdir	: autofs_pathname;	/* subdir within map */
63	in opts		: autofs_opts;
64	in isdirect	: boolean_t;		/* direct mountpoint? */
65	in issubtrigger	: boolean_t;		/* is this a subtrigger? */
66	in mntpnt_fsid	: fsid_t;		/* fsid of FS on which we're mounting */
67	in sendereuid	: uint32_t;		/* EUID of process sending request */
68	in auditsesid	: int32_t;		/* audit session id of the process sending request */
69	out mr_type	: int;			/* enum autofs_stat */
70	out fsid	: fsid_t;		/* fsid of FS we mounted */
71	out retflags	: uint32_t;		/* assorted MOUNT_RETF_ flags */
72	out actions	: byte_buffer, dealloc;	/* variable number of entries */
73	out err		: int;
74	out mr_verbose	: boolean_t;
75	ServerSecToken token : security_token_t
76);
77
78/*
79 * Unmount request.
80 * Automountd will issue unmount system call for the file system with the
81 * given fsid with the given fstype, etc..
82 * Status returned is 0 if the unmount was successful, an errno otherwise.
83 */
84routine autofs_unmount(
85	server		: mach_port_t;
86	in mntpnt_fsid	: fsid_t;		/* mntpnt fsid */
87	in mntresource	: autofs_pathname;	/* mntpnt source */
88	in mntpnt	: autofs_pathname;	/* mntpnt to unmount */
89	in fstype	: autofs_fstype;	/* filesystem type to unmount */
90	in mntopts	: autofs_opts;		/* mntpnt options */
91	out status	: int;
92	ServerSecToken token : security_token_t
93);
94
95/*
96 * Readdir request.
97 * Request list of entries in 'rda_map' map starting at the given
98 * offset 'rda_offset', for 'rda_count' bytes.
99 */
100routine autofs_readdir(
101	server			: mach_port_t;
102	in rda_map		: autofs_pathname;
103	in rda_offset		: int64_t;	/* starting offset */
104	in rda_count		: uint32_t;	/* total size requested */
105	out status		: int;
106	out rddir_offset	: int64_t;	/* last offset in list */
107	out rddir_eof		: boolean_t;	/* TRUE if last entry in result */
108	out rddir_entries	: byte_buffer, dealloc;
109						/* variable number of entries */
110	ServerSecToken token : security_token_t
111);
112
113/*
114 * Readdir request for subdirectories under a map.
115 * Request list of entries in 'rda_map' map entry 'rda_key' underneath
116 * the subdirectory 'rda_subdir',  starting at the given offset 'rda_offset',
117 * for 'rda_count' bytes.
118 */
119routine autofs_readsubdir(
120	server			: mach_port_t;
121	in rda_map		: autofs_pathname;
122	in rda_name		: autofs_component;	/* entry we're looking for */
123	in rda_subdir		: autofs_pathname;	/* subdir within map */
124	in rda_mntopts		: autofs_opts;		/* mntpnt options */
125	in rda_parentino	: uint32_t;		/* (lower 32 bits of) parent inode number */
126	in rda_offset		: int64_t;		/* starting offset */
127	in rda_count		: uint32_t;		/* total size requested */
128	out status		: int;
129	out rddir_offset	: int64_t;		/* last offset in list */
130	out rddir_eof		: boolean_t;		/* TRUE if last entry in result */
131	out rddir_entries	: byte_buffer, dealloc;
132							/* variable number of entries */
133	ServerSecToken token : security_token_t
134);
135
136/*
137 * Lookup request.
138 * Query automountd if 'subdir/name' exists in 'map'
139 */
140routine autofs_lookup(
141	server		: mach_port_t;
142	in map		: autofs_pathname;	/* context or map name */
143	in path		: autofs_pathname;	/* mountpoint */
144	in name		: autofs_component;	/* entry we're looking for */
145	in subdir	: autofs_pathname;	/* subdir within map */
146	in opts		: autofs_opts;
147	in isdirect	: boolean_t;		/* direct mountpoint? */
148	in sendereuid	: uint32_t;		/* EUID of process sending request */
149	out err		: int;
150	out node_type	: int;
151	out lu_verbose	: boolean_t;
152	ServerSecToken token : security_token_t
153);
154
155/*
156 * Mount-submount-trigger request.
157 * Request automountd to mount autofs as a trigger on submntpt under
158 * mntpt.
159 */
160routine autofs_mount_subtrigger(
161	server		: mach_port_t;
162	in mntpt	: autofs_pathname;	/* top-level mount point */
163	in submntpt	: autofs_pathname;	/* submount point relative to mntpt */
164	in path		: autofs_pathname;	/* path mount argument */
165	in opts		: autofs_opts;		/* opts mount argument */
166	in map		: autofs_pathname;	/* map mount argument */
167	in subdir	: autofs_pathname;	/* subdir mount argument */
168	in key		: autofs_pathname;	/* key mount argument */
169	in flags	: uint32_t;		/* flags argument to mount() */
170	in mntflags	: uint32_t;		/* mntflags mount argument */
171	in direct	: int32_t;		/* direct mount argument */
172	out fsid	: fsid_t;		/* fsid of FS we mounted */
173	out top_level	: boolean_t;		/* true if submntpt empty */
174	out err		: int;
175	ServerSecToken token : security_token_t
176);
177
178/*
179 * "Mount URL" request.
180 * Request automountd to mount the specified URL at the specified mount
181 * point with the specified options.
182 */
183routine autofs_mount_url(
184	server		: mach_port_t;
185	in url		: autofs_pathname;	/* URL to mount */
186	in mountpoint	: autofs_pathname;	/* mountpoint */
187	in opts		: autofs_opts;		/* mount options; null string if none */
188	in mntpnt_fsid	: fsid_t;		/* fsid of FS on which we're mounting */
189	in sendereuid	: uint32_t;		/* EUID of process sending request */
190	in auditsesid	: int32_t;		/* audit session id of the process sending request */
191	out fsid	: fsid_t;		/* fsid of FS we mounted */
192	out retflags	: uint32_t;		/* assorted MOUNT_RETF_ flags */
193	out err		: int;
194	ServerSecToken token : security_token_t
195);
196
197/*
198 * "Remount SMB server" request.
199 * Request that automountd call SMBRemountServer() with the blob passed
200 * in as an argument.
201 */
202simpleroutine autofs_smb_remount_server(
203	server		: mach_port_t;
204	in blob		: byte_buffer, dealloc;	/* opaque blob */
205	in asid		: int32_t;  /* Audit session id of caller */
206	ServerSecToken token : security_token_t
207);
208