linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Ira W. Snyder" <iws@ovro.caltech.edu>
To: Ravi Gupta <dceravigupta@gmail.com>
Cc: linuxppc-dev@ozlabs.org, MJ embd <mj.embd@gmail.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: Distinguish between kernel and user space
Date: Mon, 16 Aug 2010 08:22:44 -0700	[thread overview]
Message-ID: <20100816152244.GA30251@ovro.caltech.edu> (raw)
In-Reply-To: <AANLkTi=ZSeYf0apwK3Tuf3b3-OTsRrddMkNHkxgViw-x@mail.gmail.com>

On Mon, Aug 16, 2010 at 05:52:41PM +0530, Ravi Gupta wrote:
> 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_ */
> 

#ifdef __KERNEL__
/* kernel only definitions here */
#else
/* userspace only definitions here */
#endif

See tons of headers in include/linux/ for examples.

Ira

      reply	other threads:[~2010-08-16 15:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-16 12:22 Distinguish between kernel and user space Ravi Gupta
2010-08-16 15:22 ` Ira W. Snyder [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100816152244.GA30251@ovro.caltech.edu \
    --to=iws@ovro.caltech.edu \
    --cc=dceravigupta@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mj.embd@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).