1655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng/**************************************************************************** 2655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng **************************************************************************** 3655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng *** 4655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng *** This header was automatically generated from a Linux kernel header 5655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng *** of the same name, to make information necessary for userspace to 6655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng *** call into the kernel available to libc. It contains only constants, 7655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng *** structures, and macros generated from the original header, and thus, 8655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng *** contains no copyrightable information. 9655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng *** 10655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng *** To edit the content of this header, modify the corresponding 11655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng *** source file (e.g. under external/kernel-headers/original/) then 12655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng *** run bionic/libc/kernel/tools/update_all.py 13655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng *** 14655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng *** Any manual change here will be lost the next time this script will 15655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng *** be run. You've been warned! 16655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng *** 17655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng **************************************************************************** 18655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ****************************************************************************/ 19655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#ifndef _UAPI_ASM_GENERIC_IOCTL_H 20655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define _UAPI_ASM_GENERIC_IOCTL_H 21655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define _IOC_NRBITS 8 22655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define _IOC_TYPEBITS 8 23655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#ifndef _IOC_SIZEBITS 24655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define _IOC_SIZEBITS 14 25655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#endif 26655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#ifndef _IOC_DIRBITS 27655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define _IOC_DIRBITS 2 28655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#endif 29d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define _IOC_NRMASK ((1 << _IOC_NRBITS) - 1) 30d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS) - 1) 31d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS) - 1) 32d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define _IOC_DIRMASK ((1 << _IOC_DIRBITS) - 1) 33655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define _IOC_NRSHIFT 0 34d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define _IOC_TYPESHIFT (_IOC_NRSHIFT + _IOC_NRBITS) 35d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define _IOC_SIZESHIFT (_IOC_TYPESHIFT + _IOC_TYPEBITS) 36d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define _IOC_DIRSHIFT (_IOC_SIZESHIFT + _IOC_SIZEBITS) 37655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#ifndef _IOC_NONE 38655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define _IOC_NONE 0U 39655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#endif 40655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#ifndef _IOC_WRITE 41655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define _IOC_WRITE 1U 42655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#endif 43655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#ifndef _IOC_READ 44655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define _IOC_READ 2U 45655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#endif 46d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define _IOC(dir,type,nr,size) (((dir) << _IOC_DIRSHIFT) | ((type) << _IOC_TYPESHIFT) | ((nr) << _IOC_NRSHIFT) | ((size) << _IOC_SIZESHIFT)) 47655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define _IOC_TYPECHECK(t) (sizeof(t)) 48d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define _IO(type,nr) _IOC(_IOC_NONE, (type), (nr), 0) 49d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define _IOR(type,nr,size) _IOC(_IOC_READ, (type), (nr), (_IOC_TYPECHECK(size))) 50d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define _IOW(type,nr,size) _IOC(_IOC_WRITE, (type), (nr), (_IOC_TYPECHECK(size))) 51d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define _IOWR(type,nr,size) _IOC(_IOC_READ | _IOC_WRITE, (type), (nr), (_IOC_TYPECHECK(size))) 52d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ, (type), (nr), sizeof(size)) 53d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE, (type), (nr), sizeof(size)) 54d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ | _IOC_WRITE, (type), (nr), sizeof(size)) 55655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) 56655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) 57655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) 58655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) 59655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) 60655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) 61d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define IOC_INOUT ((_IOC_WRITE | _IOC_READ) << _IOC_DIRSHIFT) 62655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) 63655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define IOCSIZE_SHIFT (_IOC_SIZESHIFT) 64655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#endif 65