xref: /onnv-gate/usr/src/uts/common/sys/mkdev.h (revision 11291:80bdcd03e626)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*11291SRobert.Thurlow@Sun.COM  * Common Development and Distribution License (the "License").
6*11291SRobert.Thurlow@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*11291SRobert.Thurlow@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
270Sstevel@tonic-gate /*	  All Rights Reserved  	*/
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #ifndef _SYS_MKDEV_H
300Sstevel@tonic-gate #define	_SYS_MKDEV_H
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #include <sys/types.h>
330Sstevel@tonic-gate 
340Sstevel@tonic-gate #ifdef	__cplusplus
350Sstevel@tonic-gate extern "C" {
360Sstevel@tonic-gate #endif
370Sstevel@tonic-gate 
380Sstevel@tonic-gate /*
390Sstevel@tonic-gate  * SVR3/Pre-EFT device number constants.
400Sstevel@tonic-gate  */
410Sstevel@tonic-gate #define	ONBITSMAJOR	7	/* # of SVR3 major device bits */
420Sstevel@tonic-gate #define	ONBITSMINOR	8	/* # of SVR3 minor device bits */
430Sstevel@tonic-gate #define	OMAXMAJ		0x7f	/* SVR3 max major value */
440Sstevel@tonic-gate #define	OMAXMIN		0xff	/* SVR3 max major value */
450Sstevel@tonic-gate 
460Sstevel@tonic-gate /*
470Sstevel@tonic-gate  * 32-bit Solaris device major/minor sizes.
480Sstevel@tonic-gate  */
490Sstevel@tonic-gate #define	NBITSMAJOR32	14
500Sstevel@tonic-gate #define	NBITSMINOR32	18
510Sstevel@tonic-gate #define	MAXMAJ32	0x3ffful	/* SVR4 max major value */
520Sstevel@tonic-gate #define	MAXMIN32	0x3fffful	/* SVR4 max minor value */
530Sstevel@tonic-gate 
54*11291SRobert.Thurlow@Sun.COM #define	NBITSMAJOR64	32	/* # of major device bits in 64-bit Solaris */
55*11291SRobert.Thurlow@Sun.COM #define	NBITSMINOR64	32	/* # of minor device bits in 64-bit Solaris */
56*11291SRobert.Thurlow@Sun.COM 
570Sstevel@tonic-gate #ifdef _LP64
580Sstevel@tonic-gate 
590Sstevel@tonic-gate #define	MAXMAJ64	0xfffffffful	/* max major value */
600Sstevel@tonic-gate #define	MAXMIN64	0xfffffffful	/* max minor value */
610Sstevel@tonic-gate 
620Sstevel@tonic-gate #define	NBITSMAJOR	NBITSMAJOR64
630Sstevel@tonic-gate #define	NBITSMINOR	NBITSMINOR64
640Sstevel@tonic-gate #define	MAXMAJ		MAXMAJ64
650Sstevel@tonic-gate #define	MAXMIN		MAXMIN64
660Sstevel@tonic-gate 
670Sstevel@tonic-gate #else /* !_LP64 */
680Sstevel@tonic-gate 
690Sstevel@tonic-gate #define	NBITSMAJOR	NBITSMAJOR32
700Sstevel@tonic-gate #define	NBITSMINOR	NBITSMINOR32
710Sstevel@tonic-gate #define	MAXMAJ		MAXMAJ32
720Sstevel@tonic-gate #define	MAXMIN		MAXMIN32
730Sstevel@tonic-gate 
740Sstevel@tonic-gate #endif /* !_LP64 */
750Sstevel@tonic-gate 
760Sstevel@tonic-gate #if !defined(_KERNEL)
770Sstevel@tonic-gate 
780Sstevel@tonic-gate /*
790Sstevel@tonic-gate  * Undefine sysmacros.h device macros.
800Sstevel@tonic-gate  */
810Sstevel@tonic-gate #undef makedev
820Sstevel@tonic-gate #undef major
830Sstevel@tonic-gate #undef minor
840Sstevel@tonic-gate 
850Sstevel@tonic-gate #if defined(__STDC__)
860Sstevel@tonic-gate 
870Sstevel@tonic-gate extern dev_t makedev(const major_t, const minor_t);
880Sstevel@tonic-gate extern major_t major(const dev_t);
890Sstevel@tonic-gate extern minor_t minor(const dev_t);
900Sstevel@tonic-gate extern dev_t __makedev(const int, const major_t, const minor_t);
910Sstevel@tonic-gate extern major_t __major(const int, const dev_t);
920Sstevel@tonic-gate extern minor_t __minor(const int, const dev_t);
930Sstevel@tonic-gate 
940Sstevel@tonic-gate #else
950Sstevel@tonic-gate 
960Sstevel@tonic-gate extern dev_t makedev();
970Sstevel@tonic-gate extern major_t major();
980Sstevel@tonic-gate extern minor_t minor();
990Sstevel@tonic-gate extern dev_t __makedev();
1000Sstevel@tonic-gate extern major_t __major();
1010Sstevel@tonic-gate extern minor_t __minor();
1020Sstevel@tonic-gate 
1030Sstevel@tonic-gate #endif	/* defined(__STDC__) */
1040Sstevel@tonic-gate 
1050Sstevel@tonic-gate #define	OLDDEV 0	/* old device format */
1060Sstevel@tonic-gate #define	NEWDEV 1	/* new device format */
1070Sstevel@tonic-gate 
1080Sstevel@tonic-gate #define	makedev(maj, min)	(__makedev(NEWDEV, maj, min))
1090Sstevel@tonic-gate #define	major(dev)		(__major(NEWDEV, dev))
1100Sstevel@tonic-gate #define	minor(dev)		(__minor(NEWDEV, dev))
1110Sstevel@tonic-gate 
1120Sstevel@tonic-gate #endif	/* !defined(_KERNEL) */
1130Sstevel@tonic-gate 
1140Sstevel@tonic-gate #ifdef	__cplusplus
1150Sstevel@tonic-gate }
1160Sstevel@tonic-gate #endif
1170Sstevel@tonic-gate 
1180Sstevel@tonic-gate #endif	/* _SYS_MKDEV_H */
119