github.com/google/syzkaller@v0.0.0-20251211124644-a066d2bc4b02/tools/syz-declextract/testdata/include/uapi/ioctl.h (about)

     1  // Copyright 2024 syzkaller project authors. All rights reserved.
     2  // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  #define _IOC_NONE	0U
     5  #define _IOC_WRITE	1U
     6  #define _IOC_READ	2U
     7  
     8  #define _IOC_NRBITS	8
     9  #define _IOC_TYPEBITS	8
    10  #define _IOC_SIZEBITS	14
    11  #define _IOC_DIRBITS	2
    12  
    13  #define _IOC_NRSHIFT	0
    14  #define _IOC_TYPESHIFT	(_IOC_NRSHIFT+_IOC_NRBITS)
    15  #define _IOC_SIZESHIFT	(_IOC_TYPESHIFT+_IOC_TYPEBITS)
    16  #define _IOC_DIRSHIFT	(_IOC_SIZESHIFT+_IOC_SIZEBITS)
    17  
    18  #define _IOC(dir, type, nr, size) (((dir)  << _IOC_DIRSHIFT) | ((type) << _IOC_TYPESHIFT) | \
    19  	 ((nr)   << _IOC_NRSHIFT) | ((size) << _IOC_SIZESHIFT))
    20  
    21  #define _IO(type, nr)		_IOC(_IOC_NONE, (type), (nr), 0)
    22  #define _IOR(type, nr, arg)	_IOC(_IOC_READ, (type), (nr), (sizeof(arg)))
    23  #define _IOW(type, nr, arg)	_IOC(_IOC_WRITE, (type), (nr), (sizeof(arg)))
    24  #define _IOWR(type, nr, arg)	_IOC(_IOC_READ|_IOC_WRITE, (type), (nr), (sizeof(arg)))