xref: /openbmc/qemu/linux-user/ioctls.h (revision 76bccf3c)
1      /* emulated ioctl list */
2 
3      IOCTL(TCGETS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios)))
4      IOCTL(TCSETS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios)))
5      IOCTL(TCSETSF, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios)))
6      IOCTL(TCSETSW, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios)))
7      IOCTL(TIOCGWINSZ, IOC_R, MK_PTR(MK_STRUCT(STRUCT_winsize)))
8      IOCTL(TIOCSWINSZ, IOC_W, MK_PTR(MK_STRUCT(STRUCT_winsize)))
9      IOCTL(FIONREAD, IOC_R, MK_PTR(TYPE_INT))
10      IOCTL(TCGETA, IOC_R, MK_PTR(TYPE_INT))
11      IOCTL(TCSETA, IOC_W, MK_PTR(TYPE_INT))
12      IOCTL(TCSETAW, IOC_W, MK_PTR(TYPE_INT))
13      IOCTL(TCSETAF, IOC_W, MK_PTR(TYPE_INT))
14      IOCTL(TCSBRK, 0, TYPE_INT)
15      IOCTL(TCSBRKP, 0, TYPE_INT)
16      IOCTL(TCXONC, 0, TYPE_INT)
17      IOCTL(TCFLSH, 0, TYPE_INT)
18      IOCTL(TIOCEXCL, 0, TYPE_NULL)
19      IOCTL(TIOCNXCL, 0, TYPE_NULL)
20      IOCTL(TIOCSCTTY, 0, TYPE_INT)
21      IOCTL(TIOCGPGRP, IOC_R, MK_PTR(TYPE_INT))
22      IOCTL(TIOCSPGRP, IOC_W, MK_PTR(TYPE_INT))
23      IOCTL(TIOCGSID, IOC_W, MK_PTR(TYPE_INT))
24      IOCTL(TIOCOUTQ, IOC_R, MK_PTR(TYPE_INT))
25      IOCTL(TIOCSTI, IOC_W, MK_PTR(TYPE_INT))
26      IOCTL(TIOCMGET, IOC_R, MK_PTR(TYPE_INT))
27      IOCTL(TIOCMBIS, IOC_W, MK_PTR(TYPE_INT))
28      IOCTL(TIOCMBIC, IOC_W, MK_PTR(TYPE_INT))
29      IOCTL(TIOCMSET, IOC_W, MK_PTR(TYPE_INT))
30      IOCTL(TIOCGSOFTCAR, IOC_R, MK_PTR(TYPE_INT))
31      IOCTL(TIOCSSOFTCAR, IOC_W, MK_PTR(TYPE_INT))
32      IOCTL(TIOCLINUX, IOC_R | IOC_W, MK_PTR(TYPE_INT))
33      IOCTL(TIOCCONS, 0, TYPE_NULL)
34      IOCTL(TIOCGSERIAL, IOC_R, MK_PTR(TYPE_INT))
35      IOCTL(TIOCSSERIAL, IOC_W, MK_PTR(TYPE_INT))
36      IOCTL(TIOCPKT, IOC_W, MK_PTR(TYPE_INT))
37      IOCTL(FIONBIO, IOC_W, MK_PTR(TYPE_INT))
38      IOCTL(TIOCNOTTY, 0, TYPE_NULL)
39      IOCTL(TIOCGETD, IOC_R, MK_PTR(TYPE_INT))
40      IOCTL(TIOCSETD, IOC_W, MK_PTR(TYPE_INT))
41      IOCTL(TIOCGPTN, IOC_R, MK_PTR(TYPE_INT))
42      IOCTL(TIOCSPTLCK, IOC_W, MK_PTR(TYPE_INT))
43 #ifdef TIOCGPTPEER
44      IOCTL_SPECIAL(TIOCGPTPEER, 0, do_ioctl_tiocgptpeer, TYPE_INT)
45 #endif
46      IOCTL(FIOCLEX, 0, TYPE_NULL)
47      IOCTL(FIONCLEX, 0, TYPE_NULL)
48      IOCTL(FIOASYNC, IOC_W, MK_PTR(TYPE_INT))
49      IOCTL(TIOCGLCKTRMIOS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios)))
50      IOCTL(TIOCSLCKTRMIOS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios)))
51      IOCTL(TIOCSERCONFIG, 0, TYPE_NULL)
52      IOCTL(TIOCSERGETLSR, IOC_R, MK_PTR(TYPE_INT))
53      IOCTL(TIOCSERGETMULTI, IOC_R, MK_PTR(MK_STRUCT(STRUCT_serial_multiport_struct)))
54      IOCTL(TIOCSERSETMULTI, IOC_W, MK_PTR(MK_STRUCT(STRUCT_serial_multiport_struct)))
55      IOCTL(TIOCMIWAIT, 0, TYPE_INT)
56      IOCTL(TIOCGICOUNT, IOC_R, MK_PTR(MK_STRUCT(STRUCT_serial_icounter_struct)))
57 
58      IOCTL(KIOCSOUND, 0, TYPE_INT)
59      IOCTL(KDMKTONE, 0, TYPE_INT)
60      IOCTL(KDSETMODE, 0, TYPE_INT)
61      IOCTL(KDGKBTYPE, IOC_R, MK_PTR(TYPE_CHAR))
62      IOCTL(KDGKBMODE, IOC_R, MK_PTR(TYPE_INT))
63      IOCTL(KDSKBMODE, 0, TYPE_INT)
64      IOCTL(KDGKBENT, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_kbentry)))
65      IOCTL(KDGKBSENT, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_kbsentry)))
66      IOCTL(KDGKBLED, 0, TYPE_INT)
67      IOCTL(KDSKBLED, 0, TYPE_INT)
68      IOCTL(KDGETLED, 0, TYPE_INT)
69      IOCTL(KDSETLED, 0, TYPE_INT)
70      IOCTL_SPECIAL(KDSIGACCEPT, 0, do_ioctl_kdsigaccept, TYPE_INT)
71 
72      IOCTL(RTC_AIE_ON, 0, TYPE_NULL)
73      IOCTL(RTC_AIE_OFF, 0, TYPE_NULL)
74      IOCTL(RTC_UIE_ON, 0, TYPE_NULL)
75      IOCTL(RTC_UIE_OFF, 0, TYPE_NULL)
76      IOCTL(RTC_PIE_ON, 0, TYPE_NULL)
77      IOCTL(RTC_PIE_OFF, 0, TYPE_NULL)
78      IOCTL(RTC_WIE_ON, 0, TYPE_NULL)
79      IOCTL(RTC_WIE_OFF, 0, TYPE_NULL)
80      IOCTL(RTC_ALM_READ, IOC_R, MK_PTR(MK_STRUCT(STRUCT_rtc_time)))
81      IOCTL(RTC_ALM_SET, IOC_W, MK_PTR(MK_STRUCT(STRUCT_rtc_time)))
82      IOCTL(RTC_RD_TIME, IOC_R, MK_PTR(MK_STRUCT(STRUCT_rtc_time)))
83      IOCTL(RTC_SET_TIME, IOC_W, MK_PTR(MK_STRUCT(STRUCT_rtc_time)))
84      IOCTL(RTC_IRQP_READ, IOC_R, MK_PTR(TYPE_ULONG))
85      IOCTL(RTC_IRQP_SET, IOC_W, TYPE_ULONG)
86      IOCTL(RTC_EPOCH_READ, IOC_R, MK_PTR(TYPE_ULONG))
87      IOCTL(RTC_EPOCH_SET, IOC_W, TYPE_ULONG)
88      IOCTL(RTC_WKALM_RD, IOC_R, MK_PTR(MK_STRUCT(STRUCT_rtc_wkalrm)))
89      IOCTL(RTC_WKALM_SET, IOC_W, MK_PTR(MK_STRUCT(STRUCT_rtc_wkalrm)))
90      IOCTL(RTC_PLL_GET, IOC_R, MK_PTR(MK_STRUCT(STRUCT_rtc_pll_info)))
91      IOCTL(RTC_PLL_SET, IOC_W, MK_PTR(MK_STRUCT(STRUCT_rtc_pll_info)))
92      IOCTL(RTC_VL_READ, IOC_R, MK_PTR(TYPE_INT))
93      IOCTL(RTC_VL_CLR, 0, TYPE_NULL)
94 
95      IOCTL(BLKROSET, IOC_W, MK_PTR(TYPE_INT))
96      IOCTL(BLKROGET, IOC_R, MK_PTR(TYPE_INT))
97      IOCTL(BLKRRPART, 0, TYPE_NULL)
98      IOCTL(BLKGETSIZE, IOC_R, MK_PTR(TYPE_ULONG))
99      IOCTL(BLKGETSIZE64, IOC_R, MK_PTR(TYPE_ULONGLONG))
100      IOCTL(BLKFLSBUF, 0, TYPE_NULL)
101      IOCTL(BLKRASET, 0, TYPE_INT)
102      IOCTL(BLKRAGET, IOC_R, MK_PTR(TYPE_LONG))
103      IOCTL(BLKSSZGET, IOC_R, MK_PTR(TYPE_INT))
104      IOCTL(BLKBSZGET, IOC_R, MK_PTR(TYPE_INT))
105      IOCTL(BLKBSZSET, IOC_W, MK_PTR(TYPE_INT))
106      IOCTL_SPECIAL(BLKPG, IOC_W, do_ioctl_blkpg,
107                    MK_PTR(MK_STRUCT(STRUCT_blkpg_ioctl_arg)))
108 
109      IOCTL(BLKDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
110      IOCTL(BLKIOMIN, IOC_R, MK_PTR(TYPE_INT))
111      IOCTL(BLKIOOPT, IOC_R, MK_PTR(TYPE_INT))
112      IOCTL(BLKALIGNOFF, IOC_R, MK_PTR(TYPE_INT))
113      IOCTL(BLKPBSZGET, IOC_R, MK_PTR(TYPE_INT))
114      IOCTL(BLKDISCARDZEROES, IOC_R, MK_PTR(TYPE_INT))
115      IOCTL(BLKSECDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
116      IOCTL(BLKROTATIONAL, IOC_R, MK_PTR(TYPE_SHORT))
117      IOCTL(BLKZEROOUT, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
118 
119      IOCTL(FDMSGON, 0, TYPE_NULL)
120      IOCTL(FDMSGOFF, 0, TYPE_NULL)
121      IOCTL(FDSETEMSGTRESH, 0, TYPE_NULL)
122      IOCTL(FDFMTBEG, 0, TYPE_NULL)
123      IOCTL(FDFMTTRK, IOC_W, MK_PTR(MK_STRUCT(STRUCT_format_descr)))
124      IOCTL(FDFMTEND, 0, TYPE_NULL)
125      IOCTL(FDFLUSH, 0, TYPE_NULL)
126      IOCTL(FDSETMAXERRS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
127      IOCTL(FDGETMAXERRS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
128      IOCTL(FDRESET, 0, TYPE_NULL)
129      IOCTL(FDRAWCMD, 0, TYPE_NULL)
130      IOCTL(FDTWADDLE, 0, TYPE_NULL)
131      IOCTL(FDEJECT, 0, TYPE_NULL)
132 
133      IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
134 #ifdef FICLONE
135      IOCTL(FICLONE, IOC_W, TYPE_INT)
136      IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_file_clone_range)))
137 #endif
138 #ifdef FIFREEZE
139      IOCTL(FIFREEZE, IOC_W | IOC_R, TYPE_INT)
140 #endif
141 #ifdef FITHAW
142      IOCTL(FITHAW, IOC_W | IOC_R, TYPE_INT)
143 #endif
144 #ifdef FITRIM
145      IOCTL(FITRIM, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_fstrim_range)))
146 #endif
147 
148      IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG))
149 #ifdef CONFIG_FIEMAP
150      IOCTL_SPECIAL(FS_IOC_FIEMAP, IOC_W | IOC_R, do_ioctl_fs_ioc_fiemap,
151                    MK_PTR(MK_STRUCT(STRUCT_fiemap)))
152 #endif
153 
154      IOCTL(FS_IOC_GETFLAGS, IOC_R, MK_PTR(TYPE_INT))
155      IOCTL(FS_IOC_SETFLAGS, IOC_W, MK_PTR(TYPE_INT))
156      IOCTL(FS_IOC_GETVERSION, IOC_R, MK_PTR(TYPE_INT))
157      IOCTL(FS_IOC_SETVERSION, IOC_W, MK_PTR(TYPE_INT))
158      IOCTL(FS_IOC32_GETFLAGS, IOC_R, MK_PTR(TYPE_INT))
159      IOCTL(FS_IOC32_SETFLAGS, IOC_W, MK_PTR(TYPE_INT))
160      IOCTL(FS_IOC32_GETVERSION, IOC_R, MK_PTR(TYPE_INT))
161      IOCTL(FS_IOC32_SETVERSION, IOC_W, MK_PTR(TYPE_INT))
162 
163 #ifdef BTRFS_IOC_SNAP_CREATE
164      IOCTL(BTRFS_IOC_SNAP_CREATE, IOC_W,
165            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
166 #endif
167 #ifdef BTRFS_IOC_SCAN_DEV
168      IOCTL(BTRFS_IOC_SCAN_DEV, IOC_W,
169            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
170 #endif
171 #ifdef BTRFS_IOC_FORGET_DEV
172      IOCTL(BTRFS_IOC_FORGET_DEV, IOC_W,
173            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
174 #endif
175 #ifdef BTRFS_IOC_ADD_DEV
176      IOCTL(BTRFS_IOC_ADD_DEV, IOC_W,
177            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
178 #endif
179 #ifdef BTRFS_IOC_RM_DEV
180      IOCTL(BTRFS_IOC_RM_DEV, IOC_W,
181            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
182 #endif
183 #ifdef BTRFS_IOC_SUBVOL_CREATE
184      IOCTL(BTRFS_IOC_SUBVOL_CREATE, IOC_W,
185            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
186 #endif
187 #ifdef BTRFS_IOC_SNAP_DESTROY
188      IOCTL(BTRFS_IOC_SNAP_DESTROY, IOC_W,
189            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
190 #endif
191 #ifdef BTRFS_IOC_INO_LOOKUP
192      IOCTL(BTRFS_IOC_INO_LOOKUP, IOC_RW,
193            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_ino_lookup_args)))
194 #endif
195 #ifdef BTRFS_IOC_DEFAULT_SUBVOL
196      IOCTL(BTRFS_IOC_DEFAULT_SUBVOL, IOC_W, MK_PTR(TYPE_ULONGLONG))
197 #endif
198 #ifdef BTRFS_IOC_SUBVOL_GETFLAGS
199      IOCTL(BTRFS_IOC_SUBVOL_GETFLAGS, IOC_R, MK_PTR(TYPE_ULONGLONG))
200 #endif
201 #ifdef BTRFS_IOC_SUBVOL_SETFLAGS
202      IOCTL(BTRFS_IOC_SUBVOL_SETFLAGS, IOC_W, MK_PTR(TYPE_ULONGLONG))
203 #endif
204 #ifdef BTRFS_IOC_SCRUB
205      IOCTL(BTRFS_IOC_SCRUB, IOC_RW,
206            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_scrub_args)))
207 #endif
208 #ifdef BTRFS_IOC_SCRUB_CANCEL
209      IOCTL(BTRFS_IOC_SCRUB_CANCEL, 0, TYPE_NULL)
210 #endif
211 #ifdef BTRFS_IOC_SCRUB_PROGRESS
212      IOCTL(BTRFS_IOC_SCRUB_PROGRESS, IOC_RW,
213            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_scrub_args)))
214 #endif
215 #ifdef BTRFS_IOC_DEV_INFO
216      IOCTL(BTRFS_IOC_DEV_INFO, IOC_RW,
217            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_dev_info_args)))
218 #endif
219 #ifdef BTRFS_IOC_INO_PATHS
220      IOCTL(BTRFS_IOC_INO_PATHS, IOC_RW,
221            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_ino_path_args)))
222 #endif
223 #ifdef BTRFS_IOC_LOGICAL_INO
224      IOCTL(BTRFS_IOC_LOGICAL_INO, IOC_RW,
225            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_logical_ino_args)))
226 #endif
227 #ifdef BTRFS_IOC_QUOTA_CTL
228      IOCTL(BTRFS_IOC_QUOTA_CTL, IOC_RW,
229            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_quota_ctl_args)))
230 #endif
231 #ifdef BTRFS_IOC_QGROUP_ASSIGN
232      IOCTL(BTRFS_IOC_QGROUP_ASSIGN, IOC_W,
233            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_qgroup_assign_args)))
234 #endif
235 #ifdef BTRFS_IOC_QGROUP_CREATE
236      IOCTL(BTRFS_IOC_QGROUP_CREATE, IOC_W,
237            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_qgroup_create_args)))
238 #endif
239 #ifdef BTRFS_IOC_QGROUP_LIMIT
240      IOCTL(BTRFS_IOC_QGROUP_LIMIT, IOC_R,
241            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_qgroup_limit_args)))
242 #endif
243 #ifdef BTRFS_IOC_QUOTA_RESCAN
244      IOCTL(BTRFS_IOC_QUOTA_RESCAN, IOC_W,
245            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_quota_rescan_args)))
246 #endif
247 #ifdef BTRFS_IOC_QUOTA_RESCAN_STATUS
248      IOCTL(BTRFS_IOC_QUOTA_RESCAN_STATUS, IOC_R,
249            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_quota_rescan_args)))
250 #endif
251 #ifdef BTRFS_IOC_QUOTA_RESCAN_WAIT
252      IOCTL(BTRFS_IOC_QUOTA_RESCAN_WAIT, 0, TYPE_NULL)
253 #endif
254 #ifdef BTRFS_IOC_GET_DEV_STATS
255      IOCTL(BTRFS_IOC_GET_DEV_STATS, IOC_RW,
256            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_get_dev_stats)))
257 #endif
258 #ifdef BTRFS_IOC_GET_FEATURES
259      IOCTL(BTRFS_IOC_GET_FEATURES, IOC_R,
260            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_feature_flags)))
261 #endif
262 #ifdef BTRFS_IOC_SET_FEATURES
263      IOCTL(BTRFS_IOC_SET_FEATURES, IOC_W,
264            MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_btrfs_ioctl_feature_flags), 2)))
265 #endif
266 #ifdef BTRFS_IOC_GET_SUPPORTED_FEATURES
267      IOCTL(BTRFS_IOC_GET_SUPPORTED_FEATURES, IOC_R,
268            MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_btrfs_ioctl_feature_flags), 3)))
269 #endif
270 #ifdef BTRFS_IOC_LOGICAL_INO_V2
271      IOCTL(BTRFS_IOC_LOGICAL_INO_V2, IOC_RW,
272            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_logical_ino_args)))
273 #endif
274 #ifdef BTRFS_IOC_GET_SUBVOL_INFO
275      IOCTL(BTRFS_IOC_GET_SUBVOL_INFO, IOC_R,
276            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_get_subvol_info_args)))
277 #endif
278 #ifdef BTRFS_IOC_GET_SUBVOL_ROOTREF
279      IOCTL(BTRFS_IOC_GET_SUBVOL_ROOTREF, IOC_RW,
280            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_get_subvol_rootref_args)))
281 #endif
282 #ifdef BTRFS_IOC_INO_LOOKUP_USER
283      IOCTL(BTRFS_IOC_INO_LOOKUP_USER, IOC_RW,
284            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_ino_lookup_user_args)))
285 #endif
286 
287 #ifdef CONFIG_USBFS
288   /* USB ioctls */
289   IOCTL(USBDEVFS_CONTROL, IOC_RW,
290         MK_PTR(MK_STRUCT(STRUCT_usbdevfs_ctrltransfer)))
291   IOCTL(USBDEVFS_BULK, IOC_RW,
292         MK_PTR(MK_STRUCT(STRUCT_usbdevfs_bulktransfer)))
293   IOCTL(USBDEVFS_RESETEP, IOC_W, MK_PTR(TYPE_INT))
294   IOCTL(USBDEVFS_SETINTERFACE, IOC_W,
295         MK_PTR(MK_STRUCT(STRUCT_usbdevfs_setinterface)))
296   IOCTL(USBDEVFS_SETCONFIGURATION, IOC_W, MK_PTR(TYPE_INT))
297   IOCTL(USBDEVFS_GETDRIVER, IOC_R,
298         MK_PTR(MK_STRUCT(STRUCT_usbdevfs_getdriver)))
299   IOCTL_SPECIAL(USBDEVFS_SUBMITURB, IOC_W, do_ioctl_usbdevfs_submiturb,
300       MK_PTR(MK_STRUCT(STRUCT_usbdevfs_urb)))
301   IOCTL_SPECIAL(USBDEVFS_DISCARDURB, IOC_RW, do_ioctl_usbdevfs_discardurb,
302       MK_PTR(MK_STRUCT(STRUCT_usbdevfs_urb)))
303   IOCTL_SPECIAL(USBDEVFS_REAPURB, IOC_R, do_ioctl_usbdevfs_reapurb,
304       MK_PTR(TYPE_PTRVOID))
305   IOCTL_SPECIAL(USBDEVFS_REAPURBNDELAY, IOC_R, do_ioctl_usbdevfs_reapurb,
306       MK_PTR(TYPE_PTRVOID))
307   IOCTL(USBDEVFS_DISCSIGNAL, IOC_W,
308         MK_PTR(MK_STRUCT(STRUCT_usbdevfs_disconnectsignal)))
309   IOCTL(USBDEVFS_CLAIMINTERFACE, IOC_W, MK_PTR(TYPE_INT))
310   IOCTL(USBDEVFS_RELEASEINTERFACE, IOC_W, MK_PTR(TYPE_INT))
311   IOCTL(USBDEVFS_CONNECTINFO, IOC_R,
312         MK_PTR(MK_STRUCT(STRUCT_usbdevfs_connectinfo)))
313   IOCTL(USBDEVFS_IOCTL, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_usbdevfs_ioctl)))
314   IOCTL(USBDEVFS_HUB_PORTINFO, IOC_R,
315         MK_PTR(MK_STRUCT(STRUCT_usbdevfs_hub_portinfo)))
316   IOCTL(USBDEVFS_RESET, 0, TYPE_NULL)
317   IOCTL(USBDEVFS_CLEAR_HALT, IOC_W, MK_PTR(TYPE_INT))
318   IOCTL(USBDEVFS_DISCONNECT, 0, TYPE_NULL)
319   IOCTL(USBDEVFS_CONNECT, 0, TYPE_NULL)
320   IOCTL(USBDEVFS_CLAIM_PORT, IOC_W, MK_PTR(TYPE_INT))
321   IOCTL(USBDEVFS_RELEASE_PORT, IOC_W, MK_PTR(TYPE_INT))
322   IOCTL(USBDEVFS_GET_CAPABILITIES, IOC_R, MK_PTR(TYPE_INT))
323   IOCTL(USBDEVFS_DISCONNECT_CLAIM, IOC_W,
324         MK_PTR(MK_STRUCT(STRUCT_usbdevfs_disconnect_claim)))
325 #ifdef USBDEVFS_DROP_PRIVILEGES
326   IOCTL(USBDEVFS_DROP_PRIVILEGES, IOC_W, MK_PTR(TYPE_INT))
327 #endif
328 #ifdef USBDEVFS_GET_SPEED
329   IOCTL(USBDEVFS_GET_SPEED, 0, TYPE_NULL)
330 #endif
331 #endif /* CONFIG_USBFS */
332 
333   IOCTL(FIOGETOWN, IOC_R, MK_PTR(TYPE_INT))
334   IOCTL(FIOSETOWN, IOC_W, MK_PTR(TYPE_INT))
335   IOCTL(SIOCATMARK, IOC_R, MK_PTR(TYPE_INT))
336   IOCTL(SIOCGIFNAME, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_int_ifreq)))
337   IOCTL(SIOCGIFFLAGS, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)))
338   IOCTL(SIOCSIFFLAGS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)))
339   IOCTL(SIOCGIFADDR, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
340   IOCTL(SIOCSIFADDR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
341   IOCTL(SIOCGIFBRDADDR, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
342   IOCTL(SIOCSIFBRDADDR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
343   IOCTL(SIOCGIFDSTADDR, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
344   IOCTL(SIOCSIFDSTADDR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
345   IOCTL(SIOCGIFNETMASK, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
346   IOCTL(SIOCSIFNETMASK, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
347   IOCTL(SIOCGIFHWADDR, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
348   IOCTL(SIOCSIFHWADDR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
349   IOCTL(SIOCGIFTXQLEN, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
350   IOCTL(SIOCSIFTXQLEN, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
351   IOCTL(SIOCGIFMETRIC, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_int_ifreq)))
352   IOCTL(SIOCSIFMETRIC, IOC_W, MK_PTR(MK_STRUCT(STRUCT_int_ifreq)))
353   IOCTL(SIOCGIFMTU, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_int_ifreq)))
354   IOCTL(SIOCSIFMTU, IOC_W, MK_PTR(MK_STRUCT(STRUCT_int_ifreq)))
355   IOCTL(SIOCGIFMAP, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_ifmap_ifreq)))
356   IOCTL(SIOCSIFMAP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_ifmap_ifreq)))
357   IOCTL(SIOCGIFSLAVE, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_char_ifreq)))
358   IOCTL(SIOCSIFSLAVE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_char_ifreq)))
359   IOCTL(SIOCGIFMEM, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_ptr_ifreq)))
360   IOCTL(SIOCSIFMEM, IOC_W, MK_PTR(MK_STRUCT(STRUCT_ptr_ifreq)))
361   IOCTL(SIOCADDMULTI, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
362   IOCTL(SIOCDELMULTI, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
363   IOCTL(SIOCGIFINDEX, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_int_ifreq)))
364   IOCTL(SIOCSIFPFLAGS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)))
365   IOCTL(SIOCGIFPFLAGS, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)))
366   IOCTL(SIOCSIFLINK, 0, TYPE_NULL)
367   IOCTL_SPECIAL(SIOCGIFCONF, IOC_W | IOC_R, do_ioctl_ifconf,
368                 MK_PTR(MK_STRUCT(STRUCT_ifconf)))
369   IOCTL(SIOCGIFENCAP, IOC_RW, MK_PTR(TYPE_INT))
370   IOCTL(SIOCSIFENCAP, IOC_W, MK_PTR(TYPE_INT))
371   IOCTL(SIOCDARP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
372   IOCTL(SIOCSARP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
373   IOCTL(SIOCGARP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
374   IOCTL(SIOCDRARP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
375   IOCTL(SIOCSRARP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
376   IOCTL(SIOCGRARP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
377   IOCTL(SIOCGIWNAME, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_char_ifreq)))
378   IOCTL(SIOCSPGRP, IOC_W, MK_PTR(TYPE_INT)) /* pid_t */
379   IOCTL(SIOCGPGRP, IOC_R, MK_PTR(TYPE_INT)) /* pid_t */
380 
381   /*
382    * We can't use IOCTL_SPECIAL() because it will set
383    * host_cmd to XXX_OLD and XXX_NEW and these macros
384    * are not defined with kernel prior to 5.2.
385    * We must set host_cmd to the same value as in target_cmd
386    * otherwise the consistency check in syscall_init()
387    * will trigger an error.
388    * host_cmd is ignored by the do_ioctl_XXX() helpers.
389    * FIXME: create a macro to define this kind of entry
390    */
391   { TARGET_SIOCGSTAMP_OLD, TARGET_SIOCGSTAMP_OLD,
392     "SIOCGSTAMP_OLD", IOC_R, do_ioctl_SIOCGSTAMP,
393     { MK_PTR(MK_STRUCT(STRUCT_timeval)) } },
394   { TARGET_SIOCGSTAMPNS_OLD, TARGET_SIOCGSTAMPNS_OLD,
395     "SIOCGSTAMPNS_OLD", IOC_R, do_ioctl_SIOCGSTAMPNS,
396     { MK_PTR(MK_STRUCT(STRUCT_timespec)) } },
397   { TARGET_SIOCGSTAMP_NEW, TARGET_SIOCGSTAMP_NEW,
398     "SIOCGSTAMP_NEW", IOC_R, do_ioctl_SIOCGSTAMP,
399     { MK_PTR(MK_STRUCT(STRUCT__kernel_sock_timeval)) } },
400   { TARGET_SIOCGSTAMPNS_NEW, TARGET_SIOCGSTAMPNS_NEW,
401     "SIOCGSTAMPNS_NEW", IOC_R, do_ioctl_SIOCGSTAMPNS,
402     { MK_PTR(MK_STRUCT(STRUCT__kernel_timespec)) } },
403 
404   IOCTL(RNDGETENTCNT, IOC_R, MK_PTR(TYPE_INT))
405   IOCTL(RNDADDTOENTCNT, IOC_W, MK_PTR(TYPE_INT))
406   IOCTL(RNDZAPENTCNT, 0, TYPE_NULL)
407   IOCTL(RNDCLEARPOOL, 0, TYPE_NULL)
408 #ifdef RNDRESEEDCRNG
409   IOCTL(RNDRESEEDCRNG, 0, TYPE_NULL)
410 #endif
411 
412   IOCTL(CDROMPAUSE, 0, TYPE_NULL)
413   IOCTL(CDROMSTART, 0, TYPE_NULL)
414   IOCTL(CDROMSTOP, 0, TYPE_NULL)
415   IOCTL(CDROMRESUME, 0, TYPE_NULL)
416   IOCTL(CDROMEJECT, 0, TYPE_NULL)
417   IOCTL(CDROMEJECT_SW, 0, TYPE_INT)
418   IOCTL(CDROMCLOSETRAY, 0, TYPE_NULL)
419   IOCTL(CDROMRESET, 0, TYPE_NULL)
420   IOCTL(CDROMPLAYMSF, IOC_W, MK_PTR(TYPE_INT))
421   IOCTL(CDROMPLAYTRKIND, IOC_W, MK_PTR(TYPE_INT))
422   IOCTL(CDROMREADTOCHDR, IOC_R, MK_PTR(TYPE_INT))
423   IOCTL(CDROMREADTOCENTRY, IOC_RW, MK_PTR(TYPE_INT))
424   IOCTL(CDROMVOLCTRL, IOC_W, MK_PTR(TYPE_INT))
425   IOCTL(CDROMSUBCHNL, IOC_RW, MK_PTR(TYPE_INT))
426   /* XXX: incorrect (need specific handling) */
427   IOCTL(CDROMREADAUDIO, IOC_W, MK_PTR(MK_STRUCT(STRUCT_cdrom_read_audio)))
428   IOCTL(CDROMREADCOOKED, IOC_RW, MK_PTR(TYPE_INT))
429   IOCTL(CDROMREADRAW, IOC_RW, MK_PTR(TYPE_INT))
430   IOCTL(CDROMREADMODE1, IOC_RW, MK_PTR(TYPE_INT))
431   IOCTL(CDROMREADMODE2, IOC_RW, MK_PTR(TYPE_INT))
432   IOCTL(CDROMREADALL, IOC_RW, MK_PTR(TYPE_INT))
433   IOCTL(CDROMMULTISESSION, IOC_RW, MK_PTR(TYPE_INT))
434   IOCTL(CDROM_GET_UPC, IOC_R, MK_PTR(TYPE_INT))
435   IOCTL(CDROMVOLREAD, IOC_R, MK_PTR(TYPE_INT))
436   IOCTL(CDROMSEEK, IOC_W, MK_PTR(TYPE_INT))
437   IOCTL(CDROMPLAYBLK, IOC_W, MK_PTR(TYPE_INT))
438   IOCTL(CDROM_MEDIA_CHANGED, 0, TYPE_NULL)
439   IOCTL(CDROM_SET_OPTIONS, 0, TYPE_INT)
440   IOCTL(CDROM_CLEAR_OPTIONS, 0, TYPE_INT)
441   IOCTL(CDROM_SELECT_SPEED, 0, TYPE_INT)
442   IOCTL(CDROM_SELECT_DISC, 0, TYPE_INT)
443   IOCTL(CDROM_DRIVE_STATUS, 0, TYPE_NULL)
444   IOCTL(CDROM_DISC_STATUS, 0, TYPE_NULL)
445   IOCTL(CDROMAUDIOBUFSIZ, 0, TYPE_INT)
446 
447 #if 0
448   IOCTL(SNDCTL_COPR_HALT, IOC_RW, MK_PTR(TYPE_INT))
449   IOCTL(SNDCTL_COPR_LOAD, IOC_RW, MK_PTR(TYPE_INT))
450   IOCTL(SNDCTL_COPR_RCODE, IOC_RW, MK_PTR(TYPE_INT))
451   IOCTL(SNDCTL_COPR_RCVMSG, IOC_R, MK_PTR(TYPE_INT))
452   IOCTL(SNDCTL_COPR_RDATA, IOC_RW, MK_PTR(TYPE_INT))
453   IOCTL(SNDCTL_COPR_RESET, 0, TYPE_NULL)
454   IOCTL(SNDCTL_COPR_RUN, IOC_RW, MK_PTR(TYPE_INT))
455   IOCTL(SNDCTL_COPR_SENDMSG, IOC_RW, MK_PTR(TYPE_INT))
456   IOCTL(SNDCTL_COPR_WCODE, IOC_W, MK_PTR(TYPE_INT))
457   IOCTL(SNDCTL_COPR_WDATA, IOC_W, MK_PTR(TYPE_INT))
458 #endif
459   IOCTL(SNDCTL_DSP_CHANNELS, IOC_RW, MK_PTR(TYPE_INT))
460   IOCTL(SNDCTL_DSP_GETBLKSIZE, IOC_RW, MK_PTR(TYPE_INT))
461   IOCTL(SNDCTL_DSP_GETCAPS, IOC_R, MK_PTR(TYPE_INT))
462   IOCTL(SNDCTL_DSP_GETFMTS, IOC_R, MK_PTR(TYPE_INT))
463   IOCTL(SNDCTL_DSP_GETIPTR, IOC_R, MK_PTR(MK_STRUCT(STRUCT_count_info)))
464   IOCTL(SNDCTL_DSP_GETOPTR, IOC_R, MK_PTR(MK_STRUCT(STRUCT_count_info)))
465   IOCTL(SNDCTL_DSP_GETISPACE, IOC_R, MK_PTR(MK_STRUCT(STRUCT_audio_buf_info)))
466   IOCTL(SNDCTL_DSP_GETOSPACE, IOC_R, MK_PTR(MK_STRUCT(STRUCT_audio_buf_info)))
467   IOCTL(SNDCTL_DSP_GETTRIGGER, IOC_R, MK_PTR(TYPE_INT))
468   IOCTL(SNDCTL_DSP_MAPINBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc)))
469   IOCTL(SNDCTL_DSP_MAPOUTBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc)))
470   IOCTL(SNDCTL_DSP_NONBLOCK, 0, TYPE_NULL)
471   IOCTL(SNDCTL_DSP_POST, 0, TYPE_NULL)
472   IOCTL(SNDCTL_DSP_RESET, 0, TYPE_NULL)
473   IOCTL(SNDCTL_DSP_SETDUPLEX, 0, TYPE_NULL)
474   IOCTL(SNDCTL_DSP_SETFMT, IOC_RW, MK_PTR(TYPE_INT))
475   IOCTL(SNDCTL_DSP_SETFRAGMENT, IOC_RW, MK_PTR(TYPE_INT))
476   IOCTL(SNDCTL_DSP_SETSYNCRO, 0, TYPE_NULL)
477   IOCTL(SNDCTL_DSP_SETTRIGGER, IOC_W, MK_PTR(TYPE_INT))
478   IOCTL(SNDCTL_DSP_SPEED, IOC_RW, MK_PTR(TYPE_INT))
479   IOCTL(SNDCTL_DSP_STEREO, IOC_RW, MK_PTR(TYPE_INT))
480   IOCTL(SNDCTL_DSP_SUBDIVIDE, IOC_RW, MK_PTR(TYPE_INT))
481   IOCTL(SNDCTL_DSP_SYNC, 0, TYPE_NULL)
482 #if 0
483   IOCTL(SNDCTL_FM_4OP_ENABLE, IOC_W, MK_PTR(TYPE_INT))
484   IOCTL(SNDCTL_FM_LOAD_INSTR, IOC_W, MK_PTR(TYPE_INT))
485   IOCTL(SNDCTL_MIDI_INFO, IOC_RW, MK_PTR(TYPE_INT))
486   IOCTL(SNDCTL_MIDI_MPUCMD, IOC_RW, MK_PTR(TYPE_INT))
487   IOCTL(SNDCTL_MIDI_MPUMODE, IOC_RW, MK_PTR(TYPE_INT))
488   IOCTL(SNDCTL_MIDI_PRETIME, IOC_RW, MK_PTR(TYPE_INT))
489   IOCTL(SNDCTL_SEQ_CTRLRATE, IOC_RW, MK_PTR(TYPE_INT))
490   IOCTL(SNDCTL_SEQ_GETINCOUNT, IOC_R, MK_PTR(TYPE_INT))
491   IOCTL(SNDCTL_SEQ_GETOUTCOUNT, IOC_R, MK_PTR(TYPE_INT))
492   IOCTL(SNDCTL_SEQ_NRMIDIS, IOC_R, MK_PTR(TYPE_INT))
493   IOCTL(SNDCTL_SEQ_NRSYNTHS, IOC_R, MK_PTR(TYPE_INT))
494   IOCTL(SNDCTL_SEQ_OUTOFBAND, IOC_W, MK_PTR(TYPE_INT))
495   IOCTL(SNDCTL_SEQ_PANIC, 0, TYPE_NULL)
496   IOCTL(SNDCTL_SEQ_PERCMODE, IOC_W, MK_PTR(TYPE_INT))
497   IOCTL(SNDCTL_SEQ_RESET, 0, TYPE_NULL)
498   IOCTL(SNDCTL_SEQ_RESETSAMPLES, IOC_W, MK_PTR(TYPE_INT))
499   IOCTL(SNDCTL_SEQ_SYNC, 0, TYPE_NULL)
500   IOCTL(SNDCTL_SEQ_TESTMIDI, IOC_W, MK_PTR(TYPE_INT))
501   IOCTL(SNDCTL_SEQ_THRESHOLD, IOC_W, MK_PTR(TYPE_INT))
502   IOCTL(SNDCTL_SYNTH_INFO, IOC_RW, MK_PTR(TYPE_INT))
503   IOCTL(SNDCTL_SYNTH_MEMAVL, IOC_RW, MK_PTR(TYPE_INT))
504   IOCTL(SNDCTL_TMR_CONTINUE, 0, TYPE_NULL)
505   IOCTL(SNDCTL_TMR_METRONOME, IOC_W, MK_PTR(TYPE_INT))
506   IOCTL(SNDCTL_TMR_SELECT, IOC_W, MK_PTR(TYPE_INT))
507   IOCTL(SNDCTL_TMR_SOURCE, IOC_RW, MK_PTR(TYPE_INT))
508 #if 0
509      /* we invalidate these defines because they have a same number as
510         termios ioctls */
511   IOCTL(SNDCTL_TMR_START, 0, TYPE_NULL)
512   IOCTL(SNDCTL_TMR_STOP, 0, TYPE_NULL)
513 #endif
514   IOCTL(SNDCTL_TMR_TEMPO, IOC_RW, MK_PTR(TYPE_INT))
515   IOCTL(SNDCTL_TMR_TIMEBASE, IOC_RW, MK_PTR(TYPE_INT))
516 
517   IOCTL(SOUND_PCM_WRITE_FILTER, IOC_W | IOC_R, MK_PTR(TYPE_INT))
518   IOCTL(SOUND_PCM_READ_RATE, IOC_R, MK_PTR(TYPE_INT))
519   IOCTL(SOUND_PCM_READ_CHANNELS, IOC_R, MK_PTR(TYPE_INT))
520   IOCTL(SOUND_PCM_READ_BITS, IOC_R, MK_PTR(TYPE_INT))
521   IOCTL(SOUND_PCM_READ_FILTER, IOC_R, MK_PTR(TYPE_INT))
522 #endif
523   IOCTL(SOUND_MIXER_INFO, IOC_R, MK_PTR(TYPE_INT))
524   IOCTL(SOUND_MIXER_ACCESS, 0, TYPE_PTRVOID)
525   IOCTL(SOUND_MIXER_PRIVATE1, IOC_RW, MK_PTR(TYPE_INT))
526   IOCTL(SOUND_MIXER_PRIVATE2, IOC_RW, MK_PTR(TYPE_INT))
527   IOCTL(SOUND_MIXER_PRIVATE3, IOC_RW, MK_PTR(TYPE_INT))
528   IOCTL(SOUND_MIXER_PRIVATE4, IOC_RW, MK_PTR(TYPE_INT))
529   IOCTL(SOUND_MIXER_PRIVATE5, IOC_RW, MK_PTR(TYPE_INT))
530   IOCTL(SOUND_MIXER_READ_VOLUME, IOC_R, MK_PTR(TYPE_INT))
531   IOCTL(SOUND_MIXER_READ_BASS, IOC_R, MK_PTR(TYPE_INT))
532   IOCTL(SOUND_MIXER_READ_TREBLE, IOC_R, MK_PTR(TYPE_INT))
533   IOCTL(SOUND_MIXER_READ_SYNTH, IOC_R, MK_PTR(TYPE_INT))
534   IOCTL(SOUND_MIXER_READ_PCM, IOC_R, MK_PTR(TYPE_INT))
535   IOCTL(SOUND_MIXER_READ_SPEAKER, IOC_R, MK_PTR(TYPE_INT))
536   IOCTL(SOUND_MIXER_READ_LINE, IOC_R, MK_PTR(TYPE_INT))
537   IOCTL(SOUND_MIXER_READ_MIC, IOC_R, MK_PTR(TYPE_INT))
538   IOCTL(SOUND_MIXER_READ_CD, IOC_R, MK_PTR(TYPE_INT))
539   IOCTL(SOUND_MIXER_READ_IMIX, IOC_R, MK_PTR(TYPE_INT))
540   IOCTL(SOUND_MIXER_READ_ALTPCM, IOC_R, MK_PTR(TYPE_INT))
541   IOCTL(SOUND_MIXER_READ_RECLEV, IOC_R, MK_PTR(TYPE_INT))
542   IOCTL(SOUND_MIXER_READ_IGAIN, IOC_R, MK_PTR(TYPE_INT))
543   IOCTL(SOUND_MIXER_READ_OGAIN, IOC_R, MK_PTR(TYPE_INT))
544   IOCTL(SOUND_MIXER_READ_LINE1, IOC_R, MK_PTR(TYPE_INT))
545   IOCTL(SOUND_MIXER_READ_LINE2, IOC_R, MK_PTR(TYPE_INT))
546   IOCTL(SOUND_MIXER_READ_LINE3, IOC_R, MK_PTR(TYPE_INT))
547   IOCTL(SOUND_MIXER_READ_MUTE, IOC_R, MK_PTR(TYPE_INT))
548   IOCTL(SOUND_MIXER_READ_ENHANCE, IOC_R, MK_PTR(TYPE_INT))
549   IOCTL(SOUND_MIXER_READ_LOUD, IOC_R, MK_PTR(TYPE_INT))
550   IOCTL(SOUND_MIXER_READ_RECSRC, IOC_R, MK_PTR(TYPE_INT))
551   IOCTL(SOUND_MIXER_READ_DEVMASK, IOC_R, MK_PTR(TYPE_INT))
552   IOCTL(SOUND_MIXER_READ_RECMASK, IOC_R, MK_PTR(TYPE_INT))
553   IOCTL(SOUND_MIXER_READ_STEREODEVS, IOC_R, MK_PTR(TYPE_INT))
554   IOCTL(SOUND_MIXER_READ_CAPS, IOC_R, MK_PTR(TYPE_INT))
555 
556   IOCTL(SOUND_MIXER_WRITE_VOLUME, IOC_W, MK_PTR(TYPE_INT))
557   IOCTL(SOUND_MIXER_WRITE_BASS, IOC_W, MK_PTR(TYPE_INT))
558   IOCTL(SOUND_MIXER_WRITE_TREBLE, IOC_W, MK_PTR(TYPE_INT))
559   IOCTL(SOUND_MIXER_WRITE_SYNTH, IOC_W, MK_PTR(TYPE_INT))
560   IOCTL(SOUND_MIXER_WRITE_PCM, IOC_W, MK_PTR(TYPE_INT))
561   IOCTL(SOUND_MIXER_WRITE_SPEAKER, IOC_W, MK_PTR(TYPE_INT))
562   IOCTL(SOUND_MIXER_WRITE_LINE, IOC_W, MK_PTR(TYPE_INT))
563   IOCTL(SOUND_MIXER_WRITE_MIC, IOC_W, MK_PTR(TYPE_INT))
564   IOCTL(SOUND_MIXER_WRITE_CD, IOC_W, MK_PTR(TYPE_INT))
565   IOCTL(SOUND_MIXER_WRITE_IMIX, IOC_W, MK_PTR(TYPE_INT))
566   IOCTL(SOUND_MIXER_WRITE_ALTPCM, IOC_W, MK_PTR(TYPE_INT))
567   IOCTL(SOUND_MIXER_WRITE_RECLEV, IOC_W, MK_PTR(TYPE_INT))
568   IOCTL(SOUND_MIXER_WRITE_IGAIN, IOC_W, MK_PTR(TYPE_INT))
569   IOCTL(SOUND_MIXER_WRITE_OGAIN, IOC_W, MK_PTR(TYPE_INT))
570   IOCTL(SOUND_MIXER_WRITE_LINE1, IOC_W, MK_PTR(TYPE_INT))
571   IOCTL(SOUND_MIXER_WRITE_LINE2, IOC_W, MK_PTR(TYPE_INT))
572   IOCTL(SOUND_MIXER_WRITE_LINE3, IOC_W, MK_PTR(TYPE_INT))
573   IOCTL(SOUND_MIXER_WRITE_MUTE, IOC_W, MK_PTR(TYPE_INT))
574   IOCTL(SOUND_MIXER_WRITE_ENHANCE, IOC_W, MK_PTR(TYPE_INT))
575   IOCTL(SOUND_MIXER_WRITE_LOUD, IOC_W, MK_PTR(TYPE_INT))
576   IOCTL(SOUND_MIXER_WRITE_RECSRC, IOC_W, MK_PTR(TYPE_INT))
577 
578   IOCTL(SNDRV_TIMER_IOCTL_PVERSION, IOC_R, MK_PTR(TYPE_INT))
579   IOCTL(SNDRV_TIMER_IOCTL_NEXT_DEVICE, IOC_RW,
580         MK_PTR(MK_STRUCT(STRUCT_snd_timer_id)))
581   IOCTL(SNDRV_TIMER_IOCTL_GINFO, IOC_RW,
582         MK_PTR(MK_STRUCT(STRUCT_snd_timer_ginfo)))
583   IOCTL(SNDRV_TIMER_IOCTL_GPARAMS, IOC_W,
584         MK_PTR(MK_STRUCT(STRUCT_snd_timer_gparams)))
585   IOCTL(SNDRV_TIMER_IOCTL_GSTATUS, IOC_RW,
586         MK_PTR(MK_STRUCT(STRUCT_snd_timer_gstatus)))
587   IOCTL(SNDRV_TIMER_IOCTL_SELECT, IOC_W,
588         MK_PTR(MK_STRUCT(STRUCT_snd_timer_select)))
589   IOCTL(SNDRV_TIMER_IOCTL_INFO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_snd_timer_info)))
590   IOCTL(SNDRV_TIMER_IOCTL_PARAMS, IOC_W,
591         MK_PTR(MK_STRUCT(STRUCT_snd_timer_params)))
592   IOCTL(SNDRV_TIMER_IOCTL_STATUS, IOC_R,
593         MK_PTR(MK_STRUCT(STRUCT_snd_timer_status)))
594   IOCTL(SNDRV_TIMER_IOCTL_START, 0, TYPE_NULL)
595   IOCTL(SNDRV_TIMER_IOCTL_STOP, 0, TYPE_NULL)
596   IOCTL(SNDRV_TIMER_IOCTL_CONTINUE, 0, TYPE_NULL)
597   IOCTL(SNDRV_TIMER_IOCTL_PAUSE, 0, TYPE_NULL)
598 
599   IOCTL(HDIO_GETGEO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_hd_geometry)))
600   IOCTL(HDIO_GET_UNMASKINTR, IOC_R, MK_PTR(TYPE_INT))
601   IOCTL(HDIO_GET_MULTCOUNT, IOC_R, MK_PTR(TYPE_INT))
602   IOCTL(HDIO_GET_IDENTITY, IOC_R, MK_PTR(TYPE_INT))
603   IOCTL(HDIO_GET_KEEPSETTINGS, IOC_R, MK_PTR(TYPE_INT))
604   IOCTL(HDIO_GET_NOWERR, IOC_R, MK_PTR(TYPE_INT))
605   IOCTL(HDIO_GET_DMA, IOC_R, MK_PTR(TYPE_INT))
606   IOCTL(HDIO_GET_32BIT, IOC_R, MK_PTR(TYPE_INT))
607   IOCTL(HDIO_DRIVE_CMD, IOC_R, MK_PTR(TYPE_INT))
608   IOCTL(HDIO_SET_UNMASKINTR, 0, TYPE_INT)
609   IOCTL(HDIO_SET_MULTCOUNT, 0, TYPE_INT)
610   IOCTL(HDIO_SET_KEEPSETTINGS, 0, TYPE_INT)
611   IOCTL(HDIO_SET_NOWERR, 0, TYPE_INT)
612   IOCTL(HDIO_SET_DMA, 0, TYPE_INT)
613   IOCTL(HDIO_SET_32BIT, 0, TYPE_INT)
614   IOCTL(HDIO_SET_PIO_MODE, 0, TYPE_INT)
615 
616   IOCTL(VFAT_IOCTL_READDIR_BOTH, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
617   IOCTL(VFAT_IOCTL_READDIR_SHORT, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
618 
619   IOCTL(LOOP_SET_FD, 0, TYPE_INT)
620   IOCTL(LOOP_CLR_FD, 0, TYPE_INT)
621   IOCTL(LOOP_SET_STATUS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info)))
622   IOCTL(LOOP_GET_STATUS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_loop_info)))
623   IOCTL(LOOP_SET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64)))
624   IOCTL(LOOP_GET_STATUS64, IOC_R, MK_PTR(MK_STRUCT(STRUCT_loop_info64)))
625   IOCTL(LOOP_CHANGE_FD, 0, TYPE_INT)
626   IOCTL(LOOP_SET_CAPACITY, 0, TYPE_INT)
627   IOCTL(LOOP_SET_DIRECT_IO, 0, TYPE_INT)
628   IOCTL(LOOP_SET_BLOCK_SIZE, 0, TYPE_INT)
629   IOCTL(LOOP_CONFIGURE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_config)))
630 
631   IOCTL(LOOP_CTL_ADD, 0, TYPE_INT)
632   IOCTL(LOOP_CTL_REMOVE, 0, TYPE_INT)
633   IOCTL(LOOP_CTL_GET_FREE, 0, TYPE_NULL)
634 
635   IOCTL(MTIOCTOP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_mtop)))
636   IOCTL(MTIOCGET, IOC_R, MK_PTR(MK_STRUCT(STRUCT_mtget)))
637   IOCTL(MTIOCPOS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_mtpos)))
638 
639   IOCTL(FBIOGET_FSCREENINFO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_fb_fix_screeninfo)))
640   IOCTL(FBIOGET_VSCREENINFO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_fb_var_screeninfo)))
641   IOCTL(FBIOPUT_VSCREENINFO, IOC_W, MK_PTR(MK_STRUCT(STRUCT_fb_var_screeninfo)))
642   IOCTL(FBIOGETCMAP,        IOC_RW, MK_PTR(MK_STRUCT(STRUCT_fb_cmap)))
643   IOCTL(FBIOPUTCMAP,        IOC_RW, MK_PTR(MK_STRUCT(STRUCT_fb_cmap)))
644   IOCTL(FBIOPAN_DISPLAY,    IOC_RW, MK_PTR(MK_STRUCT(STRUCT_fb_var_screeninfo)))
645   IOCTL(FBIOGET_CON2FBMAP,  IOC_RW, MK_PTR(MK_STRUCT(STRUCT_fb_con2fbmap)))
646   IOCTL(FBIOPUT_CON2FBMAP,  IOC_RW, MK_PTR(MK_STRUCT(STRUCT_fb_con2fbmap)))
647 
648   IOCTL(VT_OPENQRY, IOC_R, MK_PTR(TYPE_INT))
649   IOCTL(VT_GETSTATE, IOC_R, MK_PTR(MK_STRUCT(STRUCT_vt_stat)))
650   IOCTL(VT_ACTIVATE, 0, TYPE_INT)
651   IOCTL(VT_WAITACTIVE, 0, TYPE_INT)
652   IOCTL(VT_LOCKSWITCH, 0, TYPE_INT)
653   IOCTL(VT_UNLOCKSWITCH, 0, TYPE_INT)
654   IOCTL(VT_GETMODE, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_vt_mode)))
655   IOCTL(VT_SETMODE, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_vt_mode)))
656   IOCTL(VT_RELDISP, 0, TYPE_INT)
657   IOCTL(VT_DISALLOCATE, 0, TYPE_INT)
658 
659   IOCTL(DM_VERSION, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
660   IOCTL_SPECIAL(DM_REMOVE_ALL,   IOC_RW, do_ioctl_dm,
661                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
662   IOCTL_SPECIAL(DM_LIST_DEVICES, IOC_RW, do_ioctl_dm,
663                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
664   IOCTL_SPECIAL(DM_DEV_CREATE,   IOC_RW, do_ioctl_dm,
665                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
666   IOCTL_SPECIAL(DM_DEV_REMOVE,   IOC_RW, do_ioctl_dm,
667                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
668   IOCTL_SPECIAL(DM_DEV_RENAME,   IOC_RW, do_ioctl_dm,
669                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
670   IOCTL_SPECIAL(DM_DEV_SUSPEND,  IOC_RW, do_ioctl_dm,
671                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
672   IOCTL_SPECIAL(DM_DEV_STATUS,   IOC_RW, do_ioctl_dm,
673                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
674   IOCTL_SPECIAL(DM_DEV_WAIT,     IOC_RW, do_ioctl_dm,
675                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
676   IOCTL_SPECIAL(DM_TABLE_LOAD,   IOC_RW, do_ioctl_dm,
677                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
678   IOCTL_SPECIAL(DM_TABLE_CLEAR,  IOC_RW, do_ioctl_dm,
679                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
680   IOCTL_SPECIAL(DM_TABLE_DEPS,   IOC_RW, do_ioctl_dm,
681                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
682   IOCTL_SPECIAL(DM_TABLE_STATUS, IOC_RW, do_ioctl_dm,
683                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
684   IOCTL_SPECIAL(DM_LIST_VERSIONS,IOC_RW, do_ioctl_dm,
685                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
686   IOCTL_SPECIAL(DM_TARGET_MSG,   IOC_RW, do_ioctl_dm,
687                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
688   IOCTL_SPECIAL(DM_DEV_SET_GEOMETRY, IOC_RW, do_ioctl_dm,
689                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
690   IOCTL_SPECIAL(SIOCADDRT, IOC_W, do_ioctl_rt,
691                 MK_PTR(MK_STRUCT(STRUCT_rtentry)))
692   IOCTL_SPECIAL(SIOCDELRT, IOC_W, do_ioctl_rt,
693                 MK_PTR(MK_STRUCT(STRUCT_rtentry)))
694 
695 #ifdef HAVE_DRM_H
696   IOCTL_SPECIAL(DRM_IOCTL_VERSION, IOC_RW, do_ioctl_drm,
697                 MK_PTR(MK_STRUCT(STRUCT_drm_version)))
698 
699   IOCTL_SPECIAL(DRM_IOCTL_I915_GETPARAM, IOC_RW, do_ioctl_drm_i915,
700                 MK_PTR(MK_STRUCT(STRUCT_drm_i915_getparam)))
701 #endif
702 
703 #ifdef TARGET_TIOCSTART
704   IOCTL_IGNORE(TIOCSTART)
705   IOCTL_IGNORE(TIOCSTOP)
706 #endif
707 
708 #ifdef HAVE_SYS_KCOV_H
709   IOCTL(KCOV_ENABLE, 0, TYPE_NULL)
710   IOCTL(KCOV_DISABLE, 0, TYPE_NULL)
711   IOCTL(KCOV_INIT_TRACE, IOC_R, TYPE_ULONG)
712 #endif
713 
714   IOCTL(TUNSETDEBUG,     IOC_W, TYPE_INT)
715   IOCTL(TUNSETIFF,       IOC_RW, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)))
716   IOCTL(TUNSETPERSIST,   IOC_W, TYPE_INT)
717   IOCTL(TUNSETOWNER,     IOC_W, TYPE_INT)
718   IOCTL(TUNSETLINK,      IOC_W, TYPE_INT)
719   IOCTL(TUNSETGROUP,     IOC_W, TYPE_INT)
720   IOCTL(TUNGETFEATURES,  IOC_R, MK_PTR(TYPE_INT))
721   IOCTL(TUNSETOFFLOAD,   IOC_W, TYPE_LONG)
722   IOCTL_SPECIAL(TUNSETTXFILTER, IOC_W, do_ioctl_TUNSETTXFILTER,
723                 /*
724                  * We can't represent `struct tun_filter` in thunk so leaving
725                  * it uninterpreted. do_ioctl_TUNSETTXFILTER will do the
726                  * conversion.
727                  */
728                 TYPE_PTRVOID)
729   IOCTL(TUNGETIFF,       IOC_R, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)))
730   IOCTL(TUNGETSNDBUF,    IOC_R, MK_PTR(TYPE_INT))
731   IOCTL(TUNSETSNDBUF,    IOC_W, MK_PTR(TYPE_INT))
732   /*
733    * TUNATTACHFILTER and TUNDETACHFILTER are not supported. Linux kernel keeps a
734    * user pointer in TUNATTACHFILTER, which we are not able to correctly handle.
735    */
736   IOCTL(TUNGETVNETHDRSZ, IOC_R, MK_PTR(TYPE_INT))
737   IOCTL(TUNSETVNETHDRSZ, IOC_W, MK_PTR(TYPE_INT))
738   IOCTL(TUNSETQUEUE,     IOC_W, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)))
739   IOCTL(TUNSETIFINDEX ,  IOC_W, MK_PTR(TYPE_INT))
740   /* TUNGETFILTER is not supported: see TUNATTACHFILTER. */
741 #ifdef TUNSETVNETLE
742   IOCTL(TUNSETVNETLE,    IOC_W, MK_PTR(TYPE_INT))
743   IOCTL(TUNGETVNETLE,    IOC_R, MK_PTR(TYPE_INT))
744 #endif
745 #ifdef TUNSETVNETBE
746   IOCTL(TUNSETVNETBE,    IOC_W, MK_PTR(TYPE_INT))
747   IOCTL(TUNGETVNETBE,    IOC_R, MK_PTR(TYPE_INT))
748 #endif
749 #ifdef TUNSETSTEERINGEBPF
750   IOCTL(TUNSETSTEERINGEBPF, IOC_W, MK_PTR(TYPE_INT))
751 #endif
752 #ifdef TUNSETFILTEREBPF
753   IOCTL(TUNSETFILTEREBPF, IOC_W, MK_PTR(TYPE_INT))
754 #endif
755 #ifdef TUNSETCARRIER
756   IOCTL(TUNSETCARRIER,   IOC_W, MK_PTR(TYPE_INT))
757 #endif
758 #ifdef TUNGETDEVNETNS
759   IOCTL(TUNGETDEVNETNS,  IOC_R, TYPE_NULL)
760 #endif
761