* SCSI passthrough ioctl calls vs. sd/sg devices
@ 2004-04-21 22:04 Lee Xing
2004-04-24 4:06 ` Douglas Gilbert
0 siblings, 1 reply; 5+ messages in thread
From: Lee Xing @ 2004-04-21 22:04 UTC (permalink / raw)
To: linux-scsi
Hi,
I would appreciate it if some one could clarify this. It's a bit confusing.
<<The Linux SCSI Generic (sg) HOWTO>> page 2 says "The sg driver permits user applications to send SCSI commands to devices that understand them. SCSI commands are 6, 10, 12 or 16 bytes long. The SCSI disk driver (sd), once device initialization is complete, only sends SCSI READ and WRITE commands."
<<The Linux 2.4 SCSI subsystem HOWTO>> page 3 says "Sg is a SCSI command pass through device that uses a char device interface. General purpose Linux commands should not be used on sg devices."
My questions are:
- looks like SCSI passthrough ioctl calls can only apply
to sg devices. Is it right, and can we apply SCSI
passthrough ioctl calls to sd devices as well?
- what are the so-called "General purpose Linux commands"?
Are they read()/write() or 'mount' / 'dd' or something else?
What should we do if we need to 'mount' a file system on a disk and also need to issue SCSI passthrough ioctl calls to the same disk? Maybe we should use both sd and sg (i.e. mount the file system to /dev/sda, and issue SCSI passthrough ioctl calls to /dev/sg0 that maps to the same physical disk)? 'mount' doesn't work on sg devices as I was told earlier.
Many thanks,
Lee
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: SCSI passthrough ioctl calls vs. sd/sg devices
2004-04-21 22:04 SCSI passthrough ioctl calls vs. sd/sg devices Lee Xing
@ 2004-04-24 4:06 ` Douglas Gilbert
2004-04-24 6:58 ` Kai Makisara
0 siblings, 1 reply; 5+ messages in thread
From: Douglas Gilbert @ 2004-04-24 4:06 UTC (permalink / raw)
To: Lee Xing; +Cc: linux-scsi
Lee Xing wrote:
> Hi,
>
> I would appreciate it if some one could clarify this. It's a bit confusing.
>
> <<The Linux SCSI Generic (sg) HOWTO>> page 2 says "The sg driver permits user applications to send SCSI commands to devices that understand them. SCSI commands are 6, 10, 12 or 16 bytes long. The SCSI disk driver (sd), once device initialization is complete, only sends SCSI READ and WRITE commands."
>
> <<The Linux 2.4 SCSI subsystem HOWTO>> page 3 says "Sg is a SCSI command pass through device that uses a char device interface. General purpose Linux commands should not be used on sg devices."
>
> My questions are:
>
> - looks like SCSI passthrough ioctl calls can only apply
> to sg devices. Is it right, and can we apply SCSI
> passthrough ioctl calls to sd devices as well?
True in the lk 2.4 series. When all else fails you can still
use the SCSI_IOCTL_SEND_COMMAND ioctl() [which is what is
used by smartmontools currently].
In the lk 2.6 series the SG_IO ioctl is available for block
devices which include SCSI disks and ATAPI dvd/cd drives.
The SG_IO ioctl is currently not available for SCSI char
device drivers (e.g. st and osst) other than sg itself.
BTW ATA disks don't understand SCSI commands so the SG_IO
ioctl is of little use with them.
It the next week or so I hope to propose a SG_IO ioctl
for the scsi mid level for consideration in lk 2.6.
That will make the SG_IO ioctl available to st and osst
as well.
> - what are the so-called "General purpose Linux commands"?
> Are they read()/write() or 'mount' / 'dd' or something else?
mount, dd, cp, mv, rm (etc).
The sg3_utils package has a dd variant called sg_dd which can use
sg devices (as well as those that the standard dd can handle).
> What should we do if we need to 'mount' a file system on a disk and
> also need to issue SCSI passthrough ioctl calls to the same disk?
> Maybe we should use both sd and sg (i.e. mount the file system to
> /dev/sda, and issue SCSI passthrough ioctl calls to /dev/sg0 that
> maps to the same physical disk)?
yes
> 'mount' doesn't work on sg devices as I was told earlier.
true.
Doug Gilbert
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: SCSI passthrough ioctl calls vs. sd/sg devices
2004-04-24 4:06 ` Douglas Gilbert
@ 2004-04-24 6:58 ` Kai Makisara
2004-04-24 12:42 ` Willem Riede
0 siblings, 1 reply; 5+ messages in thread
From: Kai Makisara @ 2004-04-24 6:58 UTC (permalink / raw)
To: Douglas Gilbert; +Cc: Lee Xing, linux-scsi
On Sat, 24 Apr 2004, Douglas Gilbert wrote:
...
> In the lk 2.6 series the SG_IO ioctl is available for block
> devices which include SCSI disks and ATAPI dvd/cd drives.
> The SG_IO ioctl is currently not available for SCSI char
> device drivers (e.g. st and osst) other than sg itself.
SG_IO is available for st in current 2.6 (Patrick Mansfield added a few
lines of code to st.c). Similar changes could be probably done to osst.
--
Kai
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: SCSI passthrough ioctl calls vs. sd/sg devices
2004-04-24 6:58 ` Kai Makisara
@ 2004-04-24 12:42 ` Willem Riede
2004-04-25 6:49 ` Douglas Gilbert
0 siblings, 1 reply; 5+ messages in thread
From: Willem Riede @ 2004-04-24 12:42 UTC (permalink / raw)
To: Kai Makisara; +Cc: Douglas Gilbert, Lee Xing, linux-scsi
On 2004.04.24 02:58, Kai Makisara wrote:
> On Sat, 24 Apr 2004, Douglas Gilbert wrote:
>
> ...
> > In the lk 2.6 series the SG_IO ioctl is available for block
> > devices which include SCSI disks and ATAPI dvd/cd drives.
> > The SG_IO ioctl is currently not available for SCSI char
> > device drivers (e.g. st and osst) other than sg itself.
>
> SG_IO is available for st in current 2.6 (Patrick Mansfield added a few
> lines of code to st.c). Similar changes could be probably done to osst.
I'll be happy to do that (make the equivalent change to osst) if that's
the best way to complete the SG_IO support.
Regards, Willem Riede.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: SCSI passthrough ioctl calls vs. sd/sg devices
2004-04-24 12:42 ` Willem Riede
@ 2004-04-25 6:49 ` Douglas Gilbert
0 siblings, 0 replies; 5+ messages in thread
From: Douglas Gilbert @ 2004-04-25 6:49 UTC (permalink / raw)
To: osst; +Cc: Kai Makisara, Lee Xing, linux-scsi
Willem Riede wrote:
> On 2004.04.24 02:58, Kai Makisara wrote:
>
>>On Sat, 24 Apr 2004, Douglas Gilbert wrote:
>>
>>...
>>
>>>In the lk 2.6 series the SG_IO ioctl is available for block
>>>devices which include SCSI disks and ATAPI dvd/cd drives.
>>>The SG_IO ioctl is currently not available for SCSI char
>>>device drivers (e.g. st and osst) other than sg itself.
>>
>>SG_IO is available for st in current 2.6 (Patrick Mansfield added a few
>>lines of code to st.c). Similar changes could be probably done to osst.
>
>
> I'll be happy to do that (make the equivalent change to osst) if that's
> the best way to complete the SG_IO support.
Willem,
The st mods for SG_IO seem to be working fine in lk 2.6.6-rc2.
See st's call to scsi_cmd_ioctl(). [As well as calling the SG_IO
ioctl, CDROM_SEND_PACKET is also available?! ]
So a recent version of sg3_utils (like version 1.06 beta on
http://www.torque.net/sg ) can know use /dev/st* device
names. For example:
# sg_modes -6 /dev/st0
SONY SDT-7000 0192 peripheral_type: tape [0x1]
Mode parameter header from 6 byte MODE SENSE:
Mode data length=72, medium type=0x00, specific param=0x10, longlba=0
Block descriptor length=8
> General mode parameter block descriptors:
Density code=0x13
00 13 00 00 00 00 00 02 00
>> page_code: Disconnect-Reconnect, page_control: current
00 02 0e 00 00 00 00 00 00 00 00 01 ee 00 00 00 00
>> page_code: Data Compression, page_control: current
00 0f 0e c0 80 00 00 00 20 00 00 00 20 00 00 00 00
>> page_code: Device config, page_control: current
00 10 0e 08 00 00 00 00 32 60 00 18 00 00 00 00 00
>> page_code: Medium Partition [1], page_control: current
00 11 0a 01 00 10 03 00 00 0e 73 00 00
Also on that site is a beta of lsscsi version 0.12 for
lk 2.6.6 :
# lsscsi
[3:0:6:0] tape SONY SDT-7000 0192 /dev/st0
[root@dink devices]# lsscsi -g
[3:0:6:0] tape SONY SDT-7000 0192 /dev/st0 /dev/sg0
# lsscsi -l
[3:0:6:0] tape SONY SDT-7000 0192 /dev/st0
state=running queue_depth=1 scsi_level=3 type=1 device_blocked=0
# lsscsi -H
[3] aha152x
# lsscsi -Hv
sysfsroot: /sys
[3] aha152x
dir: /sys/class/scsi_host/host3
device dir:/sys/devices/platform/host3
# lsscsi -Hl
[3] aha152x
cmd_per_lun=1 host_busy=0 sg_tablesize=255 unchecked_isa_dma=0
Doug Gilbert
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-04-25 6:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-21 22:04 SCSI passthrough ioctl calls vs. sd/sg devices Lee Xing
2004-04-24 4:06 ` Douglas Gilbert
2004-04-24 6:58 ` Kai Makisara
2004-04-24 12:42 ` Willem Riede
2004-04-25 6:49 ` Douglas Gilbert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox