From owner-cvs-all Mon Jan 4 13:42:10 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA09103 for cvs-all-outgoing; Mon, 4 Jan 1999 13:42:10 -0800 (PST) (envelope-from owner-cvs-all@FreeBSD.ORG) Received: from labinfo.iet.unipi.it (labinfo.iet.unipi.it [131.114.9.5]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id NAA09098 for ; Mon, 4 Jan 1999 13:42:07 -0800 (PST) (envelope-from luigi@labinfo.iet.unipi.it) Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id UAA00471; Mon, 4 Jan 1999 20:34:11 +0100 From: Luigi Rizzo Message-Id: <199901041934.UAA00471@labinfo.iet.unipi.it> Subject: proposed atapi-cd patch To: luigi@labinfo.iet.unipi.it (Luigi Rizzo) Date: Mon, 4 Jan 1999 20:34:11 +0100 (MET) Cc: committers@FreeBSD.ORG In-Reply-To: <199901041804.TAA00132@labinfo.iet.unipi.it> from "Luigi Rizzo" at Jan 4, 99 07:04:02 pm X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk Hi, does anyone objects to the following patch for atapi-cd.c to be able to mount other than the first data track on one disk ? (note that mount_cd9660 -s XXX does not work because it assumes that later tracks know about the previous ones). It (in my opinion) very useful to have multiple data tracks on the same disk, e.g. for independent backups. Even more with CDRW media. This (very small) patch uses a few bits in the minor number to select the track, so you need additional device entries in /dev. A better approach would involve adding an ioctl to set the track offset and call this from mount_cd9660 -- a bit cleaner perhaps, a bit more intrusive. The same thing could be implemented in the SCSI equivalent i guess. luigi Index: atapi-cd.c =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/atapi-cd.c,v retrieving revision 1.6 diff -u -r1.6 atapi-cd.c --- atapi-cd.c 1998/12/07 21:58:20 1.6 +++ atapi-cd.c 1999/01/04 13:38:17 @@ -123,6 +123,7 @@ ptr->flags = F_MEDIA_CHANGED; ptr->flags &= ~(F_WRITTEN|F_TRACK_PREP|F_TRACK_PREPED); ptr->block_size = 2048; + ptr->starting_lba = 0 ; ptr->refcnt = 0; ptr->slot = -1; ptr->changer_info = NULL; @@ -377,6 +378,7 @@ acdopen(dev_t dev, int flags, int fmt, struct proc *p) { int lun = dkunit(dev); + int track = dkslice(dev); /* XXX this is a hack... */ struct acd *cdp; if (lun >= acdnlun || !atapi_request_immediate) @@ -409,6 +411,11 @@ } } } + cdp->starting_lba = ntohl(cdp->toc.tab[track].addr.lba) ; + if (track != 0) { + printf("Warning, opening track %d at %ld\n", + track, cdp->starting_lba); + } return 0; } @@ -527,7 +534,8 @@ #ifdef NOTYET lba = bp->b_offset / cdp->block_size; #else - lba = bp->b_blkno / (cdp->block_size / DEV_BSIZE); + lba = bp->b_blkno / (cdp->block_size / DEV_BSIZE) + + cdp->starting_lba ; #endif else lba = cdp->next_writeable_lba + (bp->b_offset / cdp->block_size); @@ -1032,6 +1040,15 @@ error = EINVAL; printf("acd%d: sequence error (PREP_TRACK)\n", cdp->lun); } else { + /* + * if something has changed, synchronize track. + */ + if (cdp->flags & F_TRACK_PREPED && + (cdp->preptrack.audio != w->audio || + cdp->preptrack.preemp != w->preemp) ) { + error = acd_close_track(cdp); + cdp->flags &= ~(F_TRACK_PREPED | F_TRACK_PREP); + } cdp->flags |= F_TRACK_PREP; cdp->preptrack = *w; } Index: atapi-cd.h =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/atapi-cd.h,v retrieving revision 1.2 diff -u -r1.2 atapi-cd.h --- atapi-cd.h 1998/10/15 08:11:55 1.2 +++ atapi-cd.h 1999/01/04 13:29:07 @@ -345,6 +345,8 @@ u_char speed; /* Select drive speed */ u_int next_writeable_lba; /* Next writable position */ struct wormio_prepare_track preptrack; /* Scratch region */ + + u_long starting_lba; /* for multitrack */ #ifdef DEVFS void *ra_devfs_token; void *rc_devfs_token; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message