lkml.org 
[lkml]   [2003]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: CDROM_SEND_PACKET oddity
On Sat, 27 Sep 2003, Jens Axboe wrote:

> On Sat, Sep 27 2003, Jens Axboe wrote:
> > On Sat, Sep 27 2003, Jens Axboe wrote:
> > Actually, try this patch against current bk, it kills the
> > CDROM_SEND_PACKET setup and use SG_IO internally instead. Should be much
> > much better than what we have now. It's not tested here at all though,
> > I'd appreciate it if you could give it a go.
>
> This has a better chance of working. Changes:
>
> - Don't export sg_io() anyways (leftover)
> - Actually set ->cmdp and ->cmd_len
>
> still untested.

[...]

> + memcpy(hdr.cmdp, cgc.cmd, sizeof(cgc.cmd));

This breaks because hdr.cmdp is a pointer, not an array.

I think there has to be a hdr.mx_sb_len = sizeof(struct request_sense) in
there too?

Also, this changes the semantics of CDROM_SEND_PACKET, currently if
the command fails, it returns EIO, after the patch it succeeds.

how's this incremental patch? It seems to work as I expect it to.

--- scsi_ioctl.c.orig 2003-09-27 22:45:40.708105384 -0500
+++ scsi_ioctl.c 2003-09-27 22:46:23.490917249 -0500
@@ -479,10 +479,14 @@
hdr.dxferp = cgc.buffer;
hdr.sbp = (char *) cgc.sense;
hdr.timeout = cgc.timeout;
- memcpy(hdr.cmdp, cgc.cmd, sizeof(cgc.cmd));
+ hdr.cmdp = (unsigned char *)arg
+ + offsetof(struct cdrom_generic_command, cmd);
+ hdr.mx_sb_len = sizeof(struct request_sense);
hdr.cmd_len = sizeof(cgc.cmd);
err = sg_io(q, bdev, &hdr);

+ if (hdr.status)
+ err = -EIO;
cgc.stat = err;
cgc.buflen = hdr.resid;
if (copy_to_user((struct cdrom_generic_command *) arg, &cgc, sizeof(cgc)))
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:48    [from the cache]
©2003-2011 Jasper Spaans