| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |      /* emulated ioctl list */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      IOCTL(TCGETS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios))) | 
					
						
							| 
									
										
										
										
											2003-03-23 16:49:39 +00:00
										 |  |  |      IOCTL(TCSETS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios))) | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |      IOCTL(TCSETSF, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios))) | 
					
						
							|  |  |  |      IOCTL(TCSETSW, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios))) | 
					
						
							|  |  |  |      IOCTL(TIOCGWINSZ, IOC_R, MK_PTR(MK_STRUCT(STRUCT_winsize))) | 
					
						
							|  |  |  |      IOCTL(TIOCSWINSZ, IOC_W, MK_PTR(MK_STRUCT(STRUCT_winsize))) | 
					
						
							|  |  |  |      IOCTL(FIONREAD, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TCGETA, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TCSETA, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TCSETAW, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TCSETAF, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TCSBRK, 0, TYPE_INT) | 
					
						
							|  |  |  |      IOCTL(TCSBRKP, 0, TYPE_INT) | 
					
						
							|  |  |  |      IOCTL(TCXONC, 0, TYPE_INT) | 
					
						
							|  |  |  |      IOCTL(TCFLSH, 0, TYPE_INT) | 
					
						
							|  |  |  |      IOCTL(TIOCEXCL, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(TIOCNXCL, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(TIOCSCTTY, 0, TYPE_INT) | 
					
						
							|  |  |  |      IOCTL(TIOCGPGRP, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TIOCSPGRP, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2013-08-30 01:46:42 +02:00
										 |  |  |      IOCTL(TIOCGSID, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |      IOCTL(TIOCOUTQ, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TIOCSTI, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TIOCMGET, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TIOCMBIS, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TIOCMBIC, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TIOCMSET, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TIOCGSOFTCAR, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TIOCSSOFTCAR, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TIOCLINUX, IOC_R | IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TIOCCONS, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(TIOCGSERIAL, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TIOCSSERIAL, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TIOCPKT, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(FIONBIO, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TIOCNOTTY, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(TIOCGETD, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TIOCSETD, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2003-04-10 00:12:45 +00:00
										 |  |  |      IOCTL(TIOCGPTN, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TIOCSPTLCK, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2018-01-29 11:47:06 +01:00
										 |  |  | #ifdef TIOCGPTPEER
 | 
					
						
							|  |  |  |      IOCTL_SPECIAL(TIOCGPTPEER, 0, do_ioctl_tiocgptpeer, TYPE_INT) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |      IOCTL(FIOCLEX, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(FIONCLEX, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(FIOASYNC, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TIOCGLCKTRMIOS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios))) | 
					
						
							|  |  |  |      IOCTL(TIOCSLCKTRMIOS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios))) | 
					
						
							|  |  |  |      IOCTL(TIOCSERCONFIG, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(TIOCSERGETLSR, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(TIOCSERGETMULTI, IOC_R, MK_PTR(MK_STRUCT(STRUCT_serial_multiport_struct))) | 
					
						
							|  |  |  |      IOCTL(TIOCSERSETMULTI, IOC_W, MK_PTR(MK_STRUCT(STRUCT_serial_multiport_struct))) | 
					
						
							|  |  |  |      IOCTL(TIOCMIWAIT, 0, TYPE_INT) | 
					
						
							|  |  |  |      IOCTL(TIOCGICOUNT, IOC_R, MK_PTR(MK_STRUCT(STRUCT_serial_icounter_struct))) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-10 12:38:16 +00:00
										 |  |  |      IOCTL(KIOCSOUND, 0, TYPE_INT) | 
					
						
							|  |  |  |      IOCTL(KDMKTONE, 0, TYPE_INT) | 
					
						
							| 
									
										
										
										
											2009-10-16 17:00:44 +02:00
										 |  |  |      IOCTL(KDSETMODE, 0, TYPE_INT) | 
					
						
							| 
									
										
										
										
											2003-05-10 12:38:16 +00:00
										 |  |  |      IOCTL(KDGKBTYPE, IOC_R, MK_PTR(TYPE_CHAR)) | 
					
						
							| 
									
										
										
										
											2009-10-16 17:00:44 +02:00
										 |  |  |      IOCTL(KDGKBMODE, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(KDSKBMODE, 0, TYPE_INT) | 
					
						
							| 
									
										
										
										
											2003-05-10 12:38:16 +00:00
										 |  |  |      IOCTL(KDGKBENT, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_kbentry))) | 
					
						
							| 
									
										
										
										
											2006-03-25 19:31:22 +00:00
										 |  |  |      IOCTL(KDGKBSENT, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_kbsentry))) | 
					
						
							| 
									
										
										
										
											2011-06-29 15:09:09 +02:00
										 |  |  |      IOCTL(KDGKBLED, 0, TYPE_INT) | 
					
						
							|  |  |  |      IOCTL(KDSKBLED, 0, TYPE_INT) | 
					
						
							|  |  |  |      IOCTL(KDGETLED, 0, TYPE_INT) | 
					
						
							|  |  |  |      IOCTL(KDSETLED, 0, TYPE_INT) | 
					
						
							| 
									
										
										
										
											2014-06-22 11:25:47 +01:00
										 |  |  |      IOCTL_SPECIAL(KDSIGACCEPT, 0, do_ioctl_kdsigaccept, TYPE_INT) | 
					
						
							| 
									
										
										
										
											2003-05-08 15:42:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												linux-user: Add support for enabling/disabling RTC features using ioctls
This patch implements functionalities of following ioctls:
RTC_AIE_ON, RTC_AIE_OFF - Alarm interrupt enabling on/off
    Enable or disable the alarm interrupt, for RTCs that support
    alarms.  The third ioctl's argument is ignored.
RTC_UIE_ON, RTC_UIE_OFF - Update interrupt enabling on/off
    Enable or disable the interrupt on every clock update, for
    RTCs that support this once-per-second interrupt. The third
    ioctl's argument is ignored.
RTC_PIE_ON, RTC_PIE_OFF - Periodic interrupt enabling on/off
    Enable or disable the periodic interrupt, for RTCs that sup‐
    port these periodic interrupts. The third ioctl's argument
    is ignored. Only a privileged process (i.e., one having the
    CAP_SYS_RESOURCE capability) can enable the periodic interrupt
    if the frequency is currently set above the value specified in
    /proc/sys/dev/rtc/max-user-freq.
RTC_WIE_ON, RTC_WIE_OFF - Watchdog interrupt enabling on/off
    Enable or disable the Watchdog interrupt, for RTCs that sup-
    port this Watchdog interrupt. The third ioctl's argument is
    ignored.
Implementation notes:
    Since all of involved ioctls have NULL as their third argument,
    their implementation was straightforward.
    The line '#include <linux/rtc.h>' was added to recognize
    preprocessor definitions for these ioctls. This needs to be
    done only once in this series of commits. Also, the content
    of this file (with respect to ioctl definitions) remained
    unchanged for a long time, therefore there is no need to
    worry about supporting older Linux kernel version.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Filip Bozuta <Filip.Bozuta@rt-rk.com>
Message-Id: <1579117007-7565-2-git-send-email-Filip.Bozuta@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
											
										 
											2020-01-15 20:36:35 +01:00
										 |  |  |      IOCTL(RTC_AIE_ON, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(RTC_AIE_OFF, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(RTC_UIE_ON, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(RTC_UIE_OFF, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(RTC_PIE_ON, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(RTC_PIE_OFF, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(RTC_WIE_ON, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(RTC_WIE_OFF, 0, TYPE_NULL) | 
					
						
							| 
									
										
										
										
											2020-01-15 20:36:36 +01:00
										 |  |  |      IOCTL(RTC_ALM_READ, IOC_R, MK_PTR(MK_STRUCT(STRUCT_rtc_time))) | 
					
						
							|  |  |  |      IOCTL(RTC_ALM_SET, IOC_W, MK_PTR(MK_STRUCT(STRUCT_rtc_time))) | 
					
						
							|  |  |  |      IOCTL(RTC_RD_TIME, IOC_R, MK_PTR(MK_STRUCT(STRUCT_rtc_time))) | 
					
						
							|  |  |  |      IOCTL(RTC_SET_TIME, IOC_W, MK_PTR(MK_STRUCT(STRUCT_rtc_time))) | 
					
						
							| 
									
										
											  
											
												linux-user: Add support for getting/setting RTC periodic interrupt and epoch using ioctls
This patch implements functionalities of following ioctls:
RTC_IRQP_READ, RTC_IRQP_SET - Getting/Setting IRQ rate
    Read and set the frequency for periodic interrupts, for RTCs
    that support periodic interrupts. The periodic interrupt must
    be separately enabled or disabled using the RTC_PIE_ON,
    RTC_PIE_OFF requests. The third ioctl's argument is an
    unsigned long * or an unsigned long, respectively. The value
    is the frequency in interrupts per second. The set of allow‐
    able frequencies is the multiples of two in the range 2 to
    8192. Only a privileged process (i.e., one having the
    CAP_SYS_RESOURCE capability) can set frequencies above the
    value specified in /proc/sys/dev/rtc/max-user-freq. (This
    file contains the value 64 by default.)
RTC_EPOCH_READ, RTC_EPOCH_SET - Getting/Setting epoch
    Many RTCs encode the year in an 8-bit register which is either
    interpreted as an 8-bit binary number or as a BCD number. In
    both cases, the number is interpreted relative to this RTC's
    Epoch. The RTC's Epoch is initialized to 1900 on most systems
    but on Alpha and MIPS it might also be initialized to 1952,
    1980, or 2000, depending on the value of an RTC register for
    the year. With some RTCs, these operations can be used to
    read or to set the RTC's Epoch, respectively. The third
    ioctl's argument is an unsigned long * or an unsigned long,
    respectively, and the value returned (or assigned) is the
    Epoch. To set the RTC's Epoch the process must be privileged
    (i.e., have the CAP_SYS_TIME capability).
Implementation notes:
    All ioctls in this patch have a pointer to 'ulong' as their
    third argument. That is the reason why corresponding parts
    of added code in linux-user/syscall_defs.h contain special
    handling related to 'ulong' type: they use 'abi_ulong' type
    to make sure that ioctl's code is calculated correctly for
    both 32-bit and 64-bit targets. Also, 'MK_PTR(TYPE_ULONG)'
    is used for the similar reason in linux-user/ioctls.h.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Filip Bozuta <Filip.Bozuta@rt-rk.com>
Message-Id: <1579117007-7565-4-git-send-email-Filip.Bozuta@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
											
										 
											2020-01-15 20:36:37 +01:00
										 |  |  |      IOCTL(RTC_IRQP_READ, IOC_R, MK_PTR(TYPE_ULONG)) | 
					
						
							|  |  |  |      IOCTL(RTC_IRQP_SET, IOC_W, TYPE_ULONG) | 
					
						
							|  |  |  |      IOCTL(RTC_EPOCH_READ, IOC_R, MK_PTR(TYPE_ULONG)) | 
					
						
							|  |  |  |      IOCTL(RTC_EPOCH_SET, IOC_W, TYPE_ULONG) | 
					
						
							| 
									
										
										
										
											2020-01-15 20:36:38 +01:00
										 |  |  |      IOCTL(RTC_WKALM_RD, IOC_R, MK_PTR(MK_STRUCT(STRUCT_rtc_wkalrm))) | 
					
						
							|  |  |  |      IOCTL(RTC_WKALM_SET, IOC_W, MK_PTR(MK_STRUCT(STRUCT_rtc_wkalrm))) | 
					
						
							| 
									
										
										
										
											2020-01-15 20:36:39 +01:00
										 |  |  |      IOCTL(RTC_PLL_GET, IOC_R, MK_PTR(MK_STRUCT(STRUCT_rtc_pll_info))) | 
					
						
							|  |  |  |      IOCTL(RTC_PLL_SET, IOC_W, MK_PTR(MK_STRUCT(STRUCT_rtc_pll_info))) | 
					
						
							| 
									
										
										
										
											2020-01-15 20:36:40 +01:00
										 |  |  |      IOCTL(RTC_VL_READ, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(RTC_VL_CLR, 0, TYPE_NULL) | 
					
						
							| 
									
										
											  
											
												linux-user: Add support for enabling/disabling RTC features using ioctls
This patch implements functionalities of following ioctls:
RTC_AIE_ON, RTC_AIE_OFF - Alarm interrupt enabling on/off
    Enable or disable the alarm interrupt, for RTCs that support
    alarms.  The third ioctl's argument is ignored.
RTC_UIE_ON, RTC_UIE_OFF - Update interrupt enabling on/off
    Enable or disable the interrupt on every clock update, for
    RTCs that support this once-per-second interrupt. The third
    ioctl's argument is ignored.
RTC_PIE_ON, RTC_PIE_OFF - Periodic interrupt enabling on/off
    Enable or disable the periodic interrupt, for RTCs that sup‐
    port these periodic interrupts. The third ioctl's argument
    is ignored. Only a privileged process (i.e., one having the
    CAP_SYS_RESOURCE capability) can enable the periodic interrupt
    if the frequency is currently set above the value specified in
    /proc/sys/dev/rtc/max-user-freq.
RTC_WIE_ON, RTC_WIE_OFF - Watchdog interrupt enabling on/off
    Enable or disable the Watchdog interrupt, for RTCs that sup-
    port this Watchdog interrupt. The third ioctl's argument is
    ignored.
Implementation notes:
    Since all of involved ioctls have NULL as their third argument,
    their implementation was straightforward.
    The line '#include <linux/rtc.h>' was added to recognize
    preprocessor definitions for these ioctls. This needs to be
    done only once in this series of commits. Also, the content
    of this file (with respect to ioctl definitions) remained
    unchanged for a long time, therefore there is no need to
    worry about supporting older Linux kernel version.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Filip Bozuta <Filip.Bozuta@rt-rk.com>
Message-Id: <1579117007-7565-2-git-send-email-Filip.Bozuta@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
											
										 
											2020-01-15 20:36:35 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |      IOCTL(BLKROSET, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(BLKROGET, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(BLKRRPART, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(BLKGETSIZE, IOC_R, MK_PTR(TYPE_ULONG)) | 
					
						
							|  |  |  |      IOCTL(BLKGETSIZE64, IOC_R, MK_PTR(TYPE_ULONGLONG)) | 
					
						
							|  |  |  |      IOCTL(BLKFLSBUF, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(BLKRASET, 0, TYPE_INT) | 
					
						
							|  |  |  |      IOCTL(BLKRAGET, IOC_R, MK_PTR(TYPE_LONG)) | 
					
						
							| 
									
										
										
										
											2016-07-04 17:06:18 +01:00
										 |  |  |      IOCTL(BLKSSZGET, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2012-02-02 02:22:34 +01:00
										 |  |  |      IOCTL(BLKBSZGET, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2014-08-22 13:15:50 +02:00
										 |  |  |      IOCTL_SPECIAL(BLKPG, IOC_W, do_ioctl_blkpg, | 
					
						
							|  |  |  |                    MK_PTR(MK_STRUCT(STRUCT_blkpg_ioctl_arg))) | 
					
						
							| 
									
										
										
										
											2016-07-01 19:46:04 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |      IOCTL(BLKDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2))) | 
					
						
							|  |  |  |      IOCTL(BLKIOMIN, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(BLKIOOPT, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(BLKALIGNOFF, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(BLKPBSZGET, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(BLKDISCARDZEROES, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(BLKSECDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2))) | 
					
						
							|  |  |  |      IOCTL(BLKROTATIONAL, IOC_R, MK_PTR(TYPE_SHORT)) | 
					
						
							|  |  |  |      IOCTL(BLKZEROOUT, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2))) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-04 14:59:25 +02:00
										 |  |  |      IOCTL(FDMSGON, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(FDMSGOFF, 0, TYPE_NULL) | 
					
						
							| 
									
										
										
										
											2020-01-16 23:49:46 +01:00
										 |  |  |      IOCTL(FDSETEMSGTRESH, 0, TYPE_NULL) | 
					
						
							| 
									
										
										
										
											2020-01-16 23:49:47 +01:00
										 |  |  |      IOCTL(FDFMTBEG, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(FDFMTTRK, IOC_W, MK_PTR(MK_STRUCT(STRUCT_format_descr))) | 
					
						
							|  |  |  |      IOCTL(FDFMTEND, 0, TYPE_NULL) | 
					
						
							| 
									
										
										
										
											2019-09-04 14:59:24 +02:00
										 |  |  |      IOCTL(FDFLUSH, 0, TYPE_NULL) | 
					
						
							| 
									
										
										
										
											2020-01-16 23:49:46 +01:00
										 |  |  |      IOCTL(FDSETMAXERRS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors))) | 
					
						
							|  |  |  |      IOCTL(FDGETMAXERRS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors))) | 
					
						
							| 
									
										
										
										
											2019-09-04 14:59:26 +02:00
										 |  |  |      IOCTL(FDRESET, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(FDRAWCMD, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(FDTWADDLE, 0, TYPE_NULL) | 
					
						
							|  |  |  |      IOCTL(FDEJECT, 0, TYPE_NULL) | 
					
						
							| 
									
										
										
										
											2019-09-04 14:59:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |      IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG)) | 
					
						
							| 
									
										
										
										
											2017-02-11 23:26:02 +01:00
										 |  |  | #ifdef FICLONE
 | 
					
						
							|  |  |  |      IOCTL(FICLONE, IOC_W, TYPE_INT) | 
					
						
							|  |  |  |      IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_file_clone_range))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2024-02-20 11:57:21 +01:00
										 |  |  | #ifdef FIFREEZE
 | 
					
						
							|  |  |  |      IOCTL(FIFREEZE, IOC_W | IOC_R, TYPE_INT) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef FITHAW
 | 
					
						
							|  |  |  |      IOCTL(FITHAW, IOC_W | IOC_R, TYPE_INT) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2017-02-11 23:26:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |      IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG)) | 
					
						
							| 
									
										
										
										
											2011-01-10 13:11:24 +00:00
										 |  |  | #ifdef CONFIG_FIEMAP
 | 
					
						
							| 
									
										
										
										
											2011-01-06 15:04:18 +00:00
										 |  |  |      IOCTL_SPECIAL(FS_IOC_FIEMAP, IOC_W | IOC_R, do_ioctl_fs_ioc_fiemap, | 
					
						
							|  |  |  |                    MK_PTR(MK_STRUCT(STRUCT_fiemap))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-15 18:44:45 +01:00
										 |  |  |      IOCTL(FS_IOC_GETFLAGS, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(FS_IOC_SETFLAGS, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2020-01-16 23:49:40 +01:00
										 |  |  |      IOCTL(FS_IOC_GETVERSION, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(FS_IOC_SETVERSION, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2020-01-16 23:49:41 +01:00
										 |  |  |      IOCTL(FS_IOC32_GETFLAGS, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(FS_IOC32_SETFLAGS, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2020-01-16 23:49:42 +01:00
										 |  |  |      IOCTL(FS_IOC32_GETVERSION, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |      IOCTL(FS_IOC32_SETVERSION, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2016-07-15 18:44:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-23 21:50:08 +02:00
										 |  |  | #ifdef BTRFS_IOC_SNAP_CREATE
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_SNAP_CREATE, IOC_W, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
											  
											
												linux-user: Add support for btrfs ioctls used to manipulate with devices
This patch implements functionality for following ioctls:
BTRFS_IOC_SCAN_DEV - Scanning device for a btrfs filesystem
    Scan a device for a btrfs filesystem. The device that is to
    be scanned is passed in the ioctl's third argument which
    represents a pointer to a 'struct ioc_vol_args' (which was
    mentioned in a previous patch). Before calling this ioctl,
    the name field of this structure should be filled with the
    aproppriate name value which represents a path for the device.
    If the device contains a btrfs filesystem, the ioctl returns 0,
    otherwise a negative value is returned.
BTRFS_IOC_ADD_DEV - Adding a device to a btrfs filesystem
    Add a device to a btrfs filesystem. The device that is to be
    added is passed in the ioctl's third argument which represents
    a pointer to a 'struct ioc_vol_args' (which was mentioned in
    a previous patch). Before calling this ioctl, the name field of
    this structure should be filled with the aproppriate name value
    which represents a path for the device.
BTRFS_IOC_RM_DEV - Removing a device from a btrfs filesystem
    Remove a device from a btrfs filesystem. The device that is to be
    removed is passed in the ioctl's third argument which represents
    a pointer to a 'struct ioc_vol_args' (which was mentioned in
    a previous patch). Before calling this ioctl, the name field of
    this structure should be filled with the aproppriate name value
    which represents a path for the device.
BTRFS_IOC_DEV_INFO - Getting information about a device
    Obtain information for device in a btrfs filesystem. The information
    is gathered in the ioctl's third argument which represents a pointer
    to a following structure type:
    struct btrfs_ioctl_dev_info_args {
	__u64 devid;				/* in/out */
	__u8 uuid[BTRFS_UUID_SIZE];		/* in/out */
	__u64 bytes_used;			/* out */
	__u64 total_bytes;			/* out */
	__u64 unused[379];			/* pad to 4k */
	__u8 path[BTRFS_DEVICE_PATH_NAME_MAX];	/* out */
    };
    Before calling this ioctl, field "devid" should be set with the id value
    for the device for which the information is to be obtained. If this field
    is not aproppriately set, the errno ENODEV ("No such device") is returned.
BTRFS_IOC_GET_DEV_STATS - Getting device statistics
    Obtain stats informatin for device in a btrfs filesystem. The information
    is gathered in the ioctl's third argument which represents a pointer to
    a following structure type:
    struct btrfs_ioctl_get_dev_stats {
	__u64 devid;				/* in */
	__u64 nr_items;				/* in/out */
	__u64 flags;				/* in/out */
	/* out values: */
	__u64 values[BTRFS_DEV_STAT_VALUES_MAX];
	/*
	 * This pads the struct to 1032 bytes. It was originally meant to pad to
	 * 1024 bytes, but when adding the flags field, the padding calculation
	 * was not adjusted.
	 */
	__u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX];
    };
    Before calling this ioctl, field "devid" should be set with the id value
    for the device for which the information is to be obtained. If this field
    is not aproppriately set, the errno ENODEV ("No such device") is returned.
BTRFS_IOC_FORGET_DEV - Remove unmounted devices
    Search and remove all stale devices (devices which are not mounted).
    The third ioctl argument is a pointer to a 'struct btrfs_ioctl_vol_args'.
    The ioctl call will release all unmounted devices which match the path
    which is specified in the "name" field of the structure. If an empty
    path ("") is specified, all unmounted devices will be released.
Implementation notes:
    Ioctls BTRFS_IOC_DEV_INFO and BTRFS_IOC_GET_DEV_STATS use types
    'struct btrfs_ioctl_dev_info_args' and ' struct btrfs_ioctl_get_dev_stats'
    as third argument types. That is the reason why corresponding structure
    definitions were added in file 'linux-user/syscall_types.h'.
    Since the thunk type for 'struct ioc_vol_args' was already added in a
    previous patch, the rest of the implementation was straightforward.
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200823195014.116226-4-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
											
										 
											2020-08-23 21:50:09 +02:00
										 |  |  | #ifdef BTRFS_IOC_SCAN_DEV
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_SCAN_DEV, IOC_W, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef BTRFS_IOC_FORGET_DEV
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_FORGET_DEV, IOC_W, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef BTRFS_IOC_ADD_DEV
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_ADD_DEV, IOC_W, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef BTRFS_IOC_RM_DEV
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_RM_DEV, IOC_W, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2020-08-23 21:50:07 +02:00
										 |  |  | #ifdef BTRFS_IOC_SUBVOL_CREATE
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_SUBVOL_CREATE, IOC_W, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2020-08-23 21:50:08 +02:00
										 |  |  | #ifdef BTRFS_IOC_SNAP_DESTROY
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_SNAP_DESTROY, IOC_W, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
											  
											
												linux-user: Add support for a group of btrfs inode ioctls
This patch implements functionality of following ioctls:
BTRFS_IOC_INO_LOOKUP - Reading tree root id and path
    Read tree root id and path for a given file or directory.
    The name and tree root id are returned in an ioctl's third
    argument that represents a pointer to a following type:
    struct btrfs_ioctl_ino_lookup_args {
	__u64 treeid;
	__u64 objectid;
	char name[BTRFS_INO_LOOKUP_PATH_MAX];
    };
    Before calling this ioctl, field 'objectid' should be filled
    with the object id value for which the tree id and path are
    to be read. Value 'BTRFS_FIRST_FREE_OBJECTID' represents the
    object id for the first available btrfs object (directory or
    file).
BTRFS_IOC_INO_PATHS - Reading paths to all files
    Read path to all files with a certain inode number. The paths
    are returned in the ioctl's third argument which represents
    a pointer to a following type:
    struct btrfs_ioctl_ino_path_args {
	__u64				inum;		/* in */
	__u64				size;		/* in */
	__u64				reserved[4];
	/* struct btrfs_data_container	*fspath;	   out */
	__u64				fspath;		/* out */
     };
     Before calling this ioctl, the 'inum' and 'size' field should
     be filled with the aproppriate inode number and size of the
     directory where file paths should be looked for. For now, the
     paths are returned in an '__u64' (unsigned long long) value
     'fspath'.
BTRFS_IOC_LOGICAL_INO - Reading inode numbers
     Read inode numbers for files on a certain logical adress. The
     inode numbers are returned in the ioctl's third argument which
     represents a pointer to a following type:
     struct btrfs_ioctl_logical_ino_args {
	__u64				logical;	/* in */
	__u64				size;		/* in */
	__u64				reserved[3];	/* must be 0 for now */
	__u64				flags;		/* in, v2 only */
	/* struct btrfs_data_container	*inodes;	out   */
	__u64				inodes;
     };
     Before calling this ioctl, the 'logical' and 'size' field should
     be filled with the aproppriate logical adress and size of where
     the inode numbers of files should be looked for. For now, the
     inode numbers are returned in an '__u64' (unsigned long long)
     value 'inodes'.
BTRFS_IOC_LOGICAL_INO_V2 - Reading inode numbers
     Same as the above mentioned ioctl except that it allows passing
     a flags 'BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET'.
BTRFS_IOC_INO_LOOKUP_USER - Reading subvolume name and path
     Read name and path of a subvolume. The tree root id and
     path are read in an ioctl's third argument which represents a
     pointer to a following type:
     struct btrfs_ioctl_ino_lookup_user_args {
	/* in, inode number containing the subvolume of 'subvolid' */
	__u64 dirid;
	/* in */
	__u64 treeid;
	/* out, name of the subvolume of 'treeid' */
	char name[BTRFS_VOL_NAME_MAX + 1];
	/*
	 * out, constructed path from the directory with which the ioctl is
	 * called to dirid
	 */
	char path[BTRFS_INO_LOOKUP_USER_PATH_MAX];
     };
     Before calling this ioctl, the 'dirid' and 'treeid' field should
     be filled with aproppriate values which represent the inode number
     of the directory that contains the subvolume and treeid of the
     subvolume.
Implementation notes:
     All of the ioctls in this patch use structure types as third arguments.
     That is the reason why aproppriate thunk definitions were added in file
     'syscall_types.h'.
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200823195014.116226-6-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
											
										 
											2020-08-23 21:50:11 +02:00
										 |  |  | #ifdef BTRFS_IOC_INO_LOOKUP
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_INO_LOOKUP, IOC_RW, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_ino_lookup_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2020-08-23 21:50:12 +02:00
										 |  |  | #ifdef BTRFS_IOC_DEFAULT_SUBVOL
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_DEFAULT_SUBVOL, IOC_W, MK_PTR(TYPE_ULONGLONG)) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2020-08-23 21:50:07 +02:00
										 |  |  | #ifdef BTRFS_IOC_SUBVOL_GETFLAGS
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_SUBVOL_GETFLAGS, IOC_R, MK_PTR(TYPE_ULONGLONG)) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef BTRFS_IOC_SUBVOL_SETFLAGS
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_SUBVOL_SETFLAGS, IOC_W, MK_PTR(TYPE_ULONGLONG)) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2020-08-23 21:50:14 +02:00
										 |  |  | #ifdef BTRFS_IOC_SCRUB
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_SCRUB, IOC_RW, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_scrub_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef BTRFS_IOC_SCRUB_CANCEL
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_SCRUB_CANCEL, 0, TYPE_NULL) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef BTRFS_IOC_SCRUB_PROGRESS
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_SCRUB_PROGRESS, IOC_RW, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_scrub_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
											  
											
												linux-user: Add support for btrfs ioctls used to manipulate with devices
This patch implements functionality for following ioctls:
BTRFS_IOC_SCAN_DEV - Scanning device for a btrfs filesystem
    Scan a device for a btrfs filesystem. The device that is to
    be scanned is passed in the ioctl's third argument which
    represents a pointer to a 'struct ioc_vol_args' (which was
    mentioned in a previous patch). Before calling this ioctl,
    the name field of this structure should be filled with the
    aproppriate name value which represents a path for the device.
    If the device contains a btrfs filesystem, the ioctl returns 0,
    otherwise a negative value is returned.
BTRFS_IOC_ADD_DEV - Adding a device to a btrfs filesystem
    Add a device to a btrfs filesystem. The device that is to be
    added is passed in the ioctl's third argument which represents
    a pointer to a 'struct ioc_vol_args' (which was mentioned in
    a previous patch). Before calling this ioctl, the name field of
    this structure should be filled with the aproppriate name value
    which represents a path for the device.
BTRFS_IOC_RM_DEV - Removing a device from a btrfs filesystem
    Remove a device from a btrfs filesystem. The device that is to be
    removed is passed in the ioctl's third argument which represents
    a pointer to a 'struct ioc_vol_args' (which was mentioned in
    a previous patch). Before calling this ioctl, the name field of
    this structure should be filled with the aproppriate name value
    which represents a path for the device.
BTRFS_IOC_DEV_INFO - Getting information about a device
    Obtain information for device in a btrfs filesystem. The information
    is gathered in the ioctl's third argument which represents a pointer
    to a following structure type:
    struct btrfs_ioctl_dev_info_args {
	__u64 devid;				/* in/out */
	__u8 uuid[BTRFS_UUID_SIZE];		/* in/out */
	__u64 bytes_used;			/* out */
	__u64 total_bytes;			/* out */
	__u64 unused[379];			/* pad to 4k */
	__u8 path[BTRFS_DEVICE_PATH_NAME_MAX];	/* out */
    };
    Before calling this ioctl, field "devid" should be set with the id value
    for the device for which the information is to be obtained. If this field
    is not aproppriately set, the errno ENODEV ("No such device") is returned.
BTRFS_IOC_GET_DEV_STATS - Getting device statistics
    Obtain stats informatin for device in a btrfs filesystem. The information
    is gathered in the ioctl's third argument which represents a pointer to
    a following structure type:
    struct btrfs_ioctl_get_dev_stats {
	__u64 devid;				/* in */
	__u64 nr_items;				/* in/out */
	__u64 flags;				/* in/out */
	/* out values: */
	__u64 values[BTRFS_DEV_STAT_VALUES_MAX];
	/*
	 * This pads the struct to 1032 bytes. It was originally meant to pad to
	 * 1024 bytes, but when adding the flags field, the padding calculation
	 * was not adjusted.
	 */
	__u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX];
    };
    Before calling this ioctl, field "devid" should be set with the id value
    for the device for which the information is to be obtained. If this field
    is not aproppriately set, the errno ENODEV ("No such device") is returned.
BTRFS_IOC_FORGET_DEV - Remove unmounted devices
    Search and remove all stale devices (devices which are not mounted).
    The third ioctl argument is a pointer to a 'struct btrfs_ioctl_vol_args'.
    The ioctl call will release all unmounted devices which match the path
    which is specified in the "name" field of the structure. If an empty
    path ("") is specified, all unmounted devices will be released.
Implementation notes:
    Ioctls BTRFS_IOC_DEV_INFO and BTRFS_IOC_GET_DEV_STATS use types
    'struct btrfs_ioctl_dev_info_args' and ' struct btrfs_ioctl_get_dev_stats'
    as third argument types. That is the reason why corresponding structure
    definitions were added in file 'linux-user/syscall_types.h'.
    Since the thunk type for 'struct ioc_vol_args' was already added in a
    previous patch, the rest of the implementation was straightforward.
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200823195014.116226-4-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
											
										 
											2020-08-23 21:50:09 +02:00
										 |  |  | #ifdef BTRFS_IOC_DEV_INFO
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_DEV_INFO, IOC_RW, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_dev_info_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
											  
											
												linux-user: Add support for a group of btrfs inode ioctls
This patch implements functionality of following ioctls:
BTRFS_IOC_INO_LOOKUP - Reading tree root id and path
    Read tree root id and path for a given file or directory.
    The name and tree root id are returned in an ioctl's third
    argument that represents a pointer to a following type:
    struct btrfs_ioctl_ino_lookup_args {
	__u64 treeid;
	__u64 objectid;
	char name[BTRFS_INO_LOOKUP_PATH_MAX];
    };
    Before calling this ioctl, field 'objectid' should be filled
    with the object id value for which the tree id and path are
    to be read. Value 'BTRFS_FIRST_FREE_OBJECTID' represents the
    object id for the first available btrfs object (directory or
    file).
BTRFS_IOC_INO_PATHS - Reading paths to all files
    Read path to all files with a certain inode number. The paths
    are returned in the ioctl's third argument which represents
    a pointer to a following type:
    struct btrfs_ioctl_ino_path_args {
	__u64				inum;		/* in */
	__u64				size;		/* in */
	__u64				reserved[4];
	/* struct btrfs_data_container	*fspath;	   out */
	__u64				fspath;		/* out */
     };
     Before calling this ioctl, the 'inum' and 'size' field should
     be filled with the aproppriate inode number and size of the
     directory where file paths should be looked for. For now, the
     paths are returned in an '__u64' (unsigned long long) value
     'fspath'.
BTRFS_IOC_LOGICAL_INO - Reading inode numbers
     Read inode numbers for files on a certain logical adress. The
     inode numbers are returned in the ioctl's third argument which
     represents a pointer to a following type:
     struct btrfs_ioctl_logical_ino_args {
	__u64				logical;	/* in */
	__u64				size;		/* in */
	__u64				reserved[3];	/* must be 0 for now */
	__u64				flags;		/* in, v2 only */
	/* struct btrfs_data_container	*inodes;	out   */
	__u64				inodes;
     };
     Before calling this ioctl, the 'logical' and 'size' field should
     be filled with the aproppriate logical adress and size of where
     the inode numbers of files should be looked for. For now, the
     inode numbers are returned in an '__u64' (unsigned long long)
     value 'inodes'.
BTRFS_IOC_LOGICAL_INO_V2 - Reading inode numbers
     Same as the above mentioned ioctl except that it allows passing
     a flags 'BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET'.
BTRFS_IOC_INO_LOOKUP_USER - Reading subvolume name and path
     Read name and path of a subvolume. The tree root id and
     path are read in an ioctl's third argument which represents a
     pointer to a following type:
     struct btrfs_ioctl_ino_lookup_user_args {
	/* in, inode number containing the subvolume of 'subvolid' */
	__u64 dirid;
	/* in */
	__u64 treeid;
	/* out, name of the subvolume of 'treeid' */
	char name[BTRFS_VOL_NAME_MAX + 1];
	/*
	 * out, constructed path from the directory with which the ioctl is
	 * called to dirid
	 */
	char path[BTRFS_INO_LOOKUP_USER_PATH_MAX];
     };
     Before calling this ioctl, the 'dirid' and 'treeid' field should
     be filled with aproppriate values which represent the inode number
     of the directory that contains the subvolume and treeid of the
     subvolume.
Implementation notes:
     All of the ioctls in this patch use structure types as third arguments.
     That is the reason why aproppriate thunk definitions were added in file
     'syscall_types.h'.
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200823195014.116226-6-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
											
										 
											2020-08-23 21:50:11 +02:00
										 |  |  | #ifdef BTRFS_IOC_INO_PATHS
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_INO_PATHS, IOC_RW, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_ino_path_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef BTRFS_IOC_LOGICAL_INO
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_LOGICAL_INO, IOC_RW, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_logical_ino_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
											  
											
												linux-user: Add support for btrfs ioctls used to manage quota
This patch implements functionality for following ioctls:
BTRFS_IOC_QUOTA_CTL - Enabling/Disabling quota support
    Enable or disable quota support for a btrfs filesystem. Quota
    support is enabled or disabled using the ioctls third argument
    which represents a pointer to a following type:
    struct btrfs_ioctl_quota_ctl_args {
	__u64 cmd;
	__u64 status;
    };
    Before calling this ioctl, the 'cmd' field should be filled
    with one of the values 'BTRFS_QUOTA_CTL_ENABLE' (enabling quota)
    'BTRFS_QUOTA_CTL_DISABLE' (disabling quota).
BTRFS_IOC_QGROUP_CREATE - Creating/Removing a subvolume quota group
    Create or remove a subvolume quota group. The subvolume quota
    group is created or removed using the ioctl's third argument which
    represents a pointer to a following type:
    struct btrfs_ioctl_qgroup_create_args {
	__u64 create;
	__u64 qgroupid;
    };
    Before calling this ioctl, the 'create' field should be filled
    with the aproppriate value depending on if the user wants to
    create or remove a quota group (0 for removing, everything else
    for creating). Also, the 'qgroupid' field should be filled with
    the value for the quota group id that is to be created.
BTRFS_IOC_QGROUP_ASSIGN - Asigning or removing a quota group as child group
    Asign or remove a quota group as child quota group of another
    group in the btrfs filesystem. The asignment is done using the
    ioctl's third argument which represents a pointert to a following type:
    struct btrfs_ioctl_qgroup_assign_args {
	__u64 assign;
	__u64 src;
	__u64 dst;
    };
    Before calling this ioctl, the 'assign' field should be filled with
    the aproppriate value depending on if the user wants to asign or remove
    a quota group as a child quota group of another group (0 for removing,
    everythin else for asigning). Also, the 'src' and 'dst' fields should
    be filled with the aproppriate quota group id values depending on which
    quota group needs to asigned or removed as child quota group of another
    group ('src' gets asigned or removed as child group of 'dst').
BTRFS_IOC_QGROUP_LIMIT - Limiting the size of a quota group
    Limit the size of a quota group. The size of the quota group is limited
    with the ioctls third argument which represents a pointer to a following
    type:
    struct btrfs_ioctl_qgroup_limit_args {
	__u64	qgroupid;
	struct btrfs_qgroup_limit lim;
    };
    Before calling this ioctl, the 'qgroup' id field should be filled with
    aproppriate value of the quota group id for which the size is to be
    limited. The second field is of following type:
    struct btrfs_qgroup_limit {
	__u64	flags;
	__u64	max_rfer;
	__u64	max_excl;
	__u64	rsv_rfer;
	__u64	rsv_excl;
    };
    The 'max_rfer' field should be filled with the size to which the quota
    group should be limited. The 'flags' field can be used for passing
    additional options and can have values which can be found on:
    https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/btrfs.h#L67
BTRFS_IOC_QUOTA_RESCAN_STATUS - Checking status of running rescan operation
    Check status of a running rescan operation. The status is checked using
    the ioctl's third argument which represents a pointer to a following type:
    struct btrfs_ioctl_quota_rescan_args {
        __u64   flags;
        __u64   progress;
        __u64   reserved[6];
    };
    If there is a rescan operation running, 'flags' field is set to 1, and
    'progress' field is set to aproppriate value which represents the progress
    of the operation.
BTRFS_IOC_QUOTA_RESCAN - Starting a rescan operation
    Start ar rescan operation to Trash all quota groups and scan the metadata
    again with the current config. Before calling this ioctl,
    BTRFS_IOC_QUOTA_RESCAN_STATUS sould be run to check if there is already a
    rescan operation runing. After that ioctl call, the received
    'struct btrfs_ioctl_quota_rescan_args' should be than passed as this ioctls
    third argument.
BTRFS_IOC_QUOTA_RESCAN_WAIT - Waiting for a rescan operation to finish
    Wait until a rescan operation is finished (if there is a rescan operation
    running). The third ioctls argument is ignored.
Implementation notes:
    Almost all of the ioctls in this patch use structure types as third arguments.
    That is the reason why aproppriate thunk definitions were added in file
    'syscall_types.h'.
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200823195014.116226-8-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
											
										 
											2020-08-23 21:50:13 +02:00
										 |  |  | #ifdef BTRFS_IOC_QUOTA_CTL
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_QUOTA_CTL, IOC_RW, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_quota_ctl_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef BTRFS_IOC_QGROUP_ASSIGN
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_QGROUP_ASSIGN, IOC_W, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_qgroup_assign_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef BTRFS_IOC_QGROUP_CREATE
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_QGROUP_CREATE, IOC_W, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_qgroup_create_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef BTRFS_IOC_QGROUP_LIMIT
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_QGROUP_LIMIT, IOC_R, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_qgroup_limit_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef BTRFS_IOC_QUOTA_RESCAN
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_QUOTA_RESCAN, IOC_W, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_quota_rescan_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef BTRFS_IOC_QUOTA_RESCAN_STATUS
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_QUOTA_RESCAN_STATUS, IOC_R, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_quota_rescan_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef BTRFS_IOC_QUOTA_RESCAN_WAIT
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_QUOTA_RESCAN_WAIT, 0, TYPE_NULL) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
											  
											
												linux-user: Add support for btrfs ioctls used to manipulate with devices
This patch implements functionality for following ioctls:
BTRFS_IOC_SCAN_DEV - Scanning device for a btrfs filesystem
    Scan a device for a btrfs filesystem. The device that is to
    be scanned is passed in the ioctl's third argument which
    represents a pointer to a 'struct ioc_vol_args' (which was
    mentioned in a previous patch). Before calling this ioctl,
    the name field of this structure should be filled with the
    aproppriate name value which represents a path for the device.
    If the device contains a btrfs filesystem, the ioctl returns 0,
    otherwise a negative value is returned.
BTRFS_IOC_ADD_DEV - Adding a device to a btrfs filesystem
    Add a device to a btrfs filesystem. The device that is to be
    added is passed in the ioctl's third argument which represents
    a pointer to a 'struct ioc_vol_args' (which was mentioned in
    a previous patch). Before calling this ioctl, the name field of
    this structure should be filled with the aproppriate name value
    which represents a path for the device.
BTRFS_IOC_RM_DEV - Removing a device from a btrfs filesystem
    Remove a device from a btrfs filesystem. The device that is to be
    removed is passed in the ioctl's third argument which represents
    a pointer to a 'struct ioc_vol_args' (which was mentioned in
    a previous patch). Before calling this ioctl, the name field of
    this structure should be filled with the aproppriate name value
    which represents a path for the device.
BTRFS_IOC_DEV_INFO - Getting information about a device
    Obtain information for device in a btrfs filesystem. The information
    is gathered in the ioctl's third argument which represents a pointer
    to a following structure type:
    struct btrfs_ioctl_dev_info_args {
	__u64 devid;				/* in/out */
	__u8 uuid[BTRFS_UUID_SIZE];		/* in/out */
	__u64 bytes_used;			/* out */
	__u64 total_bytes;			/* out */
	__u64 unused[379];			/* pad to 4k */
	__u8 path[BTRFS_DEVICE_PATH_NAME_MAX];	/* out */
    };
    Before calling this ioctl, field "devid" should be set with the id value
    for the device for which the information is to be obtained. If this field
    is not aproppriately set, the errno ENODEV ("No such device") is returned.
BTRFS_IOC_GET_DEV_STATS - Getting device statistics
    Obtain stats informatin for device in a btrfs filesystem. The information
    is gathered in the ioctl's third argument which represents a pointer to
    a following structure type:
    struct btrfs_ioctl_get_dev_stats {
	__u64 devid;				/* in */
	__u64 nr_items;				/* in/out */
	__u64 flags;				/* in/out */
	/* out values: */
	__u64 values[BTRFS_DEV_STAT_VALUES_MAX];
	/*
	 * This pads the struct to 1032 bytes. It was originally meant to pad to
	 * 1024 bytes, but when adding the flags field, the padding calculation
	 * was not adjusted.
	 */
	__u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX];
    };
    Before calling this ioctl, field "devid" should be set with the id value
    for the device for which the information is to be obtained. If this field
    is not aproppriately set, the errno ENODEV ("No such device") is returned.
BTRFS_IOC_FORGET_DEV - Remove unmounted devices
    Search and remove all stale devices (devices which are not mounted).
    The third ioctl argument is a pointer to a 'struct btrfs_ioctl_vol_args'.
    The ioctl call will release all unmounted devices which match the path
    which is specified in the "name" field of the structure. If an empty
    path ("") is specified, all unmounted devices will be released.
Implementation notes:
    Ioctls BTRFS_IOC_DEV_INFO and BTRFS_IOC_GET_DEV_STATS use types
    'struct btrfs_ioctl_dev_info_args' and ' struct btrfs_ioctl_get_dev_stats'
    as third argument types. That is the reason why corresponding structure
    definitions were added in file 'linux-user/syscall_types.h'.
    Since the thunk type for 'struct ioc_vol_args' was already added in a
    previous patch, the rest of the implementation was straightforward.
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200823195014.116226-4-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
											
										 
											2020-08-23 21:50:09 +02:00
										 |  |  | #ifdef BTRFS_IOC_GET_DEV_STATS
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_GET_DEV_STATS, IOC_RW, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_get_dev_stats))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2020-08-23 21:50:10 +02:00
										 |  |  | #ifdef BTRFS_IOC_GET_FEATURES
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_GET_FEATURES, IOC_R, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_feature_flags))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef BTRFS_IOC_SET_FEATURES
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_SET_FEATURES, IOC_W, | 
					
						
							|  |  |  |            MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_btrfs_ioctl_feature_flags), 2))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef BTRFS_IOC_GET_SUPPORTED_FEATURES
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_GET_SUPPORTED_FEATURES, IOC_R, | 
					
						
							|  |  |  |            MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_btrfs_ioctl_feature_flags), 3))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
											  
											
												linux-user: Add support for a group of btrfs inode ioctls
This patch implements functionality of following ioctls:
BTRFS_IOC_INO_LOOKUP - Reading tree root id and path
    Read tree root id and path for a given file or directory.
    The name and tree root id are returned in an ioctl's third
    argument that represents a pointer to a following type:
    struct btrfs_ioctl_ino_lookup_args {
	__u64 treeid;
	__u64 objectid;
	char name[BTRFS_INO_LOOKUP_PATH_MAX];
    };
    Before calling this ioctl, field 'objectid' should be filled
    with the object id value for which the tree id and path are
    to be read. Value 'BTRFS_FIRST_FREE_OBJECTID' represents the
    object id for the first available btrfs object (directory or
    file).
BTRFS_IOC_INO_PATHS - Reading paths to all files
    Read path to all files with a certain inode number. The paths
    are returned in the ioctl's third argument which represents
    a pointer to a following type:
    struct btrfs_ioctl_ino_path_args {
	__u64				inum;		/* in */
	__u64				size;		/* in */
	__u64				reserved[4];
	/* struct btrfs_data_container	*fspath;	   out */
	__u64				fspath;		/* out */
     };
     Before calling this ioctl, the 'inum' and 'size' field should
     be filled with the aproppriate inode number and size of the
     directory where file paths should be looked for. For now, the
     paths are returned in an '__u64' (unsigned long long) value
     'fspath'.
BTRFS_IOC_LOGICAL_INO - Reading inode numbers
     Read inode numbers for files on a certain logical adress. The
     inode numbers are returned in the ioctl's third argument which
     represents a pointer to a following type:
     struct btrfs_ioctl_logical_ino_args {
	__u64				logical;	/* in */
	__u64				size;		/* in */
	__u64				reserved[3];	/* must be 0 for now */
	__u64				flags;		/* in, v2 only */
	/* struct btrfs_data_container	*inodes;	out   */
	__u64				inodes;
     };
     Before calling this ioctl, the 'logical' and 'size' field should
     be filled with the aproppriate logical adress and size of where
     the inode numbers of files should be looked for. For now, the
     inode numbers are returned in an '__u64' (unsigned long long)
     value 'inodes'.
BTRFS_IOC_LOGICAL_INO_V2 - Reading inode numbers
     Same as the above mentioned ioctl except that it allows passing
     a flags 'BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET'.
BTRFS_IOC_INO_LOOKUP_USER - Reading subvolume name and path
     Read name and path of a subvolume. The tree root id and
     path are read in an ioctl's third argument which represents a
     pointer to a following type:
     struct btrfs_ioctl_ino_lookup_user_args {
	/* in, inode number containing the subvolume of 'subvolid' */
	__u64 dirid;
	/* in */
	__u64 treeid;
	/* out, name of the subvolume of 'treeid' */
	char name[BTRFS_VOL_NAME_MAX + 1];
	/*
	 * out, constructed path from the directory with which the ioctl is
	 * called to dirid
	 */
	char path[BTRFS_INO_LOOKUP_USER_PATH_MAX];
     };
     Before calling this ioctl, the 'dirid' and 'treeid' field should
     be filled with aproppriate values which represent the inode number
     of the directory that contains the subvolume and treeid of the
     subvolume.
Implementation notes:
     All of the ioctls in this patch use structure types as third arguments.
     That is the reason why aproppriate thunk definitions were added in file
     'syscall_types.h'.
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200823195014.116226-6-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
											
										 
											2020-08-23 21:50:11 +02:00
										 |  |  | #ifdef BTRFS_IOC_LOGICAL_INO_V2
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_LOGICAL_INO_V2, IOC_RW, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_logical_ino_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2020-08-23 21:50:07 +02:00
										 |  |  | #ifdef BTRFS_IOC_GET_SUBVOL_INFO
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_GET_SUBVOL_INFO, IOC_R, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_get_subvol_info_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2020-08-23 21:50:12 +02:00
										 |  |  | #ifdef BTRFS_IOC_GET_SUBVOL_ROOTREF
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_GET_SUBVOL_ROOTREF, IOC_RW, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_get_subvol_rootref_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
											  
											
												linux-user: Add support for a group of btrfs inode ioctls
This patch implements functionality of following ioctls:
BTRFS_IOC_INO_LOOKUP - Reading tree root id and path
    Read tree root id and path for a given file or directory.
    The name and tree root id are returned in an ioctl's third
    argument that represents a pointer to a following type:
    struct btrfs_ioctl_ino_lookup_args {
	__u64 treeid;
	__u64 objectid;
	char name[BTRFS_INO_LOOKUP_PATH_MAX];
    };
    Before calling this ioctl, field 'objectid' should be filled
    with the object id value for which the tree id and path are
    to be read. Value 'BTRFS_FIRST_FREE_OBJECTID' represents the
    object id for the first available btrfs object (directory or
    file).
BTRFS_IOC_INO_PATHS - Reading paths to all files
    Read path to all files with a certain inode number. The paths
    are returned in the ioctl's third argument which represents
    a pointer to a following type:
    struct btrfs_ioctl_ino_path_args {
	__u64				inum;		/* in */
	__u64				size;		/* in */
	__u64				reserved[4];
	/* struct btrfs_data_container	*fspath;	   out */
	__u64				fspath;		/* out */
     };
     Before calling this ioctl, the 'inum' and 'size' field should
     be filled with the aproppriate inode number and size of the
     directory where file paths should be looked for. For now, the
     paths are returned in an '__u64' (unsigned long long) value
     'fspath'.
BTRFS_IOC_LOGICAL_INO - Reading inode numbers
     Read inode numbers for files on a certain logical adress. The
     inode numbers are returned in the ioctl's third argument which
     represents a pointer to a following type:
     struct btrfs_ioctl_logical_ino_args {
	__u64				logical;	/* in */
	__u64				size;		/* in */
	__u64				reserved[3];	/* must be 0 for now */
	__u64				flags;		/* in, v2 only */
	/* struct btrfs_data_container	*inodes;	out   */
	__u64				inodes;
     };
     Before calling this ioctl, the 'logical' and 'size' field should
     be filled with the aproppriate logical adress and size of where
     the inode numbers of files should be looked for. For now, the
     inode numbers are returned in an '__u64' (unsigned long long)
     value 'inodes'.
BTRFS_IOC_LOGICAL_INO_V2 - Reading inode numbers
     Same as the above mentioned ioctl except that it allows passing
     a flags 'BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET'.
BTRFS_IOC_INO_LOOKUP_USER - Reading subvolume name and path
     Read name and path of a subvolume. The tree root id and
     path are read in an ioctl's third argument which represents a
     pointer to a following type:
     struct btrfs_ioctl_ino_lookup_user_args {
	/* in, inode number containing the subvolume of 'subvolid' */
	__u64 dirid;
	/* in */
	__u64 treeid;
	/* out, name of the subvolume of 'treeid' */
	char name[BTRFS_VOL_NAME_MAX + 1];
	/*
	 * out, constructed path from the directory with which the ioctl is
	 * called to dirid
	 */
	char path[BTRFS_INO_LOOKUP_USER_PATH_MAX];
     };
     Before calling this ioctl, the 'dirid' and 'treeid' field should
     be filled with aproppriate values which represent the inode number
     of the directory that contains the subvolume and treeid of the
     subvolume.
Implementation notes:
     All of the ioctls in this patch use structure types as third arguments.
     That is the reason why aproppriate thunk definitions were added in file
     'syscall_types.h'.
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200823195014.116226-6-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
											
										 
											2020-08-23 21:50:11 +02:00
										 |  |  | #ifdef BTRFS_IOC_INO_LOOKUP_USER
 | 
					
						
							|  |  |  |      IOCTL(BTRFS_IOC_INO_LOOKUP_USER, IOC_RW, | 
					
						
							|  |  |  |            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_ino_lookup_user_args))) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2020-08-23 21:50:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-08 09:35:20 -07:00
										 |  |  | #ifdef CONFIG_USBFS
 | 
					
						
							|  |  |  |   /* USB ioctls */ | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_CONTROL, IOC_RW, | 
					
						
							|  |  |  |         MK_PTR(MK_STRUCT(STRUCT_usbdevfs_ctrltransfer))) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_BULK, IOC_RW, | 
					
						
							|  |  |  |         MK_PTR(MK_STRUCT(STRUCT_usbdevfs_bulktransfer))) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_RESETEP, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_SETINTERFACE, IOC_W, | 
					
						
							|  |  |  |         MK_PTR(MK_STRUCT(STRUCT_usbdevfs_setinterface))) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_SETCONFIGURATION, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_GETDRIVER, IOC_R, | 
					
						
							|  |  |  |         MK_PTR(MK_STRUCT(STRUCT_usbdevfs_getdriver))) | 
					
						
							| 
									
										
										
										
											2018-10-08 09:35:21 -07:00
										 |  |  |   IOCTL_SPECIAL(USBDEVFS_SUBMITURB, IOC_W, do_ioctl_usbdevfs_submiturb, | 
					
						
							|  |  |  |       MK_PTR(MK_STRUCT(STRUCT_usbdevfs_urb))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(USBDEVFS_DISCARDURB, IOC_RW, do_ioctl_usbdevfs_discardurb, | 
					
						
							|  |  |  |       MK_PTR(MK_STRUCT(STRUCT_usbdevfs_urb))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(USBDEVFS_REAPURB, IOC_R, do_ioctl_usbdevfs_reapurb, | 
					
						
							|  |  |  |       MK_PTR(TYPE_PTRVOID)) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(USBDEVFS_REAPURBNDELAY, IOC_R, do_ioctl_usbdevfs_reapurb, | 
					
						
							|  |  |  |       MK_PTR(TYPE_PTRVOID)) | 
					
						
							| 
									
										
										
										
											2018-10-08 09:35:20 -07:00
										 |  |  |   IOCTL(USBDEVFS_DISCSIGNAL, IOC_W, | 
					
						
							|  |  |  |         MK_PTR(MK_STRUCT(STRUCT_usbdevfs_disconnectsignal))) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_CLAIMINTERFACE, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_RELEASEINTERFACE, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_CONNECTINFO, IOC_R, | 
					
						
							|  |  |  |         MK_PTR(MK_STRUCT(STRUCT_usbdevfs_connectinfo))) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_IOCTL, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_usbdevfs_ioctl))) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_HUB_PORTINFO, IOC_R, | 
					
						
							|  |  |  |         MK_PTR(MK_STRUCT(STRUCT_usbdevfs_hub_portinfo))) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_RESET, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_CLEAR_HALT, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_DISCONNECT, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_CONNECT, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_CLAIM_PORT, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_RELEASE_PORT, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_GET_CAPABILITIES, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_DISCONNECT_CLAIM, IOC_W, | 
					
						
							|  |  |  |         MK_PTR(MK_STRUCT(STRUCT_usbdevfs_disconnect_claim))) | 
					
						
							|  |  |  | #ifdef USBDEVFS_DROP_PRIVILEGES
 | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_DROP_PRIVILEGES, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef USBDEVFS_GET_SPEED
 | 
					
						
							|  |  |  |   IOCTL(USBDEVFS_GET_SPEED, 0, TYPE_NULL) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #endif /* CONFIG_USBFS */
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-04 14:59:23 +02:00
										 |  |  |   IOCTL(FIOGETOWN, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(FIOSETOWN, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2016-07-15 12:09:31 +01:00
										 |  |  |   IOCTL(SIOCATMARK, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2019-04-23 15:20:05 -07:00
										 |  |  |   IOCTL(SIOCGIFNAME, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_int_ifreq))) | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |   IOCTL(SIOCGIFFLAGS, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_short_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCSIFFLAGS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_short_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCGIFADDR, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCSIFADDR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCGIFBRDADDR, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCSIFBRDADDR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCGIFDSTADDR, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCSIFDSTADDR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCGIFNETMASK, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCSIFNETMASK, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCGIFHWADDR, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCSIFHWADDR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCGIFTXQLEN, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCSIFTXQLEN, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCGIFMETRIC, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_int_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCSIFMETRIC, IOC_W, MK_PTR(MK_STRUCT(STRUCT_int_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCGIFMTU, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_int_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCSIFMTU, IOC_W, MK_PTR(MK_STRUCT(STRUCT_int_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCGIFMAP, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_ifmap_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCSIFMAP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_ifmap_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCGIFSLAVE, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_char_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCSIFSLAVE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_char_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCGIFMEM, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_ptr_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCSIFMEM, IOC_W, MK_PTR(MK_STRUCT(STRUCT_ptr_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCADDMULTI, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCDELMULTI, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) | 
					
						
							| 
									
										
										
										
											2014-07-11 03:02:02 +02:00
										 |  |  |   IOCTL(SIOCGIFINDEX, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_int_ifreq))) | 
					
						
							| 
									
										
										
										
											2019-05-19 18:15:24 +02:00
										 |  |  |   IOCTL(SIOCSIFPFLAGS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_short_ifreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCGIFPFLAGS, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_short_ifreq))) | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |   IOCTL(SIOCSIFLINK, 0, TYPE_NULL) | 
					
						
							| 
									
										
											  
											
												linux-user: convert ioctl(SIOCGIFCONF, ...) result.
The result needs to be converted as it is stored in an array of struct
ifreq and sizeof(struct ifreq) differs according to target and host
alignment rules.
This patch allows to execute correctly the following program on arm
and m68k:
 #include <stdio.h>
 #include <sys/ioctl.h>
 #include <net/if.h>
 #include <alloca.h>
 #include <string.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
int main(void)
{
    int s, ret;
    struct ifconf ifc;
    int i;
    memset( &ifc, 0, sizeof( struct ifconf ) );
    ifc.ifc_len = 8 * sizeof(struct ifreq);
    ifc.ifc_buf = alloca(ifc.ifc_len);
    s = socket( AF_INET, SOCK_DGRAM, 0 );
    if (s < 0) {
        perror("Cannot open socket");
        return 1;
    }
    ret = ioctl( s, SIOCGIFCONF, &ifc );
    if (s < 0) {
        perror("ioctl() failed");
        return 1;
    }
    for (i = 0; i < ifc.ifc_len / sizeof(struct ifreq) ; i ++) {
        struct sockaddr_in *s;
        s = (struct sockaddr_in*)&ifc.ifc_req[i].ifr_addr;
        printf("%s\n", ifc.ifc_req[i].ifr_name);
        printf("%s\n", inet_ntoa(s->sin_addr));
    }
}
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
											
										 
											2011-03-30 00:12:12 +02:00
										 |  |  |   IOCTL_SPECIAL(SIOCGIFCONF, IOC_W | IOC_R, do_ioctl_ifconf, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_ifconf))) | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |   IOCTL(SIOCGIFENCAP, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SIOCSIFENCAP, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SIOCDARP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_arpreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCSARP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_arpreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCGARP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_arpreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCDRARP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_arpreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCSRARP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_arpreq))) | 
					
						
							|  |  |  |   IOCTL(SIOCGRARP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_arpreq))) | 
					
						
							| 
									
										
										
											
												linux-user: add ioctl(SIOCGIWNAME, ...) support.
