blob: 021ed331dd716d0b663cb9b77d51595999155047 [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{
116 memset(in, 0, sizeof(struct autofs_dev_ioctl));
117 in->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR;
118 in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR;
119 in->size = sizeof(struct autofs_dev_ioctl);
120 in->ioctlfd = -1;
121}
122
123/*
124 * If you change this make sure you make the corresponding change
125 * to autofs-dev-ioctl.c:lookup_ioctl()
126 */
127enum {
128 /* Get various version info */
129 AUTOFS_DEV_IOCTL_VERSION_CMD = 0x71,
130 AUTOFS_DEV_IOCTL_PROTOVER_CMD,
131 AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD,
132
133 /* Open mount ioctl fd */
134 AUTOFS_DEV_IOCTL_OPENMOUNT_CMD,
135
136 /* Close mount ioctl fd */
137 AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD,
138
139 /* Mount/expire status returns */
140 AUTOFS_DEV_IOCTL_READY_CMD,
141 AUTOFS_DEV_IOCTL_FAIL_CMD,
142
143 /* Activate/deactivate autofs mount */
144 AUTOFS_DEV_IOCTL_SETPIPEFD_CMD,
145 AUTOFS_DEV_IOCTL_CATATONIC_CMD,
146
147 /* Expiry timeout */
148 AUTOFS_DEV_IOCTL_TIMEOUT_CMD,
149
150 /* Get mount last requesting uid and gid */
151 AUTOFS_DEV_IOCTL_REQUESTER_CMD,
152
153 /* Check for eligible expire candidates */
154 AUTOFS_DEV_IOCTL_EXPIRE_CMD,
155
156 /* Request busy status */
157 AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD,
158
159 /* Check if path is a mountpoint */
160 AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD,
161};
162
163#define AUTOFS_IOCTL 0x93
164
165#define AUTOFS_DEV_IOCTL_VERSION \
166 _IOWR(AUTOFS_IOCTL, \
167 AUTOFS_DEV_IOCTL_VERSION_CMD, struct autofs_dev_ioctl)
168
169#define AUTOFS_DEV_IOCTL_PROTOVER \
170 _IOWR(AUTOFS_IOCTL, \
171 AUTOFS_DEV_IOCTL_PROTOVER_CMD, struct autofs_dev_ioctl)
172
173#define AUTOFS_DEV_IOCTL_PROTOSUBVER \
174 _IOWR(AUTOFS_IOCTL, \
175 AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD, struct autofs_dev_ioctl)
176
177#define AUTOFS_DEV_IOCTL_OPENMOUNT \
178 _IOWR(AUTOFS_IOCTL, \
179 AUTOFS_DEV_IOCTL_OPENMOUNT_CMD, struct autofs_dev_ioctl)
180
181#define AUTOFS_DEV_IOCTL_CLOSEMOUNT \
182 _IOWR(AUTOFS_IOCTL, \
183 AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD, struct autofs_dev_ioctl)
184
185#define AUTOFS_DEV_IOCTL_READY \
186 _IOWR(AUTOFS_IOCTL, \
187 AUTOFS_DEV_IOCTL_READY_CMD, struct autofs_dev_ioctl)
188
189#define AUTOFS_DEV_IOCTL_FAIL \
190 _IOWR(AUTOFS_IOCTL, \
191 AUTOFS_DEV_IOCTL_FAIL_CMD, struct autofs_dev_ioctl)
192
193#define AUTOFS_DEV_IOCTL_SETPIPEFD \
194 _IOWR(AUTOFS_IOCTL, \
195 AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, struct autofs_dev_ioctl)
196
197#define AUTOFS_DEV_IOCTL_CATATONIC \
198 _IOWR(AUTOFS_IOCTL, \
199 AUTOFS_DEV_IOCTL_CATATONIC_CMD, struct autofs_dev_ioctl)
200
201#define AUTOFS_DEV_IOCTL_TIMEOUT \
202 _IOWR(AUTOFS_IOCTL, \
203 AUTOFS_DEV_IOCTL_TIMEOUT_CMD, struct autofs_dev_ioctl)
204
205#define AUTOFS_DEV_IOCTL_REQUESTER \
206 _IOWR(AUTOFS_IOCTL, \
207 AUTOFS_DEV_IOCTL_REQUESTER_CMD, struct autofs_dev_ioctl)
208
209#define AUTOFS_DEV_IOCTL_EXPIRE \
210 _IOWR(AUTOFS_IOCTL, \
211 AUTOFS_DEV_IOCTL_EXPIRE_CMD, struct autofs_dev_ioctl)
212
213#define AUTOFS_DEV_IOCTL_ASKUMOUNT \
214 _IOWR(AUTOFS_IOCTL, \
215 AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD, struct autofs_dev_ioctl)
216
217#define AUTOFS_DEV_IOCTL_ISMOUNTPOINT \
218 _IOWR(AUTOFS_IOCTL, \
219 AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, struct autofs_dev_ioctl)
220
221#endif /* _UAPI_LINUX_AUTO_DEV_IOCTL_H */