'\"macro stdmacro
.if n .pH ddi_dki.getmajor @(#)getmajor	40.8 of 10/10/89
.\" Copyright 1989 AT&T
.de IX
.ie '\\n(.z'' .tm .Index: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9	\\n%
.el \\!.IX \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
..
.nr X
.if \nX=0 .ds x} getmajor D3DK "" "DDI/DKI" "\&"
.if \nX=1 .ds x} getmajor D3DK "" "DDI/DKI"
.if \nX=2 .ds x} getmajor D3DK "" "\&"
.if \nX=3 .ds x} getmajor "" "" "\&"
.TH \*(x}
.IX "\f4getmajor\fP(D3DK)"
.SH NAME 
\f4getmajor\f1 \- get major or internal major device number
.SH SYNOPSIS 
.nf
.na
\f4#include <sys/types.h>
#include <sys/mkdev.h>
#include <sys/ddi.h>
.sp 0.5
major_t getmajor(dev_t \f2dev\f4);\f1
.ad
.fi
.SH ARGUMENT 
.RS 0n 10
.IP "\f2dev\f1" 10n
Device number.
.RE
.SH DESCRIPTION 
The \f4getmajor\f1 function extracts either the major number or the
internal major number from a device number.  For the 3B2,
\f4getmajor\f1 returns the internal major number.  For architectures
that do not make a distinction between internal and external major
numbers, \f4getmajor\f1 returns the major number.
.IX "major device number, internal"
.SH "RETURN VALUE" 
The major number or internal major number.
.P
\f3NOTE:\f1
No validty checking is performed.  If \f2dev\f1 is invalid, an
invalid number is returned.
.SH "LEVEL" 
Base or Interrupt
.SH "SEE ALSO" 
\f2BCI Driver Development Guide\f1, Chapter 3, ``Drivers in the
.SM UNIX
Operating System''
.P
.na
\f4makedevice\f1(D3DK),
\f4getminor\f1(D3DK)
.ad
.SH EXAMPLE 
.IX "\f4cmn_err\fP(D3DK), example"
.IX "\f4getmajor\fP(D3DK), example"
.P
The following example shows both the \f4getmajor\f1 and
\f4getminor\f1(D3DK) functions used in a debug \f4cmn_err\f1(D3DK)
statement to return the major and minor numbers for the device supported
by the driver.  This example is 3B2 specific.
.P
.ne 4
.P
.RS
.nf
.ft 4
dev_t dev;

#ifdef DEBUG 
cmn_err(CE_NOTE,"Driver Started.  Internal Major# = %d,
	Internal Minor# = %d", getmajor(dev), getminor(dev));
#endif
.ft 1
.fi
.RE
.P
.FG "getmajor \- get major device number"
