public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Polyakov <appro@fy.chalmers.se>
To: linux-kernel@vger.kernel.org
Cc: axboe@suse.de
Subject: 2.5.69-70 ide-cd to guarantee fault-free CD/DVD burning experience?
Date: Wed, 28 May 2003 09:41:14 +0200	[thread overview]
Message-ID: <3ED4681A.738DA3C6@fy.chalmers.se> (raw)

Linux is setting new landmarks all the time. Linux 2.5 is taking CD/DVD
burning to whole new level by *guaranteeing* fault-free burning
experience. No more hassle with overburns, underruns, poorly supported
media, positioning errors, power calibration failures, you name it...
It just works [by keeping the user-land totally unaware of errors
conditions raised by the logical unit]. Welcome to the future:-)

Well, I'm probably pushing this joke too far:-) In such case accept the
apologies along with this patch which makes it possible to access the
sense data returned by IDE CD/DVD units from user-land with SG_IO ioctl.
As for the last part, req->data?req->data:req->buffer. I'm not sure if
it's "the right thing(tm)" to do, but an error condition (dereferencing
of NULL pointer to be specific) is raised otherwise, whenever call to
bio_map_user in drivers/block/scsi_ioctl.c fails. The patch is
applicable at least to 2.5.69 and 2.5.70.

As for 69-ac. SG_IO doesn't work there at all (kernel logs "confused,
missing data" and then "N residual after xfer"). As far as I can tell
drivers/block/scsi_ioctl.c needs a "face lift," but that's AC's(?)
concern.

As for scsi_ioctl.c in more general sense. It apparently doesn't comply
with SG HOWTO, in particular it mis-interprets time-out values.
Background information and patch is available at
http://fy.chalmers.se/~appro/linux/DVD+RW/scsi_ioctl-2.5.69.patch.
There're couple of other issues, usage of 'bytes' variable in access_ok
and DMA being off when bio_map_user fails, that needs some further
discussion in my opinion. As for discussion. Please note that I'm not
on the linux-kernel list so that keep me on Cc:.

Cheers. A.
8<--------8<--------8<--------8<--------8<--------8<--------8<--------
--- ./drivers/ide/ide-cd.c.orig	Mon May  5 01:53:14 2003
+++ ./drivers/ide/ide-cd.c	Mon May 26 17:06:09 2003
@@ -667,7 +667,8 @@
 		void *sense = &info->sense_data;
 		
 		if (failed && failed->sense)
-			sense = failed->sense;
+			sense = failed->sense,
+			failed->sense_len=rq->sense_len;
 
 		cdrom_analyze_sense_data(drive, failed, sense);
 	}
@@ -723,7 +724,7 @@
 		 * scsi status byte
 		 */
 		if ((rq->flags & REQ_BLOCK_PC) && !rq->errors)
-			rq->errors = CHECK_CONDITION;
+			rq->errors = CHECK_CONDITION<<1;
 
 		/* Check for tray open. */
 		if (sense_key == NOT_READY) {
@@ -1471,8 +1472,13 @@
 		/* Keep count of how much data we've moved. */
 		rq->data += thislen;
 		rq->data_len -= thislen;
+#if 0
 		if (rq->cmd[0] == GPCMD_REQUEST_SENSE)
 			rq->sense_len++;
+#else
+		if (rq->flags & REQ_SENSE)
+			rq->sense_len+=thislen;
+#endif
 	} else {
 confused:
 		printk ("%s: cdrom_pc_intr: The drive "
@@ -1609,7 +1615,7 @@
 
 static void post_transform_command(struct request *req)
 {
-	char *ibuf = req->buffer;
+	char *ibuf = req->data?req->data:req->buffer;
 	u8 *c = req->cmd;
 
 	if (!blk_pc_request(req))

             reply	other threads:[~2003-05-28  7:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-28  7:41 Andy Polyakov [this message]
2003-05-28  7:48 ` 2.5.69-70 ide-cd to guarantee fault-free CD/DVD burning experience? Jens Axboe
2003-05-28  7:52   ` Jens Axboe
2003-05-28 16:42   ` Andy Polyakov
2003-05-28 17:03     ` Jens Axboe
2003-05-29 13:50       ` Andy Polyakov
2003-05-29 17:33         ` Jens Axboe
2003-05-28  7:49 ` Jens Axboe
2003-06-04 19:42 ` Andy Polyakov
2003-06-04 19:55   ` Jens Axboe
2003-06-05 21:05     ` Andy Polyakov

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=3ED4681A.738DA3C6@fy.chalmers.se \
    --to=appro@fy.chalmers.se \
    --cc=axboe@suse.de \
    --cc=linux-kernel@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