kern_physio.c (46625) | kern_physio.c (46676) |
---|---|
1/* 2 * Copyright (c) 1994 John S. Dyson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice immediately at the beginning of the file, without modification, 10 * this list of conditions, and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. Absolutely no warranty of function or purpose is made by the author 15 * John S. Dyson. 16 * 4. Modifications may be freely made to this file if the above conditions 17 * are met. 18 * | 1/* 2 * Copyright (c) 1994 John S. Dyson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice immediately at the beginning of the file, without modification, 10 * this list of conditions, and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. Absolutely no warranty of function or purpose is made by the author 15 * John S. Dyson. 16 * 4. Modifications may be freely made to this file if the above conditions 17 * are met. 18 * |
19 * $Id: kern_physio.c,v 1.32 1999/05/06 20:00:25 phk Exp $ | 19 * $Id: kern_physio.c,v 1.33 1999/05/07 07:03:39 phk Exp $ |
20 */ 21 22#include <sys/param.h> 23#include <sys/systm.h> 24#include <sys/buf.h> 25#include <sys/conf.h> 26#include <sys/proc.h> 27#include <sys/uio.h> 28 29#include <vm/vm.h> 30#include <vm/vm_extern.h> 31 32static void physwakeup __P((struct buf *bp)); 33static struct buf * phygetvpbuf(dev_t dev, int resid); 34 35int 36physread(dev_t dev, struct uio *uio, int ioflag) 37{ | 20 */ 21 22#include <sys/param.h> 23#include <sys/systm.h> 24#include <sys/buf.h> 25#include <sys/conf.h> 26#include <sys/proc.h> 27#include <sys/uio.h> 28 29#include <vm/vm.h> 30#include <vm/vm_extern.h> 31 32static void physwakeup __P((struct buf *bp)); 33static struct buf * phygetvpbuf(dev_t dev, int resid); 34 35int 36physread(dev_t dev, struct uio *uio, int ioflag) 37{ |
38 return(physio(cdevsw[major(dev)]->d_strategy, NULL, dev, 1, minphys, uio)); | 38 return(physio(devsw(dev)->d_strategy, NULL, dev, 1, minphys, uio)); |
39} 40 41int 42physwrite(dev_t dev, struct uio *uio, int ioflag) 43{ | 39} 40 41int 42physwrite(dev_t dev, struct uio *uio, int ioflag) 43{ |
44 return(physio(cdevsw[major(dev)]->d_strategy, NULL, dev, 0, minphys, uio)); | 44 return(physio(devsw(dev)->d_strategy, NULL, dev, 0, minphys, uio)); |
45} 46 47int 48physio(strategy, bp, dev, rw, minp, uio) 49 d_strategy_t *strategy; 50 struct buf *bp; 51 dev_t dev; 52 int rw; --- 123 unchanged lines hidden (view full) --- 176 177u_int 178minphys(bp) 179 struct buf *bp; 180{ 181 u_int maxphys = DFLTPHYS; 182 struct cdevsw *bdsw; 183 | 45} 46 47int 48physio(strategy, bp, dev, rw, minp, uio) 49 d_strategy_t *strategy; 50 struct buf *bp; 51 dev_t dev; 52 int rw; --- 123 unchanged lines hidden (view full) --- 176 177u_int 178minphys(bp) 179 struct buf *bp; 180{ 181 u_int maxphys = DFLTPHYS; 182 struct cdevsw *bdsw; 183 |
184 bdsw = cdevsw[major(bp->b_dev)]; | 184 bdsw = devsw(bp->b_dev); |
185 186 if (bdsw && bdsw->d_maxio) { 187 maxphys = bdsw->d_maxio; 188 } 189 if (bp->b_kvasize && (bp->b_kvasize < maxphys)) 190 maxphys = bp->b_kvasize; 191 192 if(((vm_offset_t) bp->b_data) & PAGE_MASK) { --- 8 unchanged lines hidden (view full) --- 201} 202 203struct buf * 204phygetvpbuf(dev_t dev, int resid) 205{ 206 struct cdevsw *bdsw; 207 int maxio; 208 | 185 186 if (bdsw && bdsw->d_maxio) { 187 maxphys = bdsw->d_maxio; 188 } 189 if (bp->b_kvasize && (bp->b_kvasize < maxphys)) 190 maxphys = bp->b_kvasize; 191 192 if(((vm_offset_t) bp->b_data) & PAGE_MASK) { --- 8 unchanged lines hidden (view full) --- 201} 202 203struct buf * 204phygetvpbuf(dev_t dev, int resid) 205{ 206 struct cdevsw *bdsw; 207 int maxio; 208 |
209 bdsw = cdevsw[major(dev)]; | 209 bdsw = devsw(dev); |
210 if ((bdsw == NULL) || (bdsw->d_bmaj == -1)) 211 return getpbuf(NULL); 212 213 maxio = bdsw->d_maxio; 214 if (resid > maxio) 215 resid = maxio; 216 217 return getpbuf(NULL); 218} 219 220static void 221physwakeup(bp) 222 struct buf *bp; 223{ 224 wakeup((caddr_t) bp); 225 bp->b_flags &= ~B_CALL; 226} | 210 if ((bdsw == NULL) || (bdsw->d_bmaj == -1)) 211 return getpbuf(NULL); 212 213 maxio = bdsw->d_maxio; 214 if (resid > maxio) 215 resid = maxio; 216 217 return getpbuf(NULL); 218} 219 220static void 221physwakeup(bp) 222 struct buf *bp; 223{ 224 wakeup((caddr_t) bp); 225 bp->b_flags &= ~B_CALL; 226} |