summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1998-02-01 04:13:13 +0000
committerwollman <wollman@FreeBSD.org>1998-02-01 04:13:13 +0000
commitf3d9b9b0a498f13f1dfbbc21093a6476b25a726f (patch)
tree32115aab458b73bbbb04f8dfd6b019788f244ef7
parentef6e7f7b8d227ee0ee75d6620fcc51a7e3343d0f (diff)
downloadFreeBSD-src-f3d9b9b0a498f13f1dfbbc21093a6476b25a726f.zip
FreeBSD-src-f3d9b9b0a498f13f1dfbbc21093a6476b25a726f.tar.gz
Add a new ioctl, SCSIOCGETDEVINFO, which takes a device ID and uses it
to look up information about that device. Right now, all it does is give back the dev_t for the device, if known, since that's all I needed, but hopefully the SCSI mavens will come up with a more generally useful structure.
-rw-r--r--sys/scsi/scsi_ioctl.c18
-rw-r--r--sys/sys/scsiio.h10
2 files changed, 25 insertions, 3 deletions
diff --git a/sys/scsi/scsi_ioctl.c b/sys/scsi/scsi_ioctl.c
index ceafe78..8e340f7 100644
--- a/sys/scsi/scsi_ioctl.c
+++ b/sys/scsi/scsi_ioctl.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*End copyright
*
- * $Id: scsi_ioctl.c,v 1.26 1997/09/02 20:06:34 bde Exp $
+ * $Id: scsi_ioctl.c,v 1.27 1997/12/02 21:07:01 phk Exp $
*
*
*/
@@ -256,7 +256,7 @@ struct proc *p, struct scsi_link *sc_link)
/* If we can't write the device we can't permit much:
*/
- if (cmd != SCIOCIDENTIFY && !(flags & FWRITE))
+ if (cmd != SCIOCIDENTIFY && cmd != SCSIOCGETDEVINFO&& !(flags & FWRITE))
return EACCES;
SC_DEBUG(sc_link,SDEV_DB2,("scsi_do_ioctl(0x%x)\n",cmd));
@@ -363,6 +363,20 @@ struct proc *p, struct scsi_link *sc_link)
sca->lun = sc_link->lun;
break;
}
+ case SCIOCGETDEVINFO:
+ {
+ struct scsi_devinfo *scd = (struct scsi_devinfo *)addr;
+ struct scsi_link *scl;
+ scl = scsi_link_get(scd->addr.bus, scd->addr.target,
+ scd->addr.lun);
+ if (scl != 0) {
+ scd->dev = scl->dev;
+ ret = 0;
+ } else {
+ ret = ENXIO;
+ }
+ break;
+ }
default:
ret = ENOTTY;
diff --git a/sys/sys/scsiio.h b/sys/sys/scsiio.h
index 34842bb..af6d2e0 100644
--- a/sys/sys/scsiio.h
+++ b/sys/sys/scsiio.h
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: scsiio.h,v 1.8 1997/02/22 09:45:49 peter Exp $
*/
#ifndef _SYS_SCSIIO_H_
#define _SYS_SCSIIO_H_
@@ -67,4 +67,12 @@ struct scsi_addr {
#define SCIOCFREEZETHAW _IOW('Q', 11, int) /* Freeze SCSI for some seconds */
#define SCIOCWAITTHAW _IO('Q', 12) /* Wait for SCSI to thaw */
+struct scsi_getdevinfo {
+ struct scsi_addr addr;
+ dev_t dev;
+};
+
+#define SCIOCGETDEVINFO _IOWR('Q', 13, struct scsi_getdevinfo)
+
+
#endif /* !_SYS_SCSIIO_H_ */
OpenPOWER on IntegriCloud