fdc.c (25d01e95275c80d4965cd441ad451b9410bfe886) | fdc.c (49ff4debd3d4c155448b2b4e3b95b17d9eb575ed) |
---|---|
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.150 1999/07/29 01:02:55 mdodd Exp $ | 50 * $Id: fd.c,v 1.151 1999/07/29 11:27:33 joerg Exp $ |
51 * 52 */ 53 54#include "fd.h" 55#include "opt_devfs.h" 56#include "opt_fdc.h" 57 58#if NFDC > 0 --- 2153 unchanged lines hidden (view full) --- 2212 bp->b_blkno = (finfo->cyl * (fd->ft->sectrac * fd->ft->heads) 2213 + finfo->head * fd->ft->sectrac) * fdblk / DEV_BSIZE; 2214 2215 bp->b_bcount = sizeof(struct fd_idfield_data) * finfo->fd_formb_nsecs; 2216 bp->b_data = (caddr_t)finfo; 2217 2218 /* now do the format */ 2219 bp->b_dev = dev; | 51 * 52 */ 53 54#include "fd.h" 55#include "opt_devfs.h" 56#include "opt_fdc.h" 57 58#if NFDC > 0 --- 2153 unchanged lines hidden (view full) --- 2212 bp->b_blkno = (finfo->cyl * (fd->ft->sectrac * fd->ft->heads) 2213 + finfo->head * fd->ft->sectrac) * fdblk / DEV_BSIZE; 2214 2215 bp->b_bcount = sizeof(struct fd_idfield_data) * finfo->fd_formb_nsecs; 2216 bp->b_data = (caddr_t)finfo; 2217 2218 /* now do the format */ 2219 bp->b_dev = dev; |
2220 fdstrategy(bp); | 2220 BUF_STRATEGY(bp, 0); |
2221 2222 /* ...and wait for it to complete */ 2223 s = splbio(); 2224 while(!(bp->b_flags & B_DONE)) { 2225 rv = tsleep((caddr_t)bp, PRIBIO, "fdform", 20 * hz); 2226 if (rv == EWOULDBLOCK) 2227 break; 2228 } --- 43 unchanged lines hidden (view full) --- 2272 case DIOCGDINFO: 2273 bzero(buffer, sizeof (buffer)); 2274 dl = (struct disklabel *)buffer; 2275 dl->d_secsize = fdblk; 2276 fdt = fd->ft; 2277 dl->d_secpercyl = fdt->size / fdt->tracks; 2278 dl->d_type = DTYPE_FLOPPY; 2279 | 2221 2222 /* ...and wait for it to complete */ 2223 s = splbio(); 2224 while(!(bp->b_flags & B_DONE)) { 2225 rv = tsleep((caddr_t)bp, PRIBIO, "fdform", 20 * hz); 2226 if (rv == EWOULDBLOCK) 2227 break; 2228 } --- 43 unchanged lines hidden (view full) --- 2272 case DIOCGDINFO: 2273 bzero(buffer, sizeof (buffer)); 2274 dl = (struct disklabel *)buffer; 2275 dl->d_secsize = fdblk; 2276 fdt = fd->ft; 2277 dl->d_secpercyl = fdt->size / fdt->tracks; 2278 dl->d_type = DTYPE_FLOPPY; 2279 |
2280 if (readdisklabel(dkmodpart(dev, RAW_PART), fdstrategy, dl) | 2280 if (readdisklabel(dkmodpart(dev, RAW_PART), dl) |
2281 == NULL) 2282 error = 0; 2283 else 2284 error = EINVAL; 2285 2286 *(struct disklabel *)addr = *dl; 2287 break; 2288 --- 14 unchanged lines hidden (view full) --- 2303 } 2304 2305 dl = (struct disklabel *)addr; 2306 2307 if ((error = setdisklabel((struct disklabel *)buffer, dl, 2308 (u_long)0)) != 0) 2309 break; 2310 | 2281 == NULL) 2282 error = 0; 2283 else 2284 error = EINVAL; 2285 2286 *(struct disklabel *)addr = *dl; 2287 break; 2288 --- 14 unchanged lines hidden (view full) --- 2303 } 2304 2305 dl = (struct disklabel *)addr; 2306 2307 if ((error = setdisklabel((struct disklabel *)buffer, dl, 2308 (u_long)0)) != 0) 2309 break; 2310 |
2311 error = writedisklabel(dev, fdstrategy, 2312 (struct disklabel *)buffer); | 2311 error = writedisklabel(dev, (struct disklabel *)buffer); |
2313 break; 2314 case FD_FORM: 2315 if ((flag & FWRITE) == 0) 2316 error = EBADF; /* must be opened for writing */ 2317 else if (((struct fd_formb *)addr)->format_version != 2318 FD_FORMAT_VERSION) 2319 error = EINVAL; /* wrong version of formatting prog */ 2320 else --- 91 unchanged lines hidden --- | 2312 break; 2313 case FD_FORM: 2314 if ((flag & FWRITE) == 0) 2315 error = EBADF; /* must be opened for writing */ 2316 else if (((struct fd_formb *)addr)->format_version != 2317 FD_FORMAT_VERSION) 2318 error = EINVAL; /* wrong version of formatting prog */ 2319 else --- 91 unchanged lines hidden --- |