提交 10521bd9 编写于 作者: R Robert P. J. Day 提交者: Linus Torvalds

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: NRobert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 098ef1c0
...@@ -21,8 +21,19 @@ ...@@ -21,8 +21,19 @@
*/ */
#define _IOC_NRBITS 8 #define _IOC_NRBITS 8
#define _IOC_TYPEBITS 8 #define _IOC_TYPEBITS 8
#define _IOC_SIZEBITS 14
#define _IOC_DIRBITS 2 /*
* Let any architecture override either of the following before
* including this file.
*/
#ifndef _IOC_SIZEBITS
# define _IOC_SIZEBITS 14
#endif
#ifndef _IOC_DIRBITS
# define _IOC_DIRBITS 2
#endif
#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
...@@ -35,11 +46,21 @@ ...@@ -35,11 +46,21 @@
#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
/* /*
* Direction bits. * Direction bits, which any architecture can choose to override
* before including this file.
*/ */
#define _IOC_NONE 0U
#define _IOC_WRITE 1U #ifndef _IOC_NONE
#define _IOC_READ 2U # define _IOC_NONE 0U
#endif
#ifndef _IOC_WRITE
# define _IOC_WRITE 1U
#endif
#ifndef _IOC_READ
# define _IOC_READ 2U
#endif
#define _IOC(dir,type,nr,size) \ #define _IOC(dir,type,nr,size) \
(((dir) << _IOC_DIRSHIFT) | \ (((dir) << _IOC_DIRSHIFT) | \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册