From: Nate Willams Date: Mon, 14 Feb 1994 22:24:28 +0000 (+0000) Subject: From: Jim Babb X-Git-Tag: FreeBSD-release/1.1~78 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/4af7e30c20b90e6bb0c85e9828fe8dabf6e82ee8 From: Jim Babb Date: Mon, 14 Feb 94 15:57:14 CST This adds a copyright to the fdc.h file and fixes a bug in re-tries during writes on a heavily loaded system. --- diff --git a/sys/i386/isa/fd.c b/sys/i386/isa/fd.c index 9fa06369e0..005a4dcd23 100644 --- a/sys/i386/isa/fd.c +++ b/sys/i386/isa/fd.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 - * $from: fd.c,v 1.18 1993/12/21 05:09:21 ache Exp $ + * $Id:$ * */ @@ -389,7 +389,7 @@ void fdstrategy(struct buf *bp) return; } #endif - if ((fdu >= (NFD+NFT)) || (bp->b_blkno < 0)) { + if ((fdu >= NFD) || (bp->b_blkno < 0)) { printf("fdstrat: fdu = %d, blkno = %d, bcount = %d\n", fdu, bp->b_blkno, bp->b_bcount); pg("fd:error in fdstrategy"); @@ -1174,7 +1174,10 @@ fdioctl (dev, cmd, addr, flag, p) int error; #if NFT > 0 - if (fd_data[FDUNIT(minor(dev))].fdc->flags & FDC_TAPE_BUSY) + int type = FDTYPE(minor(dev)); + + /* check for a tape ioctl */ + if (type & F_TAPE_TYPE) return ftioctl(dev, cmd, addr, flag, p); #endif diff --git a/sys/i386/isa/fdc.h b/sys/i386/isa/fdc.h index 3320de311b..1542f0eb7c 100644 --- a/sys/i386/isa/fdc.h +++ b/sys/i386/isa/fdc.h @@ -1,3 +1,40 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 + * $Id:$ + * + */ + /***********************************************************************\ * Per controller structure. * diff --git a/sys/i386/isa/ft.c b/sys/i386/isa/ft.c index 326b5bee70..b85e14d9cc 100644 --- a/sys/i386/isa/ft.c +++ b/sys/i386/isa/ft.c @@ -17,6 +17,8 @@ * POSSIBILITY OF SUCH DAMAGE. * * ft.c - QIC-40/80 floppy tape driver + * $Id:$ + * * * 01/26/94 v0.3b - Jim Babb * Got rid of the hard coded device selection. Moved (some of) the @@ -910,7 +912,7 @@ restate: #endif /* Check for errors */ - if ((rddta[0] & 0xc0) == 0x40) { + if ((rddta[0] & 0xc0) != 0x00) { if (rddta[1] & 0x04) { /* Probably wrong position */ ft->lastpos = ft->xblk; @@ -1020,16 +1022,16 @@ restate: #endif /* Check for errors */ - if ((rddta[0] & 0xc0) == 0x40) { + if ((rddta[0] & 0xc0) != 0x00) { if (rddta[1] & 0x04) { /* Probably wrong position */ ft->lastpos = ft->xblk; - ard_state = 0; + awr_state = 0; goto restate; } else if (retries < 5) { /* Something happened -- try again */ ft->lastpos = ft->xblk; - ard_state = 0; + awr_state = 0; retries++; goto restate; } else { @@ -1695,8 +1697,12 @@ int qic_status(ftu_t ftu, int cmd, int nbits) int ftopen(dev_t dev, int arg2) { ftu_t ftu = FDUNIT(minor(dev)); int type = FDTYPE(minor(dev)); - fdc_p fdc = ft_data[ftu].fdc; + fdc_p fdc; + /* check bounds */ + if (ftu >= NFT) + return(ENXIO); + fdc = ft_data[ftu].fdc; /* check for controller already busy with tape */ if (fdc->flags & FDC_TAPE_BUSY) return(EBUSY);