aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-declextract/testdata/include/uapi/ioctl.h
blob: fae14a74ef6d34d35426a0ef3933bccbe8003cbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright 2024 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

#define _IOC_NONE	0U
#define _IOC_WRITE	1U
#define _IOC_READ	2U

#define _IOC_NRBITS	8
#define _IOC_TYPEBITS	8
#define _IOC_SIZEBITS	14
#define _IOC_DIRBITS	2

#define _IOC_NRSHIFT	0
#define _IOC_TYPESHIFT	(_IOC_NRSHIFT+_IOC_NRBITS)
#define _IOC_SIZESHIFT	(_IOC_TYPESHIFT+_IOC_TYPEBITS)
#define _IOC_DIRSHIFT	(_IOC_SIZESHIFT+_IOC_SIZEBITS)

#define _IOC(dir, type, nr, size) (((dir)  << _IOC_DIRSHIFT) | ((type) << _IOC_TYPESHIFT) | \
	 ((nr)   << _IOC_NRSHIFT) | ((size) << _IOC_SIZESHIFT))

#define _IO(type, nr)		_IOC(_IOC_NONE, (type), (nr), 0)
#define _IOR(type, nr, arg)	_IOC(_IOC_READ, (type), (nr), (sizeof(arg)))
#define _IOW(type, nr, arg)	_IOC(_IOC_WRITE, (type), (nr), (sizeof(arg)))
#define _IOWR(type, nr, arg)	_IOC(_IOC_READ|_IOC_WRITE, (type), (nr), (sizeof(arg)))