NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/47676: Off-by-one error in reported CD capacity means last sector cannot be read

The following reply was made to PR kern/47676; it has been noted by GNATS.

From: Reinoud Zandijk <>
To: Mark <>
Subject: Re: kern/47676: Off-by-one error in reported CD capacity means last
 sector cannot be read
Date: Fri, 29 Mar 2013 23:02:26 +0100

 On Thu, Mar 28, 2013 at 07:08:18PM -0000, Mark wrote:
 > For some drives/discs that would mean getting an error message near the
 > end if you try to do
 >   dd if=/dev/rcd0c of=image.iso bs=2048
 > But at least all readable sectors would be read.
 True, and answering your later question on run-out blocks: no they are
 adressable but NOT readable, a big mistake IMHO that they made.
 Run-out blocks are the blocks that are needed to fill up the 7 (IIRC) sector
 lower level blocking that goes on in CDs. For CD-RW its 32 and for DVD-* its
 16. Run-out sectors themselves on CD-R(W) can't be read but the few sectors
 before them in the packet are.
 > The later MMC spec (I looked at
 > page 783) doesn't allow the returned highest LBA to be greater than the
 > actual highest LBA for non-CD media. It has this to say about CD media:
 > "For CD media, the logical unit shall use the AAh point found in the last
 > Table of Contents, convert to an LBA, and subtract one. If that block is a
 > run-out block (found on incrementally recorded CD-R and CD-RW), the
 > logical unit shall subtract two."
 BRRR... the horrors haunt me again :) They seem to always create a -ROM first
 and then later bodge -R and -RW/-RE versions *sigh*
 It would explain the 2 less reported. Hmm i could make the code check the disc
 type and if its a CD-R(W) make it DTRT but it won't be pretty. On recorders I
 use the newer READ_TRACKINFO but aparently they haven't fixed it there either,
 at least in some drives.
 It needs more thought aparently, though i hope to fix it ASAP before 6.2 gets
 rolled out or 7 gets forked.

Home | Main Index | Thread Index | Old Index