public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Derek Fawcus <dfawcus@cisco.com>
Cc: Pozsar Balazs <pozsy@sch.bme.hu>, linux-kernel@vger.kernel.org
Subject: Re: can't read DVD (under 2.4.[12] & 2.2.17)
Date: Wed, 7 Mar 2001 23:26:37 +0100	[thread overview]
Message-ID: <20010307232637.T4653@suse.de> (raw)
In-Reply-To: <20010307210848.E4653@suse.de> <Pine.GSO.4.30.0103072128180.6575-100000@balu> <20010307213632.H4653@suse.de> <20010307213625.A28742@uk-view2.cisco.com> <20010307224424.R4653@suse.de> <20010307224641.S4653@suse.de>
In-Reply-To: <20010307224641.S4653@suse.de>; from axboe@suse.de on Wed, Mar 07, 2001 at 10:46:41PM +0100

[-- Attachment #1: Type: text/plain, Size: 575 bytes --]

On Wed, Mar 07 2001, Jens Axboe wrote:
> On Wed, Mar 07 2001, Jens Axboe wrote:
> > Really good question, I sent this patch in the private thread between
> > me and Pozsar just in case the length is what the drive complains about.
> 
> Agrh, that's not all. I will fix this properly, sorry about the noise.

This should work. Pozsar, could you test?

I suspect that Derik is right though, that the 05/24/00 is because
the dvdinfo is requesting info for a non-existant physical layer.
I've attempted to quiet that error. You dvdinfo output did look
very odd.

-- 
Jens Axboe


[-- Attachment #2: dvd-read-phys-2 --]
[-- Type: text/plain, Size: 2886 bytes --]

--- /opt/kernel/linux-2.4.3-pre3/drivers/cdrom/cdrom.c	Thu Feb 22 14:55:22 2001
+++ drivers/cdrom/cdrom.c	Wed Mar  7 23:25:52 2001
@@ -1171,42 +1171,50 @@
 
 static int dvd_read_physical(struct cdrom_device_info *cdi, dvd_struct *s)
 {
-	int ret, i;
-	u_char buf[4 + 4 * 20], *base;
+	unsigned char buf[20], *base;
 	struct dvd_layer *layer;
 	struct cdrom_generic_command cgc;
 	struct cdrom_device_ops *cdo = cdi->ops;
+	int ret, layer_num = s->physical.layer_num;
+
+	if (layer_num >= DVD_LAYERS)
+		return -EINVAL;
 
 	init_cdrom_command(&cgc, buf, sizeof(buf), CGC_DATA_READ);
 	cgc.cmd[0] = GPCMD_READ_DVD_STRUCTURE;
-	cgc.cmd[6] = s->physical.layer_num;
+	cgc.cmd[6] = layer_num;
 	cgc.cmd[7] = s->type;
 	cgc.cmd[9] = cgc.buflen & 0xff;
 
+	/*
+	 * refrain from reporting errors on non-existing layers (mainly)
+	 */
+	cgc.quiet = 1;
+
 	if ((ret = cdo->generic_packet(cdi, &cgc)))
 		return ret;
 
 	base = &buf[4];
-	layer = &s->physical.layer[0];
+	layer = &s->physical.layer[layer_num];
 
-	/* place the data... really ugly, but at least we won't have to
-	   worry about endianess in userspace or here. */
-	for (i = 0; i < 4; ++i, base += 20, ++layer) {
-		memset(layer, 0, sizeof(*layer));
-		layer->book_version = base[0] & 0xf;
-		layer->book_type = base[0] >> 4;
-		layer->min_rate = base[1] & 0xf;
-		layer->disc_size = base[1] >> 4;
-		layer->layer_type = base[2] & 0xf;
-		layer->track_path = (base[2] >> 4) & 1;
-		layer->nlayers = (base[2] >> 5) & 3;
-		layer->track_density = base[3] & 0xf;
-		layer->linear_density = base[3] >> 4;
-		layer->start_sector = base[5] << 16 | base[6] << 8 | base[7];
-		layer->end_sector = base[9] << 16 | base[10] << 8 | base[11];
-		layer->end_sector_l0 = base[13] << 16 | base[14] << 8 | base[15];
-		layer->bca = base[16] >> 7;
-	}
+	/*
+	 * place the data... really ugly, but at least we won't have to
+	 * worry about endianess in userspace.
+	 */
+	memset(layer, 0, sizeof(*layer));
+	layer->book_version = base[0] & 0xf;
+	layer->book_type = base[0] >> 4;
+	layer->min_rate = base[1] & 0xf;
+	layer->disc_size = base[1] >> 4;
+	layer->layer_type = base[2] & 0xf;
+	layer->track_path = (base[2] >> 4) & 1;
+	layer->nlayers = (base[2] >> 5) & 3;
+	layer->track_density = base[3] & 0xf;
+	layer->linear_density = base[3] >> 4;
+	layer->start_sector = base[5] << 16 | base[6] << 8 | base[7];
+	layer->end_sector = base[9] << 16 | base[10] << 8 | base[11];
+	layer->end_sector_l0 = base[13] << 16 | base[14] << 8 | base[15];
+	layer->bca = base[16] >> 7;
 
 	return 0;
 }
--- /opt/kernel/linux-2.4.3-pre3/include/linux/cdrom.h	Tue Jan 30 08:24:56 2001
+++ include/linux/cdrom.h	Wed Mar  7 23:00:07 2001
@@ -524,10 +524,12 @@
 	__u32 end_sector_l0;
 };
 
+#define DVD_LAYERS	4
+
 struct dvd_physical {
 	__u8 type;
 	__u8 layer_num;
-	struct dvd_layer layer[4];
+	struct dvd_layer layer[DVD_LAYERS];
 };
 
 struct dvd_copyright {

  reply	other threads:[~2001-03-07 22:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-07 20:03 can't read DVD (under 2.4.[12] & 2.2.17) Pozsar Balazs
2001-03-07 20:08 ` Jens Axboe
2001-03-07 20:32   ` Pozsar Balazs
2001-03-07 20:36     ` Jens Axboe
2001-03-07 21:36       ` Derek Fawcus
2001-03-07 21:44         ` Jens Axboe
2001-03-07 21:46           ` Jens Axboe
2001-03-07 22:26             ` Jens Axboe [this message]
2001-03-07 22:58               ` Pozsar Balazs
2001-03-07 23:22                 ` Jens Axboe

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=20010307232637.T4653@suse.de \
    --to=axboe@suse.de \
    --cc=dfawcus@cisco.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pozsy@sch.bme.hu \
    /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