From: Douglas Gilbert <dougg@torque.net>
To: Jeremy Higdon <jeremy@sgi.com>
Cc: linux-scsi@vger.kernel.org, james.bottomley@steeleye.com
Subject: Re: [PATCH] sg.c to set direction more reliably (was Re: [PATCH] fusion update to current APIs)
Date: Thu, 26 Aug 2004 18:44:40 +1000 [thread overview]
Message-ID: <412DA2F8.8080607@torque.net> (raw)
In-Reply-To: <20040826070935.GA126538@sgi.com>
Jeremy Higdon wrote:
> I still think that this change should go into the sg1/sg2 command
> issue path, so that a warning is issued when sg has to guess on
> command direction. This will encourage developers to fix up apps
> that don't set buffer sizes properly.
>
> Doug, can you comment on this? If you don't like it, I'll drop
> it :-)
>
> This patch is against 2.6.9-rc1.
>
> thanks,
>
> jeremy
>
> ===== drivers/scsi/sg.c 1.95 vs edited =====
> --- 1.95/drivers/scsi/sg.c 2004-08-07 19:11:33 -07:00
> +++ edited/drivers/scsi/sg.c 2004-08-26 00:04:25 -07:00
> @@ -564,6 +564,17 @@
> hp->usr_ptr = NULL;
> if (__copy_from_user(cmnd, buf, cmd_size))
> return -EFAULT;
> + /*
> + * SG_DXFER_TO_FROM_DEV is functionally equivalent to SG_DXFER_FROM_DEV,
> + * but is is possible that the app intended SG_DXFER_TO_DEV, because there
> + * is a non-zero input_size, so emit a warning.
> + */
> + if (hp->dxfer_direction == SG_DXFER_TO_FROM_DEV)
> + printk("sg_write: cannot infer direction from count %ld "
> + "and reply_len %d. Command 0x%x will probably fail. "
> + "Please fix the application to use proper counts or "
> + "the sg version 3 interface\n",
> + count, old_hdr.reply_len, (unsigned int) cmnd[0]);
> k = sg_common_write(sfp, srp, cmnd, sfp->timeout, blocking);
> return (k < 0) ? k : count;
> }
>
Jeremy,
Perhaps the first argument of printk() could be prefixed with
KERN_WARNING to make it a bit more syslog friendly.
Otherwise ok.
Doug Gilbert
next prev parent reply other threads:[~2004-08-26 8:45 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-31 11:52 [PATCH] fusion update to current APIs Christoph Hellwig
2004-06-12 0:36 ` Jeremy Higdon
2004-06-12 3:45 ` Matthew Wilcox
2004-06-12 5:13 ` Jeremy Higdon
2004-06-12 5:20 ` Matthew Wilcox
2004-06-15 6:08 ` [PATCH] sg.c to set direction more reliably (was Re: [PATCH] fusion update to current APIs) Jeremy Higdon
2004-06-15 6:47 ` Douglas Gilbert
2004-06-15 7:41 ` Jeremy Higdon
2004-06-15 15:07 ` Jeff Garzik
2004-06-15 21:34 ` Jeremy Higdon
2004-06-15 22:10 ` Jeff Garzik
2004-06-15 22:15 ` Jeremy Higdon
2004-08-26 7:09 ` Jeremy Higdon
2004-08-26 8:44 ` Douglas Gilbert [this message]
2004-08-27 1:12 ` Jeremy Higdon
2004-08-27 8:10 ` Jeremy Higdon
2004-08-28 5:08 ` Douglas Gilbert
2004-08-28 9:39 ` Jeremy Higdon
2004-08-30 7:08 ` [PATCH] sg.c to warn about ambiguous data direction Jeremy Higdon
2004-06-15 6:54 ` [PATCH] sg.c to set direction more reliably (was Re: [PATCH] fusion update to current APIs) Jeff Garzik
2004-06-15 7:50 ` Jeremy Higdon
2004-06-15 7:57 ` Arjan van de Ven
2004-06-15 8:40 ` Jeremy Higdon
2004-06-15 8:17 ` Christoph Hellwig
2004-06-15 8:48 ` Jeremy Higdon
2004-06-15 9:10 ` Jeremy Higdon
2004-06-15 9:31 ` Jeremy Higdon
2004-06-15 17:42 ` Patrick Mansfield
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=412DA2F8.8080607@torque.net \
--to=dougg@torque.net \
--cc=james.bottomley@steeleye.com \
--cc=jeremy@sgi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox