Distinguish between kernel and user space

Ravi Gupta dceravigupta at gmail.com
Mon Aug 16 22:22:41 EST 2010


Hi,

I have defined a header file for ioctls macros definitions. I am including
it in both, my user space application as well as in my device driver. Now
there are some macros that I want to be visible only in device drive and
some only in user space application. Is there any set of macros defined in
linux for such purpose? This is my present header file

gpio_ioctl.h

#ifndef _GPIO_IOCTL_H_
#define _GPIO_IOCTL_H_

/*
 * Ioctl definitions
 */

/* Use 250 as type/magic number */
#define GPIO_IOC_MAGIC    250
#define GPIO_READ         _IOW (GPIO_IOC_MAGIC, 0, int)
#define GPIO_WRITE        _IOW (GPIO_IOC_MAGIC, 1, int)
#define GPIO_IOC_MAXNR    2


#ifdef _DEVICE_DRIVE_ ---> these macros should not be visible in user space
application
#define ...
...
..
#endif

#ifdef _USER_SPACE_ ---> these macros should not be visible in device driver
i.e kernel space
#define ...
...
..

#endif  /*_GPIO_IOCTL_H_ */

Thanks in advance
Ravi Gupta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20100816/bccd2f54/attachment.html>


More information about the Linuxppc-dev mailing list