xref: /titanic_44/usr/src/uts/common/sys/mkdev.h (revision 9dd0f810214fdc8e1af881a9a5c4b6927629ff9e)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1997 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 #ifndef _SYS_MKDEV_H
31 #define	_SYS_MKDEV_H
32 
33 #pragma ident	"%Z%%M%	%I%	%E% SMI"
34 
35 #include <sys/types.h>
36 
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 /*
42  * SVR3/Pre-EFT device number constants.
43  */
44 #define	ONBITSMAJOR	7	/* # of SVR3 major device bits */
45 #define	ONBITSMINOR	8	/* # of SVR3 minor device bits */
46 #define	OMAXMAJ		0x7f	/* SVR3 max major value */
47 #define	OMAXMIN		0xff	/* SVR3 max major value */
48 
49 /*
50  * 32-bit Solaris device major/minor sizes.
51  */
52 #define	NBITSMAJOR32	14
53 #define	NBITSMINOR32	18
54 #define	MAXMAJ32	0x3ffful	/* SVR4 max major value */
55 #define	MAXMIN32	0x3fffful	/* SVR4 max minor value */
56 
57 #ifdef _LP64
58 
59 #define	NBITSMAJOR64	32	/* # of major device bits in 64-bit Solaris */
60 #define	NBITSMINOR64	32	/* # of minor device bits in 64-bit Solaris */
61 #define	MAXMAJ64	0xfffffffful	/* max major value */
62 #define	MAXMIN64	0xfffffffful	/* max minor value */
63 
64 #define	NBITSMAJOR	NBITSMAJOR64
65 #define	NBITSMINOR	NBITSMINOR64
66 #define	MAXMAJ		MAXMAJ64
67 #define	MAXMIN		MAXMIN64
68 
69 #else /* !_LP64 */
70 
71 #define	NBITSMAJOR	NBITSMAJOR32
72 #define	NBITSMINOR	NBITSMINOR32
73 #define	MAXMAJ		MAXMAJ32
74 #define	MAXMIN		MAXMIN32
75 
76 #endif /* !_LP64 */
77 
78 #if !defined(_KERNEL)
79 
80 /*
81  * Undefine sysmacros.h device macros.
82  */
83 #undef makedev
84 #undef major
85 #undef minor
86 
87 #if defined(__STDC__)
88 
89 extern dev_t makedev(const major_t, const minor_t);
90 extern major_t major(const dev_t);
91 extern minor_t minor(const dev_t);
92 extern dev_t __makedev(const int, const major_t, const minor_t);
93 extern major_t __major(const int, const dev_t);
94 extern minor_t __minor(const int, const dev_t);
95 
96 #else
97 
98 extern dev_t makedev();
99 extern major_t major();
100 extern minor_t minor();
101 extern dev_t __makedev();
102 extern major_t __major();
103 extern minor_t __minor();
104 
105 #endif	/* defined(__STDC__) */
106 
107 #define	OLDDEV 0	/* old device format */
108 #define	NEWDEV 1	/* new device format */
109 
110 #define	makedev(maj, min)	(__makedev(NEWDEV, maj, min))
111 #define	major(dev)		(__major(NEWDEV, dev))
112 #define	minor(dev)		(__minor(NEWDEV, dev))
113 
114 #endif	/* !defined(_KERNEL) */
115 
116 #ifdef	__cplusplus
117 }
118 #endif
119 
120 #endif	/* _SYS_MKDEV_H */
121