-/* $OpenBSD: scsi_base.c,v 1.210 2014/01/27 23:44:40 dlg Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.211 2014/04/22 07:29:11 dlg Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
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);
+ scsi_probe(sc, target, lun);
}
void
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);
+ scsi_detach(sc, target, lun, how);
}
int
-/* $OpenBSD: scsiconf.c,v 1.186 2014/01/31 02:53:41 dlg Exp $ */
+/* $OpenBSD: scsiconf.c,v 1.187 2014/04/22 07:29:11 dlg Exp $ */
/* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */
/*
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));
+ return (scsi_probe(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));
+ return (scsi_detach(sc, sdev->sd_target, sdev->sd_lun, 0));
default:
return (ENOTTY);
return (0);
}
+int
+scsi_probe(struct scsibus_softc *sc, int target, int lun)
+{
+ if (target == -1 && lun == -1)
+ return (scsi_probe_bus(sc));
+
+ /* specific lun and wildcard target is bad */
+ if (target == -1)
+ return (EINVAL);
+
+ if (lun == -1)
+ return (scsi_probe_target(sc, target));
+
+ return (scsi_probe_lun(sc, target, lun));
+}
+
int
scsi_probe_lun(struct scsibus_softc *sc, int target, int lun)
{
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
scsi_detach_target(struct scsibus_softc *sc, int target, int flags)
{
-/* $OpenBSD: scsiconf.h,v 1.160 2014/01/31 02:53:41 dlg Exp $ */
+/* $OpenBSD: scsiconf.h,v 1.161 2014/04/22 07:29:11 dlg Exp $ */
/* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */
/*
void scsi_strvis(u_char *, u_char *, int);
int scsi_delay(struct scsi_xfer *, int);
+int scsi_probe(struct scsibus_softc *, int, int);
int scsi_probe_bus(struct scsibus_softc *);
int scsi_probe_target(struct scsibus_softc *, int);
int scsi_probe_lun(struct scsibus_softc *, int, int);
+int scsi_detach(struct scsibus_softc *, int, int, int);
int scsi_detach_bus(struct scsibus_softc *, int);
int scsi_detach_target(struct scsibus_softc *, int, int);
int scsi_detach_lun(struct scsibus_softc *, int, int, int);