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