root/include/asm-sparc/ioctl.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /* $Id: ioctl.h,v 1.4 1995/11/25 02:31:52 davem Exp $ */
   2 #ifndef _SPARC_IOCTL_H
   3 #define _SPARC_IOCTL_H
   4 
   5 #define _IOC_NRBITS      8
   6 #define _IOC_TYPEBITS    8
   7 #define _IOC_SIZEBITS    8
   8 #define _IOC_RESVBITS    5
   9 #define _IOC_DIRBITS     3
  10 
  11 #define _IOC_NRMASK      ((1 << _IOC_NRBITS)-1)
  12 #define _IOC_TYPEMASK    ((1 << _IOC_TYPEBITS)-1)
  13 #define _IOC_RESVMASK    ((1 << _IOC_RESVBITS)-1)
  14 #define _IOC_SIZEMASK    ((1 << _IOC_SIZEBITS)-1)
  15 #define _IOC_DIRMASK     ((1 << _IOC_DIRBITS)-1)
  16 
  17 #define _IOC_NRSHIFT     0
  18 #define _IOC_TYPESHIFT   (_IOC_NRSHIFT + _IOC_NRBITS)
  19 #define _IOC_SIZESHIFT   (_IOC_TYPESHIFT + _IOC_TYPEBITS)
  20 #define _IOC_RESVSHIFT   (_IOC_SIZESHIFT + _IOC_SIZEBITS)
  21 #define _IOC_DIRSHIFT    (_IOC_RESVSHIFT + _IOC_RESVBITS)
  22 
  23 #define _IOC_NONE        1U
  24 #define _IOC_READ        2U
  25 #define _IOC_WRITE       4U
  26 
  27 #define _IOC(dir,type,nr,size) \
  28         (((dir)  << _IOC_DIRSHIFT) | \
  29          ((type) << _IOC_TYPESHIFT) | \
  30          ((nr)   << _IOC_NRSHIFT) | \
  31          ((size) << _IOC_SIZESHIFT))
  32 
  33 #define _IO(type,nr)        _IOC(_IOC_NONE,(type),(nr),0)
  34 #define _IOR(type,nr,size)  _IOC(_IOC_READ,(type),(nr),sizeof(size))
  35 #define _IOW(type,nr,size)  _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
  36 #define _IORW(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
  37 
  38 #define _IOC_DIR(nr)        (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
  39 #define _IOC_TYPE(nr)       (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
  40 #define _IOC_NR(nr)         (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
  41 #define _IOC_SIZE(nr)       (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
  42 
  43 #endif /* !(_SPARC_IOCTL_H) */

/* [previous][next][first][last][top][bottom][index][help] */