Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Sep 1998 13:55:23 +0200 (MET DST)
From:      Luigi Rizzo <luigi@labinfo.iet.unipi.it>
To:        sos@FreeBSD.ORG
Cc:        current@FreeBSD.ORG
Subject:   Re: cd9660 mounts...
Message-ID:  <199809261155.NAA14371@labinfo.iet.unipi.it>
In-Reply-To: <199809261214.OAA24718@sos.freebsd.dk> from "Søren Schmidt" at Sep 26, 98 02:14:29 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> > An alternative hack (which seems to work and requires very little
> > modification -- just 4 lines in the device driver!) is to use the
> > device minor number to identify the track, so that you can say
> >
> > 	mount -t cd9660 -o -s=3D0 /dev/wcd0tN /cdrom
> >
> > to mount the n-th track.
> >
> > In the above you _need_ to specify the "-s=3D0" option to mount_cd9660
> > because otherwise it tries to access the last data track on the disk.
> >
> > Opinions ? Is this something worth adding to the system ? It is totally
> > backward compatible and nonintrusive.
> 
> I think this method is the best one, we can keep the mods in the
> atapi-cd devicedriver which still is sortof alpha code. That wont
> make it work for SCSI CDROM's, but that just too bad...

the diffs for wcd.c are below... atapi-cd.c has similar code, i
think it will not take more than five minutes to patch
the cdopen() and cdstart() functions in /sys/scsi ... (except that i
cannot find the code for cdopen() !)

	luigi

--- wcd.c	Tue Jul  7 05:23:28 1998
+++ /sys/i386/isa/wcd.c	Sat Sep 26 09:13:54 1998
@@ -225,6 +225,7 @@
 	struct audiopage aumask;        /* Audio page mask */
 	struct subchan subchan;         /* Subchannel info */
 	char description[80];           /* Device description */
+	int starting_lba ;
 #ifdef	DEVFS
 	void	*ra_devfs_token;
 	void	*rc_devfs_token;
@@ -289,12 +290,12 @@
 	lun = t->lun = wcdnlun++;
 	t->param = ap;
 	t->flags = F_MEDIA_CHANGED;
+	t->starting_lba = 0;
 	t->refcnt = 0;
 	if (debug) {
 		t->flags |= F_DEBUG;
@@ -403,7 +401,7 @@
 wcd_open (dev_t dev, int rawflag)
 {
 	int lun = UNIT(dev);
+	int track = dkslice(dev); /* XXX */
 	struct wcd *t;
 
 	/* Check that the device number is legal
@@ -431,6 +458,11 @@
 		++t->refcnt;
 	else
 		t->flags |= F_BOPEN;
+	t->starting_lba = ntohl(t->toc.tab[track].addr.lba) ;
+	if (track != 0) { 
+		printf("Warning, opening track %d at %d\n",
+			track, t->starting_lba);
+	}
 	return (0);
 }
 
@@ -547,7 +578,7 @@
 	 * First, translate the block to absolute and put it in terms of the
 	 * logical blocksize of the device.
 	 * What if something asks for 512 bytes not on a 2k boundary? */
-	blkno = bp->b_blkno / (SECSIZE / 512);
+	blkno = t->starting_lba + bp->b_blkno / (SECSIZE / 512);
 	nblk = (bp->b_bcount + (SECSIZE - 1)) / SECSIZE;
 
 	atapi_request_callback (t->ata, t->unit, ATAPI_READ_BIG, 0,

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809261155.NAA14371>