Print this page
6136 sysmacros.h unnecessarily polutes the namespace

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/sysmacros.h
          +++ new/usr/src/uts/common/sys/sysmacros.h
↓ open down ↓ 75 lines elided ↑ open up ↑
  76   76  
  77   77  #endif  /* _KERNEL */
  78   78  
  79   79  /*
  80   80   * WARNING: The device number macros defined here should not be used by device
  81   81   * drivers or user software. Device drivers should use the device functions
  82   82   * defined in the DDI/DKI interface (see also ddi.h). Application software
  83   83   * should make use of the library routines available in makedev(3). A set of
  84   84   * new device macros are provided to operate on the expanded device number
  85   85   * format supported in SVR4. Macro versions of the DDI device functions are
  86      - * provided for use by kernel proper routines only. Macro routines bmajor(),
  87      - * major(), minor(), emajor(), eminor(), and makedev() will be removed or
  88      - * their definitions changed at the next major release following SVR4.
       86 + * provided for use by kernel proper routines only.
  89   87   */
  90   88  
  91   89  #define O_BITSMAJOR     7       /* # of SVR3 major device bits */
  92   90  #define O_BITSMINOR     8       /* # of SVR3 minor device bits */
  93   91  #define O_MAXMAJ        0x7f    /* SVR3 max major value */
  94   92  #define O_MAXMIN        0xff    /* SVR3 max minor value */
  95   93  
  96   94  
  97   95  #define L_BITSMAJOR32   14      /* # of SVR4 major device bits */
  98   96  #define L_BITSMINOR32   18      /* # of SVR4 minor device bits */
↓ open down ↓ 9 lines elided ↑ open up ↑
 108  106  #define L_MAXMIN        0xfffffffful    /* max minor value */
 109  107  #else
 110  108  #define L_BITSMAJOR     L_BITSMAJOR32
 111  109  #define L_BITSMINOR     L_BITSMINOR32
 112  110  #define L_MAXMAJ        L_MAXMAJ32
 113  111  #define L_MAXMIN        L_MAXMIN32
 114  112  #endif
 115  113  
 116  114  #ifdef _KERNEL
 117  115  
 118      -/* major part of a device internal to the kernel */
 119      -
 120      -#define major(x)        (major_t)((((unsigned)(x)) >> O_BITSMINOR) & O_MAXMAJ)
 121      -#define bmajor(x)       (major_t)((((unsigned)(x)) >> O_BITSMINOR) & O_MAXMAJ)
 122      -
 123  116  /* get internal major part of expanded device number */
 124  117  
 125  118  #define getmajor(x)     (major_t)((((dev_t)(x)) >> L_BITSMINOR) & L_MAXMAJ)
 126  119  
 127      -/* minor part of a device internal to the kernel */
 128      -
 129      -#define minor(x)        (minor_t)((x) & O_MAXMIN)
 130      -
 131  120  /* get internal minor part of expanded device number */
 132  121  
 133  122  #define getminor(x)     (minor_t)((x) & L_MAXMIN)
 134  123  
 135      -#else   /* _KERNEL */
 136      -
 137      -/* major part of a device external from the kernel (same as emajor below) */
 138      -
 139      -#define major(x)        (major_t)((((unsigned)(x)) >> O_BITSMINOR) & O_MAXMAJ)
 140      -
 141      -/* minor part of a device external from the kernel  (same as eminor below) */
 142      -
 143      -#define minor(x)        (minor_t)((x) & O_MAXMIN)
 144      -
 145  124  #endif  /* _KERNEL */
 146  125  
 147      -/* create old device number */
 148      -
 149      -#define makedev(x, y) (unsigned short)(((x) << O_BITSMINOR) | ((y) & O_MAXMIN))
 150      -
 151  126  /* make an new device number */
 152  127  
 153  128  #define makedevice(x, y) (dev_t)(((dev_t)(x) << L_BITSMINOR) | ((y) & L_MAXMIN))
 154      -
 155      -
 156      -/*
 157      - * emajor() allows kernel/driver code to print external major numbers
 158      - * eminor() allows kernel/driver code to print external minor numbers
 159      - */
 160      -
 161      -#define emajor(x) \
 162      -        (major_t)(((unsigned int)(x) >> O_BITSMINOR) > O_MAXMAJ) ? \
 163      -            NODEV : (((unsigned int)(x) >> O_BITSMINOR) & O_MAXMAJ)
 164      -
 165      -#define eminor(x) \
 166      -        (minor_t)((x) & O_MAXMIN)
 167  129  
 168  130  /*
 169  131   * get external major and minor device
 170  132   * components from expanded device number
 171  133   */
 172  134  #define getemajor(x)    (major_t)((((dev_t)(x) >> L_BITSMINOR) > L_MAXMAJ) ? \
 173  135                              NODEV : (((dev_t)(x) >> L_BITSMINOR) & L_MAXMAJ))
 174  136  #define geteminor(x)    (minor_t)((x) & L_MAXMIN)
 175  137  
 176  138  /*
↓ open down ↓ 210 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX