public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Pat LaVarre <p.lavarre@ieee.org>
To: dougg@torque.net
Cc: linux-scsi@vger.kernel.org
Subject: Re: sense visible despite ide-floppy in 2.6 maybe
Date: 13 Jun 2004 13:06:13 -0600	[thread overview]
Message-ID: <1087153573.3172.24.camel@patibmrh9> (raw)
In-Reply-To: <40C8FB79.1050706@torque.net>

Doug G:

> The underlying serial protocols used by sATA and SAS do
> seem to be in units of "dwords" (i.e. 4 byte quantities).
> I have noticed several SCSI standards changing the maximum
> allocation length of a one byte field (e.g. in an INQUIRY
> and MODE SENSE(6) ) from 255 to 252. The intent seems to be
> to have lengths that are multiples of 4.

Aye, analogously, I remember noticing that t10.org op x7F claims to max
out CDB length at x104 rather than the x107 that that additional length
could express.

> > 			int vn = 0;
> > 			if (0 <= ioctl(fd, SG_GET_VERSION_NUM, &vn)) {
> > 				if (vn < 30000) {
> > 					perror("ioctl SG_GET_VERSION_NUM");
> > 					continue;
> > 				}
> 
> Note: I have started to drop this SG_GET_VERSION_NUM ioctl()
> check. It is still needed in the special case where the sg
> driver is working asynchronously (i.e. sending commands with
> write() and receiving the response with read() ).

Help?

I thought the purpose of ioctl SG_GET_VERSION_NUM was to avoid sending
ioctl SG_IO on a Linux so old that ioctl SG_IO meant something
different.

Is that wrong?  Can I expect Linux to behave reasonably whenever I
assault it with a root-privileged ioctl SG_IO, no matter what the ioctl
SG_GET_VERSION_NUM results are?

> > 	sih->dxferp = static_data;
> > 	sih->dxfer_len = 0x24;
> > 	sih->dxfer_direction = SG_DXFER_NONE;
> > 	sih->dxfer_direction = SG_DXFER_TO_DEV;
> > 	sih->dxfer_direction = SG_DXFER_FROM_DEV;
> 
> The three above lines look a bit strange :-)

Help?  Why strange?

These three lines exist because I can easily reorder them to change
quickly among the three main options of expecting data in, data out, or
no data.  Commenting out the two lines that have no effect would
actually make that edit more difficult.

Maybe your ":-)" means you understood that?

> Perhaps you could sent me the "strace" of this failure so
> I can have a closer look at what is going on.

I will try to remember to strace next time I report a failing ioctl.

I will believe the progress of this thread has obsoleted that specific
request unless you say different.

> > Can ioctl SG_IO fetch the offset 7 Additional Length field of op x03
> > "REQUEST SENSE" data?
> > 
> > Naively I thought yes of course, I know that works with /dev/scd$n.
> > 
> > But then I tried a /dev/hd$v ide-floppy.  No joy.  perror tells me ioctl
> > SG_IO fails via "Invalid argument", ...
> 
> My method with the SG_IO ioctl was to yield errnos
> if the SCSI command could not be sent (or was rejected
> at the point of transmission). So if there is an errno
> there will be no sense buffer (or any other valid
> response data).

This much I did understand correctly from the doc.

I did eventually write:

	ii = ioctl(fd, SG_IO, sih);
	if (ii < 0) {
		perror("ioctl SG_IO");
		... die ...
	} else {
		fwrite(sih->dxferp, sih->dxfer_len, 1, stdout);
		if ((sih->info & SG_INFO_OK_MASK) != SG_INFO_OK) {
			... die ...
		} else if (sih->resid != 0) {
			... die ...
		}
		...
	}

The case that falls thru without "die"ing is my guess of when SG_IO
actually has reported complete success.

Pat LaVarre



  parent reply	other threads:[~2004-06-13 19:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-08 15:53 sense visible despite ide-floppy in 2.6 maybe Pat LaVarre
2004-06-09  8:00 ` Jens Axboe
2004-06-09  8:20   ` Jens Axboe
2004-06-09 16:22     ` Pat LaVarre
2004-06-09 17:37       ` Jens Axboe
2004-06-09 18:29       ` Pat LaVarre
2004-06-09 18:51         ` Pat LaVarre
2004-06-09 23:30           ` Pat LaVarre
2004-06-11  9:30             ` Jens Axboe
2004-06-11  9:38               ` Jens Axboe
2004-06-13 18:48                 ` Pat LaVarre
2004-06-13 19:58                   ` Jens Axboe
2004-06-11  9:24           ` Jens Axboe
2004-06-11  9:24         ` Jens Axboe
2004-06-11  0:23 ` Douglas Gilbert
2004-06-11  2:08   ` Willem Riede
2004-06-13 18:21   ` Pat LaVarre
2004-06-13 19:06   ` Pat LaVarre [this message]
2004-06-14  6:39     ` Douglas Gilbert
2004-06-13 20:00   ` Jens Axboe
2004-06-17 19:03     ` Pat LaVarre
2004-06-17 19:12       ` Jens Axboe

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=1087153573.3172.24.camel@patibmrh9 \
    --to=p.lavarre@ieee.org \
    --cc=dougg@torque.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox