1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
3 * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
5 * This file is part of the Linux kernel and is made available under
6 * the terms of the GNU General Public License, version 2, or at your
7 * option, any later version, incorporated herein by reference.
10 #ifndef _LINUX_AUTO_FS4_H
11 #define _LINUX_AUTO_FS4_H
13 /* Include common v3 definitions */
14 #include <linux/types.h>
15 #include <linux/auto_fs.h>
17 /* autofs v4 definitions */
18 #undef AUTOFS_PROTO_VERSION
19 #undef AUTOFS_MIN_PROTO_VERSION
20 #undef AUTOFS_MAX_PROTO_VERSION
22 #define AUTOFS_PROTO_VERSION 5
23 #define AUTOFS_MIN_PROTO_VERSION 3
24 #define AUTOFS_MAX_PROTO_VERSION 5
26 #define AUTOFS_PROTO_SUBVERSION 2
28 /* Mask for expire behaviour */
29 #define AUTOFS_EXP_IMMEDIATE 1
30 #define AUTOFS_EXP_LEAVES 2
32 #define AUTOFS_TYPE_ANY 0U
33 #define AUTOFS_TYPE_INDIRECT 1U
34 #define AUTOFS_TYPE_DIRECT 2U
35 #define AUTOFS_TYPE_OFFSET 4U
37 static inline void set_autofs_type_indirect(unsigned int *type
)
39 *type
= AUTOFS_TYPE_INDIRECT
;
42 static inline unsigned int autofs_type_indirect(unsigned int type
)
44 return (type
== AUTOFS_TYPE_INDIRECT
);
47 static inline void set_autofs_type_direct(unsigned int *type
)
49 *type
= AUTOFS_TYPE_DIRECT
;
52 static inline unsigned int autofs_type_direct(unsigned int type
)
54 return (type
== AUTOFS_TYPE_DIRECT
);
57 static inline void set_autofs_type_offset(unsigned int *type
)
59 *type
= AUTOFS_TYPE_OFFSET
;
62 static inline unsigned int autofs_type_offset(unsigned int type
)
64 return (type
== AUTOFS_TYPE_OFFSET
);
67 static inline unsigned int autofs_type_trigger(unsigned int type
)
69 return (type
== AUTOFS_TYPE_DIRECT
|| type
== AUTOFS_TYPE_OFFSET
);
73 * This isn't really a type as we use it to say "no type set" to
74 * indicate we want to search for "any" mount in the
75 * autofs_dev_ioctl_ismountpoint() device ioctl function.
77 static inline void set_autofs_type_any(unsigned int *type
)
79 *type
= AUTOFS_TYPE_ANY
;
82 static inline unsigned int autofs_type_any(unsigned int type
)
84 return (type
== AUTOFS_TYPE_ANY
);
87 /* Daemon notification packet types */
94 /* Kernel protocol version 4 packet types */
96 /* Expire entry (umount request) */
97 #define autofs_ptype_expire_multi 2
99 /* Kernel protocol version 5 packet types */
101 /* Indirect mount missing and expire requests. */
102 #define autofs_ptype_missing_indirect 3
103 #define autofs_ptype_expire_indirect 4
105 /* Direct mount missing and expire requests */
106 #define autofs_ptype_missing_direct 5
107 #define autofs_ptype_expire_direct 6
109 /* v4 multi expire (via pipe) */
110 struct autofs_packet_expire_multi
{
111 struct autofs_packet_hdr hdr
;
112 autofs_wqt_t wait_queue_token
;
114 char name
[NAME_MAX
+1];
117 union autofs_packet_union
{
118 struct autofs_packet_hdr hdr
;
119 struct autofs_packet_missing missing
;
120 struct autofs_packet_expire expire
;
121 struct autofs_packet_expire_multi expire_multi
;
124 /* autofs v5 common packet struct */
125 struct autofs_v5_packet
{
126 struct autofs_packet_hdr hdr
;
127 autofs_wqt_t wait_queue_token
;
135 char name
[NAME_MAX
+1];
138 typedef struct autofs_v5_packet autofs_packet_missing_indirect_t
;
139 typedef struct autofs_v5_packet autofs_packet_expire_indirect_t
;
140 typedef struct autofs_v5_packet autofs_packet_missing_direct_t
;
141 typedef struct autofs_v5_packet autofs_packet_expire_direct_t
;
143 union autofs_v5_packet_union
{
144 struct autofs_packet_hdr hdr
;
145 struct autofs_v5_packet v5_packet
;
146 autofs_packet_missing_indirect_t missing_indirect
;
147 autofs_packet_expire_indirect_t expire_indirect
;
148 autofs_packet_missing_direct_t missing_direct
;
149 autofs_packet_expire_direct_t expire_direct
;
153 AUTOFS_IOC_EXPIRE_MULTI_CMD
= 0x66, /* AUTOFS_IOC_EXPIRE_CMD + 1 */
154 AUTOFS_IOC_PROTOSUBVER_CMD
,
155 AUTOFS_IOC_ASKUMOUNT_CMD
= 0x70, /* AUTOFS_DEV_IOCTL_VERSION_CMD - 1 */
158 #define AUTOFS_IOC_EXPIRE_MULTI _IOW(AUTOFS_IOCTL, AUTOFS_IOC_EXPIRE_MULTI_CMD, int)
159 #define AUTOFS_IOC_PROTOSUBVER _IOR(AUTOFS_IOCTL, AUTOFS_IOC_PROTOSUBVER_CMD, int)
160 #define AUTOFS_IOC_ASKUMOUNT _IOR(AUTOFS_IOCTL, AUTOFS_IOC_ASKUMOUNT_CMD, int)
162 #endif /* _LINUX_AUTO_FS4_H */