Re: IDE CDROM packet command buffer size restriction.

chrisl@vmware.com
Sat, 2 Nov 2002 01:10:49 -0800


On Fri, Nov 01, 2002 at 01:10:45PM +0100, Jens Axboe wrote:
> > We make a patch allow kernel return successful and return the actual
> > transfer data size. Is it the prefer behavior in this case? If not,
> > what is the best way to solve this problem?
>
> The patch does look good, thanks.

Sasha just find my change to the patch has some fault. The pc.buflen
changed after cdrom_queue_packet_command. So his original patch
is more correct.

I paste it here again. I am sorry for the confusion.

Chris

--- 1.17/drivers/ide/ide-cd.c Mon Sep 16 22:39:10 2002
+++ edited/ide-cd.c Sat Nov 2 01:02:43 2002
@@ -1322,8 +1322,7 @@
ireason = IN_BYTE (IDE_NSECTOR_REG);
len = IN_BYTE (IDE_LCYL_REG) + 256 * IN_BYTE (IDE_HCYL_REG);

- /* If DRQ is clear, the command has completed.
- Complain if we still have data left to transfer. */
+ /* If DRQ is clear, the command has completed. */
if ((stat & DRQ_STAT) == 0) {
/* Some of the trailing request sense fields are optional, and
some drives don't send them. Sigh. */
@@ -1336,19 +1335,8 @@
}
}

- if (pc->buflen == 0)
- cdrom_end_request (1, drive);
- else {
- /* Comment this out, because this always happens
- right after a reset occurs, and it is annoying to
- always print expected stuff. */
- /*
- printk ("%s: cdrom_pc_intr: data underrun %d\n",
- drive->name, pc->buflen);
- */
- pc->stat = 1;
- cdrom_end_request (1, drive);
- }
+ cdrom_end_request (1, drive);
+
return ide_stopped;
}

@@ -2202,7 +2190,9 @@
pc.quiet = cgc->quiet;
pc.timeout = cgc->timeout;
pc.sense = cgc->sense;
- return cgc->stat = cdrom_queue_packet_command(drive, &pc);
+ cgc->stat = cdrom_queue_packet_command(drive, &pc);
+ cgc->buflen -= pc.buflen;
+ return cgc->stat;
}
-
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/