fdc.c (47643) | fdc.c (48225) |
---|---|
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 | 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.145 1999/05/30 16:52:12 phk Exp $ | 50 * $Id: fd.c,v 1.146 1999/05/31 18:39:16 dfr Exp $ |
51 * 52 */ 53 54#include "fd.h" 55#include "opt_devfs.h" 56#include "opt_fdc.h" 57 58#if NFDC > 0 --- 2132 unchanged lines hidden (view full) --- 2191 bp = (struct buf *)malloc(sizeof(struct buf), M_TEMP, M_NOWAIT); 2192 if(bp == 0) 2193 return ENOBUFS; 2194 /* 2195 * keep the process from being swapped 2196 */ 2197 PHOLD(p); 2198 bzero((void *)bp, sizeof(struct buf)); | 51 * 52 */ 53 54#include "fd.h" 55#include "opt_devfs.h" 56#include "opt_fdc.h" 57 58#if NFDC > 0 --- 2132 unchanged lines hidden (view full) --- 2191 bp = (struct buf *)malloc(sizeof(struct buf), M_TEMP, M_NOWAIT); 2192 if(bp == 0) 2193 return ENOBUFS; 2194 /* 2195 * keep the process from being swapped 2196 */ 2197 PHOLD(p); 2198 bzero((void *)bp, sizeof(struct buf)); |
2199 bp->b_flags = B_BUSY | B_PHYS | B_FORMAT; | 2199 BUF_LOCKINIT(bp); 2200 BUF_LOCK(bp, LK_EXCLUSIVE); 2201 bp->b_flags = B_PHYS | B_FORMAT; |
2200 2201 /* 2202 * calculate a fake blkno, so fdstrategy() would initiate a 2203 * seek to the requested cylinder 2204 */ 2205 bp->b_blkno = (finfo->cyl * (fd->ft->sectrac * fd->ft->heads) 2206 + finfo->head * fd->ft->sectrac) * fdblk / DEV_BSIZE; 2207 --- 19 unchanged lines hidden (view full) --- 2227 biodone(bp); 2228 } 2229 if (bp->b_flags & B_ERROR) 2230 rv = bp->b_error; 2231 /* 2232 * allow the process to be swapped 2233 */ 2234 PRELE(p); | 2202 2203 /* 2204 * calculate a fake blkno, so fdstrategy() would initiate a 2205 * seek to the requested cylinder 2206 */ 2207 bp->b_blkno = (finfo->cyl * (fd->ft->sectrac * fd->ft->heads) 2208 + finfo->head * fd->ft->sectrac) * fdblk / DEV_BSIZE; 2209 --- 19 unchanged lines hidden (view full) --- 2229 biodone(bp); 2230 } 2231 if (bp->b_flags & B_ERROR) 2232 rv = bp->b_error; 2233 /* 2234 * allow the process to be swapped 2235 */ 2236 PRELE(p); |
2237 BUF_UNLOCK(bp); 2238 BUF_LOCKFREE(bp); |
|
2235 free(bp, M_TEMP); 2236 return rv; 2237} 2238 2239/* 2240 * TODO: don't allocate buffer on stack. 2241 */ 2242 --- 161 unchanged lines hidden --- | 2239 free(bp, M_TEMP); 2240 return rv; 2241} 2242 2243/* 2244 * TODO: don't allocate buffer on stack. 2245 */ 2246 --- 161 unchanged lines hidden --- |