/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _UAPI_ASM_GENERIC_IOCTL_H #define _UAPI_ASM_GENERIC_IOCTL_H /* ioctl command encoding: 32 bits total, command in lower 16 bits, * size of the parameter structure in the lower 14 bits of the * upper 16 bits. * Encoding the size of the parameter structure in the ioctl request * is useful for catching programs compiled with old versions * and to avoid overwriting user space outside the user buffer area. * The highest 2 bits are reserved for indicating the ``access mode''. * NOTE: This limits the max parameter size to 16kB -1 ! */ /* * The following is for compatibility across the various Linux * platforms. The generic ioctl numbering scheme doesn't really enforce * a type field. De facto, however, the top 8 bits of the lower 16 * bits are indeed used as a type field, so we might just as well make * this explicit here. Please be sure to use the decoding macros * below from now on. */ #define _IOC_NRBITS … #define _IOC_TYPEBITS … /* * Let any architecture override either of the following before * including this file. */ #ifndef _IOC_SIZEBITS #define _IOC_SIZEBITS … #endif #ifndef _IOC_DIRBITS #define _IOC_DIRBITS … #endif #define _IOC_NRMASK … #define _IOC_TYPEMASK … #define _IOC_SIZEMASK … #define _IOC_DIRMASK … #define _IOC_NRSHIFT … #define _IOC_TYPESHIFT … #define _IOC_SIZESHIFT … #define _IOC_DIRSHIFT … /* * Direction bits, which any architecture can choose to override * before including this file. * * NOTE: _IOC_WRITE means userland is writing and kernel is * reading. _IOC_READ means userland is reading and kernel is writing. */ #ifndef _IOC_NONE #define _IOC_NONE … #endif #ifndef _IOC_WRITE #define _IOC_WRITE … #endif #ifndef _IOC_READ #define _IOC_READ … #endif #define _IOC(dir,type,nr,size) … #ifndef __KERNEL__ #define _IOC_TYPECHECK … #endif /* * Used to create numbers. * * NOTE: _IOW means userland is writing and kernel is reading. _IOR * means userland is reading and kernel is writing. */ #define _IO(type,nr) … #define _IOR(type,nr,size) … #define _IOW(type,nr,size) … #define _IOWR(type,nr,size) … #define _IOR_BAD(type,nr,size) … #define _IOW_BAD(type,nr,size) … #define _IOWR_BAD(type,nr,size) … /* used to decode ioctl numbers.. */ #define _IOC_DIR(nr) … #define _IOC_TYPE(nr) … #define _IOC_NR(nr) … #define _IOC_SIZE(nr) … /* ...and for the drivers/sound files... */ #define IOC_IN … #define IOC_OUT … #define IOC_INOUT … #define IOCSIZE_MASK … #define IOCSIZE_SHIFT … #endif /* _UAPI_ASM_GENERIC_IOCTL_H */