Replace all calls to minor() with dev2unit().
After I removed all the unit2minor()/minor2unit() calls from the kernel yesterday, I realised calling minor() everywhere is quite confusing. Character devices now only have the ability to store a unit number, not a minor number. Remove the confusion by using dev2unit() everywhere. This commit could also be considered as a bug fix. A lot of drivers call minor(), while they should actually be calling dev2unit(). In -CURRENT this isn't a problem, but it turns out we never had any problem reports related to that issue in the past. I suspect not many people connect more than 256 pieces of the same hardware. Reviewed by: kib
This commit is contained in:
parent
45cfb1dc53
commit
6bfa9a2d66
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=183397
@ -93,7 +93,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
|
|||||||
panic("memrw");
|
panic("memrw");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (minor(dev) == CDEV_MINOR_MEM) {
|
if (dev2unit(dev) == CDEV_MINOR_MEM) {
|
||||||
v = uio->uio_offset;
|
v = uio->uio_offset;
|
||||||
kmemphys:
|
kmemphys:
|
||||||
o = v & PAGE_MASK;
|
o = v & PAGE_MASK;
|
||||||
@ -101,7 +101,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
|
|||||||
error = uiomove((void *)PHYS_TO_DMAP(v), (int)c, uio);
|
error = uiomove((void *)PHYS_TO_DMAP(v), (int)c, uio);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (minor(dev) == CDEV_MINOR_KMEM) {
|
else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
|
||||||
v = uio->uio_offset;
|
v = uio->uio_offset;
|
||||||
|
|
||||||
if (v >= DMAP_MIN_ADDRESS && v < DMAP_MAX_ADDRESS) {
|
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,
|
memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr,
|
||||||
int prot __unused)
|
int prot __unused)
|
||||||
{
|
{
|
||||||
if (minor(dev) == CDEV_MINOR_MEM)
|
if (dev2unit(dev) == CDEV_MINOR_MEM)
|
||||||
*paddr = offset;
|
*paddr = offset;
|
||||||
else if (minor(dev) == CDEV_MINOR_KMEM)
|
else if (dev2unit(dev) == CDEV_MINOR_KMEM)
|
||||||
*paddr = vtophys(offset);
|
*paddr = vtophys(offset);
|
||||||
/* else panic! */
|
/* else panic! */
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -91,7 +91,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
|
|||||||
panic("memrw");
|
panic("memrw");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (minor(dev) == CDEV_MINOR_MEM) {
|
if (dev2unit(dev) == CDEV_MINOR_MEM) {
|
||||||
int i;
|
int i;
|
||||||
int address_valid = 0;
|
int address_valid = 0;
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
|
|||||||
pmap_qremove((vm_offset_t)_tmppt, 1);
|
pmap_qremove((vm_offset_t)_tmppt, 1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (minor(dev) == CDEV_MINOR_KMEM) {
|
else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
|
||||||
c = iov->iov_len;
|
c = iov->iov_len;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -156,9 +156,9 @@ int
|
|||||||
memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr,
|
memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr,
|
||||||
int prot __unused)
|
int prot __unused)
|
||||||
{
|
{
|
||||||
if (minor(dev) == CDEV_MINOR_MEM)
|
if (dev2unit(dev) == CDEV_MINOR_MEM)
|
||||||
*paddr = offset;
|
*paddr = offset;
|
||||||
else if (minor(dev) == CDEV_MINOR_KMEM)
|
else if (dev2unit(dev) == CDEV_MINOR_KMEM)
|
||||||
*paddr = vtophys(offset);
|
*paddr = vtophys(offset);
|
||||||
/* else panic! */
|
/* else panic! */
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -175,11 +175,11 @@ typedef enum {
|
|||||||
|
|
||||||
/* units are bits 4-7, 16-21 (1024 units) */
|
/* units are bits 4-7, 16-21 (1024 units) */
|
||||||
#define SAUNIT(DEV) \
|
#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 SAMODE(z) ((dev2unit(z) & 0x3))
|
||||||
#define SADENSITY(z) (((minor(z) >> 2) & 0x3))
|
#define SADENSITY(z) (((dev2unit(z) >> 2) & 0x3))
|
||||||
#define SA_IS_CTRL(z) (minor(z) & (1 << 29))
|
#define SA_IS_CTRL(z) (dev2unit(z) & (1 << 29))
|
||||||
|
|
||||||
#define SA_NOT_CTLDEV 0
|
#define SA_NOT_CTLDEV 0
|
||||||
#define SA_CTLDEV 1
|
#define SA_CTLDEV 1
|
||||||
|
@ -155,7 +155,7 @@ struct ses_softc {
|
|||||||
#define SES_FLAG_OPEN 0x02
|
#define SES_FLAG_OPEN 0x02
|
||||||
#define SES_FLAG_INITIALIZED 0x04
|
#define SES_FLAG_INITIALIZED 0x04
|
||||||
|
|
||||||
#define SESUNIT(x) (minor((x)))
|
#define SESUNIT(x) (dev2unit((x)))
|
||||||
|
|
||||||
static d_open_t sesopen;
|
static d_open_t sesopen;
|
||||||
static d_close_t sesclose;
|
static d_close_t sesclose;
|
||||||
|
@ -180,7 +180,7 @@ targopen(struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||||||
|
|
||||||
/* Create the targ device, allocate its softc, initialize it */
|
/* Create the targ device, allocate its softc, initialize it */
|
||||||
if ((dev->si_flags & SI_NAMED) == 0) {
|
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));
|
"targ%d", dev2unit(dev));
|
||||||
}
|
}
|
||||||
MALLOC(softc, struct targ_softc *, sizeof(*softc), M_TARG,
|
MALLOC(softc, struct targ_softc *, sizeof(*softc), M_TARG,
|
||||||
|
@ -12816,7 +12816,7 @@ dtrace_state_create(struct cdev *dev)
|
|||||||
#else
|
#else
|
||||||
if (dev != NULL) {
|
if (dev != NULL) {
|
||||||
cr = dev->si_cred;
|
cr = dev->si_cred;
|
||||||
m = minor(dev);
|
m = dev2unit(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory for the state. */
|
/* 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
|
* The first minor device is the one that is cloned so there is
|
||||||
* nothing more to do here.
|
* nothing more to do here.
|
||||||
*/
|
*/
|
||||||
if (minor(dev) == 0)
|
if (dev2unit(dev) == 0)
|
||||||
return 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;
|
dtrace_state_t *state = dev->si_drv1;
|
||||||
|
|
||||||
/* Check if this is not a cloned device. */
|
/* Check if this is not a cloned device. */
|
||||||
if (minor(dev) == 0)
|
if (dev2unit(dev) == 0)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1709,7 +1709,7 @@ MALLOC_DECLARE(M_IPFILTER);
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifndef GET_MINOR
|
# ifndef GET_MINOR
|
||||||
# define GET_MINOR(x) minor(x)
|
# define GET_MINOR(x) dev2unit(x)
|
||||||
# endif
|
# endif
|
||||||
# define PANIC(x,y) if (x) panic y
|
# define PANIC(x,y) if (x) panic y
|
||||||
#endif /* _KERNEL */
|
#endif /* _KERNEL */
|
||||||
|
@ -478,7 +478,7 @@ pf_thread_create(void *v)
|
|||||||
int
|
int
|
||||||
pfopen(struct cdev *dev, int flags, int fmt, struct proc *p)
|
pfopen(struct cdev *dev, int flags, int fmt, struct proc *p)
|
||||||
{
|
{
|
||||||
if (minor(dev) >= 1)
|
if (dev2unit(dev) >= 1)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -486,7 +486,7 @@ pfopen(struct cdev *dev, int flags, int fmt, struct proc *p)
|
|||||||
int
|
int
|
||||||
pfclose(struct cdev *dev, int flags, int fmt, struct proc *p)
|
pfclose(struct cdev *dev, int flags, int fmt, struct proc *p)
|
||||||
{
|
{
|
||||||
if (minor(dev) >= 1)
|
if (dev2unit(dev) >= 1)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ static struct cdevsw agp_cdevsw = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static devclass_t agp_devclass;
|
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. */
|
/* Helper functions for implementing chipset mini drivers. */
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ amr_submit_bio(struct amr_softc *sc, struct bio *bio)
|
|||||||
static int
|
static int
|
||||||
amr_open(struct cdev *dev, int flags, int fmt, d_thread_t *td)
|
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);
|
struct amr_softc *sc = devclass_get_softc(devclass_find("amr"), unit);
|
||||||
|
|
||||||
debug_called(1);
|
debug_called(1);
|
||||||
@ -494,7 +494,7 @@ amr_prepare_ld_delete(struct amr_softc *sc)
|
|||||||
static int
|
static int
|
||||||
amr_close(struct cdev *dev, int flags, int fmt, d_thread_t *td)
|
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);
|
struct amr_softc *sc = devclass_get_softc(devclass_find("amr"), unit);
|
||||||
|
|
||||||
debug_called(1);
|
debug_called(1);
|
||||||
|
@ -256,7 +256,7 @@ MODULE_DEPEND(arcmsr, cam, 1, 1, 1);
|
|||||||
#if __FreeBSD_version < 503000
|
#if __FreeBSD_version < 503000
|
||||||
struct AdapterControlBlock *acb=dev->si_drv1;
|
struct AdapterControlBlock *acb=dev->si_drv1;
|
||||||
#else
|
#else
|
||||||
int unit = minor(dev);
|
int unit = dev2unit(dev);
|
||||||
struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit);
|
struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit);
|
||||||
#endif
|
#endif
|
||||||
if(acb==NULL) {
|
if(acb==NULL) {
|
||||||
@ -281,7 +281,7 @@ MODULE_DEPEND(arcmsr, cam, 1, 1, 1);
|
|||||||
#if __FreeBSD_version < 503000
|
#if __FreeBSD_version < 503000
|
||||||
struct AdapterControlBlock *acb=dev->si_drv1;
|
struct AdapterControlBlock *acb=dev->si_drv1;
|
||||||
#else
|
#else
|
||||||
int unit = minor(dev);
|
int unit = dev2unit(dev);
|
||||||
struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit);
|
struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit);
|
||||||
#endif
|
#endif
|
||||||
if(acb==NULL) {
|
if(acb==NULL) {
|
||||||
@ -306,7 +306,7 @@ MODULE_DEPEND(arcmsr, cam, 1, 1, 1);
|
|||||||
#if __FreeBSD_version < 503000
|
#if __FreeBSD_version < 503000
|
||||||
struct AdapterControlBlock *acb=dev->si_drv1;
|
struct AdapterControlBlock *acb=dev->si_drv1;
|
||||||
#else
|
#else
|
||||||
int unit = minor(dev);
|
int unit = dev2unit(dev);
|
||||||
struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit);
|
struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3113,7 +3113,7 @@ typedef U32 DPT_RTN_T;
|
|||||||
#undef SCSI_RESET /* Conflicts with "scsi/scsiconf.h" defintion */
|
#undef SCSI_RESET /* Conflicts with "scsi/scsiconf.h" defintion */
|
||||||
#include "dev/asr/osd_unix.h"
|
#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;
|
static u_int8_t ASR_ctlr_held;
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ ast_close(struct cdev *cdev, int flags, int fmt, struct thread *td)
|
|||||||
ast_write_filemark(dev, ATAPI_WF_WRITE);
|
ast_write_filemark(dev, ATAPI_WF_WRITE);
|
||||||
|
|
||||||
/* if minor is even rewind on close */
|
/* if minor is even rewind on close */
|
||||||
if (!(minor(cdev) & 0x01))
|
if (!(dev2unit(cdev) & 0x01))
|
||||||
ast_rewind(dev);
|
ast_rewind(dev);
|
||||||
|
|
||||||
if (stp->cap.lock && count_dev(cdev) == 1)
|
if (stp->cap.lock && count_dev(cdev) == 1)
|
||||||
|
@ -141,8 +141,8 @@ __FBSDID("$FreeBSD$");
|
|||||||
(((b[0] & 0x30) >> 2) | ((b[1] & 0x30) >> 4))
|
(((b[0] & 0x30) >> 2) | ((b[1] & 0x30) >> 4))
|
||||||
|
|
||||||
/* some macros */
|
/* some macros */
|
||||||
#define PSM_UNIT(dev) (minor(dev) >> 1)
|
#define PSM_UNIT(dev) (dev2unit(dev) >> 1)
|
||||||
#define PSM_NBLOCKIO(dev) (minor(dev) & 1)
|
#define PSM_NBLOCKIO(dev) (dev2unit(dev) & 1)
|
||||||
#define PSM_MKMINOR(unit,block) (((unit) << 1) | ((block) ? 0:1))
|
#define PSM_MKMINOR(unit,block) (((unit) << 1) | ((block) ? 0:1))
|
||||||
|
|
||||||
/* ring buffer */
|
/* ring buffer */
|
||||||
|
@ -584,7 +584,7 @@ bktr_open( struct cdev *dev, int flags, int fmt, struct thread *td )
|
|||||||
int unit;
|
int unit;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
unit = UNIT( minor(dev) );
|
unit = UNIT( dev2unit(dev) );
|
||||||
|
|
||||||
/* Get the device data */
|
/* Get the device data */
|
||||||
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
|
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
|
#endif
|
||||||
|
|
||||||
switch ( FUNCTION( minor(dev) ) ) {
|
switch ( FUNCTION( dev2unit(dev) ) ) {
|
||||||
case VIDEO_DEV:
|
case VIDEO_DEV:
|
||||||
result = video_open( bktr );
|
result = video_open( bktr );
|
||||||
break;
|
break;
|
||||||
@ -684,7 +684,7 @@ bktr_close( struct cdev *dev, int flags, int fmt, struct thread *td )
|
|||||||
int unit;
|
int unit;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
unit = UNIT( minor(dev) );
|
unit = UNIT( dev2unit(dev) );
|
||||||
|
|
||||||
/* Get the device data */
|
/* Get the device data */
|
||||||
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
|
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);
|
return (ENXIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( FUNCTION( minor(dev) ) ) {
|
switch ( FUNCTION( dev2unit(dev) ) ) {
|
||||||
case VIDEO_DEV:
|
case VIDEO_DEV:
|
||||||
result = video_close( bktr );
|
result = video_close( bktr );
|
||||||
break;
|
break;
|
||||||
@ -722,7 +722,7 @@ bktr_read( struct cdev *dev, struct uio *uio, int ioflag )
|
|||||||
bktr_ptr_t bktr;
|
bktr_ptr_t bktr;
|
||||||
int unit;
|
int unit;
|
||||||
|
|
||||||
unit = UNIT(minor(dev));
|
unit = UNIT(dev2unit(dev));
|
||||||
|
|
||||||
/* Get the device data */
|
/* Get the device data */
|
||||||
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
|
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);
|
return (ENXIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( FUNCTION( minor(dev) ) ) {
|
switch ( FUNCTION( dev2unit(dev) ) ) {
|
||||||
case VIDEO_DEV:
|
case VIDEO_DEV:
|
||||||
return( video_read( bktr, unit, dev, uio ) );
|
return( video_read( bktr, unit, dev, uio ) );
|
||||||
case VBI_DEV:
|
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;
|
bktr_ptr_t bktr;
|
||||||
int unit;
|
int unit;
|
||||||
|
|
||||||
unit = UNIT(minor(dev));
|
unit = UNIT(dev2unit(dev));
|
||||||
|
|
||||||
/* Get the device data */
|
/* Get the device data */
|
||||||
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
|
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 );
|
return( ENOMEM );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch ( FUNCTION( minor(dev) ) ) {
|
switch ( FUNCTION( dev2unit(dev) ) ) {
|
||||||
case VIDEO_DEV:
|
case VIDEO_DEV:
|
||||||
return( video_ioctl( bktr, unit, cmd, arg, td ) );
|
return( video_ioctl( bktr, unit, cmd, arg, td ) );
|
||||||
case TUNER_DEV:
|
case TUNER_DEV:
|
||||||
@ -799,9 +799,9 @@ bktr_mmap( struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot )
|
|||||||
int unit;
|
int unit;
|
||||||
bktr_ptr_t bktr;
|
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 );
|
return( -1 );
|
||||||
|
|
||||||
/* Get the device data */
|
/* Get the device data */
|
||||||
@ -832,7 +832,7 @@ bktr_poll( struct cdev *dev, int events, struct thread *td)
|
|||||||
int revents = 0;
|
int revents = 0;
|
||||||
DECLARE_INTR_MASK(s);
|
DECLARE_INTR_MASK(s);
|
||||||
|
|
||||||
unit = UNIT(minor(dev));
|
unit = UNIT(dev2unit(dev));
|
||||||
|
|
||||||
/* Get the device data */
|
/* Get the device data */
|
||||||
bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
|
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)) {
|
if (events & (POLLIN | POLLRDNORM)) {
|
||||||
|
|
||||||
switch ( FUNCTION( minor(dev) ) ) {
|
switch ( FUNCTION( dev2unit(dev) ) ) {
|
||||||
case VBI_DEV:
|
case VBI_DEV:
|
||||||
if(bktr->vbisize == 0)
|
if(bktr->vbisize == 0)
|
||||||
selrecord(td, &bktr->vbi_select);
|
selrecord(td, &bktr->vbi_select);
|
||||||
@ -1182,8 +1182,8 @@ free_bktr_mem(bktr, dmap, kva)
|
|||||||
#define TUNER_DEV 0x01
|
#define TUNER_DEV 0x01
|
||||||
#define VBI_DEV 0x02
|
#define VBI_DEV 0x02
|
||||||
|
|
||||||
#define UNIT(x) (minor((x) & 0x0f))
|
#define UNIT(x) (dev2unit((x) & 0x0f))
|
||||||
#define FUNCTION(x) (minor((x >> 4) & 0x0f))
|
#define FUNCTION(x) (dev2unit((x >> 4) & 0x0f))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
@ -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)
|
static int ce_open (struct cdev *dev, int oflags, int devtype, struct thread *td)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int unit = minor (dev);
|
int unit = dev2unit (dev);
|
||||||
drv_t *d;
|
drv_t *d;
|
||||||
|
|
||||||
if (unit >= NBRD*NCHAN || ! (d = channel[unit]))
|
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)
|
static int ce_close (struct cdev *dev, int fflag, int devtype, struct thread *td)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
drv_t *d = channel [minor (dev)];
|
drv_t *d = channel [dev2unit (dev)];
|
||||||
|
|
||||||
CE_DEBUG2 (d, ("ce_close\n"));
|
CE_DEBUG2 (d, ("ce_close\n"));
|
||||||
return 0;
|
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)
|
static int ce_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
drv_t *d = channel [minor (dev)];
|
drv_t *d = channel [dev2unit (dev)];
|
||||||
bdrv_t *bd = d->board->sys;
|
bdrv_t *bd = d->board->sys;
|
||||||
ce_chan_t *c = d->chan;
|
ce_chan_t *c = d->chan;
|
||||||
struct serial_statistics *st;
|
struct serial_statistics *st;
|
||||||
|
@ -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)
|
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;
|
drv_t *d;
|
||||||
|
|
||||||
if (unit >= NBRD*NCHAN || ! (d = channel[unit]))
|
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)
|
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"));
|
CP_DEBUG2 (d, ("cp_close\n"));
|
||||||
return 0;
|
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)
|
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;
|
bdrv_t *bd = d->board->sys;
|
||||||
cp_chan_t *c = d->chan;
|
cp_chan_t *c = d->chan;
|
||||||
struct serial_statistics *st;
|
struct serial_statistics *st;
|
||||||
|
@ -144,7 +144,7 @@ cpuctl_ioctl(struct cdev *dev, u_long cmd, caddr_t data,
|
|||||||
int flags, struct thread *td)
|
int flags, struct thread *td)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int cpu = minor(dev);
|
int cpu = dev2unit(dev);
|
||||||
|
|
||||||
if (cpu >= mp_ncpus || !cpu_enabled(cpu)) {
|
if (cpu >= mp_ncpus || !cpu_enabled(cpu)) {
|
||||||
DPRINTF("[cpuctl,%d]: bad cpu number %d\n", __LINE__, 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 ret = 0;
|
||||||
int cpu;
|
int cpu;
|
||||||
|
|
||||||
cpu = minor(dev);
|
cpu = dev2unit(dev);
|
||||||
if (cpu >= mp_ncpus || !cpu_enabled(cpu)) {
|
if (cpu >= mp_ncpus || !cpu_enabled(cpu)) {
|
||||||
DPRINTF("[cpuctl,%d]: incorrect cpu number %d\n", __LINE__,
|
DPRINTF("[cpuctl,%d]: incorrect cpu number %d\n", __LINE__,
|
||||||
cpu);
|
cpu);
|
||||||
|
@ -1218,7 +1218,7 @@ static int ct_open (struct cdev *dev, int oflags, int devtype, struct thread *td
|
|||||||
{
|
{
|
||||||
drv_t *d;
|
drv_t *d;
|
||||||
|
|
||||||
if (minor(dev) >= NCTAU*NCHAN || ! (d = channel[minor(dev)]))
|
if (dev2unit(dev) >= NCTAU*NCHAN || ! (d = channel[dev2unit(dev)]))
|
||||||
return ENXIO;
|
return ENXIO;
|
||||||
|
|
||||||
CT_DEBUG2 (d, ("ct_open\n"));
|
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)
|
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)
|
if (!d)
|
||||||
return 0;
|
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)
|
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;
|
bdrv_t *bd;
|
||||||
ct_chan_t *c;
|
ct_chan_t *c;
|
||||||
struct serial_statistics *st;
|
struct serial_statistics *st;
|
||||||
|
@ -713,7 +713,7 @@ int drm_open(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
|
|||||||
struct drm_device *dev = NULL;
|
struct drm_device *dev = NULL;
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
|
|
||||||
dev = DRIVER_SOFTC(minor(kdev));
|
dev = DRIVER_SOFTC(dev2unit(kdev));
|
||||||
|
|
||||||
DRM_DEBUG( "open_count = %d\n", dev->open_count );
|
DRM_DEBUG( "open_count = %d\n", dev->open_count );
|
||||||
|
|
||||||
|
@ -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,
|
int drm_open_helper(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
|
||||||
struct drm_device *dev)
|
struct drm_device *dev)
|
||||||
{
|
{
|
||||||
int m = minor(kdev);
|
int m = dev2unit(kdev);
|
||||||
drm_file_t *priv;
|
drm_file_t *priv;
|
||||||
int retcode;
|
int retcode;
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ fbattach(device_t dev)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FB_UNIT(dev) minor(dev)
|
#define FB_UNIT(dev) dev2unit(dev)
|
||||||
#define FB_MKMINOR(unit) (u)
|
#define FB_MKMINOR(unit) (u)
|
||||||
|
|
||||||
#if 0 /* experimental */
|
#if 0 /* experimental */
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
#define GDCREG (IO_VGA + 0x0F) /* graph data controller data */
|
#define GDCREG (IO_VGA + 0x0F) /* graph data controller data */
|
||||||
|
|
||||||
#define VGA_DRIVER_NAME "vga"
|
#define VGA_DRIVER_NAME "vga"
|
||||||
#define VGA_UNIT(dev) minor(dev)
|
#define VGA_UNIT(dev) dev2unit(dev)
|
||||||
#define VGA_MKMINOR(unit) (unit)
|
#define VGA_MKMINOR(unit) (unit)
|
||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
|
@ -417,7 +417,7 @@ struct fw_crom_buf {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAKEMINOR(f, u, s) \
|
#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 DEV2UNIT(x) ((dev2unit(x) & 0xff00) >> 8)
|
||||||
#define DEV2SUB(x) (dev2unit(x) & 0xff)
|
#define DEV2SUB(x) (dev2unit(x) & 0xff)
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ fw_open (struct cdev *dev, int flags, int fmt, fw_proc *td)
|
|||||||
int unit = DEV2UNIT(dev);
|
int unit = DEV2UNIT(dev);
|
||||||
int sub = DEV2SUB(dev);
|
int sub = DEV2SUB(dev);
|
||||||
|
|
||||||
make_dev(&firewire_cdevsw, minor(dev),
|
make_dev(&firewire_cdevsw, dev2unit(dev),
|
||||||
UID_ROOT, GID_OPERATOR, 0660,
|
UID_ROOT, GID_OPERATOR, 0660,
|
||||||
"fw%d.%d", unit, sub);
|
"fw%d.%d", unit, sub);
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ static struct cdevsw hptiop_cdevsw = {
|
|||||||
#define hba_from_dev(dev) ((struct hpt_iop_hba *)(dev)->si_drv1)
|
#define hba_from_dev(dev) ((struct hpt_iop_hba *)(dev)->si_drv1)
|
||||||
#else
|
#else
|
||||||
#define hba_from_dev(dev) \
|
#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
|
#endif
|
||||||
|
|
||||||
#define BUS_SPACE_WRT4_ITL(offset, value) bus_space_write_4(hba->bar0t,\
|
#define BUS_SPACE_WRT4_ITL(offset, value) bus_space_write_4(hba->bar0t,\
|
||||||
|
@ -152,7 +152,7 @@ iir_open(struct cdev *dev, int flags, int fmt, d_thread_t * p)
|
|||||||
int minor_no;
|
int minor_no;
|
||||||
struct gdt_softc *gdt;
|
struct gdt_softc *gdt;
|
||||||
|
|
||||||
minor_no = minor(dev);
|
minor_no = dev2unit(dev);
|
||||||
gdt = gdt_minor2softc(minor_no);
|
gdt = gdt_minor2softc(minor_no);
|
||||||
if (gdt == NULL)
|
if (gdt == NULL)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
@ -170,7 +170,7 @@ iir_close(struct cdev *dev, int flags, int fmt, d_thread_t * p)
|
|||||||
int minor_no;
|
int minor_no;
|
||||||
struct gdt_softc *gdt;
|
struct gdt_softc *gdt;
|
||||||
|
|
||||||
minor_no = minor(dev);
|
minor_no = dev2unit(dev);
|
||||||
gdt = gdt_minor2softc(minor_no);
|
gdt = gdt_minor2softc(minor_no);
|
||||||
if (gdt == NULL)
|
if (gdt == NULL)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
@ -188,7 +188,7 @@ iir_write(struct cdev *dev, struct uio * uio, int ioflag)
|
|||||||
int minor_no;
|
int minor_no;
|
||||||
struct gdt_softc *gdt;
|
struct gdt_softc *gdt;
|
||||||
|
|
||||||
minor_no = minor(dev);
|
minor_no = dev2unit(dev);
|
||||||
gdt = gdt_minor2softc(minor_no);
|
gdt = gdt_minor2softc(minor_no);
|
||||||
if (gdt == NULL)
|
if (gdt == NULL)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
@ -206,7 +206,7 @@ iir_read(struct cdev *dev, struct uio * uio, int ioflag)
|
|||||||
int minor_no;
|
int minor_no;
|
||||||
struct gdt_softc *gdt;
|
struct gdt_softc *gdt;
|
||||||
|
|
||||||
minor_no = minor(dev);
|
minor_no = dev2unit(dev);
|
||||||
gdt = gdt_minor2softc(minor_no);
|
gdt = gdt_minor2softc(minor_no);
|
||||||
if (gdt == NULL)
|
if (gdt == NULL)
|
||||||
return (ENXIO);
|
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;
|
int minor_no;
|
||||||
struct gdt_softc *gdt;
|
struct gdt_softc *gdt;
|
||||||
|
|
||||||
minor_no = minor(dev);
|
minor_no = dev2unit(dev);
|
||||||
gdt = gdt_minor2softc(minor_no);
|
gdt = gdt_minor2softc(minor_no);
|
||||||
if (gdt == NULL)
|
if (gdt == NULL)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
|
@ -142,7 +142,7 @@ ic_fullfeature(struct cdev *dev)
|
|||||||
isc_session_t *sp = (isc_session_t *)dev->si_drv2;
|
isc_session_t *sp = (isc_session_t *)dev->si_drv2;
|
||||||
|
|
||||||
debug_called(8);
|
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_FFPHASE;
|
||||||
sp->flags |= ISC_FFPWAIT;
|
sp->flags |= ISC_FFPWAIT;
|
||||||
|
@ -115,13 +115,13 @@ iscsi_open(struct cdev *dev, int flags, int otype, struct thread *td)
|
|||||||
{
|
{
|
||||||
debug_called(8);
|
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
|
// should not happen
|
||||||
return ENODEV;
|
return ENODEV;
|
||||||
}
|
}
|
||||||
if(minor(dev) == MAX_SESSIONS) {
|
if(dev2unit(dev) == MAX_SESSIONS) {
|
||||||
#if 1
|
#if 1
|
||||||
struct isc_softc *sc = (struct isc_softc *)dev->si_drv1;
|
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);
|
debug(3, "flag=%x", flag);
|
||||||
|
|
||||||
sc = (struct isc *)dev->si_drv1;
|
sc = (struct isc *)dev->si_drv1;
|
||||||
if(minor(dev) == MAX_SESSIONS) {
|
if(dev2unit(dev) == MAX_SESSIONS) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
sp = (isc_session_t *)dev->si_drv2;
|
sp = (isc_session_t *)dev->si_drv2;
|
||||||
if(sp != NULL) {
|
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
|
| if still in full phase, this probably means
|
||||||
| that something went realy bad.
|
| 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);
|
debug_called(8);
|
||||||
|
|
||||||
error = 0;
|
error = 0;
|
||||||
if(minor(dev) == MAX_SESSIONS) {
|
if(dev2unit(dev) == MAX_SESSIONS) {
|
||||||
/*
|
/*
|
||||||
| non Session commands
|
| 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)
|
if(sp == NULL)
|
||||||
return ENXIO;
|
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) {
|
switch(cmd) {
|
||||||
case ISCSISETSOC:
|
case ISCSISETSOC:
|
||||||
@ -285,7 +285,7 @@ iscsi_read(struct cdev *dev, struct uio *uio, int ioflag)
|
|||||||
|
|
||||||
sc = (struct isc_softc *)dev->si_drv1;
|
sc = (struct isc_softc *)dev->si_drv1;
|
||||||
sp = (isc_session_t *)dev->si_drv2;
|
sp = (isc_session_t *)dev->si_drv2;
|
||||||
if(minor(dev) == MAX_SESSIONS) {
|
if(dev2unit(dev) == MAX_SESSIONS) {
|
||||||
sprintf(buf, "/----- Session ------/\n");
|
sprintf(buf, "/----- Session ------/\n");
|
||||||
uiomove(buf, strlen(buf), uio);
|
uiomove(buf, strlen(buf), uio);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -311,7 +311,7 @@ ispioctl(_DEV dev, u_long c, caddr_t addr, int flags, _IOP *td)
|
|||||||
|
|
||||||
isp = isplist;
|
isp = isplist;
|
||||||
while (isp) {
|
while (isp) {
|
||||||
if (minor(dev) == device_get_unit(isp->isp_dev)) {
|
if (dev2unit(dev) == device_get_unit(isp->isp_dev)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
isp = isp->isp_osinfo.next;
|
isp = isp->isp_osinfo.next;
|
||||||
|
@ -54,8 +54,8 @@ __FBSDID("$FreeBSD$");
|
|||||||
* wait until the corresponding bit returns to 0.
|
* wait until the corresponding bit returns to 0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define joypart(d) (minor(d)&1)
|
#define joypart(d) (dev2unit(d)&1)
|
||||||
#define UNIT(d) ((minor(d)>>1)&3)
|
#define UNIT(d) ((dev2unit(d)>>1)&3)
|
||||||
#ifndef JOY_TIMEOUT
|
#ifndef JOY_TIMEOUT
|
||||||
#define JOY_TIMEOUT 2000 /* 2 milliseconds */
|
#define JOY_TIMEOUT 2000 /* 2 milliseconds */
|
||||||
#endif
|
#endif
|
||||||
|
@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include <dev/kbd/kbdreg.h>
|
#include <dev/kbd/kbdreg.h>
|
||||||
|
|
||||||
#define KBD_INDEX(dev) minor(dev)
|
#define KBD_INDEX(dev) dev2unit(dev)
|
||||||
|
|
||||||
typedef struct genkbd_softc {
|
typedef struct genkbd_softc {
|
||||||
int gkb_flags; /* flag/status bits */
|
int gkb_flags; /* flag/status bits */
|
||||||
@ -460,7 +460,7 @@ kbd_configure(int flags)
|
|||||||
* appropriate subdrivers.
|
* appropriate subdrivers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define KBD_UNIT(dev) minor(dev)
|
#define KBD_UNIT(dev) dev2unit(dev)
|
||||||
|
|
||||||
static d_open_t genkbdopen;
|
static d_open_t genkbdopen;
|
||||||
static d_close_t genkbdclose;
|
static d_close_t genkbdclose;
|
||||||
|
@ -711,7 +711,7 @@ mlx_submit_buf(struct mlx_softc *sc, mlx_bio *bp)
|
|||||||
int
|
int
|
||||||
mlx_open(struct cdev *dev, int flags, int fmt, struct thread *td)
|
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);
|
struct mlx_softc *sc = devclass_get_softc(mlx_devclass, unit);
|
||||||
|
|
||||||
sc->mlx_state |= MLX_STATE_OPEN;
|
sc->mlx_state |= MLX_STATE_OPEN;
|
||||||
@ -724,7 +724,7 @@ mlx_open(struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||||||
int
|
int
|
||||||
mlx_close(struct cdev *dev, int flags, int fmt, struct thread *td)
|
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);
|
struct mlx_softc *sc = devclass_get_softc(mlx_devclass, unit);
|
||||||
|
|
||||||
sc->mlx_state &= ~MLX_STATE_OPEN;
|
sc->mlx_state &= ~MLX_STATE_OPEN;
|
||||||
@ -737,7 +737,7 @@ mlx_close(struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||||||
int
|
int
|
||||||
mlx_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int32_t flag, struct thread *td)
|
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_softc *sc = devclass_get_softc(mlx_devclass, unit);
|
||||||
struct mlx_rebuild_request *rb = (struct mlx_rebuild_request *)addr;
|
struct mlx_rebuild_request *rb = (struct mlx_rebuild_request *)addr;
|
||||||
struct mlx_rebuild_status *rs = (struct mlx_rebuild_status *)addr;
|
struct mlx_rebuild_status *rs = (struct mlx_rebuild_status *)addr;
|
||||||
|
@ -2834,7 +2834,7 @@ mly_print_controller(int controller)
|
|||||||
static int
|
static int
|
||||||
mly_user_open(struct cdev *dev, int flags, int fmt, struct thread *td)
|
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);
|
struct mly_softc *sc = devclass_get_softc(devclass_find("mly"), unit);
|
||||||
|
|
||||||
sc->mly_state |= MLY_STATE_OPEN;
|
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
|
static int
|
||||||
mly_user_close(struct cdev *dev, int flags, int fmt, struct thread *td)
|
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);
|
struct mly_softc *sc = devclass_get_softc(devclass_find("mly"), unit);
|
||||||
|
|
||||||
sc->mly_state &= ~MLY_STATE_OPEN;
|
sc->mly_state &= ~MLY_STATE_OPEN;
|
||||||
|
@ -111,8 +111,8 @@ static struct cdevsw mse_cdevsw = {
|
|||||||
static void mseintr(void *);
|
static void mseintr(void *);
|
||||||
static timeout_t msetimeout;
|
static timeout_t msetimeout;
|
||||||
|
|
||||||
#define MSE_UNIT(dev) (minor(dev) >> 1)
|
#define MSE_UNIT(dev) (dev2unit(dev) >> 1)
|
||||||
#define MSE_NBLOCKIO(dev) (minor(dev) & 0x1)
|
#define MSE_NBLOCKIO(dev) (dev2unit(dev) & 0x1)
|
||||||
|
|
||||||
#define MSEPRI (PZERO + 3)
|
#define MSEPRI (PZERO + 3)
|
||||||
|
|
||||||
|
@ -79,8 +79,8 @@ static char *port_names[] = {"a", "b", "ch", "cl"};
|
|||||||
|
|
||||||
#define PBIO_PNAME(n) (port_names[(n)])
|
#define PBIO_PNAME(n) (port_names[(n)])
|
||||||
|
|
||||||
#define UNIT(dev) (minor(dev) >> 2)
|
#define UNIT(dev) (dev2unit(dev) >> 2)
|
||||||
#define PORT(dev) (minor(dev) & 0x3)
|
#define PORT(dev) (dev2unit(dev) & 0x3)
|
||||||
|
|
||||||
#define PBIOPRI ((PZERO + 5) | PCATCH)
|
#define PBIOPRI ((PZERO + 5) | PCATCH)
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ DRIVER_MODULE(powermac_nvram, nexus, powermac_nvram_driver, powermac_nvram_devcl
|
|||||||
* Cdev methods.
|
* Cdev methods.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NVRAM_UNIT(dev) minor(dev)
|
#define NVRAM_UNIT(dev) dev2unit(dev)
|
||||||
#define NVRAM_SOFTC(unit) ((struct powermac_nvram_softc *) \
|
#define NVRAM_SOFTC(unit) ((struct powermac_nvram_softc *) \
|
||||||
devclass_get_softc(powermac_nvram_devclass, unit))
|
devclass_get_softc(powermac_nvram_devclass, unit))
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ lptopen(struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
int trys, err;
|
int trys, err;
|
||||||
u_int unit = LPTUNIT(minor(dev));
|
u_int unit = LPTUNIT(dev2unit(dev));
|
||||||
struct lpt_data *sc = UNITOSOFTC(unit);
|
struct lpt_data *sc = UNITOSOFTC(unit);
|
||||||
device_t lptdev = UNITODEVICE(unit);
|
device_t lptdev = UNITODEVICE(unit);
|
||||||
device_t ppbus = device_get_parent(lptdev);
|
device_t ppbus = device_get_parent(lptdev);
|
||||||
@ -475,7 +475,7 @@ lptopen(struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||||||
} else
|
} else
|
||||||
sc->sc_state |= LPTINIT;
|
sc->sc_state |= LPTINIT;
|
||||||
|
|
||||||
sc->sc_flags = LPTFLAGS(minor(dev));
|
sc->sc_flags = LPTFLAGS(dev2unit(dev));
|
||||||
|
|
||||||
/* Check for open with BYPASS flag set. */
|
/* Check for open with BYPASS flag set. */
|
||||||
if (sc->sc_flags & LP_BYPASS) {
|
if (sc->sc_flags & LP_BYPASS) {
|
||||||
@ -579,7 +579,7 @@ lptopen(struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||||||
static int
|
static int
|
||||||
lptclose(struct cdev *dev, int flags, int fmt, struct thread *td)
|
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);
|
struct lpt_data *sc = UNITOSOFTC(unit);
|
||||||
device_t lptdev = UNITODEVICE(unit);
|
device_t lptdev = UNITODEVICE(unit);
|
||||||
device_t ppbus = device_get_parent(lptdev);
|
device_t ppbus = device_get_parent(lptdev);
|
||||||
@ -688,7 +688,7 @@ lpt_pushbytes(device_t dev)
|
|||||||
static int
|
static int
|
||||||
lptread(struct cdev *dev, struct uio *uio, int ioflag)
|
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);
|
struct lpt_data *sc = UNITOSOFTC(unit);
|
||||||
device_t lptdev = UNITODEVICE(unit);
|
device_t lptdev = UNITODEVICE(unit);
|
||||||
device_t ppbus = device_get_parent(lptdev);
|
device_t ppbus = device_get_parent(lptdev);
|
||||||
@ -735,7 +735,7 @@ lptwrite(struct cdev *dev, struct uio *uio, int ioflag)
|
|||||||
{
|
{
|
||||||
register unsigned n;
|
register unsigned n;
|
||||||
int err;
|
int err;
|
||||||
u_int unit = LPTUNIT(minor(dev));
|
u_int unit = LPTUNIT(dev2unit(dev));
|
||||||
struct lpt_data *sc = UNITOSOFTC(unit);
|
struct lpt_data *sc = UNITOSOFTC(unit);
|
||||||
device_t lptdev = UNITODEVICE(unit);
|
device_t lptdev = UNITODEVICE(unit);
|
||||||
device_t ppbus = device_get_parent(lptdev);
|
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)
|
lptioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td)
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
u_int unit = LPTUNIT(minor(dev));
|
u_int unit = LPTUNIT(dev2unit(dev));
|
||||||
struct lpt_data *sc = UNITOSOFTC(unit);
|
struct lpt_data *sc = UNITOSOFTC(unit);
|
||||||
u_char old_sc_irq; /* old printer IRQ status */
|
u_char old_sc_irq; /* old printer IRQ status */
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ pcfclock_attach(device_t dev)
|
|||||||
static int
|
static int
|
||||||
pcfclock_open(struct cdev *dev, int flag, int fms, struct thread *td)
|
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);
|
struct pcfclock_data *sc = UNITOSOFTC(unit);
|
||||||
device_t pcfclockdev = UNITODEVICE(unit);
|
device_t pcfclockdev = UNITODEVICE(unit);
|
||||||
device_t ppbus = device_get_parent(pcfclockdev);
|
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
|
static int
|
||||||
pcfclock_close(struct cdev *dev, int flags, int fmt, struct thread *td)
|
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);
|
struct pcfclock_data *sc = UNITOSOFTC(unit);
|
||||||
device_t pcfclockdev = UNITODEVICE(unit);
|
device_t pcfclockdev = UNITODEVICE(unit);
|
||||||
device_t ppbus = device_get_parent(pcfclockdev);
|
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
|
static void
|
||||||
pcfclock_write_cmd(struct cdev *dev, unsigned char command)
|
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 ppidev = UNITODEVICE(unit);
|
||||||
device_t ppbus = device_get_parent(ppidev);
|
device_t ppbus = device_get_parent(ppidev);
|
||||||
unsigned char ctr = 14;
|
unsigned char ctr = 14;
|
||||||
@ -209,7 +209,7 @@ pcfclock_write_cmd(struct cdev *dev, unsigned char command)
|
|||||||
static void
|
static void
|
||||||
pcfclock_display_data(struct cdev *dev, char buf[18])
|
pcfclock_display_data(struct cdev *dev, char buf[18])
|
||||||
{
|
{
|
||||||
u_int unit = minor(dev);
|
u_int unit = dev2unit(dev);
|
||||||
#ifdef PCFCLOCK_VERBOSE
|
#ifdef PCFCLOCK_VERBOSE
|
||||||
int year;
|
int year;
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ pcfclock_display_data(struct cdev *dev, char buf[18])
|
|||||||
static int
|
static int
|
||||||
pcfclock_read_data(struct cdev *dev, char *buf, ssize_t bits)
|
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 ppidev = UNITODEVICE(unit);
|
||||||
device_t ppbus = device_get_parent(ppidev);
|
device_t ppbus = device_get_parent(ppidev);
|
||||||
int i;
|
int i;
|
||||||
@ -272,7 +272,7 @@ pcfclock_read_data(struct cdev *dev, char *buf, ssize_t bits)
|
|||||||
static int
|
static int
|
||||||
pcfclock_read_dev(struct cdev *dev, char *buf, int maxretries)
|
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 ppidev = UNITODEVICE(unit);
|
||||||
device_t ppbus = device_get_parent(ppidev);
|
device_t ppbus = device_get_parent(ppidev);
|
||||||
int error = 0;
|
int error = 0;
|
||||||
@ -302,7 +302,7 @@ pcfclock_read_dev(struct cdev *dev, char *buf, int maxretries)
|
|||||||
static int
|
static int
|
||||||
pcfclock_read(struct cdev *dev, struct uio *uio, int ioflag)
|
pcfclock_read(struct cdev *dev, struct uio *uio, int ioflag)
|
||||||
{
|
{
|
||||||
u_int unit = minor(dev);
|
u_int unit = dev2unit(dev);
|
||||||
char buf[18];
|
char buf[18];
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ ppiintr(void *arg)
|
|||||||
static int
|
static int
|
||||||
ppiopen(struct cdev *dev, int flags, int fmt, struct thread *td)
|
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);
|
struct ppi_data *ppi = UNITOSOFTC(unit);
|
||||||
device_t ppidev = UNITODEVICE(unit);
|
device_t ppidev = UNITODEVICE(unit);
|
||||||
device_t ppbus = device_get_parent(ppidev);
|
device_t ppbus = device_get_parent(ppidev);
|
||||||
@ -286,7 +286,7 @@ ppiopen(struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||||||
static int
|
static int
|
||||||
ppiclose(struct cdev *dev, int flags, int fmt, struct thread *td)
|
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);
|
struct ppi_data *ppi = UNITOSOFTC(unit);
|
||||||
device_t ppidev = UNITODEVICE(unit);
|
device_t ppidev = UNITODEVICE(unit);
|
||||||
device_t ppbus = device_get_parent(ppidev);
|
device_t ppbus = device_get_parent(ppidev);
|
||||||
@ -329,7 +329,7 @@ static int
|
|||||||
ppiread(struct cdev *dev, struct uio *uio, int ioflag)
|
ppiread(struct cdev *dev, struct uio *uio, int ioflag)
|
||||||
{
|
{
|
||||||
#ifdef PERIPH_1284
|
#ifdef PERIPH_1284
|
||||||
u_int unit = minor(dev);
|
u_int unit = dev2unit(dev);
|
||||||
struct ppi_data *ppi = UNITOSOFTC(unit);
|
struct ppi_data *ppi = UNITOSOFTC(unit);
|
||||||
device_t ppidev = UNITODEVICE(unit);
|
device_t ppidev = UNITODEVICE(unit);
|
||||||
device_t ppbus = device_get_parent(ppidev);
|
device_t ppbus = device_get_parent(ppidev);
|
||||||
@ -413,7 +413,7 @@ static int
|
|||||||
ppiwrite(struct cdev *dev, struct uio *uio, int ioflag)
|
ppiwrite(struct cdev *dev, struct uio *uio, int ioflag)
|
||||||
{
|
{
|
||||||
#ifdef PERIPH_1284
|
#ifdef PERIPH_1284
|
||||||
u_int unit = minor(dev);
|
u_int unit = dev2unit(dev);
|
||||||
struct ppi_data *ppi = UNITOSOFTC(unit);
|
struct ppi_data *ppi = UNITOSOFTC(unit);
|
||||||
device_t ppidev = UNITODEVICE(unit);
|
device_t ppidev = UNITODEVICE(unit);
|
||||||
device_t ppbus = device_get_parent(ppidev);
|
device_t ppbus = device_get_parent(ppidev);
|
||||||
@ -499,7 +499,7 @@ ppiwrite(struct cdev *dev, struct uio *uio, int ioflag)
|
|||||||
static int
|
static int
|
||||||
ppiioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td)
|
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 ppidev = UNITODEVICE(unit);
|
||||||
device_t ppbus = device_get_parent(ppidev);
|
device_t ppbus = device_get_parent(ppidev);
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define RP_UNIT(x) dv_unit(x)
|
#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
|
#define MAX_RP_PORTS 128
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,8 +91,8 @@ __FBSDID("$FreeBSD$");
|
|||||||
#define PCMMKMINOR(u, d, c) \
|
#define PCMMKMINOR(u, d, c) \
|
||||||
((((c) & 0xff) << 16) | (((u) & 0x0f) << 4) | ((d) & 0x0f))
|
((((c) & 0xff) << 16) | (((u) & 0x0f) << 4) | ((d) & 0x0f))
|
||||||
#define MIDIMKMINOR(u, d, c) PCMMKMINOR(u, d, c)
|
#define MIDIMKMINOR(u, d, c) PCMMKMINOR(u, d, c)
|
||||||
#define MIDIUNIT(y) ((minor(y) >> 4) & 0x0f)
|
#define MIDIUNIT(y) ((dev2unit(y) >> 4) & 0x0f)
|
||||||
#define MIDIDEV(y) (minor(y) & 0x0f)
|
#define MIDIDEV(y) (dev2unit(y) & 0x0f)
|
||||||
|
|
||||||
/* These are the entries to the sequencer driver. */
|
/* These are the entries to the sequencer driver. */
|
||||||
static d_open_t seq_open;
|
static d_open_t seq_open;
|
||||||
|
@ -419,7 +419,7 @@ spkropen(dev, flags, fmt, td)
|
|||||||
(void) printf("spkropen: entering with dev = %s\n", devtoname(dev));
|
(void) printf("spkropen: entering with dev = %s\n", devtoname(dev));
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
if (minor(dev) != 0)
|
if (dev2unit(dev) != 0)
|
||||||
return(ENXIO);
|
return(ENXIO);
|
||||||
else if (spkr_active)
|
else if (spkr_active)
|
||||||
return(EBUSY);
|
return(EBUSY);
|
||||||
@ -444,7 +444,7 @@ spkrwrite(dev, uio, ioflag)
|
|||||||
printf("spkrwrite: entering with dev = %s, count = %d\n",
|
printf("spkrwrite: entering with dev = %s, count = %d\n",
|
||||||
devtoname(dev), uio->uio_resid);
|
devtoname(dev), uio->uio_resid);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
if (minor(dev) != 0)
|
if (dev2unit(dev) != 0)
|
||||||
return(ENXIO);
|
return(ENXIO);
|
||||||
else if (uio->uio_resid > (DEV_BSIZE - 1)) /* prevent system crashes */
|
else if (uio->uio_resid > (DEV_BSIZE - 1)) /* prevent system crashes */
|
||||||
return(E2BIG);
|
return(E2BIG);
|
||||||
@ -475,7 +475,7 @@ spkrclose(dev, flags, fmt, td)
|
|||||||
(void) printf("spkrclose: entering with dev = %s\n", devtoname(dev));
|
(void) printf("spkrclose: entering with dev = %s\n", devtoname(dev));
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
if (minor(dev) != 0)
|
if (dev2unit(dev) != 0)
|
||||||
return(ENXIO);
|
return(ENXIO);
|
||||||
else {
|
else {
|
||||||
wakeup(&endtone);
|
wakeup(&endtone);
|
||||||
@ -499,7 +499,7 @@ spkrioctl(dev, cmd, cmdarg, flags, td)
|
|||||||
devtoname(dev), cmd);
|
devtoname(dev), cmd);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
if (minor(dev) != 0)
|
if (dev2unit(dev) != 0)
|
||||||
return(ENXIO);
|
return(ENXIO);
|
||||||
else if (cmd == SPKRTONE) {
|
else if (cmd == SPKRTONE) {
|
||||||
tone_t *tp = (tone_t *)cmdarg;
|
tone_t *tp = (tone_t *)cmdarg;
|
||||||
|
@ -108,7 +108,7 @@ struct streams_softc {
|
|||||||
struct isa_device *dev;
|
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;
|
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)
|
if (td->td_dupfd >= 0)
|
||||||
return ENODEV;
|
return ENODEV;
|
||||||
|
|
||||||
switch (minor(dev)) {
|
switch (dev2unit(dev)) {
|
||||||
case dev_udp:
|
case dev_udp:
|
||||||
family = AF_INET;
|
family = AF_INET;
|
||||||
type = SOCK_DGRAM;
|
type = SOCK_DGRAM;
|
||||||
|
@ -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.
|
* We can pretty much allow any opening of the device.
|
||||||
*/
|
*/
|
||||||
struct tdfx_softc *tdfx_info = devclass_get_softc(tdfx_devclass,
|
struct tdfx_softc *tdfx_info = devclass_get_softc(tdfx_devclass,
|
||||||
UNIT(minor(dev)));
|
UNIT(dev2unit(dev)));
|
||||||
if(tdfx_info->busy != 0) return EBUSY;
|
if(tdfx_info->busy != 0) return EBUSY;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("3dfx: Opened by #%d\n", td->td_proc->p_pid);
|
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.
|
* We'll always want to close the device when it's called.
|
||||||
*/
|
*/
|
||||||
struct tdfx_softc *tdfx_info = devclass_get_softc(tdfx_devclass,
|
struct tdfx_softc *tdfx_info = devclass_get_softc(tdfx_devclass,
|
||||||
UNIT(minor(dev)));
|
UNIT(dev2unit(dev)));
|
||||||
if(tdfx_info->busy == 0) return EBADF;
|
if(tdfx_info->busy == 0) return EBADF;
|
||||||
tdfx_info->busy = 0;
|
tdfx_info->busy = 0;
|
||||||
#ifdef DEBUG
|
#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*/
|
/* Get the configuration for our card XXX*/
|
||||||
/*tdfx_info = (struct tdfx_softc*)devclass_get_softc(tdfx_devclass,
|
/*tdfx_info = (struct tdfx_softc*)devclass_get_softc(tdfx_devclass,
|
||||||
UNIT(minor(dev)));*/
|
UNIT(dev2unit(dev)));*/
|
||||||
/************************/
|
/************************/
|
||||||
|
|
||||||
struct tdfx_softc* tdfx_info[2];
|
struct tdfx_softc* tdfx_info[2];
|
||||||
|
@ -88,7 +88,7 @@ static devclass_t twa_devclass;
|
|||||||
static TW_INT32
|
static TW_INT32
|
||||||
twa_open(struct cdev *dev, TW_INT32 flags, TW_INT32 fmt, d_thread_t *proc)
|
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);
|
struct twa_softc *sc = devclass_get_softc(twa_devclass, unit);
|
||||||
|
|
||||||
tw_osli_dbg_dprintf(5, sc, "entered");
|
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
|
static TW_INT32
|
||||||
twa_close(struct cdev *dev, TW_INT32 flags, TW_INT32 fmt, d_thread_t *proc)
|
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);
|
struct twa_softc *sc = devclass_get_softc(twa_devclass, unit);
|
||||||
|
|
||||||
tw_osli_dbg_dprintf(5, sc, "entered");
|
tw_osli_dbg_dprintf(5, sc, "entered");
|
||||||
|
@ -81,7 +81,7 @@ static struct cdevsw twe_cdevsw = {
|
|||||||
static int
|
static int
|
||||||
twe_open(struct cdev *dev, int flags, int fmt, d_thread_t *td)
|
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);
|
struct twe_softc *sc = devclass_get_softc(twe_devclass, unit);
|
||||||
|
|
||||||
sc->twe_state |= TWE_STATE_OPEN;
|
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
|
static int
|
||||||
twe_close(struct cdev *dev, int flags, int fmt, d_thread_t *td)
|
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);
|
struct twe_softc *sc = devclass_get_softc(twe_devclass, unit);
|
||||||
|
|
||||||
sc->twe_state &= ~TWE_STATE_OPEN;
|
sc->twe_state &= ~TWE_STATE_OPEN;
|
||||||
|
@ -82,9 +82,9 @@
|
|||||||
#define UCOMDIALOUT_MASK 0x80000
|
#define UCOMDIALOUT_MASK 0x80000
|
||||||
#define UCOMCALLUNIT_MASK 0x40000
|
#define UCOMCALLUNIT_MASK 0x40000
|
||||||
|
|
||||||
#define UCOMUNIT(x) (minor(x) & UCOMUNIT_MASK)
|
#define UCOMUNIT(x) (dev2unit(x) & UCOMUNIT_MASK)
|
||||||
#define UCOMDIALOUT(x) (minor(x) & UCOMDIALOUT_MASK)
|
#define UCOMDIALOUT(x) (dev2unit(x) & UCOMDIALOUT_MASK)
|
||||||
#define UCOMCALLUNIT(x) (minor(x) & UCOMCALLUNIT_MASK)
|
#define UCOMCALLUNIT(x) (dev2unit(x) & UCOMCALLUNIT_MASK)
|
||||||
|
|
||||||
#define UCOM_UNK_PORTNO -1 /* XXX */
|
#define UCOM_UNK_PORTNO -1 /* XXX */
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ struct ufm_softc {
|
|||||||
int sc_refcnt;
|
int sc_refcnt;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define UFMUNIT(n) (minor(n))
|
#define UFMUNIT(n) (dev2unit(n))
|
||||||
|
|
||||||
static device_probe_t ufm_match;
|
static device_probe_t ufm_match;
|
||||||
static device_attach_t ufm_attach;
|
static device_attach_t ufm_attach;
|
||||||
|
@ -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 usbd_status ugen_set_interface(struct ugen_softc *, int, int);
|
||||||
static int ugen_get_alt_index(struct ugen_softc *sc, int ifaceidx);
|
static int ugen_get_alt_index(struct ugen_softc *sc, int ifaceidx);
|
||||||
|
|
||||||
#define UGENUNIT(n) ((minor(n) >> 4) & 0xf)
|
#define UGENUNIT(n) ((dev2unit(n) >> 4) & 0xf)
|
||||||
#define UGENENDPOINT(n) (minor(n) & 0xf)
|
#define UGENENDPOINT(n) (dev2unit(n) & 0xf)
|
||||||
#define UGENMINOR(u, e) (((u) << 4) | (e))
|
#define UGENMINOR(u, e) (((u) << 4) | (e))
|
||||||
|
|
||||||
static device_probe_t ugen_match;
|
static device_probe_t ugen_match;
|
||||||
|
@ -137,7 +137,7 @@ struct uhid_softc {
|
|||||||
struct cdev *dev;
|
struct cdev *dev;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define UHIDUNIT(dev) (minor(dev))
|
#define UHIDUNIT(dev) (dev2unit(dev))
|
||||||
#define UHID_CHUNK 128 /* chunk size for read */
|
#define UHID_CHUNK 128 /* chunk size for read */
|
||||||
#define UHID_BSIZE 1020 /* buffer size */
|
#define UHID_BSIZE 1020 /* buffer size */
|
||||||
|
|
||||||
|
@ -163,8 +163,8 @@ void ulpt_tick(void *xsc);
|
|||||||
void ieee1284_print_id(char *);
|
void ieee1284_print_id(char *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ULPTUNIT(s) (minor(s) & 0x1f)
|
#define ULPTUNIT(s) (dev2unit(s) & 0x1f)
|
||||||
#define ULPTFLAGS(s) (minor(s) & 0xe0)
|
#define ULPTFLAGS(s) (dev2unit(s) & 0xe0)
|
||||||
|
|
||||||
static device_probe_t ulpt_match;
|
static device_probe_t ulpt_match;
|
||||||
static device_attach_t ulpt_attach;
|
static device_attach_t ulpt_attach;
|
||||||
|
@ -81,7 +81,7 @@ SYSCTL_INT(_hw_usb_ums, OID_AUTO, debug, CTLFLAG_RW,
|
|||||||
#define DPRINTFN(n,x)
|
#define DPRINTFN(n,x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define UMSUNIT(s) (minor(s)&0x1f)
|
#define UMSUNIT(s) (dev2unit(s)&0x1f)
|
||||||
|
|
||||||
#define MS_TO_TICKS(ms) ((ms) * hz / 1000)
|
#define MS_TO_TICKS(ms) ((ms) * hz / 1000)
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ struct urio_softc {
|
|||||||
u_char sc_dying;
|
u_char sc_dying;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define URIOUNIT(n) (minor(n))
|
#define URIOUNIT(n) (dev2unit(n))
|
||||||
|
|
||||||
#define RIO_RW_TIMEOUT 4000 /* ms */
|
#define RIO_RW_TIMEOUT 4000 /* ms */
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <dev/usb/usbdi.h>
|
#include <dev/usb/usbdi.h>
|
||||||
#include <dev/usb/usbdi_util.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 */
|
#define USB_DEV_MINOR 255 /* event queue device */
|
||||||
|
|
||||||
MALLOC_DEFINE(M_USB, "USB", "USB");
|
MALLOC_DEFINE(M_USB, "USB", "USB");
|
||||||
|
@ -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 int uscanner_do_write(struct uscanner_softc *, struct uio *, int);
|
||||||
static void uscanner_do_close(struct uscanner_softc *);
|
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_probe_t uscanner_match;
|
||||||
static device_attach_t uscanner_attach;
|
static device_attach_t uscanner_attach;
|
||||||
|
@ -72,7 +72,7 @@ static unsigned int cnsl_evt_reg;
|
|||||||
static unsigned int wc, wp; /* write_cons, write_prod */
|
static unsigned int wc, wp; /* write_cons, write_prod */
|
||||||
|
|
||||||
#define CDEV_MAJOR 12
|
#define CDEV_MAJOR 12
|
||||||
#define XCUNIT(x) (minor(x))
|
#define XCUNIT(x) (dev2unit(x))
|
||||||
#define ISTTYOPEN(tp) ((tp) && ((tp)->t_state & TS_ISOPEN))
|
#define ISTTYOPEN(tp) ((tp) && ((tp)->t_state & TS_ISOPEN))
|
||||||
#define CN_LOCK_INIT(x, _name) \
|
#define CN_LOCK_INIT(x, _name) \
|
||||||
mtx_init(&x, _name, NULL, MTX_SPIN|MTX_RECURSE)
|
mtx_init(&x, _name, NULL, MTX_SPIN|MTX_RECURSE)
|
||||||
|
@ -78,7 +78,7 @@ int apm_evindex;
|
|||||||
#define SCFLAG_OCTL 0x0000002
|
#define SCFLAG_OCTL 0x0000002
|
||||||
#define SCFLAG_OPEN (SCFLAG_ONORMAL|SCFLAG_OCTL)
|
#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_NORMAL 0
|
||||||
#define APMDEV_CTL 8
|
#define APMDEV_CTL 8
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ smapi_ioctl (dev, cmd, data, fflag, td)
|
|||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = 0;
|
error = 0;
|
||||||
sc = devclass_get_softc(smapi_devclass, minor(dev));
|
sc = devclass_get_softc(smapi_devclass, dev2unit(dev));
|
||||||
if (sc == NULL) {
|
if (sc == NULL) {
|
||||||
error = ENXIO;
|
error = ENXIO;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -91,10 +91,10 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
|
|||||||
GIANT_REQUIRED;
|
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;
|
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))
|
if (uio->uio_offset < (vm_offset_t)VADDR(PTDPTDI, 0))
|
||||||
return (EFAULT);
|
return (EFAULT);
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
|
|||||||
panic("memrw");
|
panic("memrw");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (minor(dev) == CDEV_MINOR_MEM) {
|
if (dev2unit(dev) == CDEV_MINOR_MEM) {
|
||||||
pa = uio->uio_offset;
|
pa = uio->uio_offset;
|
||||||
pa &= ~PAGE_MASK;
|
pa &= ~PAGE_MASK;
|
||||||
} else {
|
} else {
|
||||||
@ -166,9 +166,9 @@ int
|
|||||||
memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr,
|
memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr,
|
||||||
int prot __unused)
|
int prot __unused)
|
||||||
{
|
{
|
||||||
if (minor(dev) == CDEV_MINOR_MEM)
|
if (dev2unit(dev) == CDEV_MINOR_MEM)
|
||||||
*paddr = offset;
|
*paddr = offset;
|
||||||
else if (minor(dev) == CDEV_MINOR_KMEM)
|
else if (dev2unit(dev) == CDEV_MINOR_KMEM)
|
||||||
*paddr = vtophys(offset);
|
*paddr = vtophys(offset);
|
||||||
/* else panic! */
|
/* else panic! */
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -94,7 +94,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minor(dev) == CDEV_MINOR_MEM) {
|
if (dev2unit(dev) == CDEV_MINOR_MEM) {
|
||||||
v = uio->uio_offset;
|
v = uio->uio_offset;
|
||||||
kmemphys:
|
kmemphys:
|
||||||
/* Allow reads only in RAM. */
|
/* Allow reads only in RAM. */
|
||||||
@ -111,7 +111,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
|
|||||||
error = uiomove((caddr_t)IA64_PHYS_TO_RR7(v), c, uio);
|
error = uiomove((caddr_t)IA64_PHYS_TO_RR7(v), c, uio);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (minor(dev) == CDEV_MINOR_KMEM) {
|
else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
|
||||||
v = uio->uio_offset;
|
v = uio->uio_offset;
|
||||||
|
|
||||||
if (v >= IA64_RR_BASE(6)) {
|
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
|
* could be transient and hence incorrect or invalid at
|
||||||
* a later time.
|
* a later time.
|
||||||
*/
|
*/
|
||||||
if (minor(dev) != CDEV_MINOR_MEM)
|
if (dev2unit(dev) != CDEV_MINOR_MEM)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -674,7 +674,7 @@ make_dev_credv(int flags, struct cdevsw *devsw, int unit,
|
|||||||
}
|
}
|
||||||
KASSERT(!(dev->si_flags & SI_NAMED),
|
KASSERT(!(dev->si_flags & SI_NAMED),
|
||||||
("make_dev() by driver %s on pre-existing device (min=%x, name=%s)",
|
("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);
|
i = vsnrprintf(dev->__si_namebuf, sizeof dev->__si_namebuf, 32, fmt, ap);
|
||||||
if (i > (sizeof dev->__si_namebuf - 1)) {
|
if (i > (sizeof dev->__si_namebuf - 1)) {
|
||||||
@ -800,7 +800,7 @@ destroy_devl(struct cdev *dev)
|
|||||||
|
|
||||||
mtx_assert(&devmtx, MA_OWNED);
|
mtx_assert(&devmtx, MA_OWNED);
|
||||||
KASSERT(dev->si_flags & SI_NAMED,
|
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);
|
devfs_destroy(dev);
|
||||||
|
|
||||||
@ -896,7 +896,7 @@ devtoname(struct cdev *dev)
|
|||||||
dev_relthread(dev);
|
dev_relthread(dev);
|
||||||
}
|
}
|
||||||
p += strlen(p);
|
p += strlen(p);
|
||||||
mynor = minor(dev);
|
mynor = dev2unit(dev);
|
||||||
if (mynor < 0 || mynor > 255)
|
if (mynor < 0 || mynor > 255)
|
||||||
sprintf(p, "/%#x", (u_int)mynor);
|
sprintf(p, "/%#x", (u_int)mynor);
|
||||||
else
|
else
|
||||||
|
@ -93,7 +93,7 @@ memrw(dev, uio, flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* minor device 0 is physical memory */
|
/* minor device 0 is physical memory */
|
||||||
if (minor(dev) == CDEV_MINOR_MEM) {
|
if (dev2unit(dev) == CDEV_MINOR_MEM) {
|
||||||
v = uio->uio_offset;
|
v = uio->uio_offset;
|
||||||
c = iov->iov_len;
|
c = iov->iov_len;
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ memrw(dev, uio, flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* minor device 1 is kernel memory */
|
/* minor device 1 is kernel memory */
|
||||||
else if (minor(dev) == CDEV_MINOR_KMEM) {
|
else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
|
||||||
v = uio->uio_offset;
|
v = uio->uio_offset;
|
||||||
c = min(iov->iov_len, MAXPHYS);
|
c = min(iov->iov_len, MAXPHYS);
|
||||||
vm_offset_t addr, eaddr;
|
vm_offset_t addr, eaddr;
|
||||||
|
@ -252,7 +252,7 @@ netioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td
|
|||||||
/* only support interface specific ioctls */
|
/* only support interface specific ioctls */
|
||||||
if (IOCGROUP(cmd) != 'i')
|
if (IOCGROUP(cmd) != 'i')
|
||||||
return (EOPNOTSUPP);
|
return (EOPNOTSUPP);
|
||||||
idx = minor(dev);
|
idx = dev2unit(dev);
|
||||||
if (idx == 0) {
|
if (idx == 0) {
|
||||||
/*
|
/*
|
||||||
* special network device, not interface.
|
* special network device, not interface.
|
||||||
@ -291,7 +291,7 @@ netkqfilter(struct cdev *dev, struct knote *kn)
|
|||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
idx = minor(dev);
|
idx = dev2unit(dev);
|
||||||
if (idx == 0) {
|
if (idx == 0) {
|
||||||
klist = &V_ifklist;
|
klist = &V_ifklist;
|
||||||
} else {
|
} else {
|
||||||
|
@ -429,7 +429,7 @@ tapcreate(struct cdev *dev)
|
|||||||
|
|
||||||
unit &= TAPMAXUNIT;
|
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 */
|
/* generate fake MAC address: 00 bd xx xx xx unit_no */
|
||||||
macaddr_hi = htons(0x00bd);
|
macaddr_hi = htons(0x00bd);
|
||||||
@ -465,7 +465,7 @@ tapcreate(struct cdev *dev)
|
|||||||
knlist_init(&tp->tap_rsel.si_note, NULL, NULL, NULL, NULL);
|
knlist_init(&tp->tap_rsel.si_note, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
TAPDEBUG("interface %s is created. minor = %#x\n",
|
TAPDEBUG("interface %s is created. minor = %#x\n",
|
||||||
ifp->if_xname, minor(dev));
|
ifp->if_xname, dev2unit(dev));
|
||||||
} /* tapcreate */
|
} /* tapcreate */
|
||||||
|
|
||||||
|
|
||||||
@ -511,7 +511,7 @@ tapopen(struct cdev *dev, int flag, int mode, struct thread *td)
|
|||||||
ifp->if_flags |= IFF_UP;
|
ifp->if_flags |= IFF_UP;
|
||||||
splx(s);
|
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);
|
return (0);
|
||||||
} /* tapopen */
|
} /* tapopen */
|
||||||
@ -564,7 +564,7 @@ tapclose(struct cdev *dev, int foo, int bar, struct thread *td)
|
|||||||
mtx_unlock(&tp->tap_mtx);
|
mtx_unlock(&tp->tap_mtx);
|
||||||
|
|
||||||
TAPDEBUG("%s is closed. minor = %#x\n",
|
TAPDEBUG("%s is closed. minor = %#x\n",
|
||||||
ifp->if_xname, minor(dev));
|
ifp->if_xname, dev2unit(dev));
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
} /* tapclose */
|
} /* tapclose */
|
||||||
@ -851,7 +851,7 @@ tapread(struct cdev *dev, struct uio *uio, int flag)
|
|||||||
struct mbuf *m = NULL;
|
struct mbuf *m = NULL;
|
||||||
int error = 0, len, s;
|
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);
|
mtx_lock(&tp->tap_mtx);
|
||||||
if ((tp->tap_flags & TAP_READY) != TAP_READY) {
|
if ((tp->tap_flags & TAP_READY) != TAP_READY) {
|
||||||
@ -859,7 +859,7 @@ tapread(struct cdev *dev, struct uio *uio, int flag)
|
|||||||
|
|
||||||
/* Unlocked read. */
|
/* Unlocked read. */
|
||||||
TAPDEBUG("%s not ready. minor = %#x, tap_flags = 0x%x\n",
|
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);
|
return (EHOSTDOWN);
|
||||||
}
|
}
|
||||||
@ -901,7 +901,7 @@ tapread(struct cdev *dev, struct uio *uio, int flag)
|
|||||||
|
|
||||||
if (m != NULL) {
|
if (m != NULL) {
|
||||||
TAPDEBUG("%s dropping mbuf, minor = %#x\n", ifp->if_xname,
|
TAPDEBUG("%s dropping mbuf, minor = %#x\n", ifp->if_xname,
|
||||||
minor(dev));
|
dev2unit(dev));
|
||||||
m_freem(m);
|
m_freem(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -923,14 +923,14 @@ tapwrite(struct cdev *dev, struct uio *uio, int flag)
|
|||||||
struct mbuf *m;
|
struct mbuf *m;
|
||||||
|
|
||||||
TAPDEBUG("%s writting, minor = %#x\n",
|
TAPDEBUG("%s writting, minor = %#x\n",
|
||||||
ifp->if_xname, minor(dev));
|
ifp->if_xname, dev2unit(dev));
|
||||||
|
|
||||||
if (uio->uio_resid == 0)
|
if (uio->uio_resid == 0)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
if ((uio->uio_resid < 0) || (uio->uio_resid > TAPMRU)) {
|
if ((uio->uio_resid < 0) || (uio->uio_resid > TAPMRU)) {
|
||||||
TAPDEBUG("%s invalid packet len = %d, minor = %#x\n",
|
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);
|
return (EIO);
|
||||||
}
|
}
|
||||||
@ -983,19 +983,19 @@ tappoll(struct cdev *dev, int events, struct thread *td)
|
|||||||
int s, revents = 0;
|
int s, revents = 0;
|
||||||
|
|
||||||
TAPDEBUG("%s polling, minor = %#x\n",
|
TAPDEBUG("%s polling, minor = %#x\n",
|
||||||
ifp->if_xname, minor(dev));
|
ifp->if_xname, dev2unit(dev));
|
||||||
|
|
||||||
s = splimp();
|
s = splimp();
|
||||||
if (events & (POLLIN | POLLRDNORM)) {
|
if (events & (POLLIN | POLLRDNORM)) {
|
||||||
if (ifp->if_snd.ifq_len > 0) {
|
if (ifp->if_snd.ifq_len > 0) {
|
||||||
TAPDEBUG("%s have data in queue. len = %d, " \
|
TAPDEBUG("%s have data in queue. len = %d, " \
|
||||||
"minor = %#x\n", ifp->if_xname,
|
"minor = %#x\n", ifp->if_xname,
|
||||||
ifp->if_snd.ifq_len, minor(dev));
|
ifp->if_snd.ifq_len, dev2unit(dev));
|
||||||
|
|
||||||
revents |= (events & (POLLIN | POLLRDNORM));
|
revents |= (events & (POLLIN | POLLRDNORM));
|
||||||
} else {
|
} else {
|
||||||
TAPDEBUG("%s waiting for data, minor = %#x\n",
|
TAPDEBUG("%s waiting for data, minor = %#x\n",
|
||||||
ifp->if_xname, minor(dev));
|
ifp->if_xname, dev2unit(dev));
|
||||||
|
|
||||||
selrecord(td, &tp->tap_rsel);
|
selrecord(td, &tp->tap_rsel);
|
||||||
}
|
}
|
||||||
@ -1025,19 +1025,19 @@ tapkqfilter(struct cdev *dev, struct knote *kn)
|
|||||||
switch (kn->kn_filter) {
|
switch (kn->kn_filter) {
|
||||||
case EVFILT_READ:
|
case EVFILT_READ:
|
||||||
TAPDEBUG("%s kqfilter: EVFILT_READ, minor = %#x\n",
|
TAPDEBUG("%s kqfilter: EVFILT_READ, minor = %#x\n",
|
||||||
ifp->if_xname, minor(dev));
|
ifp->if_xname, dev2unit(dev));
|
||||||
kn->kn_fop = &tap_read_filterops;
|
kn->kn_fop = &tap_read_filterops;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVFILT_WRITE:
|
case EVFILT_WRITE:
|
||||||
TAPDEBUG("%s kqfilter: EVFILT_WRITE, minor = %#x\n",
|
TAPDEBUG("%s kqfilter: EVFILT_WRITE, minor = %#x\n",
|
||||||
ifp->if_xname, minor(dev));
|
ifp->if_xname, dev2unit(dev));
|
||||||
kn->kn_fop = &tap_write_filterops;
|
kn->kn_fop = &tap_write_filterops;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
TAPDEBUG("%s kqfilter: invalid filter, minor = %#x\n",
|
TAPDEBUG("%s kqfilter: invalid filter, minor = %#x\n",
|
||||||
ifp->if_xname, minor(dev));
|
ifp->if_xname, dev2unit(dev));
|
||||||
splx(s);
|
splx(s);
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
/* NOT REACHED */
|
/* NOT REACHED */
|
||||||
@ -1067,11 +1067,11 @@ tapkqread(struct knote *kn, long hint)
|
|||||||
s = splimp();
|
s = splimp();
|
||||||
if ((kn->kn_data = ifp->if_snd.ifq_len) > 0) {
|
if ((kn->kn_data = ifp->if_snd.ifq_len) > 0) {
|
||||||
TAPDEBUG("%s have data in queue. len = %d, minor = %#x\n",
|
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;
|
ret = 1;
|
||||||
} else {
|
} else {
|
||||||
TAPDEBUG("%s waiting for data, minor = %#x\n",
|
TAPDEBUG("%s waiting for data, minor = %#x\n",
|
||||||
ifp->if_xname, minor(dev));
|
ifp->if_xname, dev2unit(dev));
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
splx(s);
|
splx(s);
|
||||||
|
@ -386,7 +386,7 @@ tuncreate(const char *name, struct cdev *dev)
|
|||||||
bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));
|
bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));
|
||||||
dev->si_drv1 = sc;
|
dev->si_drv1 = sc;
|
||||||
TUNDEBUG(ifp, "interface %s is created, minor = %#x\n",
|
TUNDEBUG(ifp, "interface %s is created, minor = %#x\n",
|
||||||
ifp->if_xname, minor(dev));
|
ifp->if_xname, dev2unit(dev));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -978,19 +978,19 @@ tunkqfilter(struct cdev *dev, struct knote *kn)
|
|||||||
switch(kn->kn_filter) {
|
switch(kn->kn_filter) {
|
||||||
case EVFILT_READ:
|
case EVFILT_READ:
|
||||||
TUNDEBUG(ifp, "%s kqfilter: EVFILT_READ, minor = %#x\n",
|
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;
|
kn->kn_fop = &tun_read_filterops;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVFILT_WRITE:
|
case EVFILT_WRITE:
|
||||||
TUNDEBUG(ifp, "%s kqfilter: EVFILT_WRITE, minor = %#x\n",
|
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;
|
kn->kn_fop = &tun_write_filterops;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
TUNDEBUG(ifp, "%s kqfilter: invalid filter, minor = %#x\n",
|
TUNDEBUG(ifp, "%s kqfilter: invalid filter, minor = %#x\n",
|
||||||
ifp->if_xname, minor(dev));
|
ifp->if_xname, dev2unit(dev));
|
||||||
splx(s);
|
splx(s);
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
}
|
}
|
||||||
@ -1017,12 +1017,12 @@ tunkqread(struct knote *kn, long hint)
|
|||||||
if ((kn->kn_data = ifp->if_snd.ifq_len) > 0) {
|
if ((kn->kn_data = ifp->if_snd.ifq_len) > 0) {
|
||||||
TUNDEBUG(ifp,
|
TUNDEBUG(ifp,
|
||||||
"%s have data in the queue. Len = %d, minor = %#x\n",
|
"%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;
|
ret = 1;
|
||||||
} else {
|
} else {
|
||||||
TUNDEBUG(ifp,
|
TUNDEBUG(ifp,
|
||||||
"%s waiting for data, minor = %#x\n", ifp->if_xname,
|
"%s waiting for data, minor = %#x\n", ifp->if_xname,
|
||||||
minor(dev));
|
dev2unit(dev));
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
splx(s);
|
splx(s);
|
||||||
|
@ -83,8 +83,8 @@ typedef struct ubtbcmfw_softc *ubtbcmfw_softc_p;
|
|||||||
* Device methods
|
* Device methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define UBTBCMFW_UNIT(n) ((minor(n) >> 4) & 0xf)
|
#define UBTBCMFW_UNIT(n) ((dev2unit(n) >> 4) & 0xf)
|
||||||
#define UBTBCMFW_ENDPOINT(n) (minor(n) & 0xf)
|
#define UBTBCMFW_ENDPOINT(n) (dev2unit(n) & 0xf)
|
||||||
#define UBTBCMFW_MINOR(u, e) (((u) << 4) | (e))
|
#define UBTBCMFW_MINOR(u, e) (((u) << 4) | (e))
|
||||||
#define UBTBCMFW_BSIZE 1024
|
#define UBTBCMFW_BSIZE 1024
|
||||||
|
|
||||||
|
@ -132,8 +132,8 @@ nsmb_dev_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
|
|||||||
* someone should take care of it.
|
* someone should take care of it.
|
||||||
*/
|
*/
|
||||||
if ((dev->si_flags & SI_NAMED) == 0)
|
if ((dev->si_flags & SI_NAMED) == 0)
|
||||||
make_dev(&nsmb_cdevsw, minor(dev), cred->cr_uid, cred->cr_gid, 0700,
|
make_dev(&nsmb_cdevsw, dev2unit(dev), cred->cr_uid,
|
||||||
NSMB_NAME"%d", dev2unit(dev));
|
cred->cr_gid, 0700, NSMB_NAME"%d", dev2unit(dev));
|
||||||
bzero(sdp, sizeof(*sdp));
|
bzero(sdp, sizeof(*sdp));
|
||||||
/*
|
/*
|
||||||
STAILQ_INIT(&sdp->sd_rqlist);
|
STAILQ_INIT(&sdp->sd_rqlist);
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
|
|
||||||
/* cdev driver declaration */
|
/* cdev driver declaration */
|
||||||
|
|
||||||
#define GDC_UNIT(dev) minor(dev)
|
#define GDC_UNIT(dev) dev2unit(dev)
|
||||||
#define GDC_MKMINOR(unit) (unit)
|
#define GDC_MKMINOR(unit) (unit)
|
||||||
|
|
||||||
typedef struct gdc_softc {
|
typedef struct gdc_softc {
|
||||||
|
@ -381,7 +381,7 @@ lptopen (struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||||||
int s;
|
int s;
|
||||||
int port;
|
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)
|
if (sc->sc_port == 0)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ lptopen (struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||||||
} else
|
} else
|
||||||
sc->sc_state |= INIT;
|
sc->sc_state |= INIT;
|
||||||
|
|
||||||
sc->sc_flags = LPTFLAGS(minor(dev));
|
sc->sc_flags = LPTFLAGS(dev2unit(dev));
|
||||||
|
|
||||||
/* Check for open with BYPASS flag set. */
|
/* Check for open with BYPASS flag set. */
|
||||||
if (sc->sc_flags & LP_BYPASS) {
|
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;
|
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)
|
if(sc->sc_flags & LP_BYPASS)
|
||||||
goto end_close;
|
goto end_close;
|
||||||
|
|
||||||
@ -558,7 +558,7 @@ lptwrite(struct cdev *dev, struct uio * uio, int ioflag)
|
|||||||
int pl, err;
|
int pl, err;
|
||||||
struct lpt_softc *sc;
|
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) {
|
if(sc->sc_flags & LP_BYPASS) {
|
||||||
/* we can't do writes in bypass mode */
|
/* we can't do writes in bypass mode */
|
||||||
return(EPERM);
|
return(EPERM);
|
||||||
@ -614,7 +614,7 @@ lptioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *t
|
|||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
struct lpt_softc *sc;
|
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 */
|
u_char old_sc_irq; /* old printer IRQ status */
|
||||||
|
|
||||||
sc = devclass_get_softc(olpt_devclass, unit);
|
sc = devclass_get_softc(olpt_devclass, unit);
|
||||||
|
@ -93,7 +93,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
|
|||||||
panic("memrw");
|
panic("memrw");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (minor(dev) == CDEV_MINOR_MEM) {
|
if (dev2unit(dev) == CDEV_MINOR_MEM) {
|
||||||
kmem_direct_mapped: v = uio->uio_offset;
|
kmem_direct_mapped: v = uio->uio_offset;
|
||||||
|
|
||||||
off = uio->uio_offset & PAGE_MASK;
|
off = uio->uio_offset & PAGE_MASK;
|
||||||
@ -111,7 +111,7 @@ kmem_direct_mapped: v = uio->uio_offset;
|
|||||||
uiomove((void *)v, cnt, uio);
|
uiomove((void *)v, cnt, uio);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (minor(dev) == CDEV_MINOR_KMEM) {
|
else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
|
||||||
va = uio->uio_offset;
|
va = uio->uio_offset;
|
||||||
|
|
||||||
if ((va < VM_MIN_KERNEL_ADDRESS)
|
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
|
* could be transient and hence incorrect or invalid at
|
||||||
* a later time.
|
* a later time.
|
||||||
*/
|
*/
|
||||||
if (minor(dev) != CDEV_MINOR_MEM)
|
if (dev2unit(dev) != CDEV_MINOR_MEM)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
/* Only direct-mapped addresses. */
|
/* Only direct-mapped addresses. */
|
||||||
|
@ -111,7 +111,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
|
|||||||
panic("memrw");
|
panic("memrw");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (minor(dev) == CDEV_MINOR_MEM) {
|
if (dev2unit(dev) == CDEV_MINOR_MEM) {
|
||||||
pa = uio->uio_offset & ~PAGE_MASK;
|
pa = uio->uio_offset & ~PAGE_MASK;
|
||||||
if (!is_physical_memory(pa)) {
|
if (!is_physical_memory(pa)) {
|
||||||
error = EFAULT;
|
error = EFAULT;
|
||||||
@ -159,7 +159,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (minor(dev) == CDEV_MINOR_KMEM) {
|
else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
|
||||||
va = trunc_page(uio->uio_offset);
|
va = trunc_page(uio->uio_offset);
|
||||||
eva = round_page(uio->uio_offset + iov->iov_len);
|
eva = round_page(uio->uio_offset + iov->iov_len);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user