remove extra mkfs.1
[minix.git] / include / minix / ioctl.h
blob1ea5c9221027b408a13ed5a7045d7df2d3ad00cc
1 /* minix/ioctl.h - Ioctl helper definitions. Author: Kees J. Bot
2 * 23 Nov 2002
4 * This file is included by every header file that defines ioctl codes.
5 */
7 #ifndef _M_IOCTL_H
8 #define _M_IOCTL_H
10 #include <sys/cdefs.h>
12 #ifndef _TYPES_H
13 #include <minix/types.h>
14 #endif
16 /* Ioctls have the command encoded in the low-order word, and the size
17 * of the parameter in the high-order word. The 3 high bits of the high-
18 * order word are used to encode the in/out/void status of the parameter.
20 #define _IOCPARM_MASK 0x0FFF
21 #define _IOCPARM_MASK_BIG 0x0FFFFF
22 #define _IOC_VOID 0x20000000
23 #define _IOCTYPE_MASK 0xFFFF
24 #define _IOC_IN 0x40000000
25 #define _IOC_OUT 0x80000000
26 #define _IOC_INOUT (_IOC_IN | _IOC_OUT)
28 /* Flag indicating ioctl format with only one type field, and more bits
29 * for the size field (using mask _IOCPARM_MASK_BIG).
31 #define _IOC_BIG 0x10000000
33 #define _IO(x,y) ((x << 8) | y | _IOC_VOID)
34 #define _IOR(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
35 _IOC_OUT)
36 #define _IOW(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
37 _IOC_IN)
38 #define _IORW(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
39 _IOC_INOUT)
41 #define _IOW_BIG(y,t) (y | ((sizeof(t) & _IOCPARM_MASK_BIG) << 8) \
42 | _IOC_IN | _IOC_BIG)
43 #define _IOR_BIG(y,t) (y | ((sizeof(t) & _IOCPARM_MASK_BIG) << 8) \
44 | _IOC_OUT | _IOC_BIG)
45 #define _IORW_BIG(y,t) (y | ((sizeof(t) & _IOCPARM_MASK_BIG) << 8) \
46 | _IOC_INOUT | _IOC_BIG)
48 /* Decode an ioctl call. */
49 #define _MINIX_IOCTL_SIZE(i) (((i) >> 16) & _IOCPARM_MASK)
50 #define _MINIX_IOCTL_IOR(i) ((i) & _IOC_OUT)
51 #define _MINIX_IOCTL_IORW(i) ((i) & _IOC_INOUT)
52 #define _MINIX_IOCTL_IOW(i) ((i) & _IOC_IN)
54 /* Recognize and decode size of a 'big' ioctl call. */
55 #define _MINIX_IOCTL_BIG(i) ((i) & _IOC_BIG)
56 #define _MINIX_IOCTL_SIZE_BIG(i) (((i) >> 8) & _IOCPARM_MASK_BIG)
58 __BEGIN_DECLS
59 int ioctl(int _fd, int _request, void *_data);
60 __END_DECLS
62 #endif /* _M_IOCTL_H */