aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert P. J. Day <rpjday@crashcourse.ca>2008-04-29 04:02:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:06:24 -0400
commit10521bd9f74be94b83cfcf639601ece1c8e4faad (patch)
tree5e121dbaae4d5e038c0c1ea638c9635970dd5afa
parent098ef1c0ea7b1b3ff9d89364af5ebc5b672cf932 (diff)
generalize asm-generic/ioctl.h to allow overriding values
In the spirit of a number of other asm-generic header files, generalize asm-generic/ioctl.h to allow arch-specific ioctl.h headers to simply override _IOC_SIZEBITS and/or _IOC_DIRBITS before including this header file, allowing a number of ioctl.h header files to be shortened considerably. Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/asm-generic/ioctl.h33
1 files changed, 27 insertions, 6 deletions
diff --git a/include/asm-generic/ioctl.h b/include/asm-generic/ioctl.h
index cd027298beb1..864181385579 100644
--- a/include/asm-generic/ioctl.h
+++ b/include/asm-generic/ioctl.h
@@ -21,8 +21,19 @@
21 */ 21 */
22#define _IOC_NRBITS 8 22#define _IOC_NRBITS 8
23#define _IOC_TYPEBITS 8 23#define _IOC_TYPEBITS 8
24#define _IOC_SIZEBITS 14 24
25#define _IOC_DIRBITS 2 25/*
26 * Let any architecture override either of the following before
27 * including this file.
28 */
29
30#ifndef _IOC_SIZEBITS
31# define _IOC_SIZEBITS 14
32#endif
33
34#ifndef _IOC_DIRBITS
35# define _IOC_DIRBITS 2
36#endif
26 37
27#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) 38#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
28#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) 39#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
@@ -35,11 +46,21 @@
35#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) 46#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
36 47
37/* 48/*
38 * Direction bits. 49 * Direction bits, which any architecture can choose to override
50 * before including this file.
39 */ 51 */
40#define _IOC_NONE 0U 52
41#define _IOC_WRITE 1U 53#ifndef _IOC_NONE
42#define _IOC_READ 2U 54# define _IOC_NONE 0U
55#endif
56
57#ifndef _IOC_WRITE
58# define _IOC_WRITE 1U
59#endif
60
61#ifndef _IOC_READ
62# define _IOC_READ 2U
63#endif
43 64
44#define _IOC(dir,type,nr,size) \ 65#define _IOC(dir,type,nr,size) \
45 (((dir) << _IOC_DIRSHIFT) | \ 66 (((dir) << _IOC_DIRSHIFT) | \