xref: /dflybsd-src/sys/vfs/autofs/autofs_ioctl.h (revision 63bc498493e0888c7c5cc0b504fac8c967c31e74)
1e2950f41STomohiro Kusumi /*-
2*63bc4984STomohiro Kusumi  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3*63bc4984STomohiro Kusumi  *
449837aefSTomohiro Kusumi  * Copyright (c) 2016 Tomohiro Kusumi <tkusumi@netbsd.org>
5e2950f41STomohiro Kusumi  * Copyright (c) 2016 The DragonFly Project
6e2950f41STomohiro Kusumi  * Copyright (c) 2013 The FreeBSD Foundation
7e2950f41STomohiro Kusumi  * All rights reserved.
8e2950f41STomohiro Kusumi  *
9e2950f41STomohiro Kusumi  * This software was developed by Edward Tomasz Napierala under sponsorship
10e2950f41STomohiro Kusumi  * from the FreeBSD Foundation.
11e2950f41STomohiro Kusumi  *
12e2950f41STomohiro Kusumi  * Redistribution and use in source and binary forms, with or without
13e2950f41STomohiro Kusumi  * modification, are permitted provided that the following conditions
14e2950f41STomohiro Kusumi  * are met:
15e2950f41STomohiro Kusumi  * 1. Redistributions of source code must retain the above copyright
16e2950f41STomohiro Kusumi  *    notice, this list of conditions and the following disclaimer.
17e2950f41STomohiro Kusumi  * 2. Redistributions in binary form must reproduce the above copyright
18e2950f41STomohiro Kusumi  *    notice, this list of conditions and the following disclaimer in the
19e2950f41STomohiro Kusumi  *    documentation and/or other materials provided with the distribution.
20e2950f41STomohiro Kusumi  *
21e2950f41STomohiro Kusumi  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22e2950f41STomohiro Kusumi  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23e2950f41STomohiro Kusumi  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24e2950f41STomohiro Kusumi  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25e2950f41STomohiro Kusumi  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26e2950f41STomohiro Kusumi  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27e2950f41STomohiro Kusumi  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28e2950f41STomohiro Kusumi  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29e2950f41STomohiro Kusumi  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30e2950f41STomohiro Kusumi  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31e2950f41STomohiro Kusumi  * SUCH DAMAGE.
32e2950f41STomohiro Kusumi  *
33e2950f41STomohiro Kusumi  * $FreeBSD$
34e2950f41STomohiro Kusumi  */
35e2950f41STomohiro Kusumi 
36e2950f41STomohiro Kusumi #ifndef AUTOFS_IOCTL_H
37e2950f41STomohiro Kusumi #define AUTOFS_IOCTL_H
38e2950f41STomohiro Kusumi 
39e2950f41STomohiro Kusumi #include <sys/param.h>
40e2950f41STomohiro Kusumi #include <sys/ioccom.h>
41e2950f41STomohiro Kusumi 
42e2950f41STomohiro Kusumi #define AUTOFS_PATH	"/dev/autofs"
43e2950f41STomohiro Kusumi 
44e2950f41STomohiro Kusumi struct autofs_daemon_request {
45e2950f41STomohiro Kusumi 	/*
46e2950f41STomohiro Kusumi 	 * Request identifier.
47e2950f41STomohiro Kusumi 	 */
48e2950f41STomohiro Kusumi 	int		adr_id;
49e2950f41STomohiro Kusumi 
50e2950f41STomohiro Kusumi 	/*
51e2950f41STomohiro Kusumi 	 * The "from" field, containing map name.  For example,
52e2950f41STomohiro Kusumi 	 * when accessing '/net/192.168.1.3/tank/vm/', that would
53e2950f41STomohiro Kusumi 	 * be '-hosts'.
54e2950f41STomohiro Kusumi 	 */
55e2950f41STomohiro Kusumi 	char		adr_from[MAXPATHLEN];
56e2950f41STomohiro Kusumi 
57e2950f41STomohiro Kusumi 	/*
58e2950f41STomohiro Kusumi 	 * Full path to the node being looked up; for requests that result
59e2950f41STomohiro Kusumi 	 * in actual mount it is the full mount path.
60e2950f41STomohiro Kusumi 	 */
61e2950f41STomohiro Kusumi 	char		adr_path[MAXPATHLEN];
62e2950f41STomohiro Kusumi 
63e2950f41STomohiro Kusumi 	/*
64e2950f41STomohiro Kusumi 	 * Prefix, which is basically the mountpoint from auto_master(5).
65e2950f41STomohiro Kusumi 	 * In example above that would be "/net"; for direct maps it is "/".
66e2950f41STomohiro Kusumi 	 */
67e2950f41STomohiro Kusumi 	char		adr_prefix[MAXPATHLEN];
68e2950f41STomohiro Kusumi 
69e2950f41STomohiro Kusumi 	/*
70e2950f41STomohiro Kusumi 	 * Map key, also used as command argument for dynamic maps; in example
71e2950f41STomohiro Kusumi 	 * above that would be '192.168.1.3'.
72e2950f41STomohiro Kusumi 	 */
73e2950f41STomohiro Kusumi 	char		adr_key[MAXPATHLEN];
74e2950f41STomohiro Kusumi 
75e2950f41STomohiro Kusumi 	/*
76e2950f41STomohiro Kusumi 	 * Mount options from auto_master(5).
77e2950f41STomohiro Kusumi 	 */
78e2950f41STomohiro Kusumi 	char		adr_options[MAXPATHLEN];
79e2950f41STomohiro Kusumi };
80e2950f41STomohiro Kusumi 
81e2950f41STomohiro Kusumi struct autofs_daemon_done {
82e2950f41STomohiro Kusumi 	/*
83e2950f41STomohiro Kusumi 	 * Identifier, copied from adr_id.
84e2950f41STomohiro Kusumi 	 */
85e2950f41STomohiro Kusumi 	int		add_id;
86e2950f41STomohiro Kusumi 
87e2950f41STomohiro Kusumi 	/*
88e2950f41STomohiro Kusumi 	 * Set to 1 if the map may contain wildcard entries;
89e2950f41STomohiro Kusumi 	 * otherwise autofs will do negative caching.
90e2950f41STomohiro Kusumi 	 */
91e2950f41STomohiro Kusumi 	int		add_wildcards;
92e2950f41STomohiro Kusumi 
93e2950f41STomohiro Kusumi 	/*
94e2950f41STomohiro Kusumi 	 * Error number, possibly returned to userland.
95e2950f41STomohiro Kusumi 	 */
96e2950f41STomohiro Kusumi 	int		add_error;
97e2950f41STomohiro Kusumi 
98e2950f41STomohiro Kusumi 	/*
99e2950f41STomohiro Kusumi 	 * Reserved for future use.
100e2950f41STomohiro Kusumi 	 */
101e2950f41STomohiro Kusumi 	int		add_spare[7];
102e2950f41STomohiro Kusumi };
103e2950f41STomohiro Kusumi 
104e2950f41STomohiro Kusumi #define AUTOFSREQUEST	_IOR('I', 0x01, struct autofs_daemon_request)
105e2950f41STomohiro Kusumi #define AUTOFSDONE	_IOW('I', 0x03, struct autofs_daemon_done)
106e2950f41STomohiro Kusumi 
107e2950f41STomohiro Kusumi #endif /* !AUTOFS_IOCTL_H */
108