From 8de3e08bf89065a7c88d41e24356eeb0ab261630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Schmidt?= Date: Thu, 15 Oct 1998 08:11:55 +0000 Subject: [PATCH] Make the next_writeable address specific for each drive, there might be more than one burner online. --- sys/i386/isa/atapi-cd.c | 11 +++++------ sys/i386/isa/atapi-cd.h | 4 ++-- sys/i386/isa/wd_cd.c | 11 +++++------ sys/i386/isa/wd_cd.h | 4 ++-- sys/pc98/pc98/wd_cd.c | 11 +++++------ 5 files changed, 19 insertions(+), 22 deletions(-) diff --git a/sys/i386/isa/atapi-cd.c b/sys/i386/isa/atapi-cd.c index 640ed7fb7685..62c168c8d2d3 100644 --- a/sys/i386/isa/atapi-cd.c +++ b/sys/i386/isa/atapi-cd.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: atapi-cd.c,v 1.1 1998/09/08 20:57:47 sos Exp $ + * $Id: atapi-cd.c,v 1.2 1998/10/08 06:41:44 sos Exp $ */ #include "wdc.h" @@ -83,7 +83,6 @@ static struct cdevsw acd_cdevsw = { static struct acd *acdtab[NUNIT]; static int acdnlun = 0; /* Number of configured drives */ -static u_int next_writeable_lba = 0; #ifndef ATAPI_STATIC static @@ -405,7 +404,7 @@ acdopen(dev_t dev, int flags, int fmt, struct proc *p) } } else { /* read only */ - if (acd_read_toc(cdp) < 0) { + if (acd_read_toc(cdp) != 0) { printf("acd%d: read_toc failed\n", lun); /* return EIO; */ } @@ -536,7 +535,7 @@ acd_start(struct acd *cdp) lba = bp->b_blkno / (cdp->block_size / DEV_BSIZE); #endif else - lba = next_writeable_lba + (bp->b_offset / cdp->block_size); + lba = cdp->next_writeable_lba + (bp->b_offset / cdp->block_size); blocks = (bp->b_bcount + (cdp->block_size - 1)) / cdp->block_size; if ((bp->b_flags & B_READ) == B_WRITE) { @@ -1004,7 +1003,7 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) break; if (!track_info.nwa_valid) return EINVAL; - next_writeable_lba = track_info.next_writeable_addr; + cdp->next_writeable_lba = track_info.next_writeable_addr; *(int*)addr = track_info.next_writeable_addr; } break; @@ -1274,7 +1273,7 @@ acd_rezero_unit(struct acd *cdp) static int acd_open_disk(struct acd *cdp, int test) { - next_writeable_lba = 0; + cdp->next_writeable_lba = 0; return 0; } diff --git a/sys/i386/isa/atapi-cd.h b/sys/i386/isa/atapi-cd.h index 29da547dc56f..11aaf319e95d 100644 --- a/sys/i386/isa/atapi-cd.h +++ b/sys/i386/isa/atapi-cd.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: atapi-cd.h,v 1.2 1998/09/02 08:47:31 sos Exp sos $ + * $Id: atapi-cd.h,v 1.1 1998/09/08 20:57:47 sos Exp $ */ /* @@ -343,8 +343,8 @@ struct acd { u_int block_size; /* Blocksize currently used */ u_char dummy; /* Use dummy writes */ u_char speed; /* Select drive speed */ + u_int next_writeable_lba; /* Next writable position */ struct wormio_prepare_track preptrack; /* Scratch region */ - #ifdef DEVFS void *ra_devfs_token; void *rc_devfs_token; diff --git a/sys/i386/isa/wd_cd.c b/sys/i386/isa/wd_cd.c index 640ed7fb7685..62c168c8d2d3 100644 --- a/sys/i386/isa/wd_cd.c +++ b/sys/i386/isa/wd_cd.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: atapi-cd.c,v 1.1 1998/09/08 20:57:47 sos Exp $ + * $Id: atapi-cd.c,v 1.2 1998/10/08 06:41:44 sos Exp $ */ #include "wdc.h" @@ -83,7 +83,6 @@ static struct cdevsw acd_cdevsw = { static struct acd *acdtab[NUNIT]; static int acdnlun = 0; /* Number of configured drives */ -static u_int next_writeable_lba = 0; #ifndef ATAPI_STATIC static @@ -405,7 +404,7 @@ acdopen(dev_t dev, int flags, int fmt, struct proc *p) } } else { /* read only */ - if (acd_read_toc(cdp) < 0) { + if (acd_read_toc(cdp) != 0) { printf("acd%d: read_toc failed\n", lun); /* return EIO; */ } @@ -536,7 +535,7 @@ acd_start(struct acd *cdp) lba = bp->b_blkno / (cdp->block_size / DEV_BSIZE); #endif else - lba = next_writeable_lba + (bp->b_offset / cdp->block_size); + lba = cdp->next_writeable_lba + (bp->b_offset / cdp->block_size); blocks = (bp->b_bcount + (cdp->block_size - 1)) / cdp->block_size; if ((bp->b_flags & B_READ) == B_WRITE) { @@ -1004,7 +1003,7 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) break; if (!track_info.nwa_valid) return EINVAL; - next_writeable_lba = track_info.next_writeable_addr; + cdp->next_writeable_lba = track_info.next_writeable_addr; *(int*)addr = track_info.next_writeable_addr; } break; @@ -1274,7 +1273,7 @@ acd_rezero_unit(struct acd *cdp) static int acd_open_disk(struct acd *cdp, int test) { - next_writeable_lba = 0; + cdp->next_writeable_lba = 0; return 0; } diff --git a/sys/i386/isa/wd_cd.h b/sys/i386/isa/wd_cd.h index 29da547dc56f..11aaf319e95d 100644 --- a/sys/i386/isa/wd_cd.h +++ b/sys/i386/isa/wd_cd.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: atapi-cd.h,v 1.2 1998/09/02 08:47:31 sos Exp sos $ + * $Id: atapi-cd.h,v 1.1 1998/09/08 20:57:47 sos Exp $ */ /* @@ -343,8 +343,8 @@ struct acd { u_int block_size; /* Blocksize currently used */ u_char dummy; /* Use dummy writes */ u_char speed; /* Select drive speed */ + u_int next_writeable_lba; /* Next writable position */ struct wormio_prepare_track preptrack; /* Scratch region */ - #ifdef DEVFS void *ra_devfs_token; void *rc_devfs_token; diff --git a/sys/pc98/pc98/wd_cd.c b/sys/pc98/pc98/wd_cd.c index 640ed7fb7685..62c168c8d2d3 100644 --- a/sys/pc98/pc98/wd_cd.c +++ b/sys/pc98/pc98/wd_cd.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: atapi-cd.c,v 1.1 1998/09/08 20:57:47 sos Exp $ + * $Id: atapi-cd.c,v 1.2 1998/10/08 06:41:44 sos Exp $ */ #include "wdc.h" @@ -83,7 +83,6 @@ static struct cdevsw acd_cdevsw = { static struct acd *acdtab[NUNIT]; static int acdnlun = 0; /* Number of configured drives */ -static u_int next_writeable_lba = 0; #ifndef ATAPI_STATIC static @@ -405,7 +404,7 @@ acdopen(dev_t dev, int flags, int fmt, struct proc *p) } } else { /* read only */ - if (acd_read_toc(cdp) < 0) { + if (acd_read_toc(cdp) != 0) { printf("acd%d: read_toc failed\n", lun); /* return EIO; */ } @@ -536,7 +535,7 @@ acd_start(struct acd *cdp) lba = bp->b_blkno / (cdp->block_size / DEV_BSIZE); #endif else - lba = next_writeable_lba + (bp->b_offset / cdp->block_size); + lba = cdp->next_writeable_lba + (bp->b_offset / cdp->block_size); blocks = (bp->b_bcount + (cdp->block_size - 1)) / cdp->block_size; if ((bp->b_flags & B_READ) == B_WRITE) { @@ -1004,7 +1003,7 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) break; if (!track_info.nwa_valid) return EINVAL; - next_writeable_lba = track_info.next_writeable_addr; + cdp->next_writeable_lba = track_info.next_writeable_addr; *(int*)addr = track_info.next_writeable_addr; } break; @@ -1274,7 +1273,7 @@ acd_rezero_unit(struct acd *cdp) static int acd_open_disk(struct acd *cdp, int test) { - next_writeable_lba = 0; + cdp->next_writeable_lba = 0; return 0; }