From: Douglas Gilbert <dougg@torque.net>
To: Kai Makisara <Kai.Makisara@kolumbus.fi>
Cc: osst@riede.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] st.c for GET_IDLUN 2.6.6-rc2
Date: Wed, 28 Apr 2004 13:42:24 +1000 [thread overview]
Message-ID: <408F2820.4030605@torque.net> (raw)
In-Reply-To: <Pine.LNX.4.58.0404261858140.24847@kai.makisara.local>
Kai Makisara wrote:
> On Mon, 26 Apr 2004, Douglas Gilbert wrote:
>
>
>>Kai Makisara wrote:
>
> ....
>
>>>2. Reversing the order of calls in st so that scsi_ioctl is called first
>>>and if it returns -ENOTTY, then scsi_cmd_ioctl is called. This would
>>>require changing scsi_ioctl to return -ENOTTY for commands not being
>>>handled but would be othewise a logical solution: first try SCSI specific
>>>implementation of the ioctl, if it does not exist, then try the block
>>>layer version (Linux block layer, not Unix block layer ;-).
>>
>>This solution looks cleaner.
>>
>
> I looked at the necessary changes a little more carefully and I think
> your solution is better from the practical point of view. The problem in
> my solution is to make sure that scsi_ioctl() returns -ENOTTY in case it
> does not implement the ioctl. This is easy except for the default case:
>
> if (sdev->host->hostt->ioctl)
> return sdev->host->hostt->ioctl(sdev, cmd, arg);
>
> where any kind of code can be found ;-) It is safer to leave this as the
> last resort.
Kai,
Here is another take on this matter. A summary of the ioctls
defined in block/scsi_ioctl.c follows with my comments:
ioctls defined in
block/scsi_ioctl.c Comment
================== =======
SCSI_IOCTL_SEND_COMMAND redirects to scsi mid level
SCSI_IOCTL_GET_IDLUN yields 0 (wrong, trips up cdrecord??)
SCSI_IOCTL_GET_BUS_NUMBER yields 0 (wrong)
SG_EMULATED_HOST irrelevant to st (obsolete in sg)
SG_GET_RESERVED_SIZE irrelevant to st (to trick cdrecord)
SG_GET_TIMEOUT irrelevant to st (to trick cdrecord)
SG_GET_VERSION_NUM irrelevant to st (to trick cdrecord)
SG_IO <<< only ioctl useful to st (+ osst) >>
SG_SET_RESERVED_SIZE irrelevant to st (to trick cdrecord)
SG_SET_TIMEOUT irrelevant to st (to trick cdrecord)
CDROM_SEND_PACKET irrelevant
CDROMCLOSETRAY irrelevant
CDROMEJECT irrelevant
So if st just redirects only the SG_IO ioctl to scsi_cmd_ioctl()
and lets the rest go to the scsi mid level (from where they can
dribble down to the LLD) that solves the problem.
Doug Gilbert
next prev parent reply other threads:[~2004-04-28 3:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-25 8:40 [PATCH] st.c for GET_IDLUN 2.6.6-rc2 Douglas Gilbert
2004-04-25 9:06 ` Kai Makisara
2004-04-26 0:48 ` Douglas Gilbert
2004-04-26 16:12 ` Kai Makisara
2004-04-28 3:42 ` Douglas Gilbert [this message]
2004-04-28 15:21 ` Kai Makisara
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=408F2820.4030605@torque.net \
--to=dougg@torque.net \
--cc=Kai.Makisara@kolumbus.fi \
--cc=linux-scsi@vger.kernel.org \
--cc=osst@riede.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