diff options
author | 2010-09-08 00:58:05 +0000 | |
---|---|---|
committer | 2010-09-08 00:58:05 +0000 | |
commit | c42815b3aec07b465b33f471a6f7f4844363bf07 (patch) | |
tree | 98a9699283b8e1413f41ea3370785eaef69c2b77 | |
parent | Document EBUSY return when attempting to open a cua device that (diff) | |
download | wireguard-openbsd-c42815b3aec07b465b33f471a6f7f4844363bf07.tar.xz wireguard-openbsd-c42815b3aec07b465b33f471a6f7f4844363bf07.zip |
activate hooks should return a value.
all from deraadt@
tested by me with hotplugged disks on mpi(4)
-rw-r--r-- | sys/scsi/scsiconf.c | 52 | ||||
-rw-r--r-- | sys/scsi/scsiconf.h | 4 |
2 files changed, 32 insertions, 24 deletions
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c index f4abf5d8028..fe1262ded9b 100644 --- a/sys/scsi/scsiconf.c +++ b/sys/scsi/scsiconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.c,v 1.165 2010/09/02 11:54:44 dlg Exp $ */ +/* $OpenBSD: scsiconf.c,v 1.166 2010/09/08 00:58:05 dlg Exp $ */ /* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */ /* @@ -107,9 +107,9 @@ int scsi_autoconf = SCSI_AUTOCONF; int scsibusprint(void *, const char *); void scsibus_printlink(struct scsi_link *); -void scsi_activate_bus(struct scsibus_softc *, int); -void scsi_activate_target(struct scsibus_softc *, int, int); -void scsi_activate_lun(struct scsibus_softc *, int, int, int); +int scsi_activate_bus(struct scsibus_softc *, int); +int scsi_activate_target(struct scsibus_softc *, int, int); +int scsi_activate_lun(struct scsibus_softc *, int, int, int); const u_int8_t version_to_spc [] = { 0, /* 0x00: The device does not claim conformance to any standard. */ @@ -189,45 +189,51 @@ scsibusactivate(struct device *dev, int act) { struct scsibus_softc *sc = (struct scsibus_softc *)dev; - scsi_activate(sc, -1, -1, act); - - return (0); + return scsi_activate(sc, -1, -1, act); } -void +int scsi_activate(struct scsibus_softc *sc, int target, int lun, int act) { if (target == -1 && lun == -1) - scsi_activate_bus(sc, act); + return scsi_activate_bus(sc, act); if (target == -1) - return; + return 0; if (lun == -1) - scsi_activate_target(sc, target, act); + return scsi_activate_target(sc, target, act); - scsi_activate_lun(sc, target, lun, act); + return scsi_activate_lun(sc, target, lun, act); } -void +int scsi_activate_bus(struct scsibus_softc *sc, int act) { - int target; + int target, rv = 0, r; - for (target = 0; target < sc->sc_buswidth; target++) - scsi_activate_target(sc, target, act); + for (target = 0; target < sc->sc_buswidth; target++) { + r = scsi_activate_target(sc, target, act); + if (r) + rv = r; + } + return (rv); } -void +int scsi_activate_target(struct scsibus_softc *sc, int target, int act) { - int lun; + int lun, rv = 0, r; - for (lun = 0; lun < sc->adapter_link->luns; lun++) - scsi_activate_lun(sc, target, lun, act); + for (lun = 0; lun < sc->adapter_link->luns; lun++) { + r = scsi_activate_lun(sc, target, lun, act); + if (r) + rv = r; + } + return (rv); } -void +int scsi_activate_lun(struct scsibus_softc *sc, int target, int lun, int act) { struct scsi_link *link; @@ -235,7 +241,7 @@ scsi_activate_lun(struct scsibus_softc *sc, int target, int lun, int act) link = scsi_get_link(sc, target, lun); if (link == NULL) - return; + return (0); dev = link->device_softc; switch (act) { @@ -265,6 +271,8 @@ scsi_activate_lun(struct scsibus_softc *sc, int target, int lun, int act) default: break; } + + return (0); } int diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h index 5d5e074dfef..89bfa4d426d 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.h,v 1.136 2010/08/25 00:31:35 dlg Exp $ */ +/* $OpenBSD: scsiconf.h,v 1.137 2010/09/08 00:58:05 dlg Exp $ */ /* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */ /* @@ -575,7 +575,7 @@ int scsi_detach_lun(struct scsibus_softc *, int, int, int); int scsi_req_probe(struct scsibus_softc *, int, int); int scsi_req_detach(struct scsibus_softc *, int, int, int); -void scsi_activate(struct scsibus_softc *, int, int, int); +int scsi_activate(struct scsibus_softc *, int, int, int); struct scsi_link * scsi_get_link(struct scsibus_softc *, int, int); void scsi_add_link(struct scsibus_softc *, |