diff options
author | ed <ed@FreeBSD.org> | 2008-09-27 08:51:18 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2008-09-27 08:51:18 +0000 |
commit | 4efdef565f9a0ca3468534f97c6ac4aaaf747c9a (patch) | |
tree | dd0035910760a440d495b23940f57a42ed24ca85 /sys/cam | |
parent | d720932e5974ce75bf983cc61010a6eb70f94b86 (diff) | |
download | FreeBSD-src-4efdef565f9a0ca3468534f97c6ac4aaaf747c9a.zip FreeBSD-src-4efdef565f9a0ca3468534f97c6ac4aaaf747c9a.tar.gz |
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
Diffstat (limited to 'sys/cam')
-rw-r--r-- | sys/cam/scsi/scsi_sa.c | 8 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_ses.c | 2 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_target.c | 2 |
3 files changed, 6 insertions, 6 deletions
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, |