Make minor, major and makedev inline functions so we gain type checking
and prevent compile time creation of dev_t's from happening again.
This commit is contained in:
parent
5fd0058fc8
commit
e03d163b72
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)types.h 8.6 (Berkeley) 2/19/95
|
||||
* $Id: types.h,v 1.28 1999/01/27 19:01:44 dillon Exp $
|
||||
* $Id: types.h,v 1.29 1999/01/28 00:57:54 dillon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_TYPES_H_
|
||||
@ -102,9 +102,25 @@ typedef struct vm_page *vm_page_t;
|
||||
* change the meanings of bits 0-15 or waste time and space shifting
|
||||
* bits 16-31 for devices that don't use them.
|
||||
*/
|
||||
#define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */
|
||||
#define minor(x) ((int)((x)&0xffff00ff)) /* minor number */
|
||||
#define makedev(x,y) ((dev_t)(((x) << 8) | (y))) /* create dev_t */
|
||||
|
||||
static __inline int
|
||||
minor(dev_t dev)
|
||||
{
|
||||
return(dev & 0xffff00ff);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
major(dev_t dev)
|
||||
{
|
||||
return((dev & 0xff00) >> 8);
|
||||
}
|
||||
|
||||
static __inline dev_t
|
||||
makedev(int x, int y)
|
||||
{
|
||||
return ((x << 8) | y);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#include <machine/endian.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user