Allow to run properly following program from linux-user:
/* cc -o wifi wifi.c */
 #include <stdio.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <linux/wireless.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <string.h>
int main(int argc, char **argv)
{
    int ret;
    struct ifreq req;
    struct sockaddr_in *addr;
    int s;
    if (argc != 2) {
        fprintf(stderr, "Need an interface name (like wlan0)\n");
	return 1;
    }
    s = socket( AF_INET, SOCK_DGRAM, 0 );
    if (s < 0) {
        perror("Cannot open socket");
        return 1;
    }
    strncpy(req.ifr_name, argv[1], sizeof(req.ifr_name));
    ret = ioctl( s, SIOCGIWNAME, &req );
    if (ret < 0) {
	fprintf(stderr, "No wireless extension\n");
        return 1;
    }
    printf("%s\n", req.ifr_name);
    printf("%s\n", req.ifr_newname);
    return 0;
}
$ ./wifi eth0
No wireless extension
$ ./wifi wlan0
wlan0
IEEE 802.11bg
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
											
										 
											2011-03-30 01:35:23 +02:00
										 |  |  |   IOCTL(SIOCGIWNAME, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_char_ifreq))) | 
					
						
							| 
									
										
											  
											
												linux-user: Add support for SIOCSPGRP ioctl for all targets
Add support for setting the process (or process group) to receive SIGIO
or SIGURG signals when I/O becomes possible or urgent data is available,
using SIOCSPGRP ioctl.
The ioctl numeric values for SIOCSPGRP are platform-dependent and are
determined by following files in Linux kernel source tree:
arch/ia64/include/uapi/asm/sockios.h:#define SIOCSPGRP    0x8902
arch/mips/include/uapi/asm/sockios.h:#define SIOCSPGRP    _IOW('s', 8, pid_t)
arch/parisc/include/uapi/asm/sockios.h:#define SIOCSPGRP  0x8902
arch/sh/include/uapi/asm/sockios.h:#define SIOCSPGRP      _IOW('s', 8, pid_t)
arch/xtensa/include/uapi/asm/sockios.h:#define SIOCSPGRP  _IOW('s', 8, pid_t)
arch/alpha/include/uapi/asm/sockios.h:#define SIOCSPGRP   _IOW('s', 8, pid_t)
arch/sparc/include/uapi/asm/sockios.h:#define SIOCSPGRP   0x8902
include/uapi/asm-generic/sockios.h:#define SIOCSPGRP      0x8902
Hence the different definition for alpha, mips, sh4, and xtensa.
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <1558282527-22183-3-git-send-email-aleksandar.markovic@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
											
										 
											2019-05-19 18:15:23 +02:00
										 |  |  |   IOCTL(SIOCSPGRP, IOC_W, MK_PTR(TYPE_INT)) /* pid_t */ | 
					
						
							| 
									
										
										
										
											2016-12-07 11:31:46 -08:00
										 |  |  |   IOCTL(SIOCGPGRP, IOC_R, MK_PTR(TYPE_INT)) /* pid_t */ | 
					
						
							| 
									
										
										
										
											2019-07-18 15:06:41 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /*
 | 
					
						
							|  |  |  |    * We can't use IOCTL_SPECIAL() because it will set | 
					
						
							|  |  |  |    * host_cmd to XXX_OLD and XXX_NEW and these macros | 
					
						
							|  |  |  |    * are not defined with kernel prior to 5.2. | 
					
						
							|  |  |  |    * We must set host_cmd to the same value as in target_cmd | 
					
						
							|  |  |  |    * otherwise the consistency check in syscall_init() | 
					
						
							|  |  |  |    * will trigger an error. | 
					
						
							|  |  |  |    * host_cmd is ignored by the do_ioctl_XXX() helpers. | 
					
						
							|  |  |  |    * FIXME: create a macro to define this kind of entry | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   { TARGET_SIOCGSTAMP_OLD, TARGET_SIOCGSTAMP_OLD, | 
					
						
							| 
									
										
										
										
											2020-06-19 14:47:26 +02:00
										 |  |  |     "SIOCGSTAMP_OLD", IOC_R, do_ioctl_SIOCGSTAMP, | 
					
						
							|  |  |  |     { MK_PTR(MK_STRUCT(STRUCT_timeval)) } }, | 
					
						
							| 
									
										
										
										
											2019-07-18 15:06:41 +02:00
										 |  |  |   { TARGET_SIOCGSTAMPNS_OLD, TARGET_SIOCGSTAMPNS_OLD, | 
					
						
							| 
									
										
										
										
											2020-06-19 14:47:26 +02:00
										 |  |  |     "SIOCGSTAMPNS_OLD", IOC_R, do_ioctl_SIOCGSTAMPNS, | 
					
						
							|  |  |  |     { MK_PTR(MK_STRUCT(STRUCT_timespec)) } }, | 
					
						
							| 
									
										
										
										
											2019-07-18 15:06:41 +02:00
										 |  |  |   { TARGET_SIOCGSTAMP_NEW, TARGET_SIOCGSTAMP_NEW, | 
					
						
							| 
									
										
										
										
											2020-06-19 14:47:26 +02:00
										 |  |  |     "SIOCGSTAMP_NEW", IOC_R, do_ioctl_SIOCGSTAMP, | 
					
						
							|  |  |  |     { MK_PTR(MK_STRUCT(STRUCT__kernel_sock_timeval)) } }, | 
					
						
							| 
									
										
										
										
											2019-07-18 15:06:41 +02:00
										 |  |  |   { TARGET_SIOCGSTAMPNS_NEW, TARGET_SIOCGSTAMPNS_NEW, | 
					
						
							| 
									
										
										
										
											2020-06-19 14:47:26 +02:00
										 |  |  |     "SIOCGSTAMPNS_NEW", IOC_R, do_ioctl_SIOCGSTAMPNS, | 
					
						
							|  |  |  |     { MK_PTR(MK_STRUCT(STRUCT__kernel_timespec)) } }, | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-05 10:55:30 -03:00
										 |  |  |   IOCTL(RNDGETENTCNT, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(RNDADDTOENTCNT, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(RNDZAPENTCNT, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(RNDCLEARPOOL, 0, TYPE_NULL) | 
					
						
							| 
									
										
										
										
											2019-09-04 14:59:22 +02:00
										 |  |  | #ifdef RNDRESEEDCRNG
 | 
					
						
							|  |  |  |   IOCTL(RNDRESEEDCRNG, 0, TYPE_NULL) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2017-10-05 10:55:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |   IOCTL(CDROMPAUSE, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(CDROMSTART, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(CDROMSTOP, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(CDROMRESUME, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(CDROMEJECT, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(CDROMEJECT_SW, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(CDROMCLOSETRAY, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(CDROMRESET, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(CDROMPLAYMSF, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(CDROMPLAYTRKIND, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(CDROMREADTOCHDR, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(CDROMREADTOCENTRY, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(CDROMVOLCTRL, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(CDROMSUBCHNL, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   /* XXX: incorrect (need specific handling) */ | 
					
						
							|  |  |  |   IOCTL(CDROMREADAUDIO, IOC_W, MK_PTR(MK_STRUCT(STRUCT_cdrom_read_audio))) | 
					
						
							|  |  |  |   IOCTL(CDROMREADCOOKED, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(CDROMREADRAW, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(CDROMREADMODE1, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(CDROMREADMODE2, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(CDROMREADALL, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(CDROMMULTISESSION, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(CDROM_GET_UPC, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(CDROMVOLREAD, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(CDROMSEEK, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(CDROMPLAYBLK, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(CDROM_MEDIA_CHANGED, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(CDROM_SET_OPTIONS, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(CDROM_CLEAR_OPTIONS, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(CDROM_SELECT_SPEED, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(CDROM_SELECT_DISC, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(CDROM_DRIVE_STATUS, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(CDROM_DISC_STATUS, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(CDROMAUDIOBUFSIZ, 0, TYPE_INT) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-15 19:58:13 +00:00
										 |  |  | #if 0
 | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |   IOCTL(SNDCTL_COPR_HALT, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_COPR_LOAD, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_COPR_RCODE, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_COPR_RCVMSG, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_COPR_RDATA, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_COPR_RESET, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_COPR_RUN, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_COPR_SENDMSG, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_COPR_WCODE, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_COPR_WDATA, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2003-06-15 19:58:13 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |   IOCTL(SNDCTL_DSP_CHANNELS, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_GETBLKSIZE, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_GETCAPS, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_GETFMTS, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2003-06-15 19:58:13 +00:00
										 |  |  |   IOCTL(SNDCTL_DSP_GETIPTR, IOC_R, MK_PTR(MK_STRUCT(STRUCT_count_info))) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_GETOPTR, IOC_R, MK_PTR(MK_STRUCT(STRUCT_count_info))) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_GETISPACE, IOC_R, MK_PTR(MK_STRUCT(STRUCT_audio_buf_info))) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_GETOSPACE, IOC_R, MK_PTR(MK_STRUCT(STRUCT_audio_buf_info))) | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |   IOCTL(SNDCTL_DSP_GETTRIGGER, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2012-07-23 08:06:15 +00:00
										 |  |  |   IOCTL(SNDCTL_DSP_MAPINBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc))) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_MAPOUTBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc))) | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |   IOCTL(SNDCTL_DSP_NONBLOCK, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_POST, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_RESET, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_SETDUPLEX, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_SETFMT, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_SETFRAGMENT, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_SETSYNCRO, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_SETTRIGGER, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_SPEED, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_STEREO, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_SUBDIVIDE, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_DSP_SYNC, 0, TYPE_NULL) | 
					
						
							| 
									
										
										
										
											2003-06-15 19:58:13 +00:00
										 |  |  | #if 0
 | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |   IOCTL(SNDCTL_FM_4OP_ENABLE, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_FM_LOAD_INSTR, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_MIDI_INFO, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_MIDI_MPUCMD, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_MIDI_MPUMODE, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_MIDI_PRETIME, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_SEQ_CTRLRATE, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_SEQ_GETINCOUNT, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_SEQ_GETOUTCOUNT, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_SEQ_NRMIDIS, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_SEQ_NRSYNTHS, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_SEQ_OUTOFBAND, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_SEQ_PANIC, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_SEQ_PERCMODE, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_SEQ_RESET, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_SEQ_RESETSAMPLES, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_SEQ_SYNC, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_SEQ_TESTMIDI, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_SEQ_THRESHOLD, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_SYNTH_INFO, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_SYNTH_MEMAVL, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_TMR_CONTINUE, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_TMR_METRONOME, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_TMR_SELECT, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_TMR_SOURCE, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2003-03-23 16:49:39 +00:00
										 |  |  | #if 0
 | 
					
						
							|  |  |  |      /* we invalidate these defines because they have a same number as
 | 
					
						
							|  |  |  |         termios ioctls */ | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |   IOCTL(SNDCTL_TMR_START, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_TMR_STOP, 0, TYPE_NULL) | 
					
						
							| 
									
										
										
										
											2003-03-23 16:49:39 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |   IOCTL(SNDCTL_TMR_TEMPO, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDCTL_TMR_TIMEBASE, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   IOCTL(SOUND_PCM_WRITE_FILTER, IOC_W | IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_PCM_READ_RATE, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_PCM_READ_CHANNELS, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_PCM_READ_BITS, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_PCM_READ_FILTER, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2003-06-15 19:58:13 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |   IOCTL(SOUND_MIXER_INFO, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_ACCESS, 0, TYPE_PTRVOID) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_PRIVATE1, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_PRIVATE2, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_PRIVATE3, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_PRIVATE4, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_PRIVATE5, IOC_RW, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_VOLUME, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_BASS, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_TREBLE, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_SYNTH, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_PCM, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_SPEAKER, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_LINE, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_MIC, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_CD, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_IMIX, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_ALTPCM, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_RECLEV, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_IGAIN, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_OGAIN, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_LINE1, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_LINE2, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_LINE3, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_MUTE, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_ENHANCE, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_LOUD, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_RECSRC, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_DEVMASK, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_RECMASK, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_STEREODEVS, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_READ_CAPS, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_VOLUME, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_BASS, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_TREBLE, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_SYNTH, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_PCM, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_SPEAKER, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_LINE, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_MIC, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_CD, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_IMIX, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_ALTPCM, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_RECLEV, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_IGAIN, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_OGAIN, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_LINE1, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_LINE2, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_LINE3, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_MUTE, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_ENHANCE, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_LOUD, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SOUND_MIXER_WRITE_RECSRC, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												linux-user: Add support for getting alsa timer version and id
This patch implements functionalities of following ioctls:
SNDRV_TIMER_IOCTL_PVERSION - Getting the sound timer version
    Read the sound timer version. The third ioctl's argument is
    a pointer to an int in which the specified timers version
    is returned.
SNDRV_TIMER_IOCTL_NEXT_DEVICE - Getting id information about next timer
    Read id information about the next timer device from the sound timer
    device list. The id infomration is returned in the following structure:
        struct snd_timer_id {
            int dev_class;    /* timer device class number */
            int dev_sclass;   /* slave device class number (unused) */
            int card;         /* card number */
            int device;       /* device number */
            int subdevice;    /* sub-device number */
        };
    The devices in the sound timer device list are arranged by the fields
    of this structure respectively (first by dev_class number, then by
    card number, ...). A pointer to this structure should be passed as
    the third ioctl's argument. Before calling the ioctl, the parameters
    of this structure should be initialized in relation to the next timer
    device which information is to be obtained. For example, if a wanted
    timer device has the device class number equal to or bigger then 2,
    the field dev_class should be initialized to 2. After the ioctl call,
    the structure fields are filled with values from the next device in
    the sound timer device list. If there is no next device in the list,
    the structure is filled with "zero" id values (in that case all
    fields are filled with value -1).
Implementation notes:
    The ioctl 'SNDRV_TIMER_IOCTL_NEXT_DEVICE' has a pointer to a
    'struct snd_timer_id' as its third argument. That is the reason why
    corresponding definition is added in 'linux-user/syscall_types.h'.
    Since all elements of this structure are of type 'int', the rest of
    the implementation was straightforward.
    The line '#include <linux/rtc.h>' was added to recognize
    preprocessor definitions for these ioctls. This needs to be
    done only once in this series of commits. Also, the content
    of this file (with respect to ioctl definitions) remained
    unchanged for a long time, therefore there is no need to
    worry about supporting older Linux kernel version.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Filip Bozuta <Filip.Bozuta@rt-rk.com>
Message-Id: <1579117007-7565-8-git-send-email-Filip.Bozuta@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
											
										 
											2020-01-15 20:36:41 +01:00
										 |  |  |   IOCTL(SNDRV_TIMER_IOCTL_PVERSION, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(SNDRV_TIMER_IOCTL_NEXT_DEVICE, IOC_RW, | 
					
						
							|  |  |  |         MK_PTR(MK_STRUCT(STRUCT_snd_timer_id))) | 
					
						
							| 
									
										
											  
											
												linux-user: Add support for getting/setting specified alsa timer parameters using ioctls
This patch implements functionalities of following ioctls:
SNDRV_TIMER_IOCTL_GINFO - Getting information about specified timer
    Read information about the specified timer. The information about the
    timer is returned in the following structure:
        struct snd_timer_ginfo {
            struct snd_timer_id tid;      /* requested timer ID */
            unsigned int flags;           /* timer flags - SNDRV_TIMER_FLG_* */
            int card;                     /* card number */
            unsigned char id[64];         /* timer identification */
            unsigned char name[80];       /* timer name */
            unsigned long reserved0;      /* reserved for future use */
            unsigned long resolution;     /* average period resolution in ns */
            unsigned long resolution_min; /* minimal period resolution in ns */
            unsigned long resolution_max; /* maximal period resolution in ns */
            unsigned int clients;         /* active timer clients */
            unsigned char reserved[32];   /* reserved */
        };
    A pointer to this structure should be passed as the third ioctl's argument.
    Before calling the ioctl, the field "tid" should be initialized with the id
    information for the timer which information is to be obtained. After the
    ioctl call, the rest of the structure fields are filled with values from
    the timer device with the specified id. If there is no device with the
    specified id, the error ENODEV ("No such device") is returned.
SNDRV_TIMER_IOCTL_GPARAMS - Setting precise period duration
    Sets timer precise period duration numerator and denominator in seconds. The
    period duration is set in the following structure:
        struct snd_timer_gparams {
            struct snd_timer_id tid;    /* requested timer ID */
            unsigned long period_num;   /* period duration - numerator */
            unsigned long period_den;   /* period duration - denominator */
            unsigned char reserved[32]; /* reserved */
        };
    A pointer to this structure should be passed as the third ioctl's argument.
    Before calling the ioctl, the field "tid" should be initialized with the id
    information for the timer which period duration is to be set. Also, the
    fileds "period_num" and "period_den" should be filled with the period
    duration numerator and denominator values that are to be set respectively.
    If there is no device with the specified id, the error ENODEV ("No such
    device") is returned.
SNDRV_TIMER_IOCTL_GSTATUS - Getting current period resolution
    Read timer current period resolution in nanoseconds and period resolution
    numerator and denominator in seconds. The period resolution information is
    returned in the following structure:
    struct snd_timer_gstatus {
        struct snd_timer_id tid;        /* requested timer ID */
        unsigned long resolution;       /* current period resolution in ns */
        unsigned long resolution_num;   /* period resolution - numerator */
        unsigned long resolution_den;   /* period resolution - denominator */
        unsigned char reserved[32];     /* reserved for future use */
    };
    A pointer to this structure should be passed as the third ioctl's argument.
    Before calling the ioctl, the field "tid" should be initialized with the id
    information for the timer which period resolution is to be obtained. After
    the ioctl call, the rest of the structure fields are filled with values
    from the timer device with the specified id. If there is no device with the
    specified id, the error ENODEV ("No such device") is returned.
Implementation notes:
    All ioctls in this patch have pointer to some kind of a structure as their
    third argument. That is the reason why corresponding definitions were added
    in 'linux-user/syscall_types.h'. All of these strcutures have some fields
    that are of type 'unsigned long'. That is the reason why separate target
    structures were defined in 'linux-user/syscall_defs.h'. Also, all of the
    structures have a field with type 'struct snd_timer_id' which is the reason
    why a separate target structure 'struct target_snd_timer_id' was also
    defined. The rest of the implementation was straightforward.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Filip Bozuta <Filip.Bozuta@rt-rk.com>
Message-Id: <1579117007-7565-10-git-send-email-Filip.Bozuta@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
											
										 
											2020-01-15 20:36:43 +01:00
										 |  |  |   IOCTL(SNDRV_TIMER_IOCTL_GINFO, IOC_RW, | 
					
						
							|  |  |  |         MK_PTR(MK_STRUCT(STRUCT_snd_timer_ginfo))) | 
					
						
							|  |  |  |   IOCTL(SNDRV_TIMER_IOCTL_GPARAMS, IOC_W, | 
					
						
							|  |  |  |         MK_PTR(MK_STRUCT(STRUCT_snd_timer_gparams))) | 
					
						
							|  |  |  |   IOCTL(SNDRV_TIMER_IOCTL_GSTATUS, IOC_RW, | 
					
						
							|  |  |  |         MK_PTR(MK_STRUCT(STRUCT_snd_timer_gstatus))) | 
					
						
							| 
									
										
										
										
											2020-01-15 20:36:44 +01:00
										 |  |  |   IOCTL(SNDRV_TIMER_IOCTL_SELECT, IOC_W, | 
					
						
							|  |  |  |         MK_PTR(MK_STRUCT(STRUCT_snd_timer_select))) | 
					
						
							| 
									
										
										
										
											2020-01-15 20:36:45 +01:00
										 |  |  |   IOCTL(SNDRV_TIMER_IOCTL_INFO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_snd_timer_info))) | 
					
						
							|  |  |  |   IOCTL(SNDRV_TIMER_IOCTL_PARAMS, IOC_W, | 
					
						
							|  |  |  |         MK_PTR(MK_STRUCT(STRUCT_snd_timer_params))) | 
					
						
							|  |  |  |   IOCTL(SNDRV_TIMER_IOCTL_STATUS, IOC_R, | 
					
						
							|  |  |  |         MK_PTR(MK_STRUCT(STRUCT_snd_timer_status))) | 
					
						
							| 
									
										
										
										
											2020-01-15 20:36:46 +01:00
										 |  |  |   IOCTL(SNDRV_TIMER_IOCTL_START, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(SNDRV_TIMER_IOCTL_STOP, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(SNDRV_TIMER_IOCTL_CONTINUE, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(SNDRV_TIMER_IOCTL_PAUSE, 0, TYPE_NULL) | 
					
						
							| 
									
										
											  
											
												linux-user: Add support for getting alsa timer version and id
This patch implements functionalities of following ioctls:
SNDRV_TIMER_IOCTL_PVERSION - Getting the sound timer version
    Read the sound timer version. The third ioctl's argument is
    a pointer to an int in which the specified timers version
    is returned.
SNDRV_TIMER_IOCTL_NEXT_DEVICE - Getting id information about next timer
    Read id information about the next timer device from the sound timer
    device list. The id infomration is returned in the following structure:
        struct snd_timer_id {
            int dev_class;    /* timer device class number */
            int dev_sclass;   /* slave device class number (unused) */
            int card;         /* card number */
            int device;       /* device number */
            int subdevice;    /* sub-device number */
        };
    The devices in the sound timer device list are arranged by the fields
    of this structure respectively (first by dev_class number, then by
    card number, ...). A pointer to this structure should be passed as
    the third ioctl's argument. Before calling the ioctl, the parameters
    of this structure should be initialized in relation to the next timer
    device which information is to be obtained. For example, if a wanted
    timer device has the device class number equal to or bigger then 2,
    the field dev_class should be initialized to 2. After the ioctl call,
    the structure fields are filled with values from the next device in
    the sound timer device list. If there is no next device in the list,
    the structure is filled with "zero" id values (in that case all
    fields are filled with value -1).
Implementation notes:
    The ioctl 'SNDRV_TIMER_IOCTL_NEXT_DEVICE' has a pointer to a
    'struct snd_timer_id' as its third argument. That is the reason why
    corresponding definition is added in 'linux-user/syscall_types.h'.
    Since all elements of this structure are of type 'int', the rest of
    the implementation was straightforward.
    The line '#include <linux/rtc.h>' was added to recognize
    preprocessor definitions for these ioctls. This needs to be
    done only once in this series of commits. Also, the content
    of this file (with respect to ioctl definitions) remained
    unchanged for a long time, therefore there is no need to
    worry about supporting older Linux kernel version.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Filip Bozuta <Filip.Bozuta@rt-rk.com>
Message-Id: <1579117007-7565-8-git-send-email-Filip.Bozuta@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
											
										 
											2020-01-15 20:36:41 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-18 22:55:36 +00:00
										 |  |  |   IOCTL(HDIO_GETGEO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_hd_geometry))) | 
					
						
							|  |  |  |   IOCTL(HDIO_GET_UNMASKINTR, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(HDIO_GET_MULTCOUNT, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(HDIO_GET_IDENTITY, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(HDIO_GET_KEEPSETTINGS, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(HDIO_GET_NOWERR, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(HDIO_GET_DMA, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(HDIO_GET_32BIT, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(HDIO_DRIVE_CMD, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(HDIO_SET_UNMASKINTR, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(HDIO_SET_MULTCOUNT, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(HDIO_SET_KEEPSETTINGS, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(HDIO_SET_NOWERR, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(HDIO_SET_DMA, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(HDIO_SET_32BIT, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(HDIO_SET_PIO_MODE, 0, TYPE_INT) | 
					
						
							| 
									
										
										
										
											2003-03-16 20:28:50 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   IOCTL(VFAT_IOCTL_READDIR_BOTH, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2))) | 
					
						
							|  |  |  |   IOCTL(VFAT_IOCTL_READDIR_SHORT, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2))) | 
					
						
							| 
									
										
										
										
											2008-04-26 14:44:49 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   IOCTL(LOOP_SET_FD, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(LOOP_CLR_FD, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(LOOP_SET_STATUS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info))) | 
					
						
							| 
									
										
										
										
											2016-07-05 16:36:29 +01:00
										 |  |  |   IOCTL(LOOP_GET_STATUS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_loop_info))) | 
					
						
							| 
									
										
										
										
											2008-04-26 14:44:49 +00:00
										 |  |  |   IOCTL(LOOP_SET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64))) | 
					
						
							| 
									
										
										
										
											2016-07-05 16:36:29 +01:00
										 |  |  |   IOCTL(LOOP_GET_STATUS64, IOC_R, MK_PTR(MK_STRUCT(STRUCT_loop_info64))) | 
					
						
							| 
									
										
										
										
											2008-04-26 14:44:49 +00:00
										 |  |  |   IOCTL(LOOP_CHANGE_FD, 0, TYPE_INT) | 
					
						
							| 
									
										
										
										
											2021-11-22 16:56:02 +01:00
										 |  |  |   IOCTL(LOOP_SET_CAPACITY, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(LOOP_SET_DIRECT_IO, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(LOOP_SET_BLOCK_SIZE, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(LOOP_CONFIGURE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_config))) | 
					
						
							| 
									
										
										
										
											2008-09-20 03:03:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-04 17:06:17 +01:00
										 |  |  |   IOCTL(LOOP_CTL_ADD, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(LOOP_CTL_REMOVE, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(LOOP_CTL_GET_FREE, 0, TYPE_NULL) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-20 03:03:09 +00:00
										 |  |  |   IOCTL(MTIOCTOP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_mtop))) | 
					
						
							|  |  |  |   IOCTL(MTIOCGET, IOC_R, MK_PTR(MK_STRUCT(STRUCT_mtget))) | 
					
						
							|  |  |  |   IOCTL(MTIOCPOS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_mtpos))) | 
					
						
							| 
									
										
										
										
											2009-10-16 17:00:44 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   IOCTL(FBIOGET_FSCREENINFO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_fb_fix_screeninfo))) | 
					
						
							|  |  |  |   IOCTL(FBIOGET_VSCREENINFO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_fb_var_screeninfo))) | 
					
						
							|  |  |  |   IOCTL(FBIOPUT_VSCREENINFO, IOC_W, MK_PTR(MK_STRUCT(STRUCT_fb_var_screeninfo))) | 
					
						
							| 
									
										
										
										
											2011-06-29 15:09:11 +02:00
										 |  |  |   IOCTL(FBIOGETCMAP,        IOC_RW, MK_PTR(MK_STRUCT(STRUCT_fb_cmap))) | 
					
						
							|  |  |  |   IOCTL(FBIOPUTCMAP,        IOC_RW, MK_PTR(MK_STRUCT(STRUCT_fb_cmap))) | 
					
						
							|  |  |  |   IOCTL(FBIOPAN_DISPLAY,    IOC_RW, MK_PTR(MK_STRUCT(STRUCT_fb_var_screeninfo))) | 
					
						
							|  |  |  |   IOCTL(FBIOGET_CON2FBMAP,  IOC_RW, MK_PTR(MK_STRUCT(STRUCT_fb_con2fbmap))) | 
					
						
							|  |  |  |   IOCTL(FBIOPUT_CON2FBMAP,  IOC_RW, MK_PTR(MK_STRUCT(STRUCT_fb_con2fbmap))) | 
					
						
							| 
									
										
										
										
											2009-10-16 17:00:44 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   IOCTL(VT_OPENQRY, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(VT_GETSTATE, IOC_R, MK_PTR(MK_STRUCT(STRUCT_vt_stat))) | 
					
						
							|  |  |  |   IOCTL(VT_ACTIVATE, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(VT_WAITACTIVE, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(VT_LOCKSWITCH, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(VT_UNLOCKSWITCH, 0, TYPE_INT) | 
					
						
							| 
									
										
										
										
											2011-06-29 15:09:10 +02:00
										 |  |  |   IOCTL(VT_GETMODE, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_vt_mode))) | 
					
						
							|  |  |  |   IOCTL(VT_SETMODE, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_vt_mode))) | 
					
						
							|  |  |  |   IOCTL(VT_RELDISP, 0, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(VT_DISALLOCATE, 0, TYPE_INT) | 
					
						
							| 
									
										
										
										
											2012-01-31 18:42:06 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   IOCTL(DM_VERSION, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_dm_ioctl))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(DM_REMOVE_ALL,   IOC_RW, do_ioctl_dm, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(DM_LIST_DEVICES, IOC_RW, do_ioctl_dm, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(DM_DEV_CREATE,   IOC_RW, do_ioctl_dm, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(DM_DEV_REMOVE,   IOC_RW, do_ioctl_dm, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(DM_DEV_RENAME,   IOC_RW, do_ioctl_dm, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(DM_DEV_SUSPEND,  IOC_RW, do_ioctl_dm, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(DM_DEV_STATUS,   IOC_RW, do_ioctl_dm, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(DM_DEV_WAIT,     IOC_RW, do_ioctl_dm, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(DM_TABLE_LOAD,   IOC_RW, do_ioctl_dm, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(DM_TABLE_CLEAR,  IOC_RW, do_ioctl_dm, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(DM_TABLE_DEPS,   IOC_RW, do_ioctl_dm, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(DM_TABLE_STATUS, IOC_RW, do_ioctl_dm, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(DM_LIST_VERSIONS,IOC_RW, do_ioctl_dm, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(DM_TARGET_MSG,   IOC_RW, do_ioctl_dm, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(DM_DEV_SET_GEOMETRY, IOC_RW, do_ioctl_dm, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_dm_ioctl))) | 
					
						
							| 
									
										
										
										
											2013-07-02 14:04:12 +01:00
										 |  |  |   IOCTL_SPECIAL(SIOCADDRT, IOC_W, do_ioctl_rt, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_rtentry))) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(SIOCDELRT, IOC_W, do_ioctl_rt, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_rtentry))) | 
					
						
							| 
									
										
										
										
											2016-12-06 16:24:03 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-05 09:32:21 +08:00
										 |  |  | #ifdef HAVE_DRM_H
 | 
					
						
							|  |  |  |   IOCTL_SPECIAL(DRM_IOCTL_VERSION, IOC_RW, do_ioctl_drm, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_drm_version))) | 
					
						
							| 
									
										
										
										
											2020-08-02 21:39:38 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   IOCTL_SPECIAL(DRM_IOCTL_I915_GETPARAM, IOC_RW, do_ioctl_drm_i915, | 
					
						
							|  |  |  |                 MK_PTR(MK_STRUCT(STRUCT_drm_i915_getparam))) | 
					
						
							| 
									
										
										
										
											2020-06-05 09:32:21 +08:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-12-06 16:24:03 +01:00
										 |  |  | #ifdef TARGET_TIOCSTART
 | 
					
						
							|  |  |  |   IOCTL_IGNORE(TIOCSTART) | 
					
						
							|  |  |  |   IOCTL_IGNORE(TIOCSTOP) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2020-01-16 23:49:50 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-18 18:10:51 +01:00
										 |  |  | #ifdef HAVE_SYS_KCOV_H
 | 
					
						
							| 
									
										
										
										
											2020-01-16 23:49:50 +01:00
										 |  |  |   IOCTL(KCOV_ENABLE, 0, TYPE_NULL) | 
					
						
							|  |  |  |   IOCTL(KCOV_DISABLE, 0, TYPE_NULL) | 
					
						
							| 
									
										
										
										
											2020-01-16 23:49:51 +01:00
										 |  |  |   IOCTL(KCOV_INIT_TRACE, IOC_R, TYPE_ULONG) | 
					
						
							| 
									
										
										
										
											2020-01-16 23:49:50 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2020-09-28 18:48:01 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   IOCTL(TUNSETDEBUG,     IOC_W, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(TUNSETIFF,       IOC_RW, MK_PTR(MK_STRUCT(STRUCT_short_ifreq))) | 
					
						
							|  |  |  |   IOCTL(TUNSETPERSIST,   IOC_W, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(TUNSETOWNER,     IOC_W, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(TUNSETLINK,      IOC_W, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(TUNSETGROUP,     IOC_W, TYPE_INT) | 
					
						
							|  |  |  |   IOCTL(TUNGETFEATURES,  IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(TUNSETOFFLOAD,   IOC_W, TYPE_LONG) | 
					
						
							|  |  |  |   IOCTL_SPECIAL(TUNSETTXFILTER, IOC_W, do_ioctl_TUNSETTXFILTER, | 
					
						
							|  |  |  |                 /*
 | 
					
						
							|  |  |  |                  * We can't represent `struct tun_filter` in thunk so leaving | 
					
						
							|  |  |  |                  * it uninterpreted. do_ioctl_TUNSETTXFILTER will do the | 
					
						
							|  |  |  |                  * conversion. | 
					
						
							|  |  |  |                  */ | 
					
						
							|  |  |  |                 TYPE_PTRVOID) | 
					
						
							|  |  |  |   IOCTL(TUNGETIFF,       IOC_R, MK_PTR(MK_STRUCT(STRUCT_short_ifreq))) | 
					
						
							|  |  |  |   IOCTL(TUNGETSNDBUF,    IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(TUNSETSNDBUF,    IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   /*
 | 
					
						
							|  |  |  |    * TUNATTACHFILTER and TUNDETACHFILTER are not supported. Linux kernel keeps a | 
					
						
							|  |  |  |    * user pointer in TUNATTACHFILTER, which we are not able to correctly handle. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   IOCTL(TUNGETVNETHDRSZ, IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(TUNSETVNETHDRSZ, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(TUNSETQUEUE,     IOC_W, MK_PTR(MK_STRUCT(STRUCT_short_ifreq))) | 
					
						
							|  |  |  |   IOCTL(TUNSETIFINDEX ,  IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   /* TUNGETFILTER is not supported: see TUNATTACHFILTER. */ | 
					
						
							| 
									
										
										
										
											2021-01-04 13:40:42 -10:00
										 |  |  | #ifdef TUNSETVNETLE
 | 
					
						
							| 
									
										
										
										
											2020-09-28 18:48:01 -07:00
										 |  |  |   IOCTL(TUNSETVNETLE,    IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(TUNGETVNETLE,    IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							| 
									
										
										
										
											2021-01-04 13:40:42 -10:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2020-09-28 18:48:01 -07:00
										 |  |  | #ifdef TUNSETVNETBE
 | 
					
						
							|  |  |  |   IOCTL(TUNSETVNETBE,    IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  |   IOCTL(TUNGETVNETBE,    IOC_R, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef TUNSETSTEERINGEBPF
 | 
					
						
							|  |  |  |   IOCTL(TUNSETSTEERINGEBPF, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef TUNSETFILTEREBPF
 | 
					
						
							|  |  |  |   IOCTL(TUNSETFILTEREBPF, IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef TUNSETCARRIER
 | 
					
						
							|  |  |  |   IOCTL(TUNSETCARRIER,   IOC_W, MK_PTR(TYPE_INT)) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef TUNGETDEVNETNS
 | 
					
						
							|  |  |  |   IOCTL(TUNGETDEVNETNS,  IOC_R, TYPE_NULL) | 
					
						
							|  |  |  | #endif
 |