Oh these cdrom ioctls...

Gerd Knorr (kraxel@cs.tu-berlin.de)
Mon, 23 Dec 1996 17:54:32 +0100 (MET)


Hi *,

While looking around how to implement form2(aka XA)/mode2 reading stuff
(2324 byte sectors, used for MPEG and other multimedia data) in the
scsi cdrom driver I found the following ioctl chaos:

include/linux/cdrom.h says this:

#define CDROMREADMODE1 0x530d /* (struct cdrom_read) */
#define CDROMREADMODE2 0x530c /* (struct cdrom_read) */
#define CDROMREADRAW 0x5314 /* read data in raw mode */
#define CDROMREADCOOKED 0x5315 /* read data in cooked mode */
#define CDROMREADALL 0x5318 /* read all 2646 bytes */

CDROMREADMODE1/2:
ide-cd has them and reads data in mode1 (2048) / mode2 (2336), but
expects as argument an "struct cdrom_msf" instead of "struct
cdrom_read".
aztcd and sbpcd use these ioctls for switching between mode1 and mode2.
Which is useless in my eyes, as there is no way to get the mode2
sectors throuth the VFS layer. sbpcd.c has a comment saying "/* not
usable at the moment */" to CDROMREADMODE2...

CDROMREADRAW:
aztcd has this, expects argument to be "struct cdrom_msf", and reads
2336 bytes. Is #ifdef'ed out per default, a comment states this ioctl
is "private" to aztcd.
optcd has this too, but reads 2340 bytes.

CDROMREADCOOKED:
implemented in aztcd and optcd, reads 2048 sectors.

CDROMREADALL:
optcd only has this. Anybody else can do this? Any real application for
this?

Time to clean up here. CDROMREADMODE1/2 for example: Three drivers have
implemented this, in two different variants. And both do *not* do what
what you would expect from reading the comments in include/linux/cdrom.h.
What is the CDROMREADCOOKED ioctl good for? Reading the "normal" 2048 byte
sectors you can do with the read(2) system call.

Comments? Is anythere documented how these ioctl's should work? In the
source it is'nt...

Gerd