int scsi_detach_bus(struct scsibus_softc *sc, int flags) { struct scsi_link *alink = sc->adapter_link; int i; for (i = 0; i < alink->adapter_buswidth; i++) scsi_detach_target(sc, i, flags); return (0); }
int scsi_detach_bus(struct scsibus_softc *sc, int flags) { struct scsi_link *alink = sc->adapter_link; int i, err, rv = 0; for (i = 0; i < alink->adapter_buswidth; i++) { err = scsi_detach_target(sc, i, flags); if (err != 0 && err != ENXIO) rv = err; } return (rv); }
int scsi_detach(struct scsibus_softc *sc, int target, int lun, int flags) { if (target == -1 && lun == -1) return (scsi_detach_bus(sc, flags)); /* specific lun and wildcard target is bad */ if (target == -1) return (EINVAL); if (lun == -1) return (scsi_detach_target(sc, target, flags)); return (scsi_detach_lun(sc, target, lun, flags)); }
int scsibus_bioctl(struct device *dev, u_long cmd, caddr_t addr) { struct scsibus_softc *sc = (struct scsibus_softc *)dev; struct sbioc_device *sdev; switch (cmd) { case SBIOCPROBE: sdev = (struct sbioc_device *)addr; if (sdev->sd_target == -1 && sdev->sd_lun == -1) return (scsi_probe_bus(sc)); /* specific lun and wildcard target is bad */ if (sdev->sd_target == -1) return (EINVAL); if (sdev->sd_lun == -1) return (scsi_probe_target(sc, sdev->sd_target)); return (scsi_probe_lun(sc, sdev->sd_target, sdev->sd_lun)); case SBIOCDETACH: sdev = (struct sbioc_device *)addr; if (sdev->sd_target == -1 && sdev->sd_lun == -1) return (scsi_detach_bus(sc, 0)); if (sdev->sd_target == -1) return (EINVAL); if (sdev->sd_lun == -1) return (scsi_detach_target(sc, sdev->sd_target, 0)); return (scsi_detach_lun(sc, sdev->sd_target, sdev->sd_lun, 0)); default: return (ENOTTY); } }