]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/uapi/linux/auto_fs4.h
Merge tag 'drm-misc-fixes-2018-01-24' of git://anongit.freedesktop.org/drm/drm-misc...
[mirror_ubuntu-bionic-kernel.git] / include / uapi / linux / auto_fs4.h
CommitLineData
e2be04c7 1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
e9a7c2f1 2/*
1da177e4
LT
3 * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
4 *
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.
8 */
9
10#ifndef _LINUX_AUTO_FS4_H
11#define _LINUX_AUTO_FS4_H
12
13/* Include common v3 definitions */
5d461bfe 14#include <linux/types.h>
1da177e4
LT
15#include <linux/auto_fs.h>
16
17/* autofs v4 definitions */
18#undef AUTOFS_PROTO_VERSION
19#undef AUTOFS_MIN_PROTO_VERSION
20#undef AUTOFS_MAX_PROTO_VERSION
21
5c0a32fc 22#define AUTOFS_PROTO_VERSION 5
1da177e4 23#define AUTOFS_MIN_PROTO_VERSION 3
5c0a32fc 24#define AUTOFS_MAX_PROTO_VERSION 5
1da177e4 25
1972580b 26#define AUTOFS_PROTO_SUBVERSION 2
1da177e4
LT
27
28/* Mask for expire behaviour */
29#define AUTOFS_EXP_IMMEDIATE 1
30#define AUTOFS_EXP_LEAVES 2
31
a92daf6b
IK
32#define AUTOFS_TYPE_ANY 0U
33#define AUTOFS_TYPE_INDIRECT 1U
34#define AUTOFS_TYPE_DIRECT 2U
35#define AUTOFS_TYPE_OFFSET 4U
36
37static inline void set_autofs_type_indirect(unsigned int *type)
38{
39 *type = AUTOFS_TYPE_INDIRECT;
a92daf6b
IK
40}
41
42static inline unsigned int autofs_type_indirect(unsigned int type)
43{
44 return (type == AUTOFS_TYPE_INDIRECT);
45}
46
47static inline void set_autofs_type_direct(unsigned int *type)
48{
49 *type = AUTOFS_TYPE_DIRECT;
a92daf6b
IK
50}
51
52static inline unsigned int autofs_type_direct(unsigned int type)
53{
54 return (type == AUTOFS_TYPE_DIRECT);
55}
56
57static inline void set_autofs_type_offset(unsigned int *type)
58{
59 *type = AUTOFS_TYPE_OFFSET;
a92daf6b
IK
60}
61
62static inline unsigned int autofs_type_offset(unsigned int type)
63{
64 return (type == AUTOFS_TYPE_OFFSET);
65}
66
67static inline unsigned int autofs_type_trigger(unsigned int type)
68{
69 return (type == AUTOFS_TYPE_DIRECT || type == AUTOFS_TYPE_OFFSET);
70}
71
72/*
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.
76 */
77static inline void set_autofs_type_any(unsigned int *type)
78{
79 *type = AUTOFS_TYPE_ANY;
a92daf6b
IK
80}
81
82static inline unsigned int autofs_type_any(unsigned int type)
83{
84 return (type == AUTOFS_TYPE_ANY);
85}
bb979d7f 86
5c0a32fc
IK
87/* Daemon notification packet types */
88enum autofs_notify {
89 NFY_NONE,
90 NFY_MOUNT,
91 NFY_EXPIRE
92};
93
94/* Kernel protocol version 4 packet types */
95
96/* Expire entry (umount request) */
97#define autofs_ptype_expire_multi 2
98
99/* Kernel protocol version 5 packet types */
100
101/* Indirect mount missing and expire requests. */
102#define autofs_ptype_missing_indirect 3
103#define autofs_ptype_expire_indirect 4
104
105/* Direct mount missing and expire requests */
106#define autofs_ptype_missing_direct 5
107#define autofs_ptype_expire_direct 6
1da177e4
LT
108
109/* v4 multi expire (via pipe) */
110struct autofs_packet_expire_multi {
111 struct autofs_packet_hdr hdr;
7cee9384 112 autofs_wqt_t wait_queue_token;
1da177e4
LT
113 int len;
114 char name[NAME_MAX+1];
115};
116
e8514478
IK
117union 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;
122};
123
5c0a32fc
IK
124/* autofs v5 common packet struct */
125struct autofs_v5_packet {
126 struct autofs_packet_hdr hdr;
7cee9384 127 autofs_wqt_t wait_queue_token;
5c0a32fc
IK
128 __u32 dev;
129 __u64 ino;
130 __u32 uid;
131 __u32 gid;
132 __u32 pid;
133 __u32 tgid;
134 __u32 len;
135 char name[NAME_MAX+1];
136};
137
138typedef struct autofs_v5_packet autofs_packet_missing_indirect_t;
139typedef struct autofs_v5_packet autofs_packet_expire_indirect_t;
140typedef struct autofs_v5_packet autofs_packet_missing_direct_t;
141typedef struct autofs_v5_packet autofs_packet_expire_direct_t;
142
e8514478 143union autofs_v5_packet_union {
1da177e4 144 struct autofs_packet_hdr hdr;
5c0a32fc 145 struct autofs_v5_packet v5_packet;
e8514478
IK
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;
1da177e4
LT
150};
151
0fae77fe
TK
152enum {
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 */
156};
157
158#define AUTOFS_IOC_EXPIRE_MULTI _IOW(AUTOFS_IOCTL, AUTOFS_IOC_EXPIRE_MULTI_CMD, int)
0fae77fe
TK
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)
1da177e4
LT
161
162#endif /* _LINUX_AUTO_FS4_H */