Subject: ideas for multisession CD support
To: None <tech-kern@netbsd.org>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: tech-kern
Date: 04/19/2002 20:59:57
I'm missing two features at the moment:
1) access to previous sessions on a CD, and
2) the ability to simulate a multisession CD on vnd (or
   hard disk, for that matter)

What we have now is that the cd9660 filesystem asks the CD
driver for the offset of the last session through an ioctl
and always uses the offset if the driver/device supplies it.

For (2), we could support this ioctl (CDIOREADMSADDR) in other
drivers; we'd also need a way to configure it because the
hardware doesn't provide the offset generally. Another ioctl --
if the CD driver(s) supported it to override the hardware,
item (1) would also be solved.
I don't like the idea too much because it is a completely new
interface.

FreeBSD invented a new mount argument to tell cd9660 which
session offset (in CD sectors) to use.

Inspired by mbrlabel(8), I'm toying with another idea:
How about using the disklabel to transfer information from
the CD (or whatever) driver to the iso9660 filesystem?
The in-core disklabel only, of course.
The CD driver's getdefaultlabel() can initialize it reasonably
(to what we had before), and it can be overridden by disklabel(8)
or a dedicated tool.

The problem is that the partition offset field can not be used for
that purpose, because the iso9660 filesystem uses absolute
block addresses (not relative to the session), and it is completely
legal to access data in previous sessions what would be rejected by
bounds_check_with_label().
The p_fsize field of the disklabel is not used in the FS_ISO9660
case, so it could be overloaded.

disklabel(8) must be tricked into allowing to edit this field
at the moment (there is also a sectorsize!=DEV_BSIZE issue),
but in principle this works for me.
What I've done atm is that the CD driver (scsipi/cd.c) sets up
partition 'a' to point to the last sesson - this is what we had
before - and RAW_PART to offset "0" (which means the first
session, different from current behaviour). Other sessions must
be entered manually.

So what do you think about the idea?

best regards
Matthias