Re: PROBLEM: Impossible to read files from a CD-Rom

From: Samuel Thibault
Date: Fri Sep 12 2003 - 04:59:40 EST


Le ven 12 sep 2003 08:51:16 GMT, Jens Axboe a tapoté sur son clavier :
> On Mon, Sep 08 2003, Samuel Thibault wrote:
> > The solution would be to return an error if
> > cgc.buflen != sizeof(track_information) after the truncation to
> > sizeof(track_information), so that cdrom_get_last_written() will
> > correctly fail, and make cdrom_read_toc() use cdrom_read_capacity()
> > instead, which gives the correct answer.
>
> It isn't that easy, if that were the case there would be no need for the
> above code would there?
>
> This basically boils down to a typical problem with CDROM/DVD drives -
> some specific structure may vary a little in size depending on when in
> the spec cycle they were implemented. Some drives barf if you try and
> read to much, some when you read too little. So the approach that
> typically works the best is to just read the very first of the
> structure, check the length, and issue a read for the complete data.

This is fine. Another solution would be that cdrom_get_track_info returns
the actual amount of data that was read, so that the caller may check
that the field it needs was really filled up.

> I'd be more interested in fixing the real bug: why does your drive
> return zero length, and only sporadically?

This we don't know, and I don't think we may do much about it. The cdrom
drive is a Dell one, connected to a dell laptop. They don't come from
the same laptop package at first, but it should still work (or linux may
try to work it around).

The very funny thing about it is that with 2.4 there was no problem
merely because it happened that the not filled up track_size field
already had a very big value, so that linux would think the cd is
actually very big and let i/o go...

Regards,
Samuel Thibault
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/