Re: SCSI driver query

From: Douglas Gilbert (
Date: Sat Oct 13 2001 - 23:51:42 EST

Linux Bigot <> wrote:

> How is the ioctl() entry point in Scsi_Host_Template
> used. What device node is associated with it and what
> all commands can be passed down through this
> interface.

That ioctl can be accessed (if defined) via a "trickle
down" ioctl call to any open SCSI device name (e.g. /dev/sda).

When an ioctl is called on an open SCSI device name
then the first match in the following list processes
   - the associated upper level SCSI driver looks for
     a match on the ioctl 'cmd' number
   - the mid-level looks for a match on the ioctl
     'cmd' number
   - otherwise if Scsi_Host_Template::ioctl is non-NULL
     then it is called for the given SCSI device with
     the 'cmd' and 'arg' of the original user ioctl call

A SCSI lower level (adapter) driver is not required to
support Scsi_Host_Template::ioctl in which case it will
be NULL. If it is supported then it is up to that adapter
driver what is supported.

This mechanism only allows an adapter which has attached
SCSI devices to be sent an ioctl. The proc_fs interface
may be useful for contacting an adapter driver even if it
doesn't have any attached devices. Something like:
 $ echo "<some_command>" > /proc/scsi/advansys/0

Doug Gilbert
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon Oct 15 2001 - 21:00:52 EST