summaryrefslogtreecommitdiffstats
path: root/sys/scsi
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 /sys/scsi
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.
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/scsi_ioctl.c18
1 files changed, 16 insertions, 2 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;
OpenPOWER on IntegriCloud