diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2010-09-08 11:04:40 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2010-09-08 11:04:40 +0000 |
commit | a9359ecea89eecce1ea6fcd922998bcc8cf875a9 (patch) | |
tree | a1b8f1eeedf5edf72eb8f927c9338ebe5e7e4b94 /sys/scsi | |
parent | 9f680c609e93a1c429c5b109a7c00340ba1dc8df (diff) |
let things request the detach of everything on the whole bus, rather than
just a target/lun.
Diffstat (limited to 'sys/scsi')
-rw-r--r-- | sys/scsi/scsi_base.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index bdbb1604dd6..167faf4d357 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi_base.c,v 1.193 2010/08/30 02:47:56 matthew Exp $ */ +/* $OpenBSD: scsi_base.c,v 1.194 2010/09/08 11:04:39 dlg Exp $ */ /* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */ /* @@ -177,13 +177,21 @@ scsi_plug_probe(void *xsc, void *xp) { struct scsibus_softc *sc = xsc; struct scsi_plug *p = xp; - - if (p->lun == -1) - scsi_probe_target(sc, p->target); - else - scsi_probe_lun(sc, p->target, p->lun); + int target = p->target, lun = p->lun; pool_put(&scsi_plug_pool, p); + + if (target == -1 && lun == -1) + scsi_probe_bus(sc); + + /* specific lun and wildcard target is bad */ + if (target == -1) + return; + + if (lun == -1) + scsi_probe_target(sc, target); + + scsi_probe_lun(sc, target, lun); } void @@ -191,13 +199,22 @@ scsi_plug_detach(void *xsc, void *xp) { struct scsibus_softc *sc = xsc; struct scsi_plug *p = xp; - - if (p->lun == -1) - scsi_detach_target(sc, p->target, p->how); - else - scsi_detach_lun(sc, p->target, p->lun, p->how); + int target = p->target, lun = p->lun; + int how = p->how; pool_put(&scsi_plug_pool, p); + + if (target == -1 && lun == -1) + scsi_detach_bus(sc, how); + + /* specific lun and wildcard target is bad */ + if (target == -1) + return; + + if (lun == -1) + scsi_detach_target(sc, target, how); + + scsi_detach_lun(sc, target, lun, how); } int |