summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/amd64/amd64/mem.c8
-rw-r--r--sys/arm/arm/mem.c8
-rw-r--r--sys/cam/scsi/scsi_sa.c8
-rw-r--r--sys/cam/scsi/scsi_ses.c2
-rw-r--r--sys/cam/scsi/scsi_target.c2
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c6
-rw-r--r--sys/contrib/ipfilter/netinet/ip_compat.h2
-rw-r--r--sys/contrib/pf/net/pf_ioctl.c4
-rw-r--r--sys/dev/agp/agp.c2
-rw-r--r--sys/dev/amr/amr.c4
-rw-r--r--sys/dev/arcmsr/arcmsr.c6
-rw-r--r--sys/dev/asr/asr.c2
-rw-r--r--sys/dev/ata/atapi-tape.c2
-rw-r--r--sys/dev/atkbdc/psm.c4
-rw-r--r--sys/dev/bktr/bktr_os.c28
-rw-r--r--sys/dev/ce/if_ce.c6
-rw-r--r--sys/dev/cp/if_cp.c6
-rw-r--r--sys/dev/cpuctl/cpuctl.c4
-rw-r--r--sys/dev/ctau/if_ct.c6
-rw-r--r--sys/dev/drm/drm_drv.c2
-rw-r--r--sys/dev/drm/drm_fops.c2
-rw-r--r--sys/dev/fb/fb.c2
-rw-r--r--sys/dev/fb/vgareg.h2
-rw-r--r--sys/dev/firewire/firewire.h2
-rw-r--r--sys/dev/firewire/fwdev.c2
-rw-r--r--sys/dev/hptiop/hptiop.c2
-rw-r--r--sys/dev/iir/iir_ctrl.c10
-rw-r--r--sys/dev/iscsi/initiator/isc_cam.c2
-rw-r--r--sys/dev/iscsi/initiator/iscsi.c16
-rw-r--r--sys/dev/isp/isp_freebsd.c2
-rw-r--r--sys/dev/joy/joy.c4
-rw-r--r--sys/dev/kbd/kbd.c4
-rw-r--r--sys/dev/mlx/mlx.c6
-rw-r--r--sys/dev/mly/mly.c4
-rw-r--r--sys/dev/mse/mse.c4
-rw-r--r--sys/dev/pbio/pbio.c4
-rw-r--r--sys/dev/powermac_nvram/powermac_nvram.c2
-rw-r--r--sys/dev/ppbus/lpt.c12
-rw-r--r--sys/dev/ppbus/pcfclock.c14
-rw-r--r--sys/dev/ppbus/ppi.c10
-rw-r--r--sys/dev/rp/rpvar.h2
-rw-r--r--sys/dev/sound/midi/sequencer.c4
-rw-r--r--sys/dev/speaker/spkr.c8
-rw-r--r--sys/dev/streams/streams.c4
-rw-r--r--sys/dev/tdfx/tdfx_pci.c6
-rw-r--r--sys/dev/twa/tw_osl_freebsd.c4
-rw-r--r--sys/dev/twe/twe_freebsd.c4
-rw-r--r--sys/dev/usb/ucomvar.h6
-rw-r--r--sys/dev/usb/ufm.c2
-rw-r--r--sys/dev/usb/ugen.c4
-rw-r--r--sys/dev/usb/uhid.c2
-rw-r--r--sys/dev/usb/ulpt.c4
-rw-r--r--sys/dev/usb/ums.c2
-rw-r--r--sys/dev/usb/urio.c2
-rw-r--r--sys/dev/usb/usb.c2
-rw-r--r--sys/dev/usb/uscanner.c2
-rw-r--r--sys/dev/xen/console/console.c2
-rw-r--r--sys/i386/bios/apm.c2
-rw-r--r--sys/i386/bios/smapi.c2
-rw-r--r--sys/i386/i386/mem.c10
-rw-r--r--sys/ia64/ia64/mem.c6
-rw-r--r--sys/kern/kern_conf.c6
-rw-r--r--sys/mips/mips/mem.c4
-rw-r--r--sys/net/if.c4
-rw-r--r--sys/net/if_tap.c34
-rw-r--r--sys/net/if_tun.c12
-rw-r--r--sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c4
-rw-r--r--sys/netsmb/smb_dev.c4
-rw-r--r--sys/pc98/cbus/gdc.c2
-rw-r--r--sys/pc98/cbus/olpt.c10
-rw-r--r--sys/powerpc/powerpc/mem.c6
-rw-r--r--sys/sparc64/sparc64/mem.c4
72 files changed, 194 insertions, 194 deletions
diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c
index af119dc..7cac98d 100644
--- a/sys/amd64/amd64/mem.c
+++ b/sys/amd64/amd64/mem.c
@@ -93,7 +93,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
panic("memrw");
continue;
}
- if (minor(dev) == CDEV_MINOR_MEM) {
+ if (dev2unit(dev) == CDEV_MINOR_MEM) {
v = uio->uio_offset;
kmemphys:
o = v & PAGE_MASK;
@@ -101,7 +101,7 @@ kmemphys:
error = uiomove((void *)PHYS_TO_DMAP(v), (int)c, uio);
continue;
}
- else if (minor(dev) == CDEV_MINOR_KMEM) {
+ else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
v = uio->uio_offset;
if (v >= DMAP_MIN_ADDRESS && v < DMAP_MAX_ADDRESS) {
@@ -147,9 +147,9 @@ int
memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr,
int prot __unused)
{
- if (minor(dev) == CDEV_MINOR_MEM)
+ if (dev2unit(dev) == CDEV_MINOR_MEM)
*paddr = offset;
- else if (minor(dev) == CDEV_MINOR_KMEM)
+ else if (dev2unit(dev) == CDEV_MINOR_KMEM)
*paddr = vtophys(offset);
/* else panic! */
return (0);
diff --git a/sys/arm/arm/mem.c b/sys/arm/arm/mem.c
index 8a6df6e..abad8ae 100644
--- a/sys/arm/arm/mem.c
+++ b/sys/arm/arm/mem.c
@@ -91,7 +91,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
panic("memrw");
continue;
}
- if (minor(dev) == CDEV_MINOR_MEM) {
+ if (dev2unit(dev) == CDEV_MINOR_MEM) {
int i;
int address_valid = 0;
@@ -116,7 +116,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
pmap_qremove((vm_offset_t)_tmppt, 1);
continue;
}
- else if (minor(dev) == CDEV_MINOR_KMEM) {
+ else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
c = iov->iov_len;
/*
@@ -156,9 +156,9 @@ int
memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr,
int prot __unused)
{
- if (minor(dev) == CDEV_MINOR_MEM)
+ if (dev2unit(dev) == CDEV_MINOR_MEM)
*paddr = offset;
- else if (minor(dev) == CDEV_MINOR_KMEM)
+ else if (dev2unit(dev) == CDEV_MINOR_KMEM)
*paddr = vtophys(offset);
/* else panic! */
return (0);
diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c
index 617535a..b775cc1 100644
--- a/sys/cam/scsi/scsi_sa.c
+++ b/sys/cam/scsi/scsi_sa.c
@@ -175,11 +175,11 @@ typedef enum {
/* units are bits 4-7, 16-21 (1024 units) */
#define SAUNIT(DEV) \
- (((minor(DEV) & 0xF0) >> 4) | ((minor(DEV) & 0x3f0000) >> 16))
+ (((dev2unit(DEV) & 0xF0) >> 4) | ((dev2unit(DEV) & 0x3f0000) >> 16))
-#define SAMODE(z) ((minor(z) & 0x3))
-#define SADENSITY(z) (((minor(z) >> 2) & 0x3))
-#define SA_IS_CTRL(z) (minor(z) & (1 << 29))
+#define SAMODE(z) ((dev2unit(z) & 0x3))
+#define SADENSITY(z) (((dev2unit(z) >> 2) & 0x3))
+#define SA_IS_CTRL(z) (dev2unit(z) & (1 << 29))
#define SA_NOT_CTLDEV 0
#define SA_CTLDEV 1
diff --git a/sys/cam/scsi/scsi_ses.c b/sys/cam/scsi/scsi_ses.c
index efccf09..acd6e51 100644
--- a/sys/cam/scsi/scsi_ses.c
+++ b/sys/cam/scsi/scsi_ses.c
@@ -155,7 +155,7 @@ struct ses_softc {
#define SES_FLAG_OPEN 0x02
#define SES_FLAG_INITIALIZED 0x04
-#define SESUNIT(x) (minor((x)))
+#define SESUNIT(x) (dev2unit((x)))
static d_open_t sesopen;
static d_close_t sesclose;
diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c
index 140da9b..cb14027 100644
--- a/sys/cam/scsi/scsi_target.c
+++ b/sys/cam/scsi/scsi_target.c
@@ -180,7 +180,7 @@ targopen(struct cdev *dev, int flags, int fmt, struct thread *td)
/* Create the targ device, allocate its softc, initialize it */
if ((dev->si_flags & SI_NAMED) == 0) {
- make_dev(&targ_cdevsw, minor(dev), UID_ROOT, GID_WHEEL, 0600,
+ make_dev(&targ_cdevsw, dev2unit(dev), UID_ROOT, GID_WHEEL, 0600,
"targ%d", dev2unit(dev));
}
MALLOC(softc, struct targ_softc *, sizeof(*softc), M_TARG,
diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
index 2afc602..847a1ba 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
@@ -12816,7 +12816,7 @@ dtrace_state_create(struct cdev *dev)
#else
if (dev != NULL) {
cr = dev->si_cred;
- m = minor(dev);
+ m = dev2unit(dev);
}
/* Allocate memory for the state. */
@@ -15266,7 +15266,7 @@ dtrace_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
* The first minor device is the one that is cloned so there is
* nothing more to do here.
*/
- if (minor(dev) == 0)
+ if (dev2unit(dev) == 0)
return 0;
/*
@@ -15367,7 +15367,7 @@ dtrace_close(struct cdev *dev, int flags, int fmt __unused, struct thread *td)
dtrace_state_t *state = dev->si_drv1;
/* Check if this is not a cloned device. */
- if (minor(dev) == 0)
+ if (dev2unit(dev) == 0)
return (0);
#endif
diff --git a/sys/contrib/ipfilter/netinet/ip_compat.h b/sys/contrib/ipfilter/netinet/ip_compat.h
index daf824c..6f05720 100644
--- a/sys/contrib/ipfilter/netinet/ip_compat.h
+++ b/sys/contrib/ipfilter/netinet/ip_compat.h
@@ -1709,7 +1709,7 @@ MALLOC_DECLARE(M_IPFILTER);
# endif
# ifndef GET_MINOR
-# define GET_MINOR(x) minor(x)
+# define GET_MINOR(x) dev2unit(x)
# endif
# define PANIC(x,y) if (x) panic y
#endif /* _KERNEL */
diff --git a/sys/contrib/pf/net/pf_ioctl.c b/sys/contrib/pf/net/pf_ioctl.c
index 3e99a99..9b35443 100644
--- a/sys/contrib/pf/net/pf_ioctl.c
+++ b/sys/contrib/pf/net/pf_ioctl.c
@@ -478,7 +478,7 @@ pf_thread_create(void *v)
int
pfopen(struct cdev *dev, int flags, int fmt, struct proc *p)
{
- if (minor(dev) >= 1)
+ if (dev2unit(dev) >= 1)
return (ENXIO);
return (0);
}
@@ -486,7 +486,7 @@ pfopen(struct cdev *dev, int flags, int fmt, struct proc *p)
int
pfclose(struct cdev *dev, int flags, int fmt, struct proc *p)
{
- if (minor(dev) >= 1)
+ if (dev2unit(dev) >= 1)
return (ENXIO);
return (0);
}
diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c
index 1dd8b3a..c18fa19 100644
--- a/sys/dev/agp/agp.c
+++ b/sys/dev/agp/agp.c
@@ -80,7 +80,7 @@ static struct cdevsw agp_cdevsw = {
};
static devclass_t agp_devclass;
-#define KDEV2DEV(kdev) devclass_get_device(agp_devclass, minor(kdev))
+#define KDEV2DEV(kdev) devclass_get_device(agp_devclass, dev2unit(kdev))
/* Helper functions for implementing chipset mini drivers. */
diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c
index d586a36..192f128 100644
--- a/sys/dev/amr/amr.c
+++ b/sys/dev/amr/amr.c
@@ -438,7 +438,7 @@ amr_submit_bio(struct amr_softc *sc, struct bio *bio)
static int
amr_open(struct cdev *dev, int flags, int fmt, d_thread_t *td)
{
- int unit = minor(dev);
+ int unit = dev2unit(dev);
struct amr_softc *sc = devclass_get_softc(devclass_find("amr"), unit);
debug_called(1);
@@ -494,7 +494,7 @@ amr_prepare_ld_delete(struct amr_softc *sc)
static int
amr_close(struct cdev *dev, int flags, int fmt, d_thread_t *td)
{
- int unit = minor(dev);
+ int unit = dev2unit(dev);
struct amr_softc *sc = devclass_get_softc(devclass_find("amr"), unit);
debug_called(1);
diff --git a/sys/dev/arcmsr/arcmsr.c b/sys/dev/arcmsr/arcmsr.c
index 1c23181..74c807f 100644
--- a/sys/dev/arcmsr/arcmsr.c
+++ b/sys/dev/arcmsr/arcmsr.c
@@ -256,7 +256,7 @@ MODULE_DEPEND(arcmsr, cam, 1, 1, 1);
#if __FreeBSD_version < 503000
struct AdapterControlBlock *acb=dev->si_drv1;
#else
- int unit = minor(dev);
+ int unit = dev2unit(dev);
struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit);
#endif
if(acb==NULL) {
@@ -281,7 +281,7 @@ MODULE_DEPEND(arcmsr, cam, 1, 1, 1);
#if __FreeBSD_version < 503000
struct AdapterControlBlock *acb=dev->si_drv1;
#else
- int unit = minor(dev);
+ int unit = dev2unit(dev);
struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit);
#endif
if(acb==NULL) {
@@ -306,7 +306,7 @@ MODULE_DEPEND(arcmsr, cam, 1, 1, 1);
#if __FreeBSD_version < 503000
struct AdapterControlBlock *acb=dev->si_drv1;
#else
- int unit = minor(dev);
+ int unit = dev2unit(dev);
struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit);
#endif
diff --git a/sys/dev/asr/asr.c b/sys/dev/asr/asr.c
index 2e3aae2..8cda0a9 100644
--- a/sys/dev/asr/asr.c
+++ b/sys/dev/asr/asr.c
@@ -3113,7 +3113,7 @@ typedef U32 DPT_RTN_T;
#undef SCSI_RESET /* Conflicts with "scsi/scsiconf.h" defintion */
#include "dev/asr/osd_unix.h"
-#define asr_unit(dev) minor(dev)
+#define asr_unit(dev) dev2unit(dev)
static u_int8_t ASR_ctlr_held;
diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c
index 8986069..947bacf 100644
--- a/sys/dev/ata/atapi-tape.c
+++ b/sys/dev/ata/atapi-tape.c
@@ -238,7 +238,7 @@ ast_close(struct cdev *cdev, int flags, int fmt, struct thread *td)
ast_write_filemark(dev, ATAPI_WF_WRITE);
/* if minor is even rewind on close */
- if (!(minor(cdev) & 0x01))
+ if (!(dev2unit(cdev) & 0x01))
ast_rewind(dev);
if (stp->cap.lock && count_dev(cdev) == 1)
diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c
index bed0c37..c173496 100644
--- a/sys/dev/atkbdc/psm.c
+++ b/sys/dev/atkbdc/psm.c
@@ -141,8 +141,8 @@ __FBSDID("$FreeBSD$");
(((b[0] & 0x30) >> 2) | ((b[1] & 0x30) >> 4))
/* some macros */
-#define PSM_UNIT(dev) (minor(dev) >> 1)
-#define PSM_NBLOCKIO(dev) (minor(dev) & 1)
+#define PSM_UNIT(dev) (dev2unit(dev) >> 1)
+#define PSM_NBLOCKIO(dev) (dev2unit(dev) & 1)
#define PSM_MKMINOR(unit,block) (((unit) << 1) | ((block) ? 0:1))
/* ring buffer */
diff --git a/sys/dev/bktr/bktr_os.c b/sys/dev/bktr/bktr_os.c
index 9ce258c..1e0010f 100644
--- a/sys/dev/bktr/bktr_os.c
+++ b/sys/dev/bktr/bktr_os.c
@@ -584,7 +584,7 @@ bktr_open( struct cdev *dev, int flags, int fmt, struct thread *td )
int unit;
int result;
- unit = UNIT( minor(dev) );
+ unit = UNIT( dev2unit(dev) );
/* Get the device data */
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
@@ -652,7 +652,7 @@ bktr_open( struct cdev *dev, int flags, int fmt, struct thread *td )
}
#endif
- switch ( FUNCTION( minor(dev) ) ) {
+ switch ( FUNCTION( dev2unit(dev) ) ) {
case VIDEO_DEV:
result = video_open( bktr );
break;
@@ -684,7 +684,7 @@ bktr_close( struct cdev *dev, int flags, int fmt, struct thread *td )
int unit;
int result;
- unit = UNIT( minor(dev) );
+ unit = UNIT( dev2unit(dev) );
/* Get the device data */
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
@@ -693,7 +693,7 @@ bktr_close( struct cdev *dev, int flags, int fmt, struct thread *td )
return (ENXIO);
}
- switch ( FUNCTION( minor(dev) ) ) {
+ switch ( FUNCTION( dev2unit(dev) ) ) {
case VIDEO_DEV:
result = video_close( bktr );
break;
@@ -722,7 +722,7 @@ bktr_read( struct cdev *dev, struct uio *uio, int ioflag )
bktr_ptr_t bktr;
int unit;
- unit = UNIT(minor(dev));
+ unit = UNIT(dev2unit(dev));
/* Get the device data */
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
@@ -731,7 +731,7 @@ bktr_read( struct cdev *dev, struct uio *uio, int ioflag )
return (ENXIO);
}
- switch ( FUNCTION( minor(dev) ) ) {
+ switch ( FUNCTION( dev2unit(dev) ) ) {
case VIDEO_DEV:
return( video_read( bktr, unit, dev, uio ) );
case VBI_DEV:
@@ -760,7 +760,7 @@ bktr_ioctl( struct cdev *dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct thr
bktr_ptr_t bktr;
int unit;
- unit = UNIT(minor(dev));
+ unit = UNIT(dev2unit(dev));
/* Get the device data */
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
@@ -779,7 +779,7 @@ bktr_ioctl( struct cdev *dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct thr
return( ENOMEM );
#endif
- switch ( FUNCTION( minor(dev) ) ) {
+ switch ( FUNCTION( dev2unit(dev) ) ) {
case VIDEO_DEV:
return( video_ioctl( bktr, unit, cmd, arg, td ) );
case TUNER_DEV:
@@ -799,9 +799,9 @@ bktr_mmap( struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot )
int unit;
bktr_ptr_t bktr;
- unit = UNIT(minor(dev));
+ unit = UNIT(dev2unit(dev));
- if (FUNCTION(minor(dev)) > 0) /* only allow mmap on /dev/bktr[n] */
+ if (FUNCTION(dev2unit(dev)) > 0) /* only allow mmap on /dev/bktr[n] */
return( -1 );
/* Get the device data */
@@ -832,7 +832,7 @@ bktr_poll( struct cdev *dev, int events, struct thread *td)
int revents = 0;
DECLARE_INTR_MASK(s);
- unit = UNIT(minor(dev));
+ unit = UNIT(dev2unit(dev));
/* Get the device data */
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
@@ -846,7 +846,7 @@ bktr_poll( struct cdev *dev, int events, struct thread *td)
if (events & (POLLIN | POLLRDNORM)) {
- switch ( FUNCTION( minor(dev) ) ) {
+ switch ( FUNCTION( dev2unit(dev) ) ) {
case VBI_DEV:
if(bktr->vbisize == 0)
selrecord(td, &bktr->vbi_select);
@@ -1182,8 +1182,8 @@ free_bktr_mem(bktr, dmap, kva)
#define TUNER_DEV 0x01
#define VBI_DEV 0x02
-#define UNIT(x) (minor((x) & 0x0f))
-#define FUNCTION(x) (minor((x >> 4) & 0x0f))
+#define UNIT(x) (dev2unit((x) & 0x0f))
+#define FUNCTION(x) (dev2unit((x >> 4) & 0x0f))
/*
*
diff --git a/sys/dev/ce/if_ce.c b/sys/dev/ce/if_ce.c
index a08a7a0..9b0d69c 100644
--- a/sys/dev/ce/if_ce.c
+++ b/sys/dev/ce/if_ce.c
@@ -1254,7 +1254,7 @@ static int ce_open (dev_t dev, int oflags, int devtype, struct proc *p)
static int ce_open (struct cdev *dev, int oflags, int devtype, struct thread *td)
#endif
{
- int unit = minor (dev);
+ int unit = dev2unit (dev);
drv_t *d;
if (unit >= NBRD*NCHAN || ! (d = channel[unit]))
@@ -1272,7 +1272,7 @@ static int ce_close (dev_t dev, int fflag, int devtype, struct proc *p)
static int ce_close (struct cdev *dev, int fflag, int devtype, struct thread *td)
#endif
{
- drv_t *d = channel [minor (dev)];
+ drv_t *d = channel [dev2unit (dev)];
CE_DEBUG2 (d, ("ce_close\n"));
return 0;
@@ -1303,7 +1303,7 @@ static int ce_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct proc
static int ce_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
#endif
{
- drv_t *d = channel [minor (dev)];
+ drv_t *d = channel [dev2unit (dev)];
bdrv_t *bd = d->board->sys;
ce_chan_t *c = d->chan;
struct serial_statistics *st;
diff --git a/sys/dev/cp/if_cp.c b/sys/dev/cp/if_cp.c
index 36b12ab..0b300ce 100644
--- a/sys/dev/cp/if_cp.c
+++ b/sys/dev/cp/if_cp.c
@@ -999,7 +999,7 @@ static void cp_error (cp_chan_t *c, int data)
*/
static int cp_open (struct cdev *dev, int oflags, int devtype, struct thread *td)
{
- int unit = minor (dev);
+ int unit = dev2unit (dev);
drv_t *d;
if (unit >= NBRD*NCHAN || ! (d = channel[unit]))
@@ -1013,7 +1013,7 @@ static int cp_open (struct cdev *dev, int oflags, int devtype, struct thread *td
*/
static int cp_close (struct cdev *dev, int fflag, int devtype, struct thread *td)
{
- drv_t *d = channel [minor (dev)];
+ drv_t *d = channel [dev2unit (dev)];
CP_DEBUG2 (d, ("cp_close\n"));
return 0;
@@ -1040,7 +1040,7 @@ static int cp_modem_status (cp_chan_t *c)
static int cp_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
{
- drv_t *d = channel [minor (dev)];
+ drv_t *d = channel [dev2unit (dev)];
bdrv_t *bd = d->board->sys;
cp_chan_t *c = d->chan;
struct serial_statistics *st;
diff --git a/sys/dev/cpuctl/cpuctl.c b/sys/dev/cpuctl/cpuctl.c
index b560fde..157991c 100644
--- a/sys/dev/cpuctl/cpuctl.c
+++ b/sys/dev/cpuctl/cpuctl.c
@@ -144,7 +144,7 @@ cpuctl_ioctl(struct cdev *dev, u_long cmd, caddr_t data,
int flags, struct thread *td)
{
int ret;
- int cpu = minor(dev);
+ int cpu = dev2unit(dev);
if (cpu >= mp_ncpus || !cpu_enabled(cpu)) {
DPRINTF("[cpuctl,%d]: bad cpu number %d\n", __LINE__, cpu);
@@ -389,7 +389,7 @@ cpuctl_open(struct cdev *dev, int flags, int fmt __unused, struct thread *td)
int ret = 0;
int cpu;
- cpu = minor(dev);
+ cpu = dev2unit(dev);
if (cpu >= mp_ncpus || !cpu_enabled(cpu)) {
DPRINTF("[cpuctl,%d]: incorrect cpu number %d\n", __LINE__,
cpu);
diff --git a/sys/dev/ctau/if_ct.c b/sys/dev/ctau/if_ct.c
index f2d876d..b8bccf4 100644
--- a/sys/dev/ctau/if_ct.c
+++ b/sys/dev/ctau/if_ct.c
@@ -1218,7 +1218,7 @@ static int ct_open (struct cdev *dev, int oflags, int devtype, struct thread *td
{
drv_t *d;
- if (minor(dev) >= NCTAU*NCHAN || ! (d = channel[minor(dev)]))
+ if (dev2unit(dev) >= NCTAU*NCHAN || ! (d = channel[dev2unit(dev)]))
return ENXIO;
CT_DEBUG2 (d, ("ct_open\n"));
@@ -1227,7 +1227,7 @@ static int ct_open (struct cdev *dev, int oflags, int devtype, struct thread *td
static int ct_close (struct cdev *dev, int fflag, int devtype, struct thread *td)
{
- drv_t *d = channel [minor(dev)];
+ drv_t *d = channel [dev2unit(dev)];
if (!d)
return 0;
@@ -1265,7 +1265,7 @@ static int ct_modem_status (ct_chan_t *c)
*/
static int ct_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
{
- drv_t *d = channel [minor (dev)];
+ drv_t *d = channel [dev2unit (dev)];
bdrv_t *bd;
ct_chan_t *c;
struct serial_statistics *st;
diff --git a/sys/dev/drm/drm_drv.c b/sys/dev/drm/drm_drv.c
index 7ed2393..b41b53d 100644
--- a/sys/dev/drm/drm_drv.c
+++ b/sys/dev/drm/drm_drv.c
@@ -713,7 +713,7 @@ int drm_open(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
struct drm_device *dev = NULL;
int retcode = 0;
- dev = DRIVER_SOFTC(minor(kdev));
+ dev = DRIVER_SOFTC(dev2unit(kdev));
DRM_DEBUG( "open_count = %d\n", dev->open_count );
diff --git a/sys/dev/drm/drm_fops.c b/sys/dev/drm/drm_fops.c
index 23cc1c0..f6eacd2 100644
--- a/sys/dev/drm/drm_fops.c
+++ b/sys/dev/drm/drm_fops.c
@@ -62,7 +62,7 @@ drm_file_t *drm_find_file_by_proc(struct drm_device *dev, DRM_STRUCTPROC *p)
int drm_open_helper(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
struct drm_device *dev)
{
- int m = minor(kdev);
+ int m = dev2unit(kdev);
drm_file_t *priv;
int retcode;
diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c
index dbb9f36..21871f6 100644
--- a/sys/dev/fb/fb.c
+++ b/sys/dev/fb/fb.c
@@ -350,7 +350,7 @@ fbattach(device_t dev)
#endif
-#define FB_UNIT(dev) minor(dev)
+#define FB_UNIT(dev) dev2unit(dev)
#define FB_MKMINOR(unit) (u)
#if 0 /* experimental */
diff --git a/sys/dev/fb/vgareg.h b/sys/dev/fb/vgareg.h
index 4ccef40..0a73fbd 100644
--- a/sys/dev/fb/vgareg.h
+++ b/sys/dev/fb/vgareg.h
@@ -61,7 +61,7 @@
#define GDCREG (IO_VGA + 0x0F) /* graph data controller data */
#define VGA_DRIVER_NAME "vga"
-#define VGA_UNIT(dev) minor(dev)
+#define VGA_UNIT(dev) dev2unit(dev)
#define VGA_MKMINOR(unit) (unit)
#ifdef _KERNEL
diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h
index ee510e6..39d8fd1 100644
--- a/sys/dev/firewire/firewire.h
+++ b/sys/dev/firewire/firewire.h
@@ -417,7 +417,7 @@ struct fw_crom_buf {
#endif
#define MAKEMINOR(f, u, s) \
- unit2minor((f) | (((u) & 0xff) << 8) | (s & 0xff))
+ ((f) | (((u) & 0xff) << 8) | (s & 0xff))
#define DEV2UNIT(x) ((dev2unit(x) & 0xff00) >> 8)
#define DEV2SUB(x) (dev2unit(x) & 0xff)
diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c
index 9e6602d..9cbb5e4 100644
--- a/sys/dev/firewire/fwdev.c
+++ b/sys/dev/firewire/fwdev.c
@@ -213,7 +213,7 @@ fw_open (struct cdev *dev, int flags, int fmt, fw_proc *td)
int unit = DEV2UNIT(dev);
int sub = DEV2SUB(dev);
- make_dev(&firewire_cdevsw, minor(dev),
+ make_dev(&firewire_cdevsw, dev2unit(dev),
UID_ROOT, GID_OPERATOR, 0660,
"fw%d.%d", unit, sub);
}
diff --git a/sys/dev/hptiop/hptiop.c b/sys/dev/hptiop/hptiop.c
index 88aa843..7218bc5 100644
--- a/sys/dev/hptiop/hptiop.c
+++ b/sys/dev/hptiop/hptiop.c
@@ -178,7 +178,7 @@ static struct cdevsw hptiop_cdevsw = {
#define hba_from_dev(dev) ((struct hpt_iop_hba *)(dev)->si_drv1)
#else
#define hba_from_dev(dev) \
- ((struct hpt_iop_hba *)devclass_get_softc(hptiop_devclass, minor(dev)))
+ ((struct hpt_iop_hba *)devclass_get_softc(hptiop_devclass, dev2unit(dev)))
#endif
#define BUS_SPACE_WRT4_ITL(offset, value) bus_space_write_4(hba->bar0t,\
diff --git a/sys/dev/iir/iir_ctrl.c b/sys/dev/iir/iir_ctrl.c
index 206b6ff..e5fbac94 100644
--- a/sys/dev/iir/iir_ctrl.c
+++ b/sys/dev/iir/iir_ctrl.c
@@ -152,7 +152,7 @@ iir_open(struct cdev *dev, int flags, int fmt, d_thread_t * p)
int minor_no;
struct gdt_softc *gdt;
- minor_no = minor(dev);
+ minor_no = dev2unit(dev);
gdt = gdt_minor2softc(minor_no);
if (gdt == NULL)
return (ENXIO);
@@ -170,7 +170,7 @@ iir_close(struct cdev *dev, int flags, int fmt, d_thread_t * p)
int minor_no;
struct gdt_softc *gdt;
- minor_no = minor(dev);
+ minor_no = dev2unit(dev);
gdt = gdt_minor2softc(minor_no);
if (gdt == NULL)
return (ENXIO);
@@ -188,7 +188,7 @@ iir_write(struct cdev *dev, struct uio * uio, int ioflag)
int minor_no;
struct gdt_softc *gdt;
- minor_no = minor(dev);
+ minor_no = dev2unit(dev);
gdt = gdt_minor2softc(minor_no);
if (gdt == NULL)
return (ENXIO);
@@ -206,7 +206,7 @@ iir_read(struct cdev *dev, struct uio * uio, int ioflag)
int minor_no;
struct gdt_softc *gdt;
- minor_no = minor(dev);
+ minor_no = dev2unit(dev);
gdt = gdt_minor2softc(minor_no);
if (gdt == NULL)
return (ENXIO);
@@ -230,7 +230,7 @@ iir_ioctl(struct cdev *dev, u_long cmd, caddr_t cmdarg, int flags, d_thread_t *
int minor_no;
struct gdt_softc *gdt;
- minor_no = minor(dev);
+ minor_no = dev2unit(dev);
gdt = gdt_minor2softc(minor_no);
if (gdt == NULL)
return (ENXIO);
diff --git a/sys/dev/iscsi/initiator/isc_cam.c b/sys/dev/iscsi/initiator/isc_cam.c
index ed0b74a..d978db3 100644
--- a/sys/dev/iscsi/initiator/isc_cam.c
+++ b/sys/dev/iscsi/initiator/isc_cam.c
@@ -142,7 +142,7 @@ ic_fullfeature(struct cdev *dev)
isc_session_t *sp = (isc_session_t *)dev->si_drv2;
debug_called(8);
- sdebug(3, "dev=%d sc=%p", minor(dev), isp);
+ sdebug(3, "dev=%d sc=%p", dev2unit(dev), isp);
sp->flags &= ~ISC_FFPHASE;
sp->flags |= ISC_FFPWAIT;
diff --git a/sys/dev/iscsi/initiator/iscsi.c b/sys/dev/iscsi/initiator/iscsi.c
index a572ba9..1b0b00c 100644
--- a/sys/dev/iscsi/initiator/iscsi.c
+++ b/sys/dev/iscsi/initiator/iscsi.c
@@ -115,13 +115,13 @@ iscsi_open(struct cdev *dev, int flags, int otype, struct thread *td)
{
debug_called(8);
- debug(7, "dev=%d", minor(dev));
+ debug(7, "dev=%d", dev2unit(dev));
- if(minor(dev) > MAX_SESSIONS) {
+ if(dev2unit(dev) > MAX_SESSIONS) {
// should not happen
return ENODEV;
}
- if(minor(dev) == MAX_SESSIONS) {
+ if(dev2unit(dev) == MAX_SESSIONS) {
#if 1
struct isc_softc *sc = (struct isc_softc *)dev->si_drv1;
@@ -144,12 +144,12 @@ iscsi_close(struct cdev *dev, int flag, int otyp, struct thread *td)
debug(3, "flag=%x", flag);
sc = (struct isc *)dev->si_drv1;
- if(minor(dev) == MAX_SESSIONS) {
+ if(dev2unit(dev) == MAX_SESSIONS) {
return 0;
}
sp = (isc_session_t *)dev->si_drv2;
if(sp != NULL) {
- sdebug(2, "session=%d flags=%x", minor(dev), sp->flags );
+ sdebug(2, "session=%d flags=%x", dev2unit(dev), sp->flags );
/*
| if still in full phase, this probably means
| that something went realy bad.
@@ -179,7 +179,7 @@ iscsi_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int mode, struct thread *
debug_called(8);
error = 0;
- if(minor(dev) == MAX_SESSIONS) {
+ if(dev2unit(dev) == MAX_SESSIONS) {
/*
| non Session commands
*/
@@ -205,7 +205,7 @@ iscsi_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int mode, struct thread *
if(sp == NULL)
return ENXIO;
- sdebug(6, "dev=%d cmd=%d", minor(dev), (int)(cmd & 0xff));
+ sdebug(6, "dev=%d cmd=%d", dev2unit(dev), (int)(cmd & 0xff));
switch(cmd) {
case ISCSISETSOC:
@@ -285,7 +285,7 @@ iscsi_read(struct cdev *dev, struct uio *uio, int ioflag)
sc = (struct isc_softc *)dev->si_drv1;
sp = (isc_session_t *)dev->si_drv2;
- if(minor(dev) == MAX_SESSIONS) {
+ if(dev2unit(dev) == MAX_SESSIONS) {
sprintf(buf, "/----- Session ------/\n");
uiomove(buf, strlen(buf), uio);
int i = 0;
diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c
index cc7017a..2e7981f 100644
--- a/sys/dev/isp/isp_freebsd.c
+++ b/sys/dev/isp/isp_freebsd.c
@@ -311,7 +311,7 @@ ispioctl(_DEV dev, u_long c, caddr_t addr, int flags, _IOP *td)
isp = isplist;
while (isp) {
- if (minor(dev) == device_get_unit(isp->isp_dev)) {
+ if (dev2unit(dev) == device_get_unit(isp->isp_dev)) {
break;
}
isp = isp->isp_osinfo.next;
diff --git a/sys/dev/joy/joy.c b/sys/dev/joy/joy.c
index 472985b..762cfd7 100644
--- a/sys/dev/joy/joy.c
+++ b/sys/dev/joy/joy.c
@@ -54,8 +54,8 @@ __FBSDID("$FreeBSD$");
* wait until the corresponding bit returns to 0.
*/
-#define joypart(d) (minor(d)&1)
-#define UNIT(d) ((minor(d)>>1)&3)
+#define joypart(d) (dev2unit(d)&1)
+#define UNIT(d) ((dev2unit(d)>>1)&3)
#ifndef JOY_TIMEOUT
#define JOY_TIMEOUT 2000 /* 2 milliseconds */
#endif
diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c
index 53b118d..753269a 100644
--- a/sys/dev/kbd/kbd.c
+++ b/sys/dev/kbd/kbd.c
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
#include <dev/kbd/kbdreg.h>
-#define KBD_INDEX(dev) minor(dev)
+#define KBD_INDEX(dev) dev2unit(dev)
typedef struct genkbd_softc {
int gkb_flags; /* flag/status bits */
@@ -460,7 +460,7 @@ kbd_configure(int flags)
* appropriate subdrivers.
*/
-#define KBD_UNIT(dev) minor(dev)
+#define KBD_UNIT(dev) dev2unit(dev)
static d_open_t genkbdopen;
static d_close_t genkbdclose;
diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c
index c7c7be7f..368530d 100644
--- a/sys/dev/mlx/mlx.c
+++ b/sys/dev/mlx/mlx.c
@@ -711,7 +711,7 @@ mlx_submit_buf(struct mlx_softc *sc, mlx_bio *bp)
int
mlx_open(struct cdev *dev, int flags, int fmt, struct thread *td)
{
- int unit = minor(dev);
+ int unit = dev2unit(dev);
struct mlx_softc *sc = devclass_get_softc(mlx_devclass, unit);
sc->mlx_state |= MLX_STATE_OPEN;
@@ -724,7 +724,7 @@ mlx_open(struct cdev *dev, int flags, int fmt, struct thread *td)
int
mlx_close(struct cdev *dev, int flags, int fmt, struct thread *td)
{
- int unit = minor(dev);
+ int unit = dev2unit(dev);
struct mlx_softc *sc = devclass_get_softc(mlx_devclass, unit);
sc->mlx_state &= ~MLX_STATE_OPEN;
@@ -737,7 +737,7 @@ mlx_close(struct cdev *dev, int flags, int fmt, struct thread *td)
int
mlx_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int32_t flag, struct thread *td)
{
- int unit = minor(dev);
+ int unit = dev2unit(dev);
struct mlx_softc *sc = devclass_get_softc(mlx_devclass, unit);
struct mlx_rebuild_request *rb = (struct mlx_rebuild_request *)addr;
struct mlx_rebuild_status *rs = (struct mlx_rebuild_status *)addr;
diff --git a/sys/dev/mly/mly.c b/sys/dev/mly/mly.c
index d9e78bd..2fcaadc 100644
--- a/sys/dev/mly/mly.c
+++ b/sys/dev/mly/mly.c
@@ -2834,7 +2834,7 @@ mly_print_controller(int controller)
static int
mly_user_open(struct cdev *dev, int flags, int fmt, struct thread *td)
{
- int unit = minor(dev);
+ int unit = dev2unit(dev);
struct mly_softc *sc = devclass_get_softc(devclass_find("mly"), unit);
sc->mly_state |= MLY_STATE_OPEN;
@@ -2847,7 +2847,7 @@ mly_user_open(struct cdev *dev, int flags, int fmt, struct thread *td)
static int
mly_user_close(struct cdev *dev, int flags, int fmt, struct thread *td)
{
- int unit = minor(dev);
+ int unit = dev2unit(dev);
struct mly_softc *sc = devclass_get_softc(devclass_find("mly"), unit);
sc->mly_state &= ~MLY_STATE_OPEN;
diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c
index 405be42..4f3258b 100644
--- a/sys/dev/mse/mse.c
+++ b/sys/dev/mse/mse.c
@@ -111,8 +111,8 @@ static struct cdevsw mse_cdevsw = {
static void mseintr(void *);
static timeout_t msetimeout;
-#define MSE_UNIT(dev) (minor(dev) >> 1)
-#define MSE_NBLOCKIO(dev) (minor(dev) & 0x1)
+#define MSE_UNIT(dev) (dev2unit(dev) >> 1)
+#define MSE_NBLOCKIO(dev) (dev2unit(dev) & 0x1)
#define MSEPRI (PZERO + 3)
diff --git a/sys/dev/pbio/pbio.c b/sys/dev/pbio/pbio.c
index 3ba3c12..536e6fb 100644
--- a/sys/dev/pbio/pbio.c
+++ b/sys/dev/pbio/pbio.c
@@ -79,8 +79,8 @@ static char *port_names[] = {"a", "b", "ch", "cl"};
#define PBIO_PNAME(n) (port_names[(n)])
-#define UNIT(dev) (minor(dev) >> 2)
-#define PORT(dev) (minor(dev) & 0x3)
+#define UNIT(dev) (dev2unit(dev) >> 2)
+#define PORT(dev) (dev2unit(dev) & 0x3)
#define PBIOPRI ((PZERO + 5) | PCATCH)
diff --git a/sys/dev/powermac_nvram/powermac_nvram.c b/sys/dev/powermac_nvram/powermac_nvram.c
index bcc1db1..a22c7ab 100644
--- a/sys/dev/powermac_nvram/powermac_nvram.c
+++ b/sys/dev/powermac_nvram/powermac_nvram.c
@@ -91,7 +91,7 @@ DRIVER_MODULE(powermac_nvram, nexus, powermac_nvram_driver, powermac_nvram_devcl
* Cdev methods.
*/
-#define NVRAM_UNIT(dev) minor(dev)
+#define NVRAM_UNIT(dev) dev2unit(dev)
#define NVRAM_SOFTC(unit) ((struct powermac_nvram_softc *) \
devclass_get_softc(powermac_nvram_devclass, unit))
diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c
index d507f14..c3253a2 100644
--- a/sys/dev/ppbus/lpt.c
+++ b/sys/dev/ppbus/lpt.c
@@ -461,7 +461,7 @@ lptopen(struct cdev *dev, int flags, int fmt, struct thread *td)
{
int s;
int trys, err;
- u_int unit = LPTUNIT(minor(dev));
+ u_int unit = LPTUNIT(dev2unit(dev));
struct lpt_data *sc = UNITOSOFTC(unit);
device_t lptdev = UNITODEVICE(unit);
device_t ppbus = device_get_parent(lptdev);
@@ -475,7 +475,7 @@ lptopen(struct cdev *dev, int flags, int fmt, struct thread *td)
} else
sc->sc_state |= LPTINIT;
- sc->sc_flags = LPTFLAGS(minor(dev));
+ sc->sc_flags = LPTFLAGS(dev2unit(dev));
/* Check for open with BYPASS flag set. */
if (sc->sc_flags & LP_BYPASS) {
@@ -579,7 +579,7 @@ lptopen(struct cdev *dev, int flags, int fmt, struct thread *td)
static int
lptclose(struct cdev *dev, int flags, int fmt, struct thread *td)
{
- u_int unit = LPTUNIT(minor(dev));
+ u_int unit = LPTUNIT(dev2unit(dev));
struct lpt_data *sc = UNITOSOFTC(unit);
device_t lptdev = UNITODEVICE(unit);
device_t ppbus = device_get_parent(lptdev);
@@ -688,7 +688,7 @@ lpt_pushbytes(device_t dev)
static int
lptread(struct cdev *dev, struct uio *uio, int ioflag)
{
- u_int unit = LPTUNIT(minor(dev));
+ u_int unit = LPTUNIT(dev2unit(dev));
struct lpt_data *sc = UNITOSOFTC(unit);
device_t lptdev = UNITODEVICE(unit);
device_t ppbus = device_get_parent(lptdev);
@@ -735,7 +735,7 @@ lptwrite(struct cdev *dev, struct uio *uio, int ioflag)
{
register unsigned n;
int err;
- u_int unit = LPTUNIT(minor(dev));
+ u_int unit = LPTUNIT(dev2unit(dev));
struct lpt_data *sc = UNITOSOFTC(unit);
device_t lptdev = UNITODEVICE(unit);
device_t ppbus = device_get_parent(lptdev);
@@ -902,7 +902,7 @@ static int
lptioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td)
{
int error = 0;
- u_int unit = LPTUNIT(minor(dev));
+ u_int unit = LPTUNIT(dev2unit(dev));
struct lpt_data *sc = UNITOSOFTC(unit);
u_char old_sc_irq; /* old printer IRQ status */
diff --git a/sys/dev/ppbus/pcfclock.c b/sys/dev/ppbus/pcfclock.c
index 0a65055..c7562fc 100644
--- a/sys/dev/ppbus/pcfclock.c
+++ b/sys/dev/ppbus/pcfclock.c
@@ -153,7 +153,7 @@ pcfclock_attach(device_t dev)
static int
pcfclock_open(struct cdev *dev, int flag, int fms, struct thread *td)
{
- u_int unit = minor(dev);
+ u_int unit = dev2unit(dev);
struct pcfclock_data *sc = UNITOSOFTC(unit);
device_t pcfclockdev = UNITODEVICE(unit);
device_t ppbus = device_get_parent(pcfclockdev);
@@ -174,7 +174,7 @@ pcfclock_open(struct cdev *dev, int flag, int fms, struct thread *td)
static int
pcfclock_close(struct cdev *dev, int flags, int fmt, struct thread *td)
{
- u_int unit = minor(dev);
+ u_int unit = dev2unit(dev);
struct pcfclock_data *sc = UNITOSOFTC(unit);
device_t pcfclockdev = UNITODEVICE(unit);
device_t ppbus = device_get_parent(pcfclockdev);
@@ -189,7 +189,7 @@ pcfclock_close(struct cdev *dev, int flags, int fmt, struct thread *td)
static void
pcfclock_write_cmd(struct cdev *dev, unsigned char command)
{
- u_int unit = minor(dev);
+ u_int unit = dev2unit(dev);
device_t ppidev = UNITODEVICE(unit);
device_t ppbus = device_get_parent(ppidev);
unsigned char ctr = 14;
@@ -209,7 +209,7 @@ pcfclock_write_cmd(struct cdev *dev, unsigned char command)
static void
pcfclock_display_data(struct cdev *dev, char buf[18])
{
- u_int unit = minor(dev);
+ u_int unit = dev2unit(dev);
#ifdef PCFCLOCK_VERBOSE
int year;
@@ -233,7 +233,7 @@ pcfclock_display_data(struct cdev *dev, char buf[18])
static int
pcfclock_read_data(struct cdev *dev, char *buf, ssize_t bits)
{
- u_int unit = minor(dev);
+ u_int unit = dev2unit(dev);
device_t ppidev = UNITODEVICE(unit);
device_t ppbus = device_get_parent(ppidev);
int i;
@@ -272,7 +272,7 @@ pcfclock_read_data(struct cdev *dev, char *buf, ssize_t bits)
static int
pcfclock_read_dev(struct cdev *dev, char *buf, int maxretries)
{
- u_int unit = minor(dev);
+ u_int unit = dev2unit(dev);
device_t ppidev = UNITODEVICE(unit);
device_t ppbus = device_get_parent(ppidev);
int error = 0;
@@ -302,7 +302,7 @@ pcfclock_read_dev(struct cdev *dev, char *buf, int maxretries)
static int
pcfclock_read(struct cdev *dev, struct uio *uio, int ioflag)
{
- u_int unit = minor(dev);
+ u_int unit = dev2unit(dev);
char buf[18];
int error = 0;
diff --git a/sys/dev/ppbus/ppi.c b/sys/dev/ppbus/ppi.c
index ca8aa04..e3e329f 100644
--- a/sys/dev/ppbus/ppi.c
+++ b/sys/dev/ppbus/ppi.c
@@ -252,7 +252,7 @@ ppiintr(void *arg)
static int
ppiopen(struct cdev *dev, int flags, int fmt, struct thread *td)
{
- u_int unit = minor(dev);
+ u_int unit = dev2unit(dev);
struct ppi_data *ppi = UNITOSOFTC(unit);
device_t ppidev = UNITODEVICE(unit);
device_t ppbus = device_get_parent(ppidev);
@@ -286,7 +286,7 @@ ppiopen(struct cdev *dev, int flags, int fmt, struct thread *td)
static int
ppiclose(struct cdev *dev, int flags, int fmt, struct thread *td)
{
- u_int unit = minor(dev);
+ u_int unit = dev2unit(dev);
struct ppi_data *ppi = UNITOSOFTC(unit);
device_t ppidev = UNITODEVICE(unit);
device_t ppbus = device_get_parent(ppidev);
@@ -329,7 +329,7 @@ static int
ppiread(struct cdev *dev, struct uio *uio, int ioflag)
{
#ifdef PERIPH_1284
- u_int unit = minor(dev);
+ u_int unit = dev2unit(dev);
struct ppi_data *ppi = UNITOSOFTC(unit);
device_t ppidev = UNITODEVICE(unit);
device_t ppbus = device_get_parent(ppidev);
@@ -413,7 +413,7 @@ static int
ppiwrite(struct cdev *dev, struct uio *uio, int ioflag)
{
#ifdef PERIPH_1284
- u_int unit = minor(dev);
+ u_int unit = dev2unit(dev);
struct ppi_data *ppi = UNITOSOFTC(unit);
device_t ppidev = UNITODEVICE(unit);
device_t ppbus = device_get_parent(ppidev);
@@ -499,7 +499,7 @@ error:
static int
ppiioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td)
{
- u_int unit = minor(dev);
+ u_int unit = dev2unit(dev);
device_t ppidev = UNITODEVICE(unit);
device_t ppbus = device_get_parent(ppidev);
int error = 0;
diff --git a/sys/dev/rp/rpvar.h b/sys/dev/rp/rpvar.h
index 7aff0d6..f7f28aa 100644
--- a/sys/dev/rp/rpvar.h
+++ b/sys/dev/rp/rpvar.h
@@ -37,7 +37,7 @@
*/
#define RP_UNIT(x) dv_unit(x)
-#define RP_PORT(x) (minor(x) & 0x3f)
+#define RP_PORT(x) (dev2unit(x) & 0x3f)
#define MAX_RP_PORTS 128
diff --git a/sys/dev/sound/midi/sequencer.c b/sys/dev/sound/midi/sequencer.c
index aaf53ef..9cdc2d5 100644
--- a/sys/dev/sound/midi/sequencer.c
+++ b/sys/dev/sound/midi/sequencer.c
@@ -91,8 +91,8 @@ __FBSDID("$FreeBSD$");
#define PCMMKMINOR(u, d, c) \
((((c) & 0xff) << 16) | (((u) & 0x0f) << 4) | ((d) & 0x0f))
#define MIDIMKMINOR(u, d, c) PCMMKMINOR(u, d, c)
-#define MIDIUNIT(y) ((minor(y) >> 4) & 0x0f)
-#define MIDIDEV(y) (minor(y) & 0x0f)
+#define MIDIUNIT(y) ((dev2unit(y) >> 4) & 0x0f)
+#define MIDIDEV(y) (dev2unit(y) & 0x0f)
/* These are the entries to the sequencer driver. */
static d_open_t seq_open;
diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c
index 44b825f..8d2ceed 100644
--- a/sys/dev/speaker/spkr.c
+++ b/sys/dev/speaker/spkr.c
@@ -419,7 +419,7 @@ spkropen(dev, flags, fmt, td)
(void) printf("spkropen: entering with dev = %s\n", devtoname(dev));
#endif /* DEBUG */
- if (minor(dev) != 0)
+ if (dev2unit(dev) != 0)
return(ENXIO);
else if (spkr_active)
return(EBUSY);
@@ -444,7 +444,7 @@ spkrwrite(dev, uio, ioflag)
printf("spkrwrite: entering with dev = %s, count = %d\n",
devtoname(dev), uio->uio_resid);
#endif /* DEBUG */
- if (minor(dev) != 0)
+ if (dev2unit(dev) != 0)
return(ENXIO);
else if (uio->uio_resid > (DEV_BSIZE - 1)) /* prevent system crashes */
return(E2BIG);
@@ -475,7 +475,7 @@ spkrclose(dev, flags, fmt, td)
(void) printf("spkrclose: entering with dev = %s\n", devtoname(dev));
#endif /* DEBUG */
- if (minor(dev) != 0)
+ if (dev2unit(dev) != 0)
return(ENXIO);
else {
wakeup(&endtone);
@@ -499,7 +499,7 @@ spkrioctl(dev, cmd, cmdarg, flags, td)
devtoname(dev), cmd);
#endif /* DEBUG */
- if (minor(dev) != 0)
+ if (dev2unit(dev) != 0)
return(ENXIO);
else if (cmd == SPKRTONE) {
tone_t *tp = (tone_t *)cmdarg;
diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c
index 5b97f85..e7327f8 100644
--- a/sys/dev/streams/streams.c
+++ b/sys/dev/streams/streams.c
@@ -108,7 +108,7 @@ struct streams_softc {
struct isa_device *dev;
} ;
-#define UNIT(dev) minor(dev) /* assume one minor number per unit */
+#define UNIT(dev) dev2unit(dev) /* assume one minor number per unit */
typedef struct streams_softc *sc_p;
@@ -194,7 +194,7 @@ streamsopen(struct cdev *dev, int oflags, int devtype, struct thread *td)
if (td->td_dupfd >= 0)
return ENODEV;
- switch (minor(dev)) {
+ switch (dev2unit(dev)) {
case dev_udp:
family = AF_INET;
type = SOCK_DGRAM;
diff --git a/sys/dev/tdfx/tdfx_pci.c b/sys/dev/tdfx/tdfx_pci.c
index ff4efc6..4d12a65 100644
--- a/sys/dev/tdfx/tdfx_pci.c
+++ b/sys/dev/tdfx/tdfx_pci.c
@@ -394,7 +394,7 @@ tdfx_open(struct cdev *dev, int flags, int fmt, struct thread *td)
* We can pretty much allow any opening of the device.
*/
struct tdfx_softc *tdfx_info = devclass_get_softc(tdfx_devclass,
- UNIT(minor(dev)));
+ UNIT(dev2unit(dev)));
if(tdfx_info->busy != 0) return EBUSY;
#ifdef DEBUG
printf("3dfx: Opened by #%d\n", td->td_proc->p_pid);
@@ -412,7 +412,7 @@ tdfx_close(struct cdev *dev, int fflag, int devtype, struct thread *td)
* We'll always want to close the device when it's called.
*/
struct tdfx_softc *tdfx_info = devclass_get_softc(tdfx_devclass,
- UNIT(minor(dev)));
+ UNIT(dev2unit(dev)));
if(tdfx_info->busy == 0) return EBADF;
tdfx_info->busy = 0;
#ifdef DEBUG
@@ -435,7 +435,7 @@ tdfx_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot)
/* Get the configuration for our card XXX*/
/*tdfx_info = (struct tdfx_softc*)devclass_get_softc(tdfx_devclass,
- UNIT(minor(dev)));*/
+ UNIT(dev2unit(dev)));*/
/************************/
struct tdfx_softc* tdfx_info[2];
diff --git a/sys/dev/twa/tw_osl_freebsd.c b/sys/dev/twa/tw_osl_freebsd.c
index 4b098ae..b1fd287 100644
--- a/sys/dev/twa/tw_osl_freebsd.c
+++ b/sys/dev/twa/tw_osl_freebsd.c
@@ -88,7 +88,7 @@ static devclass_t twa_devclass;
static TW_INT32
twa_open(struct cdev *dev, TW_INT32 flags, TW_INT32 fmt, d_thread_t *proc)
{
- TW_INT32 unit = minor(dev);
+ TW_INT32 unit = dev2unit(dev);
struct twa_softc *sc = devclass_get_softc(twa_devclass, unit);
tw_osli_dbg_dprintf(5, sc, "entered");
@@ -114,7 +114,7 @@ twa_open(struct cdev *dev, TW_INT32 flags, TW_INT32 fmt, d_thread_t *proc)
static TW_INT32
twa_close(struct cdev *dev, TW_INT32 flags, TW_INT32 fmt, d_thread_t *proc)
{
- TW_INT32 unit = minor(dev);
+ TW_INT32 unit = dev2unit(dev);
struct twa_softc *sc = devclass_get_softc(twa_devclass, unit);
tw_osli_dbg_dprintf(5, sc, "entered");
diff --git a/sys/dev/twe/twe_freebsd.c b/sys/dev/twe/twe_freebsd.c
index 7e03883..d5e794a 100644
--- a/sys/dev/twe/twe_freebsd.c
+++ b/sys/dev/twe/twe_freebsd.c
@@ -81,7 +81,7 @@ static struct cdevsw twe_cdevsw = {
static int
twe_open(struct cdev *dev, int flags, int fmt, d_thread_t *td)
{
- int unit = minor(dev);
+ int unit = dev2unit(dev);
struct twe_softc *sc = devclass_get_softc(twe_devclass, unit);
sc->twe_state |= TWE_STATE_OPEN;
@@ -94,7 +94,7 @@ twe_open(struct cdev *dev, int flags, int fmt, d_thread_t *td)
static int
twe_close(struct cdev *dev, int flags, int fmt, d_thread_t *td)
{
- int unit = minor(dev);
+ int unit = dev2unit(dev);
struct twe_softc *sc = devclass_get_softc(twe_devclass, unit);
sc->twe_state &= ~TWE_STATE_OPEN;
diff --git a/sys/dev/usb/ucomvar.h b/sys/dev/usb/ucomvar.h
index 32d7c04..0fcd7f3 100644
--- a/sys/dev/usb/ucomvar.h
+++ b/sys/dev/usb/ucomvar.h
@@ -82,9 +82,9 @@
#define UCOMDIALOUT_MASK 0x80000
#define UCOMCALLUNIT_MASK 0x40000
-#define UCOMUNIT(x) (minor(x) & UCOMUNIT_MASK)
-#define UCOMDIALOUT(x) (minor(x) & UCOMDIALOUT_MASK)
-#define UCOMCALLUNIT(x) (minor(x) & UCOMCALLUNIT_MASK)
+#define UCOMUNIT(x) (dev2unit(x) & UCOMUNIT_MASK)
+#define UCOMDIALOUT(x) (dev2unit(x) & UCOMDIALOUT_MASK)
+#define UCOMCALLUNIT(x) (dev2unit(x) & UCOMCALLUNIT_MASK)
#define UCOM_UNK_PORTNO -1 /* XXX */
diff --git a/sys/dev/usb/ufm.c b/sys/dev/usb/ufm.c
index 9eaf49720..2635827 100644
--- a/sys/dev/usb/ufm.c
+++ b/sys/dev/usb/ufm.c
@@ -96,7 +96,7 @@ struct ufm_softc {
int sc_refcnt;
};
-#define UFMUNIT(n) (minor(n))
+#define UFMUNIT(n) (dev2unit(n))
static device_probe_t ufm_match;
static device_attach_t ufm_attach;
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c
index 4856919..77ea2ef 100644
--- a/sys/dev/usb/ugen.c
+++ b/sys/dev/usb/ugen.c
@@ -182,8 +182,8 @@ static usb_config_descriptor_t *ugen_get_cdesc(struct ugen_softc *sc,
static usbd_status ugen_set_interface(struct ugen_softc *, int, int);
static int ugen_get_alt_index(struct ugen_softc *sc, int ifaceidx);
-#define UGENUNIT(n) ((minor(n) >> 4) & 0xf)
-#define UGENENDPOINT(n) (minor(n) & 0xf)
+#define UGENUNIT(n) ((dev2unit(n) >> 4) & 0xf)
+#define UGENENDPOINT(n) (dev2unit(n) & 0xf)
#define UGENMINOR(u, e) (((u) << 4) | (e))
static device_probe_t ugen_match;
diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c
index 44e8349..d821c01 100644
--- a/sys/dev/usb/uhid.c
+++ b/sys/dev/usb/uhid.c
@@ -137,7 +137,7 @@ struct uhid_softc {
struct cdev *dev;
};
-#define UHIDUNIT(dev) (minor(dev))
+#define UHIDUNIT(dev) (dev2unit(dev))
#define UHID_CHUNK 128 /* chunk size for read */
#define UHID_BSIZE 1020 /* buffer size */
diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c
index 909aa28..99a1433 100644
--- a/sys/dev/usb/ulpt.c
+++ b/sys/dev/usb/ulpt.c
@@ -163,8 +163,8 @@ void ulpt_tick(void *xsc);
void ieee1284_print_id(char *);
#endif
-#define ULPTUNIT(s) (minor(s) & 0x1f)
-#define ULPTFLAGS(s) (minor(s) & 0xe0)
+#define ULPTUNIT(s) (dev2unit(s) & 0x1f)
+#define ULPTFLAGS(s) (dev2unit(s) & 0xe0)
static device_probe_t ulpt_match;
static device_attach_t ulpt_attach;
diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c
index a869f75..6484303 100644
--- a/sys/dev/usb/ums.c
+++ b/sys/dev/usb/ums.c
@@ -81,7 +81,7 @@ SYSCTL_INT(_hw_usb_ums, OID_AUTO, debug, CTLFLAG_RW,
#define DPRINTFN(n,x)
#endif
-#define UMSUNIT(s) (minor(s)&0x1f)
+#define UMSUNIT(s) (dev2unit(s)&0x1f)
#define MS_TO_TICKS(ms) ((ms) * hz / 1000)
diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c
index 01e276a..5f69918 100644
--- a/sys/dev/usb/urio.c
+++ b/sys/dev/usb/urio.c
@@ -126,7 +126,7 @@ struct urio_softc {
u_char sc_dying;
};
-#define URIOUNIT(n) (minor(n))
+#define URIOUNIT(n) (dev2unit(n))
#define RIO_RW_TIMEOUT 4000 /* ms */
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c
index 0cbf6bd..b1b7d44 100644
--- a/sys/dev/usb/usb.c
+++ b/sys/dev/usb/usb.c
@@ -78,7 +78,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
-#define USBUNIT(d) (minor(d)) /* usb_discover device nodes, kthread */
+#define USBUNIT(d) (dev2unit(d)) /* usb_discover device nodes, kthread */
#define USB_DEV_MINOR 255 /* event queue device */
MALLOC_DEFINE(M_USB, "USB", "USB");
diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c
index 4c42f46..0f3293a 100644
--- a/sys/dev/usb/uscanner.c
+++ b/sys/dev/usb/uscanner.c
@@ -293,7 +293,7 @@ static int uscanner_do_read(struct uscanner_softc *, struct uio *, int);
static int uscanner_do_write(struct uscanner_softc *, struct uio *, int);
static void uscanner_do_close(struct uscanner_softc *);
-#define USCANNERUNIT(n) (minor(n))
+#define USCANNERUNIT(n) (dev2unit(n))
static device_probe_t uscanner_match;
static device_attach_t uscanner_attach;
diff --git a/sys/dev/xen/console/console.c b/sys/dev/xen/console/console.c
index ac6dc70..da778d6 100644
--- a/sys/dev/xen/console/console.c
+++ b/sys/dev/xen/console/console.c
@@ -72,7 +72,7 @@ static unsigned int cnsl_evt_reg;
static unsigned int wc, wp; /* write_cons, write_prod */
#define CDEV_MAJOR 12
-#define XCUNIT(x) (minor(x))
+#define XCUNIT(x) (dev2unit(x))
#define ISTTYOPEN(tp) ((tp) && ((tp)->t_state & TS_ISOPEN))
#define CN_LOCK_INIT(x, _name) \
mtx_init(&x, _name, NULL, MTX_SPIN|MTX_RECURSE)
diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c
index 6120723..2ac82c5 100644
--- a/sys/i386/bios/apm.c
+++ b/sys/i386/bios/apm.c
@@ -78,7 +78,7 @@ int apm_evindex;
#define SCFLAG_OCTL 0x0000002
#define SCFLAG_OPEN (SCFLAG_ONORMAL|SCFLAG_OCTL)
-#define APMDEV(dev) (minor(dev)&0x0f)
+#define APMDEV(dev) (dev2unit(dev)&0x0f)
#define APMDEV_NORMAL 0
#define APMDEV_CTL 8
diff --git a/sys/i386/bios/smapi.c b/sys/i386/bios/smapi.c
index a97e2a9..bb0b2bf 100644
--- a/sys/i386/bios/smapi.c
+++ b/sys/i386/bios/smapi.c
@@ -108,7 +108,7 @@ smapi_ioctl (dev, cmd, data, fflag, td)
int error;
error = 0;
- sc = devclass_get_softc(smapi_devclass, minor(dev));
+ sc = devclass_get_softc(smapi_devclass, dev2unit(dev));
if (sc == NULL) {
error = ENXIO;
goto fail;
diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c
index 1a9ecdd..b2deab2 100644
--- a/sys/i386/i386/mem.c
+++ b/sys/i386/i386/mem.c
@@ -91,10 +91,10 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
GIANT_REQUIRED;
- if (minor(dev) != CDEV_MINOR_MEM && minor(dev) != CDEV_MINOR_KMEM)
+ if (dev2unit(dev) != CDEV_MINOR_MEM && dev2unit(dev) != CDEV_MINOR_KMEM)
return EIO;
- if ( minor(dev) == CDEV_MINOR_KMEM && uio->uio_resid > 0) {
+ if (dev2unit(dev) == CDEV_MINOR_KMEM && uio->uio_resid > 0) {
if (uio->uio_offset < (vm_offset_t)VADDR(PTDPTDI, 0))
return (EFAULT);
@@ -112,7 +112,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
panic("memrw");
continue;
}
- if (minor(dev) == CDEV_MINOR_MEM) {
+ if (dev2unit(dev) == CDEV_MINOR_MEM) {
pa = uio->uio_offset;
pa &= ~PAGE_MASK;
} else {
@@ -166,9 +166,9 @@ int
memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr,
int prot __unused)
{
- if (minor(dev) == CDEV_MINOR_MEM)
+ if (dev2unit(dev) == CDEV_MINOR_MEM)
*paddr = offset;
- else if (minor(dev) == CDEV_MINOR_KMEM)
+ else if (dev2unit(dev) == CDEV_MINOR_KMEM)
*paddr = vtophys(offset);
/* else panic! */
return (0);
diff --git a/sys/ia64/ia64/mem.c b/sys/ia64/ia64/mem.c
index 6c5cbe7..ab213d7 100644
--- a/sys/ia64/ia64/mem.c
+++ b/sys/ia64/ia64/mem.c
@@ -94,7 +94,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
continue;
}
- if (minor(dev) == CDEV_MINOR_MEM) {
+ if (dev2unit(dev) == CDEV_MINOR_MEM) {
v = uio->uio_offset;
kmemphys:
/* Allow reads only in RAM. */
@@ -111,7 +111,7 @@ kmemphys:
error = uiomove((caddr_t)IA64_PHYS_TO_RR7(v), c, uio);
continue;
}
- else if (minor(dev) == CDEV_MINOR_KMEM) {
+ else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
v = uio->uio_offset;
if (v >= IA64_RR_BASE(6)) {
@@ -156,7 +156,7 @@ memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot)
* could be transient and hence incorrect or invalid at
* a later time.
*/
- if (minor(dev) != CDEV_MINOR_MEM)
+ if (dev2unit(dev) != CDEV_MINOR_MEM)
return (-1);
/*
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index daf7e0c..98bae88 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -674,7 +674,7 @@ make_dev_credv(int flags, struct cdevsw *devsw, int unit,
}
KASSERT(!(dev->si_flags & SI_NAMED),
("make_dev() by driver %s on pre-existing device (min=%x, name=%s)",
- devsw->d_name, minor(dev), devtoname(dev)));
+ devsw->d_name, dev2unit(dev), devtoname(dev)));
i = vsnrprintf(dev->__si_namebuf, sizeof dev->__si_namebuf, 32, fmt, ap);
if (i > (sizeof dev->__si_namebuf - 1)) {
@@ -800,7 +800,7 @@ destroy_devl(struct cdev *dev)
mtx_assert(&devmtx, MA_OWNED);
KASSERT(dev->si_flags & SI_NAMED,
- ("WARNING: Driver mistake: destroy_dev on %d\n", minor(dev)));
+ ("WARNING: Driver mistake: destroy_dev on %d\n", dev2unit(dev)));
devfs_destroy(dev);
@@ -896,7 +896,7 @@ devtoname(struct cdev *dev)
dev_relthread(dev);
}
p += strlen(p);
- mynor = minor(dev);
+ mynor = dev2unit(dev);
if (mynor < 0 || mynor > 255)
sprintf(p, "/%#x", (u_int)mynor);
else
diff --git a/sys/mips/mips/mem.c b/sys/mips/mips/mem.c
index 04cc937..53fe634 100644
--- a/sys/mips/mips/mem.c
+++ b/sys/mips/mips/mem.c
@@ -93,7 +93,7 @@ memrw(dev, uio, flags)
}
/* minor device 0 is physical memory */
- if (minor(dev) == CDEV_MINOR_MEM) {
+ if (dev2unit(dev) == CDEV_MINOR_MEM) {
v = uio->uio_offset;
c = iov->iov_len;
@@ -130,7 +130,7 @@ memrw(dev, uio, flags)
}
/* minor device 1 is kernel memory */
- else if (minor(dev) == CDEV_MINOR_KMEM) {
+ else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
v = uio->uio_offset;
c = min(iov->iov_len, MAXPHYS);
vm_offset_t addr, eaddr;
diff --git a/sys/net/if.c b/sys/net/if.c
index 0bc0329..0e5821e 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -252,7 +252,7 @@ netioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td
/* only support interface specific ioctls */
if (IOCGROUP(cmd) != 'i')
return (EOPNOTSUPP);
- idx = minor(dev);
+ idx = dev2unit(dev);
if (idx == 0) {
/*
* special network device, not interface.
@@ -291,7 +291,7 @@ netkqfilter(struct cdev *dev, struct knote *kn)
return (EINVAL);
}
- idx = minor(dev);
+ idx = dev2unit(dev);
if (idx == 0) {
klist = &V_ifklist;
} else {
diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c
index 25728f4..6dfc8c9 100644
--- a/sys/net/if_tap.c
+++ b/sys/net/if_tap.c
@@ -429,7 +429,7 @@ tapcreate(struct cdev *dev)
unit &= TAPMAXUNIT;
- TAPDEBUG("tapcreate(%s%d). minor = %#x\n", name, unit, minor(dev));
+ TAPDEBUG("tapcreate(%s%d). minor = %#x\n", name, unit, dev2unit(dev));
/* generate fake MAC address: 00 bd xx xx xx unit_no */
macaddr_hi = htons(0x00bd);
@@ -465,7 +465,7 @@ tapcreate(struct cdev *dev)
knlist_init(&tp->tap_rsel.si_note, NULL, NULL, NULL, NULL);
TAPDEBUG("interface %s is created. minor = %#x\n",
- ifp->if_xname, minor(dev));
+ ifp->if_xname, dev2unit(dev));
} /* tapcreate */
@@ -511,7 +511,7 @@ tapopen(struct cdev *dev, int flag, int mode, struct thread *td)
ifp->if_flags |= IFF_UP;
splx(s);
- TAPDEBUG("%s is open. minor = %#x\n", ifp->if_xname, minor(dev));
+ TAPDEBUG("%s is open. minor = %#x\n", ifp->if_xname, dev2unit(dev));
return (0);
} /* tapopen */
@@ -564,7 +564,7 @@ tapclose(struct cdev *dev, int foo, int bar, struct thread *td)
mtx_unlock(&tp->tap_mtx);
TAPDEBUG("%s is closed. minor = %#x\n",
- ifp->if_xname, minor(dev));
+ ifp->if_xname, dev2unit(dev));
return (0);
} /* tapclose */
@@ -851,7 +851,7 @@ tapread(struct cdev *dev, struct uio *uio, int flag)
struct mbuf *m = NULL;
int error = 0, len, s;
- TAPDEBUG("%s reading, minor = %#x\n", ifp->if_xname, minor(dev));
+ TAPDEBUG("%s reading, minor = %#x\n", ifp->if_xname, dev2unit(dev));
mtx_lock(&tp->tap_mtx);
if ((tp->tap_flags & TAP_READY) != TAP_READY) {
@@ -859,7 +859,7 @@ tapread(struct cdev *dev, struct uio *uio, int flag)
/* Unlocked read. */
TAPDEBUG("%s not ready. minor = %#x, tap_flags = 0x%x\n",
- ifp->if_xname, minor(dev), tp->tap_flags);
+ ifp->if_xname, dev2unit(dev), tp->tap_flags);
return (EHOSTDOWN);
}
@@ -901,7 +901,7 @@ tapread(struct cdev *dev, struct uio *uio, int flag)
if (m != NULL) {
TAPDEBUG("%s dropping mbuf, minor = %#x\n", ifp->if_xname,
- minor(dev));
+ dev2unit(dev));
m_freem(m);
}
@@ -923,14 +923,14 @@ tapwrite(struct cdev *dev, struct uio *uio, int flag)
struct mbuf *m;
TAPDEBUG("%s writting, minor = %#x\n",
- ifp->if_xname, minor(dev));
+ ifp->if_xname, dev2unit(dev));
if (uio->uio_resid == 0)
return (0);
if ((uio->uio_resid < 0) || (uio->uio_resid > TAPMRU)) {
TAPDEBUG("%s invalid packet len = %d, minor = %#x\n",
- ifp->if_xname, uio->uio_resid, minor(dev));
+ ifp->if_xname, uio->uio_resid, dev2unit(dev));
return (EIO);
}
@@ -983,19 +983,19 @@ tappoll(struct cdev *dev, int events, struct thread *td)
int s, revents = 0;
TAPDEBUG("%s polling, minor = %#x\n",
- ifp->if_xname, minor(dev));
+ ifp->if_xname, dev2unit(dev));
s = splimp();
if (events & (POLLIN | POLLRDNORM)) {
if (ifp->if_snd.ifq_len > 0) {
TAPDEBUG("%s have data in queue. len = %d, " \
"minor = %#x\n", ifp->if_xname,
- ifp->if_snd.ifq_len, minor(dev));
+ ifp->if_snd.ifq_len, dev2unit(dev));
revents |= (events & (POLLIN | POLLRDNORM));
} else {
TAPDEBUG("%s waiting for data, minor = %#x\n",
- ifp->if_xname, minor(dev));
+ ifp->if_xname, dev2unit(dev));
selrecord(td, &tp->tap_rsel);
}
@@ -1025,19 +1025,19 @@ tapkqfilter(struct cdev *dev, struct knote *kn)
switch (kn->kn_filter) {
case EVFILT_READ:
TAPDEBUG("%s kqfilter: EVFILT_READ, minor = %#x\n",
- ifp->if_xname, minor(dev));
+ ifp->if_xname, dev2unit(dev));
kn->kn_fop = &tap_read_filterops;
break;
case EVFILT_WRITE:
TAPDEBUG("%s kqfilter: EVFILT_WRITE, minor = %#x\n",
- ifp->if_xname, minor(dev));
+ ifp->if_xname, dev2unit(dev));
kn->kn_fop = &tap_write_filterops;
break;
default:
TAPDEBUG("%s kqfilter: invalid filter, minor = %#x\n",
- ifp->if_xname, minor(dev));
+ ifp->if_xname, dev2unit(dev));
splx(s);
return (EINVAL);
/* NOT REACHED */
@@ -1067,11 +1067,11 @@ tapkqread(struct knote *kn, long hint)
s = splimp();
if ((kn->kn_data = ifp->if_snd.ifq_len) > 0) {
TAPDEBUG("%s have data in queue. len = %d, minor = %#x\n",
- ifp->if_xname, ifp->if_snd.ifq_len, minor(dev));
+ ifp->if_xname, ifp->if_snd.ifq_len, dev2unit(dev));
ret = 1;
} else {
TAPDEBUG("%s waiting for data, minor = %#x\n",
- ifp->if_xname, minor(dev));
+ ifp->if_xname, dev2unit(dev));
ret = 0;
}
splx(s);
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 24f3187..b057b79 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -386,7 +386,7 @@ tuncreate(const char *name, struct cdev *dev)
bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));
dev->si_drv1 = sc;
TUNDEBUG(ifp, "interface %s is created, minor = %#x\n",
- ifp->if_xname, minor(dev));
+ ifp->if_xname, dev2unit(dev));
}
static int
@@ -978,19 +978,19 @@ tunkqfilter(struct cdev *dev, struct knote *kn)
switch(kn->kn_filter) {
case EVFILT_READ:
TUNDEBUG(ifp, "%s kqfilter: EVFILT_READ, minor = %#x\n",
- ifp->if_xname, minor(dev));
+ ifp->if_xname, dev2unit(dev));
kn->kn_fop = &tun_read_filterops;
break;
case EVFILT_WRITE:
TUNDEBUG(ifp, "%s kqfilter: EVFILT_WRITE, minor = %#x\n",
- ifp->if_xname, minor(dev));
+ ifp->if_xname, dev2unit(dev));
kn->kn_fop = &tun_write_filterops;
break;
default:
TUNDEBUG(ifp, "%s kqfilter: invalid filter, minor = %#x\n",
- ifp->if_xname, minor(dev));
+ ifp->if_xname, dev2unit(dev));
splx(s);
return(EINVAL);
}
@@ -1017,12 +1017,12 @@ tunkqread(struct knote *kn, long hint)
if ((kn->kn_data = ifp->if_snd.ifq_len) > 0) {
TUNDEBUG(ifp,
"%s have data in the queue. Len = %d, minor = %#x\n",
- ifp->if_xname, ifp->if_snd.ifq_len, minor(dev));
+ ifp->if_xname, ifp->if_snd.ifq_len, dev2unit(dev));
ret = 1;
} else {
TUNDEBUG(ifp,
"%s waiting for data, minor = %#x\n", ifp->if_xname,
- minor(dev));
+ dev2unit(dev));
ret = 0;
}
splx(s);
diff --git a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c
index 8db419a..17180d0 100644
--- a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c
+++ b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c
@@ -83,8 +83,8 @@ typedef struct ubtbcmfw_softc *ubtbcmfw_softc_p;
* Device methods
*/
-#define UBTBCMFW_UNIT(n) ((minor(n) >> 4) & 0xf)
-#define UBTBCMFW_ENDPOINT(n) (minor(n) & 0xf)
+#define UBTBCMFW_UNIT(n) ((dev2unit(n) >> 4) & 0xf)
+#define UBTBCMFW_ENDPOINT(n) (dev2unit(n) & 0xf)
#define UBTBCMFW_MINOR(u, e) (((u) << 4) | (e))
#define UBTBCMFW_BSIZE 1024
diff --git a/sys/netsmb/smb_dev.c b/sys/netsmb/smb_dev.c
index c77297e..50cc644 100644
--- a/sys/netsmb/smb_dev.c
+++ b/sys/netsmb/smb_dev.c
@@ -132,8 +132,8 @@ nsmb_dev_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
* someone should take care of it.
*/
if ((dev->si_flags & SI_NAMED) == 0)
- make_dev(&nsmb_cdevsw, minor(dev), cred->cr_uid, cred->cr_gid, 0700,
- NSMB_NAME"%d", dev2unit(dev));
+ make_dev(&nsmb_cdevsw, dev2unit(dev), cred->cr_uid,
+ cred->cr_gid, 0700, NSMB_NAME"%d", dev2unit(dev));
bzero(sdp, sizeof(*sdp));
/*
STAILQ_INIT(&sdp->sd_rqlist);
diff --git a/sys/pc98/cbus/gdc.c b/sys/pc98/cbus/gdc.c
index 9f990b2..3fb6c82 100644
--- a/sys/pc98/cbus/gdc.c
+++ b/sys/pc98/cbus/gdc.c
@@ -69,7 +69,7 @@
/* cdev driver declaration */
-#define GDC_UNIT(dev) minor(dev)
+#define GDC_UNIT(dev) dev2unit(dev)
#define GDC_MKMINOR(unit) (unit)
typedef struct gdc_softc {
diff --git a/sys/pc98/cbus/olpt.c b/sys/pc98/cbus/olpt.c
index f0d0da7..f86cf12 100644
--- a/sys/pc98/cbus/olpt.c
+++ b/sys/pc98/cbus/olpt.c
@@ -381,7 +381,7 @@ lptopen (struct cdev *dev, int flags, int fmt, struct thread *td)
int s;
int port;
- sc = devclass_get_softc(olpt_devclass, LPTUNIT(minor(dev)));
+ sc = devclass_get_softc(olpt_devclass, LPTUNIT(dev2unit(dev)));
if (sc->sc_port == 0)
return (ENXIO);
@@ -391,7 +391,7 @@ lptopen (struct cdev *dev, int flags, int fmt, struct thread *td)
} else
sc->sc_state |= INIT;
- sc->sc_flags = LPTFLAGS(minor(dev));
+ sc->sc_flags = LPTFLAGS(dev2unit(dev));
/* Check for open with BYPASS flag set. */
if (sc->sc_flags & LP_BYPASS) {
@@ -469,7 +469,7 @@ lptclose(struct cdev *dev, int flags, int fmt, struct thread *td)
{
struct lpt_softc *sc;
- sc = devclass_get_softc(olpt_devclass, LPTUNIT(minor(dev)));
+ sc = devclass_get_softc(olpt_devclass, LPTUNIT(dev2unit(dev)));
if(sc->sc_flags & LP_BYPASS)
goto end_close;
@@ -558,7 +558,7 @@ lptwrite(struct cdev *dev, struct uio * uio, int ioflag)
int pl, err;
struct lpt_softc *sc;
- sc = devclass_get_softc(olpt_devclass, LPTUNIT(minor(dev)));
+ sc = devclass_get_softc(olpt_devclass, LPTUNIT(dev2unit(dev)));
if(sc->sc_flags & LP_BYPASS) {
/* we can't do writes in bypass mode */
return(EPERM);
@@ -614,7 +614,7 @@ lptioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *t
{
int error = 0;
struct lpt_softc *sc;
- u_int unit = LPTUNIT(minor(dev));
+ u_int unit = LPTUNIT(dev2unit(dev));
u_char old_sc_irq; /* old printer IRQ status */
sc = devclass_get_softc(olpt_devclass, unit);
diff --git a/sys/powerpc/powerpc/mem.c b/sys/powerpc/powerpc/mem.c
index 340fa82..b3c320b 100644
--- a/sys/powerpc/powerpc/mem.c
+++ b/sys/powerpc/powerpc/mem.c
@@ -93,7 +93,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
panic("memrw");
continue;
}
- if (minor(dev) == CDEV_MINOR_MEM) {
+ if (dev2unit(dev) == CDEV_MINOR_MEM) {
kmem_direct_mapped: v = uio->uio_offset;
off = uio->uio_offset & PAGE_MASK;
@@ -111,7 +111,7 @@ kmem_direct_mapped: v = uio->uio_offset;
uiomove((void *)v, cnt, uio);
break;
}
- else if (minor(dev) == CDEV_MINOR_KMEM) {
+ else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
va = uio->uio_offset;
if ((va < VM_MIN_KERNEL_ADDRESS)
@@ -162,7 +162,7 @@ memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot)
* could be transient and hence incorrect or invalid at
* a later time.
*/
- if (minor(dev) != CDEV_MINOR_MEM)
+ if (dev2unit(dev) != CDEV_MINOR_MEM)
return (-1);
/* Only direct-mapped addresses. */
diff --git a/sys/sparc64/sparc64/mem.c b/sys/sparc64/sparc64/mem.c
index 124d387..b85f266 100644
--- a/sys/sparc64/sparc64/mem.c
+++ b/sys/sparc64/sparc64/mem.c
@@ -111,7 +111,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
panic("memrw");
continue;
}
- if (minor(dev) == CDEV_MINOR_MEM) {
+ if (dev2unit(dev) == CDEV_MINOR_MEM) {
pa = uio->uio_offset & ~PAGE_MASK;
if (!is_physical_memory(pa)) {
error = EFAULT;
@@ -159,7 +159,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
}
break;
}
- else if (minor(dev) == CDEV_MINOR_KMEM) {
+ else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
va = trunc_page(uio->uio_offset);
eva = round_page(uio->uio_offset + iov->iov_len);
OpenPOWER on IntegriCloud