diff options
author | joerg <joerg@FreeBSD.org> | 1997-05-04 15:24:23 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1997-05-04 15:24:23 +0000 |
commit | 8cea5b917d62db9701a7fe2a45c9032aec48325d (patch) | |
tree | a2408a8a297df1fa5ba68bcc7ee4bc36c2fc2521 /sys/scsi | |
parent | 60343a746abd65c1fe9040ea648287d56be4b871 (diff) | |
download | FreeBSD-src-8cea5b917d62db9701a7fe2a45c9032aec48325d.zip FreeBSD-src-8cea5b917d62db9701a7fe2a45c9032aec48325d.tar.gz |
This mega-commit brings the following:
. It makes cd9660 root f/s working again.
. It makes CD9660 a new-style option.
. It adds support to mount an ISO9660 multi-session CD-ROM as the root
filesystem (the last session actually, but that's what is expected
behaviour).
Sigh. The CDIOREADTOCENTRYS did a copyout() of its own, and thus has
been unusable for me for this work. Too bad it didn't simply stuff
the max 100 entries into the struct ioc_read_toc_entry, but relied on
a user supplied data buffer instead. :-( I now had to reinvent the
wheel, and created a CDIOREADTOCENTRY ioctl command that can be used
in a kernel context.
While doing this, i noticed the following bogosities in existing CD-ROM
drivers:
wcd: This driver is likely to be totally bogus when someone tries
two succeeding CDIOREADTOCENTRYS (or now CDIOREADTOCENTRY)
commands with requesting MSF format, since it apparently
operates on an internal table.
scd: This driver apparently returns just a single TOC entry only for
the CDIOREADTOCENTRYS command.
I have only been able to test the CDIOREADTOCENTRY command with the
cd(4) driver. I hereby request the respective maintainers of the
other CD-ROM drivers to verify my code for their driver. When it
comes to merging this CD-ROM multisession stuff into RELENG_2_2 i will
only consider drivers where i've got a confirmation that it actually
works.
Diffstat (limited to 'sys/scsi')
-rw-r--r-- | sys/scsi/cd.c | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index f643c37..00df2f7 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * - * $Id: cd.c,v 1.81 1997/03/24 11:24:54 bde Exp $ + * $Id: cd.c,v 1.82 1997/04/02 09:05:38 jmg Exp $ */ #include "opt_bounce.h" @@ -834,6 +834,63 @@ cd_ioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p, error = copyout(data.entries, te->data, len); } break; + case CDIOREADTOCENTRY: + { + struct { + struct ioc_toc_header header; + struct cd_toc_entry entry; + } data; + struct ioc_read_toc_single_entry *te = + (struct ioc_read_toc_single_entry *) addr; + struct ioc_toc_header *th; + u_int32_t track; + + if (te->address_format != CD_MSF_FORMAT + && te->address_format != CD_LBA_FORMAT) { + error = EINVAL; + break; + } + + th = &data.header; + error = cd_read_toc(unit, 0, 0, + (struct cd_toc_entry *)th, sizeof (*th)); + if (error) + break; + + if (sc_link->quirks & CD_Q_BCD_TRACKS) { + /* we are going to have to convert the BCD + * encoding on the cd to what is expected + */ + th->starting_track = + bcd2bin(th->starting_track); + th->ending_track = bcd2bin(th->ending_track); + } + + track = te->track; + if (track == 0) + track = th->starting_track; + else if (track == LEADOUT) + /* OK */; + else if (track < th->starting_track || + track > th->ending_track + 1) { + error = EINVAL; + break; + } + + error = cd_read_toc(unit, te->address_format, + track, + (struct cd_toc_entry *)&data, + sizeof data); + if (error) + break; + + if (sc_link->quirks & CD_Q_BCD_TRACKS) + data.entry.track = bcd2bin(data.entry.track); + + bcopy(&data.entry, &te->entry, + sizeof(struct cd_toc_entry)); + } + break; case CDIOCSETPATCH: { struct ioc_patch *arg = (struct ioc_patch *) addr; |