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