blob: 744b3d0609687b82bb198ed76c158417c22f09f9 [file] [log] [blame]
Ian Kent9b88ee02016-10-11 13:53:13 -07001/*
2 * Copyright 2008 Red Hat, Inc. All rights reserved.
3 * Copyright 2008 Ian Kent <raven@themaw.net>
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 _UAPI_LINUX_AUTO_DEV_IOCTL_H
11#define _UAPI_LINUX_AUTO_DEV_IOCTL_H
12
13#include <linux/auto_fs.h>
14#include <linux/string.h>
15
16#define AUTOFS_DEVICE_NAME "autofs"
17
18#define AUTOFS_DEV_IOCTL_VERSION_MAJOR 1
19#define AUTOFS_DEV_IOCTL_VERSION_MINOR 0
20
21#define AUTOFS_DEV_IOCTL_SIZE sizeof(struct autofs_dev_ioctl)
22
23/*
24 * An ioctl interface for autofs mount point control.
25 */
26
27struct args_protover {
28 __u32 version;
29};
30
31struct args_protosubver {
32 __u32 sub_version;
33};
34
35struct args_openmount {
36 __u32 devid;
37};
38
39struct args_ready {
40 __u32 token;
41};
42
43struct args_fail {
44 __u32 token;
45 __s32 status;
46};
47
48struct args_setpipefd {
49 __s32 pipefd;
50};
51
52struct args_timeout {
53 __u64 timeout;
54};
55
56struct args_requester {
57 __u32 uid;
58 __u32 gid;
59};
60
61struct args_expire {
62 __u32 how;
63};
64
65struct args_askumount {
66 __u32 may_umount;
67};
68
69struct args_ismountpoint {
70 union {
71 struct args_in {
72 __u32 type;
73 } in;
74 struct args_out {
75 __u32 devid;
76 __u32 magic;
77 } out;
78 };
79};
80
81/*
82 * All the ioctls use this structure.
83 * When sending a path size must account for the total length
84 * of the chunk of memory otherwise is is the size of the
85 * structure.
86 */
87
88struct autofs_dev_ioctl {
89 __u32 ver_major;
90 __u32 ver_minor;
91 __u32 size; /* total size of data passed in
92 * including this struct */
93 __s32 ioctlfd; /* automount command fd */
94
95 /* Command parameters */
96
97 union {
98 struct args_protover protover;
99 struct args_protosubver protosubver;
100 struct args_openmount openmount;
101 struct args_ready ready;
102 struct args_fail fail;
103 struct args_setpipefd setpipefd;
104 struct args_timeout timeout;
105 struct args_requester requester;
106 struct args_expire expire;
107 struct args_askumount askumount;
108 struct args_ismountpoint ismountpoint;
109 };
110
111 char path[0];
112};
113
114static inline void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in)
115{
Tomohiro Kusumi3bb2fbd2017-02-27 14:27:14 -0800116 memset(in, 0, AUTOFS_DEV_IOCTL_SIZE);
Ian Kent9b88ee02016-10-11 13:53:13 -0700117 in->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR;
118 in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR;
Tomohiro Kusumi3bb2fbd2017-02-27 14:27:14 -0800119 in->size = AUTOFS_DEV_IOCTL_SIZE;
Ian Kent9b88ee02016-10-11 13:53:13 -0700120 in->ioctlfd = -1;
121}
122
Ian Kent9b88ee02016-10-11 13:53:13 -0700123enum {
124 /* Get various version info */
125 AUTOFS_DEV_IOCTL_VERSION_CMD = 0x71,
126 AUTOFS_DEV_IOCTL_PROTOVER_CMD,
127 AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD,
128
129 /* Open mount ioctl fd */
130 AUTOFS_DEV_IOCTL_OPENMOUNT_CMD,
131
132 /* Close mount ioctl fd */
133 AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD,
134
135 /* Mount/expire status returns */
136 AUTOFS_DEV_IOCTL_READY_CMD,
137 AUTOFS_DEV_IOCTL_FAIL_CMD,
138
139 /* Activate/deactivate autofs mount */
140 AUTOFS_DEV_IOCTL_SETPIPEFD_CMD,
141 AUTOFS_DEV_IOCTL_CATATONIC_CMD,
142
143 /* Expiry timeout */
144 AUTOFS_DEV_IOCTL_TIMEOUT_CMD,
145
146 /* Get mount last requesting uid and gid */
147 AUTOFS_DEV_IOCTL_REQUESTER_CMD,
148
149 /* Check for eligible expire candidates */
150 AUTOFS_DEV_IOCTL_EXPIRE_CMD,
151
152 /* Request busy status */
153 AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD,
154
155 /* Check if path is a mountpoint */
156 AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD,
157};
158
Ian Kent9b88ee02016-10-11 13:53:13 -0700159#define AUTOFS_DEV_IOCTL_VERSION \
160 _IOWR(AUTOFS_IOCTL, \
161 AUTOFS_DEV_IOCTL_VERSION_CMD, struct autofs_dev_ioctl)
162
163#define AUTOFS_DEV_IOCTL_PROTOVER \
164 _IOWR(AUTOFS_IOCTL, \
165 AUTOFS_DEV_IOCTL_PROTOVER_CMD, struct autofs_dev_ioctl)
166
167#define AUTOFS_DEV_IOCTL_PROTOSUBVER \
168 _IOWR(AUTOFS_IOCTL, \
169 AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD, struct autofs_dev_ioctl)
170
171#define AUTOFS_DEV_IOCTL_OPENMOUNT \
172 _IOWR(AUTOFS_IOCTL, \
173 AUTOFS_DEV_IOCTL_OPENMOUNT_CMD, struct autofs_dev_ioctl)
174
175#define AUTOFS_DEV_IOCTL_CLOSEMOUNT \
176 _IOWR(AUTOFS_IOCTL, \
177 AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD, struct autofs_dev_ioctl)
178
179#define AUTOFS_DEV_IOCTL_READY \
180 _IOWR(AUTOFS_IOCTL, \
181 AUTOFS_DEV_IOCTL_READY_CMD, struct autofs_dev_ioctl)
182
183#define AUTOFS_DEV_IOCTL_FAIL \
184 _IOWR(AUTOFS_IOCTL, \
185 AUTOFS_DEV_IOCTL_FAIL_CMD, struct autofs_dev_ioctl)
186
187#define AUTOFS_DEV_IOCTL_SETPIPEFD \
188 _IOWR(AUTOFS_IOCTL, \
189 AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, struct autofs_dev_ioctl)
190
191#define AUTOFS_DEV_IOCTL_CATATONIC \
192 _IOWR(AUTOFS_IOCTL, \
193 AUTOFS_DEV_IOCTL_CATATONIC_CMD, struct autofs_dev_ioctl)
194
195#define AUTOFS_DEV_IOCTL_TIMEOUT \
196 _IOWR(AUTOFS_IOCTL, \
197 AUTOFS_DEV_IOCTL_TIMEOUT_CMD, struct autofs_dev_ioctl)
198
199#define AUTOFS_DEV_IOCTL_REQUESTER \
200 _IOWR(AUTOFS_IOCTL, \
201 AUTOFS_DEV_IOCTL_REQUESTER_CMD, struct autofs_dev_ioctl)
202
203#define AUTOFS_DEV_IOCTL_EXPIRE \
204 _IOWR(AUTOFS_IOCTL, \
205 AUTOFS_DEV_IOCTL_EXPIRE_CMD, struct autofs_dev_ioctl)
206
207#define AUTOFS_DEV_IOCTL_ASKUMOUNT \
208 _IOWR(AUTOFS_IOCTL, \
209 AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD, struct autofs_dev_ioctl)
210
211#define AUTOFS_DEV_IOCTL_ISMOUNTPOINT \
212 _IOWR(AUTOFS_IOCTL, \
213 AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, struct autofs_dev_ioctl)
214
215#endif /* _UAPI_LINUX_AUTO_DEV_IOCTL_H */