Messages in this thread Patch in this message | | | Date | Mon, 11 Oct 1999 09:55:26 +0300 (EEST) | From | Vladimir Chernyshov <> | Subject | [PATCH] cdda reading |
| |
Hi
In recent version of generic CDROM driver the number of blocks requestable with CDROMREADAUDIO ioctl has been limited to 8. Why? This breaks for example nice cdda2wav program, which used to request 75 blocks (1 sec of audio) at once.
Here is a patch for it... I am not sure to what number of block we should limit the request size, so I have put 300 (4 seconds). Should we limit it at all?
Vladimir --- linux/drivers/cdrom/cdrom.c.old Fri Oct 8 15:34:12 1999 +++ linux/drivers/cdrom/cdrom.c Sat Oct 9 10:29:42 1999 @@ -1764,11 +1764,11 @@ return -EINVAL; /* do between 1 and 8 frames at the time */ - if (ra.nframes > 8 || ra.nframes < 1) + if (ra.nframes > 300 || ra.nframes < 1) return -EINVAL; /* just a nice round figure */ - if ((cgc.buffer = (char *) kmalloc(CD_FRAMESIZE_RAW*ra.nframes, + if ((cgc.buffer = (char *) kmalloc(CD_FRAMESIZE_RAW*8, GFP_KERNEL)) == NULL) return -ENOMEM; @@ -1778,14 +1778,15 @@ } while (ra.nframes > 0) { - ret = cdrom_read_block(cdi, &cgc, lba, ra.nframes, 1, + int nr = ra.nframes > 8 ? 8 : ra.nframes; + ret = cdrom_read_block(cdi, &cgc, lba, nr, 1, CD_FRAMESIZE_RAW); if (ret) break; __copy_to_user(ra.buf, cgc.buffer, - CD_FRAMESIZE_RAW*ra.nframes); - ra.buf += (CD_FRAMESIZE_RAW * ra.nframes); - ra.nframes -= ra.nframes; - lba += ra.nframes; + CD_FRAMESIZE_RAW*nr); + ra.buf += (CD_FRAMESIZE_RAW * nr); + ra.nframes -= nr; + lba += nr; } kfree(cgc.buffer); return ret; | |