Re: program inquiry is using a deprecated scsi_ioctl , please convert it to SG_IO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



James Bottomley wrote:
> On Thu, 2007-02-22 at 11:59 +0530, MASTHAN DUDEKULA wrote:
>> Hi JAMES,
>>  
>>  
>> The following code is SG_IO equivalent of scsi ioctls
>> SCSI_TEST_UNIT_READY
>>  
>>    unsigned char sense_b[32];
>>     unsigned char turCmbBlk[] = {0x00, 0, 0, 0, 0, 0};
>>     struct sg_io_hdr io_hdr; 
>>
>>     memset(&io_hdr, 0, sizeof(struct sg_io_hdr));
>>     io_hdr.interface_id = 'S';
>>     io_hdr.cmd_len = sizeof(turCmbBlk);
>>     io_hdr.mx_sb_len = sizeof(sense_b);
>>     io_hdr.dxfer_direction = SG_DXFER_NONE;
>>     io_hdr.cmdp = turCmbBlk;
>>     io_hdr.sbp = sense_b;
>>     io_hdr.timeout = DEF_TIMEOUT;
>>
>>     if (ioctl(fd, SG_IO, &io_hdr) < 0) {
>>  
>> Like this What is the SG_IO equivalent for SCSI_IOCTL_SCSI_COMMAND ?

Judging from the above you have found some sg3_utils
code. In a recent version, if you go to the "examples"
subdirectory, you will find the scsi_inquiry.c and
sg_simple1.c files.
The former shows the usage of the older, deprecated
SCSI_IOCTL_SCSI_COMMAND ioctl while the latter does something
very similar but uses the SG_IO ioctl interface.

The equivalence is that they both programs send a SCSI
INQUIRY cdb to a device and print out the response.

Doug Gilbert

> I don't understand your question ... SCSI_IOCTL_SEND_COMMAND sends a
> SCSI command to the device.  Your example of test unit ready above does
> just that ... it sends a Test Unit Ready command to the device using
> SG_IO ... exactly what do you not understand about using SG_IO to send
> commands to the device?
> 
> James

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux