Serves me right for committing code late at night...

Fix the SCIOCGETDEVINFO code so that it compiles, and while I'm at it,
add support for human-readable device names so that I don't have
to call devname(3) on  the scd->dev to get it.
This commit is contained in:
Garrett Wollman 1998-02-01 18:09:50 +00:00
parent 609e0c94f2
commit f57e23d3a2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=32989
2 changed files with 14 additions and 6 deletions

View file

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*End copyright
*
* $Id: scsi_ioctl.c,v 1.27 1997/12/02 21:07:01 phk Exp $
* $Id: scsi_ioctl.c,v 1.28 1998/02/01 04:13:00 wollman 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 && cmd != SCSIOCGETDEVINFO&& !(flags & FWRITE))
if (cmd != SCIOCIDENTIFY && cmd != SCIOCGETDEVINFO&& !(flags & FWRITE))
return EACCES;
SC_DEBUG(sc_link,SDEV_DB2,("scsi_do_ioctl(0x%x)\n",cmd));
@ -367,10 +367,16 @@ struct proc *p, struct scsi_link *sc_link)
{
struct scsi_devinfo *scd = (struct scsi_devinfo *)addr;
struct scsi_link *scl;
scl = scsi_link_get(scd->addr.bus, scd->addr.target,
scl = scsi_link_get(scd->addr.scbus, scd->addr.target,
scd->addr.lun);
if (scl != 0) {
scd->dev = scl->dev;
/* XXX buffers better be big enough... */
sprintf(scd->devname, "%s%d",
scl->device->name, scl->dev_unit);
sprintf(scd->adname, "%s%d:%d",
scl->adapter->name, scl->adapter_unit,
scl->adapter_bus);
ret = 0;
} else {
ret = ENXIO;

View file

@ -1,5 +1,5 @@
/*
* $Id: scsiio.h,v 1.8 1997/02/22 09:45:49 peter Exp $
* $Id: scsiio.h,v 1.9 1998/02/01 04:13:13 wollman Exp $
*/
#ifndef _SYS_SCSIIO_H_
#define _SYS_SCSIIO_H_
@ -67,12 +67,14 @@ 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_devinfo {
struct scsi_addr addr;
dev_t dev;
char devname[16];
char adname[16];
};
#define SCIOCGETDEVINFO _IOWR('Q', 13, struct scsi_getdevinfo)
#define SCIOCGETDEVINFO _IOWR('Q', 13, struct scsi_devinfo)
#endif /* !_SYS_SCSIIO_H_ */