macros - How to share same header files between kernel modules and userspace applications. -
i want implement simple module in ioctl()
method used. in kernel module, use kernel macros, such _io()
, _iowr()
, etc., define own ioctl
sub-commands. in facts, don't care actual values of these definitions use these macros instead of actual values .
when programmers in userspace want invoke ioctl()
function, however, needs know either actual values or macro definitions of such sub-commands.
i guess, in userspace, won't such _io()
, _iowr()
macro definitions, so, how can export these definitions userspace application programmers.
the _io
, _iowr
(and forth) macros available in user-space headers. definitions can pulled both kernel-space , user-space source #including <linux/ioctl.h>
first.
you should separate kernel header files 2 parts: (a) needed kernel code -- struct
definitions, inter-source-file declarations, other #includes, or else find convenient include there isn't needed user-space -- , (b) define interface between kernel , user-space. latter contain _io*
definitions , may include custom structure definitions used transmit information in ioctl
s user-space kernel.
then you'll need arrange strategy share interface-defining header file between kernel , user-space code.
Comments
Post a Comment