All of lore.kernel.org
 help / color / mirror / Atom feed
From: Douglas Gilbert <dougg@torque.net>
To: MASTHAN DUDEKULA <d.mastan@gmail.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: program inquiry is using a deprecated scsi_ioctl , please	convert it to SG_IO
Date: Thu, 22 Feb 2007 18:59:37 -0500	[thread overview]
Message-ID: <45DE2E69.70201@torque.net> (raw)
In-Reply-To: <1172182531.3378.41.camel@mulgrave.il.steeleye.com>

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


      reply	other threads:[~2007-02-22 23:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-08 10:14 program inquiry is using a deprecated scsi_ioctl , please convert it to SG_IO Masthan
2007-02-08 14:50 ` James Bottomley
     [not found]   ` <868c9d9d0702202233pa206222jb9beb85d60089003@mail.gmail.com>
2007-02-21 17:17     ` James Bottomley
     [not found]       ` <868c9d9d0702212229p2e1a39ek9b73813899f18645@mail.gmail.com>
2007-02-22 22:15         ` James Bottomley
2007-02-22 23:59           ` Douglas Gilbert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45DE2E69.70201@torque.net \
    --to=dougg@torque.net \
    --cc=d.mastan@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.