summaryrefslogtreecommitdiffstats
path: root/sys/dev/iscsi/initiator/iscsi.c
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2008-09-27 08:51:18 +0000
committered <ed@FreeBSD.org>2008-09-27 08:51:18 +0000
commit4efdef565f9a0ca3468534f97c6ac4aaaf747c9a (patch)
treedd0035910760a440d495b23940f57a42ed24ca85 /sys/dev/iscsi/initiator/iscsi.c
parentd720932e5974ce75bf983cc61010a6eb70f94b86 (diff)
downloadFreeBSD-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/dev/iscsi/initiator/iscsi.c')
-rw-r--r--sys/dev/iscsi/initiator/iscsi.c16
1 files changed, 8 insertions, 8 deletions
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;
OpenPOWER on IntegriCloud