File: sysmacros.h

package info (click to toggle)
klibc 1.5.20-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 5,104 kB
  • ctags: 7,234
  • sloc: ansic: 46,580; asm: 2,343; perl: 758; makefile: 170; sh: 141
file content (34 lines) | stat: -rw-r--r-- 723 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * sys/sysmacros.h
 *
 * Constructs to create and pick apart dev_t.  The double-underscore
 * versions are macros so they can be used as constants.
 */

#ifndef _SYS_SYSMACROS_H
#define _SYS_SYSMACROS_H

#ifndef _SYS_TYPES_H
# include <sys/types.h>
#endif

#define __major(__d) (((__d) >> 8) & 0xfff)
static __inline__ int major(dev_t __d)
{
	return __major(__d);
}

#define __minor(__d) (((__d) & 0xff)|(((__d) >> 12) & 0xfff00))
static __inline__ int minor(dev_t __d)
{
	return __minor(__d);
}

#define __makedev(__ma, __mi) \
	((((__ma) & 0xfff) << 8)|((__mi) & 0xff)|(((__mi) & 0xfff00) << 12))
static __inline__ dev_t makedev(int __ma, int __mi)
{
	return __makedev(__ma, __mi);
}

#endif				/* _SYS_SYSMACROS_H */