1/* 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Don Ahn. 7 * 8 * Libretto PCMCIA floppy support by David Horwitt (dhorwitt@ucsd.edu) --- 33 unchanged lines hidden (view full) --- 42 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 43 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 45 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 46 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 47 * SUCH DAMAGE. 48 * 49 * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 |
50 * $Id: fd.c,v 1.63 1999/06/01 13:14:34 kato Exp $ |
51 * 52 */ 53 54#include "fd.h" 55#include "opt_devfs.h" 56#include "opt_fdc.h" 57 58#if NFDC > 0 --- 2539 unchanged lines hidden (view full) --- 2598 bp = (struct buf *)malloc(sizeof(struct buf), M_TEMP, M_NOWAIT); 2599 if(bp == 0) 2600 return ENOBUFS; 2601 /* 2602 * keep the process from being swapped 2603 */ 2604 PHOLD(p); 2605 bzero((void *)bp, sizeof(struct buf)); |
2606 BUF_INITLOCK(bp); 2607 BUF_LOCK(bp, LK_EXCLUSIVE); 2608 bp->b_flags = B_PHYS | B_FORMAT; |
2609 2610 /* 2611 * calculate a fake blkno, so fdstrategy() would initiate a 2612 * seek to the requested cylinder 2613 */ 2614 bp->b_blkno = (finfo->cyl * (fd->ft->sectrac * fd->ft->heads) 2615 + finfo->head * fd->ft->sectrac) * fdblk / DEV_BSIZE; 2616 --- 19 unchanged lines hidden (view full) --- 2636 biodone(bp); 2637 } 2638 if (bp->b_flags & B_ERROR) 2639 rv = bp->b_error; 2640 /* 2641 * allow the process to be swapped 2642 */ 2643 PRELE(p); |
2644 BUF_UNLOCK(bp); 2645 BUF_FREELOCK(bp); |
2646 free(bp, M_TEMP); 2647 return rv; 2648} 2649 2650/* 2651 * TODO: don't allocate buffer on stack. 2652 */ 2653 --- 164 unchanged lines hidden --- |