Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc
[cris-mirror.git] / include / linux / auto_dev-ioctl.h
blob850f39b33e743f927acf0d2ca9777971c873e345
1 /*
2 * Copyright 2008 Red Hat, Inc. All rights reserved.
3 * Copyright 2008 Ian Kent <raven@themaw.net>
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 */
10 #ifndef _LINUX_AUTO_DEV_IOCTL_H
11 #define _LINUX_AUTO_DEV_IOCTL_H
13 #include <linux/auto_fs.h>
15 #ifdef __KERNEL__
16 #include <linux/string.h>
17 #else
18 #include <string.h>
19 #endif /* __KERNEL__ */
21 #define AUTOFS_DEVICE_NAME "autofs"
23 #define AUTOFS_DEV_IOCTL_VERSION_MAJOR 1
24 #define AUTOFS_DEV_IOCTL_VERSION_MINOR 0
26 #define AUTOFS_DEVID_LEN 16
28 #define AUTOFS_DEV_IOCTL_SIZE sizeof(struct autofs_dev_ioctl)
31 * An ioctl interface for autofs mount point control.
34 struct args_protover {
35 __u32 version;
38 struct args_protosubver {
39 __u32 sub_version;
42 struct args_openmount {
43 __u32 devid;
46 struct args_ready {
47 __u32 token;
50 struct args_fail {
51 __u32 token;
52 __s32 status;
55 struct args_setpipefd {
56 __s32 pipefd;
59 struct args_timeout {
60 __u64 timeout;
63 struct args_requester {
64 __u32 uid;
65 __u32 gid;
68 struct args_expire {
69 __u32 how;
72 struct args_askumount {
73 __u32 may_umount;
76 struct args_ismountpoint {
77 union {
78 struct args_in {
79 __u32 type;
80 } in;
81 struct args_out {
82 __u32 devid;
83 __u32 magic;
84 } out;
89 * All the ioctls use this structure.
90 * When sending a path size must account for the total length
91 * of the chunk of memory otherwise is is the size of the
92 * structure.
95 struct autofs_dev_ioctl {
96 __u32 ver_major;
97 __u32 ver_minor;
98 __u32 size; /* total size of data passed in
99 * including this struct */
100 __s32 ioctlfd; /* automount command fd */
102 /* Command parameters */
104 union {
105 struct args_protover protover;
106 struct args_protosubver protosubver;
107 struct args_openmount openmount;
108 struct args_ready ready;
109 struct args_fail fail;
110 struct args_setpipefd setpipefd;
111 struct args_timeout timeout;
112 struct args_requester requester;
113 struct args_expire expire;
114 struct args_askumount askumount;
115 struct args_ismountpoint ismountpoint;
118 char path[0];
121 static inline void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in)
123 memset(in, 0, sizeof(struct autofs_dev_ioctl));
124 in->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR;
125 in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR;
126 in->size = sizeof(struct autofs_dev_ioctl);
127 in->ioctlfd = -1;
128 return;
132 * If you change this make sure you make the corresponding change
133 * to autofs-dev-ioctl.c:lookup_ioctl()
135 enum {
136 /* Get various version info */
137 AUTOFS_DEV_IOCTL_VERSION_CMD = 0x71,
138 AUTOFS_DEV_IOCTL_PROTOVER_CMD,
139 AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD,
141 /* Open mount ioctl fd */
142 AUTOFS_DEV_IOCTL_OPENMOUNT_CMD,
144 /* Close mount ioctl fd */
145 AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD,
147 /* Mount/expire status returns */
148 AUTOFS_DEV_IOCTL_READY_CMD,
149 AUTOFS_DEV_IOCTL_FAIL_CMD,
151 /* Activate/deactivate autofs mount */
152 AUTOFS_DEV_IOCTL_SETPIPEFD_CMD,
153 AUTOFS_DEV_IOCTL_CATATONIC_CMD,
155 /* Expiry timeout */
156 AUTOFS_DEV_IOCTL_TIMEOUT_CMD,
158 /* Get mount last requesting uid and gid */
159 AUTOFS_DEV_IOCTL_REQUESTER_CMD,
161 /* Check for eligible expire candidates */
162 AUTOFS_DEV_IOCTL_EXPIRE_CMD,
164 /* Request busy status */
165 AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD,
167 /* Check if path is a mountpoint */
168 AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD,
171 #define AUTOFS_IOCTL 0x93
173 #define AUTOFS_DEV_IOCTL_VERSION \
174 _IOWR(AUTOFS_IOCTL, \
175 AUTOFS_DEV_IOCTL_VERSION_CMD, struct autofs_dev_ioctl)
177 #define AUTOFS_DEV_IOCTL_PROTOVER \
178 _IOWR(AUTOFS_IOCTL, \
179 AUTOFS_DEV_IOCTL_PROTOVER_CMD, struct autofs_dev_ioctl)
181 #define AUTOFS_DEV_IOCTL_PROTOSUBVER \
182 _IOWR(AUTOFS_IOCTL, \
183 AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD, struct autofs_dev_ioctl)
185 #define AUTOFS_DEV_IOCTL_OPENMOUNT \
186 _IOWR(AUTOFS_IOCTL, \
187 AUTOFS_DEV_IOCTL_OPENMOUNT_CMD, struct autofs_dev_ioctl)
189 #define AUTOFS_DEV_IOCTL_CLOSEMOUNT \
190 _IOWR(AUTOFS_IOCTL, \
191 AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD, struct autofs_dev_ioctl)
193 #define AUTOFS_DEV_IOCTL_READY \
194 _IOWR(AUTOFS_IOCTL, \
195 AUTOFS_DEV_IOCTL_READY_CMD, struct autofs_dev_ioctl)
197 #define AUTOFS_DEV_IOCTL_FAIL \
198 _IOWR(AUTOFS_IOCTL, \
199 AUTOFS_DEV_IOCTL_FAIL_CMD, struct autofs_dev_ioctl)
201 #define AUTOFS_DEV_IOCTL_SETPIPEFD \
202 _IOWR(AUTOFS_IOCTL, \
203 AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, struct autofs_dev_ioctl)
205 #define AUTOFS_DEV_IOCTL_CATATONIC \
206 _IOWR(AUTOFS_IOCTL, \
207 AUTOFS_DEV_IOCTL_CATATONIC_CMD, struct autofs_dev_ioctl)
209 #define AUTOFS_DEV_IOCTL_TIMEOUT \
210 _IOWR(AUTOFS_IOCTL, \
211 AUTOFS_DEV_IOCTL_TIMEOUT_CMD, struct autofs_dev_ioctl)
213 #define AUTOFS_DEV_IOCTL_REQUESTER \
214 _IOWR(AUTOFS_IOCTL, \
215 AUTOFS_DEV_IOCTL_REQUESTER_CMD, struct autofs_dev_ioctl)
217 #define AUTOFS_DEV_IOCTL_EXPIRE \
218 _IOWR(AUTOFS_IOCTL, \
219 AUTOFS_DEV_IOCTL_EXPIRE_CMD, struct autofs_dev_ioctl)
221 #define AUTOFS_DEV_IOCTL_ASKUMOUNT \
222 _IOWR(AUTOFS_IOCTL, \
223 AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD, struct autofs_dev_ioctl)
225 #define AUTOFS_DEV_IOCTL_ISMOUNTPOINT \
226 _IOWR(AUTOFS_IOCTL, \
227 AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, struct autofs_dev_ioctl)
229 #endif /* _LINUX_AUTO_DEV_IOCTL_H */