I want to implement a simple module in which an ioctl() method is used. In the kernel module, I use kernel macros, such as _IO(), _IOWR(), etc., to define my own ioctl sub-commands. In facts, I don't care the actual values of these definitions for that I will always use these macros instead of the actual values . 
When programmers in userspace want to invoke my ioctl() function, however, they needs to know either the actual values or macro definitions of such sub-commands. 
I guess, in userspace, it won't be such _IO(), _IOWR() macro definitions, so, how can I export these definitions to userspace for application programmers.
                        
The
_IOand_IOWR(and so forth) macros are also available in user-space headers. The definitions can be pulled into both kernel-space and user-space source by #including<linux/ioctl.h>first.You should separate your kernel header files into two parts: (a) those needed only by the kernel code --
structdefinitions, inter-source-file declarations, other #includes, or anything else you find convenient to include there that isn't needed by user-space -- and (b) those that define the interface between kernel and user-space. The latter will contain those_IO*definitions and may also include custom structure definitions used to transmit information in theioctls from user-space to kernel.Then you'll need to arrange a strategy to share the interface-defining header file between your kernel and user-space code.