diff options
author | Brian Gerst <bgerst@didntduck.org> | 2006-01-09 23:52:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-10 11:01:34 -0500 |
commit | af4cd3fe4cfa75ca74f8d8622867371289043a8d (patch) | |
tree | 70dc7836a98758578628a96dc609a0c67f78dffb /include | |
parent | 7ff92053ddff48d9d7908a353bd85f893944463e (diff) |
[PATCH] Generic ioctl.h
Most arches copied the i386 ioctl.h. Combine them into a generic header.
Signed-off-by: Brian Gerst <bgerst@didntduck.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-arm/ioctl.h | 75 | ||||
-rw-r--r-- | include/asm-arm26/ioctl.h | 75 | ||||
-rw-r--r-- | include/asm-cris/ioctl.h | 84 | ||||
-rw-r--r-- | include/asm-frv/ioctl.h | 81 | ||||
-rw-r--r-- | include/asm-generic/ioctl.h | 80 | ||||
-rw-r--r-- | include/asm-h8300/ioctl.h | 81 | ||||
-rw-r--r-- | include/asm-i386/ioctl.h | 86 | ||||
-rw-r--r-- | include/asm-ia64/ioctl.h | 78 | ||||
-rw-r--r-- | include/asm-m32r/ioctl.h | 79 | ||||
-rw-r--r-- | include/asm-m68k/ioctl.h | 81 | ||||
-rw-r--r-- | include/asm-m68knommu/ioctl.h | 2 | ||||
-rw-r--r-- | include/asm-s390/ioctl.h | 89 | ||||
-rw-r--r-- | include/asm-sh/ioctl.h | 76 | ||||
-rw-r--r-- | include/asm-sh64/ioctl.h | 84 | ||||
-rw-r--r-- | include/asm-v850/ioctl.h | 81 | ||||
-rw-r--r-- | include/asm-x86_64/ioctl.h | 76 | ||||
-rw-r--r-- | include/asm-xtensa/ioctl.h | 84 |
17 files changed, 96 insertions, 1196 deletions
diff --git a/include/asm-arm/ioctl.h b/include/asm-arm/ioctl.h index 2cbb7d0e9dc6..b279fe06dfe5 100644 --- a/include/asm-arm/ioctl.h +++ b/include/asm-arm/ioctl.h | |||
@@ -1,74 +1 @@ | |||
1 | /* | #include <asm-generic/ioctl.h> | |
2 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
3 | */ | ||
4 | |||
5 | #ifndef _ASMARM_IOCTL_H | ||
6 | #define _ASMARM_IOCTL_H | ||
7 | |||
8 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
9 | * size of the parameter structure in the lower 14 bits of the | ||
10 | * upper 16 bits. | ||
11 | * Encoding the size of the parameter structure in the ioctl request | ||
12 | * is useful for catching programs compiled with old versions | ||
13 | * and to avoid overwriting user space outside the user buffer area. | ||
14 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
15 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
16 | */ | ||
17 | |||
18 | /* | ||
19 | * The following is for compatibility across the various Linux | ||
20 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
21 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
22 | * bits are indeed used as a type field, so we might just as well make | ||
23 | * this explicit here. Please be sure to use the decoding macros | ||
24 | * below from now on. | ||
25 | */ | ||
26 | #define _IOC_NRBITS 8 | ||
27 | #define _IOC_TYPEBITS 8 | ||
28 | #define _IOC_SIZEBITS 14 | ||
29 | #define _IOC_DIRBITS 2 | ||
30 | |||
31 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
32 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
33 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
34 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
35 | |||
36 | #define _IOC_NRSHIFT 0 | ||
37 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
38 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
39 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
40 | |||
41 | /* | ||
42 | * Direction bits. | ||
43 | */ | ||
44 | #define _IOC_NONE 0U | ||
45 | #define _IOC_WRITE 1U | ||
46 | #define _IOC_READ 2U | ||
47 | |||
48 | #define _IOC(dir,type,nr,size) \ | ||
49 | (((dir) << _IOC_DIRSHIFT) | \ | ||
50 | ((type) << _IOC_TYPESHIFT) | \ | ||
51 | ((nr) << _IOC_NRSHIFT) | \ | ||
52 | ((size) << _IOC_SIZESHIFT)) | ||
53 | |||
54 | /* used to create numbers */ | ||
55 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
56 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
57 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
58 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
59 | |||
60 | /* used to decode ioctl numbers.. */ | ||
61 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
62 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
63 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
64 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
65 | |||
66 | /* ...and for the drivers/sound files... */ | ||
67 | |||
68 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
69 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
70 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
71 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
72 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
73 | |||
74 | #endif /* _ASMARM_IOCTL_H */ | ||
diff --git a/include/asm-arm26/ioctl.h b/include/asm-arm26/ioctl.h index 2cbb7d0e9dc6..b279fe06dfe5 100644 --- a/include/asm-arm26/ioctl.h +++ b/include/asm-arm26/ioctl.h | |||
@@ -1,74 +1 @@ | |||
1 | /* | #include <asm-generic/ioctl.h> | |
2 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
3 | */ | ||
4 | |||
5 | #ifndef _ASMARM_IOCTL_H | ||
6 | #define _ASMARM_IOCTL_H | ||
7 | |||
8 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
9 | * size of the parameter structure in the lower 14 bits of the | ||
10 | * upper 16 bits. | ||
11 | * Encoding the size of the parameter structure in the ioctl request | ||
12 | * is useful for catching programs compiled with old versions | ||
13 | * and to avoid overwriting user space outside the user buffer area. | ||
14 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
15 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
16 | */ | ||
17 | |||
18 | /* | ||
19 | * The following is for compatibility across the various Linux | ||
20 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
21 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
22 | * bits are indeed used as a type field, so we might just as well make | ||
23 | * this explicit here. Please be sure to use the decoding macros | ||
24 | * below from now on. | ||
25 | */ | ||
26 | #define _IOC_NRBITS 8 | ||
27 | #define _IOC_TYPEBITS 8 | ||
28 | #define _IOC_SIZEBITS 14 | ||
29 | #define _IOC_DIRBITS 2 | ||
30 | |||
31 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
32 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
33 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
34 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
35 | |||
36 | #define _IOC_NRSHIFT 0 | ||
37 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
38 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
39 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
40 | |||
41 | /* | ||
42 | * Direction bits. | ||
43 | */ | ||
44 | #define _IOC_NONE 0U | ||
45 | #define _IOC_WRITE 1U | ||
46 | #define _IOC_READ 2U | ||
47 | |||
48 | #define _IOC(dir,type,nr,size) \ | ||
49 | (((dir) << _IOC_DIRSHIFT) | \ | ||
50 | ((type) << _IOC_TYPESHIFT) | \ | ||
51 | ((nr) << _IOC_NRSHIFT) | \ | ||
52 | ((size) << _IOC_SIZESHIFT)) | ||
53 | |||
54 | /* used to create numbers */ | ||
55 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
56 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
57 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
58 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
59 | |||
60 | /* used to decode ioctl numbers.. */ | ||
61 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
62 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
63 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
64 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
65 | |||
66 | /* ...and for the drivers/sound files... */ | ||
67 | |||
68 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
69 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
70 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
71 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
72 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
73 | |||
74 | #endif /* _ASMARM_IOCTL_H */ | ||
diff --git a/include/asm-cris/ioctl.h b/include/asm-cris/ioctl.h index be2d8f667a38..b279fe06dfe5 100644 --- a/include/asm-cris/ioctl.h +++ b/include/asm-cris/ioctl.h | |||
@@ -1,83 +1 @@ | |||
1 | /* | #include <asm-generic/ioctl.h> | |
2 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
3 | * | ||
4 | * This is the same as the i386 version. | ||
5 | */ | ||
6 | |||
7 | #ifndef _ASMCRIS_IOCTL_H | ||
8 | #define _ASMCRIS_IOCTL_H | ||
9 | |||
10 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
11 | * size of the parameter structure in the lower 14 bits of the | ||
12 | * upper 16 bits. | ||
13 | * Encoding the size of the parameter structure in the ioctl request | ||
14 | * is useful for catching programs compiled with old versions | ||
15 | * and to avoid overwriting user space outside the user buffer area. | ||
16 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
17 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
18 | */ | ||
19 | |||
20 | /* | ||
21 | * The following is for compatibility across the various Linux | ||
22 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
23 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
24 | * bits are indeed used as a type field, so we might just as well make | ||
25 | * this explicit here. Please be sure to use the decoding macros | ||
26 | * below from now on. | ||
27 | */ | ||
28 | #define _IOC_NRBITS 8 | ||
29 | #define _IOC_TYPEBITS 8 | ||
30 | #define _IOC_SIZEBITS 14 | ||
31 | #define _IOC_DIRBITS 2 | ||
32 | |||
33 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
34 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
35 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
36 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
37 | |||
38 | #define _IOC_NRSHIFT 0 | ||
39 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
40 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
41 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
42 | |||
43 | /* | ||
44 | * Direction bits. | ||
45 | */ | ||
46 | #define _IOC_NONE 0U | ||
47 | #define _IOC_WRITE 1U | ||
48 | #define _IOC_READ 2U | ||
49 | |||
50 | #define _IOC(dir,type,nr,size) \ | ||
51 | (((dir) << _IOC_DIRSHIFT) | \ | ||
52 | ((type) << _IOC_TYPESHIFT) | \ | ||
53 | ((nr) << _IOC_NRSHIFT) | \ | ||
54 | ((size) << _IOC_SIZESHIFT)) | ||
55 | |||
56 | /* provoke compile error for invalid uses of size argument */ | ||
57 | extern int __invalid_size_argument_for_IOC; | ||
58 | #define _IOC_TYPECHECK(t) \ | ||
59 | ((sizeof(t) == sizeof(t[1]) && \ | ||
60 | sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ | ||
61 | sizeof(t) : __invalid_size_argument_for_IOC) | ||
62 | |||
63 | /* used to create numbers */ | ||
64 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
65 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) | ||
66 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
67 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
68 | |||
69 | /* used to decode ioctl numbers.. */ | ||
70 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
71 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
72 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
73 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
74 | |||
75 | /* ...and for the drivers/sound files... */ | ||
76 | |||
77 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
78 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
79 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
80 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
81 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
82 | |||
83 | #endif /* _ASMCRIS_IOCTL_H */ | ||
diff --git a/include/asm-frv/ioctl.h b/include/asm-frv/ioctl.h index 8aee76905545..b279fe06dfe5 100644 --- a/include/asm-frv/ioctl.h +++ b/include/asm-frv/ioctl.h | |||
@@ -1,80 +1 @@ | |||
1 | /* | #include <asm-generic/ioctl.h> | |
2 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
3 | */ | ||
4 | |||
5 | #ifndef _ASM_IOCTL_H | ||
6 | #define _ASM_IOCTL_H | ||
7 | |||
8 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
9 | * size of the parameter structure in the lower 14 bits of the | ||
10 | * upper 16 bits. | ||
11 | * Encoding the size of the parameter structure in the ioctl request | ||
12 | * is useful for catching programs compiled with old versions | ||
13 | * and to avoid overwriting user space outside the user buffer area. | ||
14 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
15 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
16 | */ | ||
17 | |||
18 | /* | ||
19 | * I don't really have any idea about what this should look like, so | ||
20 | * for the time being, this is heavily based on the PC definitions. | ||
21 | */ | ||
22 | |||
23 | /* | ||
24 | * The following is for compatibility across the various Linux | ||
25 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
26 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
27 | * bits are indeed used as a type field, so we might just as well make | ||
28 | * this explicit here. Please be sure to use the decoding macros | ||
29 | * below from now on. | ||
30 | */ | ||
31 | #define _IOC_NRBITS 8 | ||
32 | #define _IOC_TYPEBITS 8 | ||
33 | #define _IOC_SIZEBITS 14 | ||
34 | #define _IOC_DIRBITS 2 | ||
35 | |||
36 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
37 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
38 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
39 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
40 | |||
41 | #define _IOC_NRSHIFT 0 | ||
42 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
43 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
44 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
45 | |||
46 | /* | ||
47 | * Direction bits. | ||
48 | */ | ||
49 | #define _IOC_NONE 0U | ||
50 | #define _IOC_WRITE 1U | ||
51 | #define _IOC_READ 2U | ||
52 | |||
53 | #define _IOC(dir,type,nr,size) \ | ||
54 | (((dir) << _IOC_DIRSHIFT) | \ | ||
55 | ((type) << _IOC_TYPESHIFT) | \ | ||
56 | ((nr) << _IOC_NRSHIFT) | \ | ||
57 | ((size) << _IOC_SIZESHIFT)) | ||
58 | |||
59 | /* used to create numbers */ | ||
60 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
61 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
62 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
63 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
64 | |||
65 | /* used to decode ioctl numbers.. */ | ||
66 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
67 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
68 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
69 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
70 | |||
71 | /* ...and for the drivers/sound files... */ | ||
72 | |||
73 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
74 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
75 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
76 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
77 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
78 | |||
79 | #endif /* _ASM_IOCTL_H */ | ||
80 | |||
diff --git a/include/asm-generic/ioctl.h b/include/asm-generic/ioctl.h new file mode 100644 index 000000000000..cd027298beb1 --- /dev/null +++ b/include/asm-generic/ioctl.h | |||
@@ -0,0 +1,80 @@ | |||
1 | #ifndef _ASM_GENERIC_IOCTL_H | ||
2 | #define _ASM_GENERIC_IOCTL_H | ||
3 | |||
4 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
5 | * size of the parameter structure in the lower 14 bits of the | ||
6 | * upper 16 bits. | ||
7 | * Encoding the size of the parameter structure in the ioctl request | ||
8 | * is useful for catching programs compiled with old versions | ||
9 | * and to avoid overwriting user space outside the user buffer area. | ||
10 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
11 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
12 | */ | ||
13 | |||
14 | /* | ||
15 | * The following is for compatibility across the various Linux | ||
16 | * platforms. The generic ioctl numbering scheme doesn't really enforce | ||
17 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
18 | * bits are indeed used as a type field, so we might just as well make | ||
19 | * this explicit here. Please be sure to use the decoding macros | ||
20 | * below from now on. | ||
21 | */ | ||
22 | #define _IOC_NRBITS 8 | ||
23 | #define _IOC_TYPEBITS 8 | ||
24 | #define _IOC_SIZEBITS 14 | ||
25 | #define _IOC_DIRBITS 2 | ||
26 | |||
27 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
28 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
29 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
30 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
31 | |||
32 | #define _IOC_NRSHIFT 0 | ||
33 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
34 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
35 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
36 | |||
37 | /* | ||
38 | * Direction bits. | ||
39 | */ | ||
40 | #define _IOC_NONE 0U | ||
41 | #define _IOC_WRITE 1U | ||
42 | #define _IOC_READ 2U | ||
43 | |||
44 | #define _IOC(dir,type,nr,size) \ | ||
45 | (((dir) << _IOC_DIRSHIFT) | \ | ||
46 | ((type) << _IOC_TYPESHIFT) | \ | ||
47 | ((nr) << _IOC_NRSHIFT) | \ | ||
48 | ((size) << _IOC_SIZESHIFT)) | ||
49 | |||
50 | /* provoke compile error for invalid uses of size argument */ | ||
51 | extern unsigned int __invalid_size_argument_for_IOC; | ||
52 | #define _IOC_TYPECHECK(t) \ | ||
53 | ((sizeof(t) == sizeof(t[1]) && \ | ||
54 | sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ | ||
55 | sizeof(t) : __invalid_size_argument_for_IOC) | ||
56 | |||
57 | /* used to create numbers */ | ||
58 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
59 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) | ||
60 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
61 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
62 | #define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
63 | #define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
64 | #define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
65 | |||
66 | /* used to decode ioctl numbers.. */ | ||
67 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
68 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
69 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
70 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
71 | |||
72 | /* ...and for the drivers/sound files... */ | ||
73 | |||
74 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
75 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
76 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
77 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
78 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
79 | |||
80 | #endif /* _ASM_GENERIC_IOCTL_H */ | ||
diff --git a/include/asm-h8300/ioctl.h b/include/asm-h8300/ioctl.h index 031c623478b3..b279fe06dfe5 100644 --- a/include/asm-h8300/ioctl.h +++ b/include/asm-h8300/ioctl.h | |||
@@ -1,80 +1 @@ | |||
1 | /* $Id: ioctl.h,v 1.1 2002/11/19 02:09:26 gerg Exp $ | #include <asm-generic/ioctl.h> | |
2 | * | ||
3 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
4 | */ | ||
5 | |||
6 | #ifndef _H8300_IOCTL_H | ||
7 | #define _H8300_IOCTL_H | ||
8 | |||
9 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
10 | * size of the parameter structure in the lower 14 bits of the | ||
11 | * upper 16 bits. | ||
12 | * Encoding the size of the parameter structure in the ioctl request | ||
13 | * is useful for catching programs compiled with old versions | ||
14 | * and to avoid overwriting user space outside the user buffer area. | ||
15 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
16 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
17 | */ | ||
18 | |||
19 | /* | ||
20 | * I don't really have any idea about what this should look like, so | ||
21 | * for the time being, this is heavily based on the PC definitions. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * The following is for compatibility across the various Linux | ||
26 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
27 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
28 | * bits are indeed used as a type field, so we might just as well make | ||
29 | * this explicit here. Please be sure to use the decoding macros | ||
30 | * below from now on. | ||
31 | */ | ||
32 | #define _IOC_NRBITS 8 | ||
33 | #define _IOC_TYPEBITS 8 | ||
34 | #define _IOC_SIZEBITS 14 | ||
35 | #define _IOC_DIRBITS 2 | ||
36 | |||
37 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
38 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
39 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
40 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
41 | |||
42 | #define _IOC_NRSHIFT 0 | ||
43 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
44 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
45 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
46 | |||
47 | /* | ||
48 | * Direction bits. | ||
49 | */ | ||
50 | #define _IOC_NONE 0U | ||
51 | #define _IOC_WRITE 1U | ||
52 | #define _IOC_READ 2U | ||
53 | |||
54 | #define _IOC(dir,type,nr,size) \ | ||
55 | (((dir) << _IOC_DIRSHIFT) | \ | ||
56 | ((type) << _IOC_TYPESHIFT) | \ | ||
57 | ((nr) << _IOC_NRSHIFT) | \ | ||
58 | ((size) << _IOC_SIZESHIFT)) | ||
59 | |||
60 | /* used to create numbers */ | ||
61 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
62 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
63 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
64 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
65 | |||
66 | /* used to decode ioctl numbers.. */ | ||
67 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
68 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
69 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
70 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
71 | |||
72 | /* ...and for the drivers/sound files... */ | ||
73 | |||
74 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
75 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
76 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
77 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
78 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
79 | |||
80 | #endif /* _H8300_IOCTL_H */ | ||
diff --git a/include/asm-i386/ioctl.h b/include/asm-i386/ioctl.h index 543f7843d553..b279fe06dfe5 100644 --- a/include/asm-i386/ioctl.h +++ b/include/asm-i386/ioctl.h | |||
@@ -1,85 +1 @@ | |||
1 | /* $Id: ioctl.h,v 1.5 1993/07/19 21:53:50 root Exp root $ | #include <asm-generic/ioctl.h> | |
2 | * | ||
3 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
4 | */ | ||
5 | |||
6 | #ifndef _ASMI386_IOCTL_H | ||
7 | #define _ASMI386_IOCTL_H | ||
8 | |||
9 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
10 | * size of the parameter structure in the lower 14 bits of the | ||
11 | * upper 16 bits. | ||
12 | * Encoding the size of the parameter structure in the ioctl request | ||
13 | * is useful for catching programs compiled with old versions | ||
14 | * and to avoid overwriting user space outside the user buffer area. | ||
15 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
16 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
17 | */ | ||
18 | |||
19 | /* | ||
20 | * The following is for compatibility across the various Linux | ||
21 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
22 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
23 | * bits are indeed used as a type field, so we might just as well make | ||
24 | * this explicit here. Please be sure to use the decoding macros | ||
25 | * below from now on. | ||
26 | */ | ||
27 | #define _IOC_NRBITS 8 | ||
28 | #define _IOC_TYPEBITS 8 | ||
29 | #define _IOC_SIZEBITS 14 | ||
30 | #define _IOC_DIRBITS 2 | ||
31 | |||
32 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
33 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
34 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
35 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
36 | |||
37 | #define _IOC_NRSHIFT 0 | ||
38 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
39 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
40 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
41 | |||
42 | /* | ||
43 | * Direction bits. | ||
44 | */ | ||
45 | #define _IOC_NONE 0U | ||
46 | #define _IOC_WRITE 1U | ||
47 | #define _IOC_READ 2U | ||
48 | |||
49 | #define _IOC(dir,type,nr,size) \ | ||
50 | (((dir) << _IOC_DIRSHIFT) | \ | ||
51 | ((type) << _IOC_TYPESHIFT) | \ | ||
52 | ((nr) << _IOC_NRSHIFT) | \ | ||
53 | ((size) << _IOC_SIZESHIFT)) | ||
54 | |||
55 | /* provoke compile error for invalid uses of size argument */ | ||
56 | extern unsigned int __invalid_size_argument_for_IOC; | ||
57 | #define _IOC_TYPECHECK(t) \ | ||
58 | ((sizeof(t) == sizeof(t[1]) && \ | ||
59 | sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ | ||
60 | sizeof(t) : __invalid_size_argument_for_IOC) | ||
61 | |||
62 | /* used to create numbers */ | ||
63 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
64 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) | ||
65 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
66 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
67 | #define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
68 | #define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
69 | #define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
70 | |||
71 | /* used to decode ioctl numbers.. */ | ||
72 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
73 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
74 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
75 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
76 | |||
77 | /* ...and for the drivers/sound files... */ | ||
78 | |||
79 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
80 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
81 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
82 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
83 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
84 | |||
85 | #endif /* _ASMI386_IOCTL_H */ | ||
diff --git a/include/asm-ia64/ioctl.h b/include/asm-ia64/ioctl.h index be9cc2403d2a..b279fe06dfe5 100644 --- a/include/asm-ia64/ioctl.h +++ b/include/asm-ia64/ioctl.h | |||
@@ -1,77 +1 @@ | |||
1 | #ifndef _ASM_IA64_IOCTL_H | #include <asm-generic/ioctl.h> | |
2 | #define _ASM_IA64_IOCTL_H | ||
3 | |||
4 | /* | ||
5 | * Based on <asm-i386/ioctl.h>. | ||
6 | * | ||
7 | * Modified 1998, 1999 | ||
8 | * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co | ||
9 | */ | ||
10 | |||
11 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
12 | * size of the parameter structure in the lower 14 bits of the | ||
13 | * upper 16 bits. | ||
14 | * Encoding the size of the parameter structure in the ioctl request | ||
15 | * is useful for catching programs compiled with old versions | ||
16 | * and to avoid overwriting user space outside the user buffer area. | ||
17 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
18 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | * The following is for compatibility across the various Linux | ||
23 | * platforms. The ia64 ioctl numbering scheme doesn't really enforce | ||
24 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
25 | * bits are indeed used as a type field, so we might just as well make | ||
26 | * this explicit here. Please be sure to use the decoding macros | ||
27 | * below from now on. | ||
28 | */ | ||
29 | #define _IOC_NRBITS 8 | ||
30 | #define _IOC_TYPEBITS 8 | ||
31 | #define _IOC_SIZEBITS 14 | ||
32 | #define _IOC_DIRBITS 2 | ||
33 | |||
34 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
35 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
36 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
37 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
38 | |||
39 | #define _IOC_NRSHIFT 0 | ||
40 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
41 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
42 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
43 | |||
44 | /* | ||
45 | * Direction bits. | ||
46 | */ | ||
47 | #define _IOC_NONE 0U | ||
48 | #define _IOC_WRITE 1U | ||
49 | #define _IOC_READ 2U | ||
50 | |||
51 | #define _IOC(dir,type,nr,size) \ | ||
52 | (((dir) << _IOC_DIRSHIFT) | \ | ||
53 | ((type) << _IOC_TYPESHIFT) | \ | ||
54 | ((nr) << _IOC_NRSHIFT) | \ | ||
55 | ((size) << _IOC_SIZESHIFT)) | ||
56 | |||
57 | /* used to create numbers */ | ||
58 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
59 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
60 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
61 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
62 | |||
63 | /* used to decode ioctl numbers.. */ | ||
64 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
65 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
66 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
67 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
68 | |||
69 | /* ...and for the drivers/sound files... */ | ||
70 | |||
71 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
72 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
73 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
74 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
75 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
76 | |||
77 | #endif /* _ASM_IA64_IOCTL_H */ | ||
diff --git a/include/asm-m32r/ioctl.h b/include/asm-m32r/ioctl.h index 87d8f7db6af1..b279fe06dfe5 100644 --- a/include/asm-m32r/ioctl.h +++ b/include/asm-m32r/ioctl.h | |||
@@ -1,78 +1 @@ | |||
1 | #ifndef _ASM_M32R_IOCTL_H | #include <asm-generic/ioctl.h> | |
2 | #define _ASM_M32R_IOCTL_H | ||
3 | |||
4 | /* $Id$ */ | ||
5 | |||
6 | /* orig : i386 2.4.18 */ | ||
7 | |||
8 | /* | ||
9 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
10 | */ | ||
11 | |||
12 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
13 | * size of the parameter structure in the lower 14 bits of the | ||
14 | * upper 16 bits. | ||
15 | * Encoding the size of the parameter structure in the ioctl request | ||
16 | * is useful for catching programs compiled with old versions | ||
17 | * and to avoid overwriting user space outside the user buffer area. | ||
18 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
19 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
20 | */ | ||
21 | |||
22 | /* | ||
23 | * The following is for compatibility across the various Linux | ||
24 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
25 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
26 | * bits are indeed used as a type field, so we might just as well make | ||
27 | * this explicit here. Please be sure to use the decoding macros | ||
28 | * below from now on. | ||
29 | */ | ||
30 | #define _IOC_NRBITS 8 | ||
31 | #define _IOC_TYPEBITS 8 | ||
32 | #define _IOC_SIZEBITS 14 | ||
33 | #define _IOC_DIRBITS 2 | ||
34 | |||
35 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
36 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
37 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
38 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
39 | |||
40 | #define _IOC_NRSHIFT 0 | ||
41 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
42 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
43 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
44 | |||
45 | /* | ||
46 | * Direction bits. | ||
47 | */ | ||
48 | #define _IOC_NONE 0U | ||
49 | #define _IOC_WRITE 1U | ||
50 | #define _IOC_READ 2U | ||
51 | |||
52 | #define _IOC(dir,type,nr,size) \ | ||
53 | (((dir) << _IOC_DIRSHIFT) | \ | ||
54 | ((type) << _IOC_TYPESHIFT) | \ | ||
55 | ((nr) << _IOC_NRSHIFT) | \ | ||
56 | ((size) << _IOC_SIZESHIFT)) | ||
57 | |||
58 | /* used to create numbers */ | ||
59 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
60 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
61 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
62 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
63 | |||
64 | /* used to decode ioctl numbers.. */ | ||
65 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
66 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
67 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
68 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
69 | |||
70 | /* ...and for the drivers/sound files... */ | ||
71 | |||
72 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
73 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
74 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
75 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
76 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
77 | |||
78 | #endif /* _ASM_M32R_IOCTL_H */ | ||
diff --git a/include/asm-m68k/ioctl.h b/include/asm-m68k/ioctl.h index fd68914ab292..b279fe06dfe5 100644 --- a/include/asm-m68k/ioctl.h +++ b/include/asm-m68k/ioctl.h | |||
@@ -1,80 +1 @@ | |||
1 | /* $Id: ioctl.h,v 1.3 1997/04/16 15:10:07 jes Exp $ | #include <asm-generic/ioctl.h> | |
2 | * | ||
3 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
4 | */ | ||
5 | |||
6 | #ifndef _M68K_IOCTL_H | ||
7 | #define _M68K_IOCTL_H | ||
8 | |||
9 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
10 | * size of the parameter structure in the lower 14 bits of the | ||
11 | * upper 16 bits. | ||
12 | * Encoding the size of the parameter structure in the ioctl request | ||
13 | * is useful for catching programs compiled with old versions | ||
14 | * and to avoid overwriting user space outside the user buffer area. | ||
15 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
16 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
17 | */ | ||
18 | |||
19 | /* | ||
20 | * I don't really have any idea about what this should look like, so | ||
21 | * for the time being, this is heavily based on the PC definitions. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * The following is for compatibility across the various Linux | ||
26 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
27 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
28 | * bits are indeed used as a type field, so we might just as well make | ||
29 | * this explicit here. Please be sure to use the decoding macros | ||
30 | * below from now on. | ||
31 | */ | ||
32 | #define _IOC_NRBITS 8 | ||
33 | #define _IOC_TYPEBITS 8 | ||
34 | #define _IOC_SIZEBITS 14 | ||
35 | #define _IOC_DIRBITS 2 | ||
36 | |||
37 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
38 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
39 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
40 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
41 | |||
42 | #define _IOC_NRSHIFT 0 | ||
43 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
44 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
45 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
46 | |||
47 | /* | ||
48 | * Direction bits. | ||
49 | */ | ||
50 | #define _IOC_NONE 0U | ||
51 | #define _IOC_WRITE 1U | ||
52 | #define _IOC_READ 2U | ||
53 | |||
54 | #define _IOC(dir,type,nr,size) \ | ||
55 | (((dir) << _IOC_DIRSHIFT) | \ | ||
56 | ((type) << _IOC_TYPESHIFT) | \ | ||
57 | ((nr) << _IOC_NRSHIFT) | \ | ||
58 | ((size) << _IOC_SIZESHIFT)) | ||
59 | |||
60 | /* used to create numbers */ | ||
61 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
62 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
63 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
64 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
65 | |||
66 | /* used to decode ioctl numbers.. */ | ||
67 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
68 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
69 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
70 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
71 | |||
72 | /* ...and for the drivers/sound files... */ | ||
73 | |||
74 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
75 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
76 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
77 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
78 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
79 | |||
80 | #endif /* _M68K_IOCTL_H */ | ||
diff --git a/include/asm-m68knommu/ioctl.h b/include/asm-m68knommu/ioctl.h index cff72f33350f..b279fe06dfe5 100644 --- a/include/asm-m68knommu/ioctl.h +++ b/include/asm-m68knommu/ioctl.h | |||
@@ -1 +1 @@ | |||
#include <asm-m68k/ioctl.h> | #include <asm-generic/ioctl.h> | ||
diff --git a/include/asm-s390/ioctl.h b/include/asm-s390/ioctl.h index df7394345ac4..b279fe06dfe5 100644 --- a/include/asm-s390/ioctl.h +++ b/include/asm-s390/ioctl.h | |||
@@ -1,88 +1 @@ | |||
1 | /* | #include <asm-generic/ioctl.h> | |
2 | * include/asm-s390/ioctl.h | ||
3 | * | ||
4 | * S390 version | ||
5 | * | ||
6 | * Derived from "include/asm-i386/ioctl.h" | ||
7 | */ | ||
8 | |||
9 | #ifndef _S390_IOCTL_H | ||
10 | #define _S390_IOCTL_H | ||
11 | |||
12 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
13 | * size of the parameter structure in the lower 14 bits of the | ||
14 | * upper 16 bits. | ||
15 | * Encoding the size of the parameter structure in the ioctl request | ||
16 | * is useful for catching programs compiled with old versions | ||
17 | * and to avoid overwriting user space outside the user buffer area. | ||
18 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
19 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
20 | */ | ||
21 | |||
22 | /* | ||
23 | * The following is for compatibility across the various Linux | ||
24 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
25 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
26 | * bits are indeed used as a type field, so we might just as well make | ||
27 | * this explicit here. Please be sure to use the decoding macros | ||
28 | * below from now on. | ||
29 | */ | ||
30 | #define _IOC_NRBITS 8 | ||
31 | #define _IOC_TYPEBITS 8 | ||
32 | #define _IOC_SIZEBITS 14 | ||
33 | #define _IOC_DIRBITS 2 | ||
34 | |||
35 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
36 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
37 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
38 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
39 | |||
40 | #define _IOC_NRSHIFT 0 | ||
41 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
42 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
43 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
44 | |||
45 | /* | ||
46 | * Direction bits. | ||
47 | */ | ||
48 | #define _IOC_NONE 0U | ||
49 | #define _IOC_WRITE 1U | ||
50 | #define _IOC_READ 2U | ||
51 | |||
52 | #define _IOC(dir,type,nr,size) \ | ||
53 | (((dir) << _IOC_DIRSHIFT) | \ | ||
54 | ((type) << _IOC_TYPESHIFT) | \ | ||
55 | ((nr) << _IOC_NRSHIFT) | \ | ||
56 | ((size) << _IOC_SIZESHIFT)) | ||
57 | |||
58 | /* provoke compile error for invalid uses of size argument */ | ||
59 | extern unsigned long __invalid_size_argument_for_IOC; | ||
60 | #define _IOC_TYPECHECK(t) \ | ||
61 | ((sizeof(t) == sizeof(t[1]) && \ | ||
62 | sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ | ||
63 | sizeof(t) : __invalid_size_argument_for_IOC) | ||
64 | |||
65 | /* used to create numbers */ | ||
66 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
67 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) | ||
68 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
69 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
70 | #define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
71 | #define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
72 | #define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
73 | |||
74 | /* used to decode ioctl numbers.. */ | ||
75 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
76 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
77 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
78 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
79 | |||
80 | /* ...and for the drivers/sound files... */ | ||
81 | |||
82 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
83 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
84 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
85 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
86 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
87 | |||
88 | #endif /* _S390_IOCTL_H */ | ||
diff --git a/include/asm-sh/ioctl.h b/include/asm-sh/ioctl.h index 524700e84acd..b279fe06dfe5 100644 --- a/include/asm-sh/ioctl.h +++ b/include/asm-sh/ioctl.h | |||
@@ -1,75 +1 @@ | |||
1 | /* $Id: ioctl.h,v 1.1.1.1 2001/10/15 20:45:09 mrbrown Exp $ | #include <asm-generic/ioctl.h> | |
2 | * | ||
3 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
4 | */ | ||
5 | |||
6 | #ifndef __ASM_SH_IOCTL_H | ||
7 | #define __ASM_SH_IOCTL_H | ||
8 | |||
9 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
10 | * size of the parameter structure in the lower 14 bits of the | ||
11 | * upper 16 bits. | ||
12 | * Encoding the size of the parameter structure in the ioctl request | ||
13 | * is useful for catching programs compiled with old versions | ||
14 | * and to avoid overwriting user space outside the user buffer area. | ||
15 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
16 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
17 | */ | ||
18 | |||
19 | /* | ||
20 | * The following is for compatibility across the various Linux | ||
21 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
22 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
23 | * bits are indeed used as a type field, so we might just as well make | ||
24 | * this explicit here. Please be sure to use the decoding macros | ||
25 | * below from now on. | ||
26 | */ | ||
27 | #define _IOC_NRBITS 8 | ||
28 | #define _IOC_TYPEBITS 8 | ||
29 | #define _IOC_SIZEBITS 14 | ||
30 | #define _IOC_DIRBITS 2 | ||
31 | |||
32 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
33 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
34 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
35 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
36 | |||
37 | #define _IOC_NRSHIFT 0 | ||
38 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
39 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
40 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
41 | |||
42 | /* | ||
43 | * Direction bits. | ||
44 | */ | ||
45 | #define _IOC_NONE 0U | ||
46 | #define _IOC_WRITE 1U | ||
47 | #define _IOC_READ 2U | ||
48 | |||
49 | #define _IOC(dir,type,nr,size) \ | ||
50 | (((dir) << _IOC_DIRSHIFT) | \ | ||
51 | ((type) << _IOC_TYPESHIFT) | \ | ||
52 | ((nr) << _IOC_NRSHIFT) | \ | ||
53 | ((size) << _IOC_SIZESHIFT)) | ||
54 | |||
55 | /* used to create numbers */ | ||
56 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
57 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
58 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
59 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
60 | |||
61 | /* used to decode ioctl numbers.. */ | ||
62 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
63 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
64 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
65 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
66 | |||
67 | /* ...and for the drivers/sound files... */ | ||
68 | |||
69 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
70 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
71 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
72 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
73 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
74 | |||
75 | #endif /* __ASM_SH_IOCTL_H */ | ||
diff --git a/include/asm-sh64/ioctl.h b/include/asm-sh64/ioctl.h index c089a6fb78e0..b279fe06dfe5 100644 --- a/include/asm-sh64/ioctl.h +++ b/include/asm-sh64/ioctl.h | |||
@@ -1,83 +1 @@ | |||
1 | #ifndef __ASM_SH64_IOCTL_H | #include <asm-generic/ioctl.h> | |
2 | #define __ASM_SH64_IOCTL_H | ||
3 | |||
4 | /* | ||
5 | * This file is subject to the terms and conditions of the GNU General Public | ||
6 | * License. See the file "COPYING" in the main directory of this archive | ||
7 | * for more details. | ||
8 | * | ||
9 | * include/asm-sh64/ioctl.h | ||
10 | * | ||
11 | * Copyright (C) 2000, 2001 Paolo Alberelli | ||
12 | * | ||
13 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
18 | * size of the parameter structure in the lower 14 bits of the | ||
19 | * upper 16 bits. | ||
20 | * Encoding the size of the parameter structure in the ioctl request | ||
21 | * is useful for catching programs compiled with old versions | ||
22 | * and to avoid overwriting user space outside the user buffer area. | ||
23 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
24 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
25 | */ | ||
26 | |||
27 | /* | ||
28 | * The following is for compatibility across the various Linux | ||
29 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
30 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
31 | * bits are indeed used as a type field, so we might just as well make | ||
32 | * this explicit here. Please be sure to use the decoding macros | ||
33 | * below from now on. | ||
34 | */ | ||
35 | #define _IOC_NRBITS 8 | ||
36 | #define _IOC_TYPEBITS 8 | ||
37 | #define _IOC_SIZEBITS 14 | ||
38 | #define _IOC_DIRBITS 2 | ||
39 | |||
40 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
41 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
42 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
43 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
44 | |||
45 | #define _IOC_NRSHIFT 0 | ||
46 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
47 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
48 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
49 | |||
50 | /* | ||
51 | * Direction bits. | ||
52 | */ | ||
53 | #define _IOC_NONE 0U | ||
54 | #define _IOC_WRITE 1U | ||
55 | #define _IOC_READ 2U | ||
56 | |||
57 | #define _IOC(dir,type,nr,size) \ | ||
58 | (((dir) << _IOC_DIRSHIFT) | \ | ||
59 | ((type) << _IOC_TYPESHIFT) | \ | ||
60 | ((nr) << _IOC_NRSHIFT) | \ | ||
61 | ((size) << _IOC_SIZESHIFT)) | ||
62 | |||
63 | /* used to create numbers */ | ||
64 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
65 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
66 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
67 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
68 | |||
69 | /* used to decode ioctl numbers.. */ | ||
70 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
71 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
72 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
73 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
74 | |||
75 | /* ...and for the drivers/sound files... */ | ||
76 | |||
77 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
78 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
79 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
80 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
81 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
82 | |||
83 | #endif /* __ASM_SH64_IOCTL_H */ | ||
diff --git a/include/asm-v850/ioctl.h b/include/asm-v850/ioctl.h index 1765df6c7b87..b279fe06dfe5 100644 --- a/include/asm-v850/ioctl.h +++ b/include/asm-v850/ioctl.h | |||
@@ -1,80 +1 @@ | |||
1 | /* $Id: ioctl.h,v 1.1 2002/09/28 14:58:41 gerg Exp $ | #include <asm-generic/ioctl.h> | |
2 | * | ||
3 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
4 | */ | ||
5 | |||
6 | #ifndef _V850_IOCTL_H | ||
7 | #define _V850_IOCTL_H | ||
8 | |||
9 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
10 | * size of the parameter structure in the lower 14 bits of the | ||
11 | * upper 16 bits. | ||
12 | * Encoding the size of the parameter structure in the ioctl request | ||
13 | * is useful for catching programs compiled with old versions | ||
14 | * and to avoid overwriting user space outside the user buffer area. | ||
15 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
16 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
17 | */ | ||
18 | |||
19 | /* | ||
20 | * I don't really have any idea about what this should look like, so | ||
21 | * for the time being, this is heavily based on the PC definitions. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * The following is for compatibility across the various Linux | ||
26 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
27 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
28 | * bits are indeed used as a type field, so we might just as well make | ||
29 | * this explicit here. Please be sure to use the decoding macros | ||
30 | * below from now on. | ||
31 | */ | ||
32 | #define _IOC_NRBITS 8 | ||
33 | #define _IOC_TYPEBITS 8 | ||
34 | #define _IOC_SIZEBITS 14 | ||
35 | #define _IOC_DIRBITS 2 | ||
36 | |||
37 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
38 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
39 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
40 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
41 | |||
42 | #define _IOC_NRSHIFT 0 | ||
43 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
44 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
45 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
46 | |||
47 | /* | ||
48 | * Direction bits. | ||
49 | */ | ||
50 | #define _IOC_NONE 0U | ||
51 | #define _IOC_WRITE 1U | ||
52 | #define _IOC_READ 2U | ||
53 | |||
54 | #define _IOC(dir,type,nr,size) \ | ||
55 | (((dir) << _IOC_DIRSHIFT) | \ | ||
56 | ((type) << _IOC_TYPESHIFT) | \ | ||
57 | ((nr) << _IOC_NRSHIFT) | \ | ||
58 | ((size) << _IOC_SIZESHIFT)) | ||
59 | |||
60 | /* used to create numbers */ | ||
61 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
62 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
63 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
64 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
65 | |||
66 | /* used to decode ioctl numbers.. */ | ||
67 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
68 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
69 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
70 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
71 | |||
72 | /* ...and for the drivers/sound files... */ | ||
73 | |||
74 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
75 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
76 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
77 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
78 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
79 | |||
80 | #endif /* __V850_IOCTL_H__ */ | ||
diff --git a/include/asm-x86_64/ioctl.h b/include/asm-x86_64/ioctl.h index 609b663b6bf4..b279fe06dfe5 100644 --- a/include/asm-x86_64/ioctl.h +++ b/include/asm-x86_64/ioctl.h | |||
@@ -1,75 +1 @@ | |||
1 | /* $Id: ioctl.h,v 1.2 2001/07/04 09:08:13 ak Exp $ | #include <asm-generic/ioctl.h> | |
2 | * | ||
3 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
4 | */ | ||
5 | |||
6 | #ifndef _ASMX8664_IOCTL_H | ||
7 | #define _ASMX8664_IOCTL_H | ||
8 | |||
9 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
10 | * size of the parameter structure in the lower 14 bits of the | ||
11 | * upper 16 bits. | ||
12 | * Encoding the size of the parameter structure in the ioctl request | ||
13 | * is useful for catching programs compiled with old versions | ||
14 | * and to avoid overwriting user space outside the user buffer area. | ||
15 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
16 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
17 | */ | ||
18 | |||
19 | /* | ||
20 | * The following is for compatibility across the various Linux | ||
21 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
22 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
23 | * bits are indeed used as a type field, so we might just as well make | ||
24 | * this explicit here. Please be sure to use the decoding macros | ||
25 | * below from now on. | ||
26 | */ | ||
27 | #define _IOC_NRBITS 8 | ||
28 | #define _IOC_TYPEBITS 8 | ||
29 | #define _IOC_SIZEBITS 14 | ||
30 | #define _IOC_DIRBITS 2 | ||
31 | |||
32 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
33 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
34 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
35 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
36 | |||
37 | #define _IOC_NRSHIFT 0 | ||
38 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
39 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
40 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
41 | |||
42 | /* | ||
43 | * Direction bits. | ||
44 | */ | ||
45 | #define _IOC_NONE 0U | ||
46 | #define _IOC_WRITE 1U | ||
47 | #define _IOC_READ 2U | ||
48 | |||
49 | #define _IOC(dir,type,nr,size) \ | ||
50 | (((dir) << _IOC_DIRSHIFT) | \ | ||
51 | ((type) << _IOC_TYPESHIFT) | \ | ||
52 | ((nr) << _IOC_NRSHIFT) | \ | ||
53 | ((size) << _IOC_SIZESHIFT)) | ||
54 | |||
55 | /* used to create numbers */ | ||
56 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
57 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
58 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
59 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
60 | |||
61 | /* used to decode ioctl numbers.. */ | ||
62 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
63 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
64 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
65 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
66 | |||
67 | /* ...and for the drivers/sound files... */ | ||
68 | |||
69 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
70 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
71 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
72 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
73 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
74 | |||
75 | #endif /* _ASMX8664_IOCTL_H */ | ||
diff --git a/include/asm-xtensa/ioctl.h b/include/asm-xtensa/ioctl.h index 856c605d62b1..b279fe06dfe5 100644 --- a/include/asm-xtensa/ioctl.h +++ b/include/asm-xtensa/ioctl.h | |||
@@ -1,83 +1 @@ | |||
1 | /* | #include <asm-generic/ioctl.h> | |
2 | * include/asm-xtensa/ioctl.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2003 - 2005 Tensilica Inc. | ||
9 | * | ||
10 | * Derived from "include/asm-i386/ioctl.h" | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_IOCTL_H | ||
14 | #define _XTENSA_IOCTL_H | ||
15 | |||
16 | |||
17 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
18 | * size of the parameter structure in the lower 14 bits of the | ||
19 | * upper 16 bits. | ||
20 | * Encoding the size of the parameter structure in the ioctl request | ||
21 | * is useful for catching programs compiled with old versions | ||
22 | * and to avoid overwriting user space outside the user buffer area. | ||
23 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
24 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
25 | */ | ||
26 | |||
27 | /* | ||
28 | * The following is for compatibility across the various Linux | ||
29 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
30 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
31 | * bits are indeed used as a type field, so we might just as well make | ||
32 | * this explicit here. Please be sure to use the decoding macros | ||
33 | * below from now on. | ||
34 | */ | ||
35 | #define _IOC_NRBITS 8 | ||
36 | #define _IOC_TYPEBITS 8 | ||
37 | #define _IOC_SIZEBITS 14 | ||
38 | #define _IOC_DIRBITS 2 | ||
39 | |||
40 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
41 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
42 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
43 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
44 | |||
45 | #define _IOC_NRSHIFT 0 | ||
46 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
47 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
48 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
49 | |||
50 | /* | ||
51 | * Direction bits. | ||
52 | */ | ||
53 | #define _IOC_NONE 0U | ||
54 | #define _IOC_WRITE 1U | ||
55 | #define _IOC_READ 2U | ||
56 | |||
57 | #define _IOC(dir,type,nr,size) \ | ||
58 | (((dir) << _IOC_DIRSHIFT) | \ | ||
59 | ((type) << _IOC_TYPESHIFT) | \ | ||
60 | ((nr) << _IOC_NRSHIFT) | \ | ||
61 | ((size) << _IOC_SIZESHIFT)) | ||
62 | |||
63 | /* used to create numbers */ | ||
64 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
65 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
66 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
67 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
68 | |||
69 | /* used to decode ioctl numbers.. */ | ||
70 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
71 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
72 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
73 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
74 | |||
75 | /* ...and for the drivers/sound files... */ | ||
76 | |||
77 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
78 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
79 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
80 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
81 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
82 | |||
83 | #endif | ||