Deleted Added
full compact
kern_physio.c (35021) kern_physio.c (37389)
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.25 1998/03/28 10:33:05 bde Exp $
19 * $Id: kern_physio.c,v 1.26 1998/04/04 05:55:05 dyson 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>

--- 135 unchanged lines hidden (view full) ---

163 return (error);
164}
165
166u_int
167minphys(bp)
168 struct buf *bp;
169{
170 u_int maxphys = DFLTPHYS;
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>

--- 135 unchanged lines hidden (view full) ---

163 return (error);
164}
165
166u_int
167minphys(bp)
168 struct buf *bp;
169{
170 u_int maxphys = DFLTPHYS;
171 struct bdevsw *bdsw;
171 struct cdevsw *bdsw;
172 int offset;
173
172 int offset;
173
174 bdsw = cdevsw[major(bp->b_dev)]->d_bdev;
174 bdsw = cdevsw[major(bp->b_dev)];
175
176 if (bdsw && bdsw->d_maxio) {
177 maxphys = bdsw->d_maxio;
178 }
179 if (bp->b_kvasize && (bp->b_kvasize < maxphys))
180 maxphys = bp->b_kvasize;
181
182 if(((vm_offset_t) bp->b_data) & PAGE_MASK) {

--- 5 unchanged lines hidden (view full) ---

188 }
189
190 return bp->b_bcount;
191}
192
193struct buf *
194phygetvpbuf(dev_t dev, int resid)
195{
175
176 if (bdsw && bdsw->d_maxio) {
177 maxphys = bdsw->d_maxio;
178 }
179 if (bp->b_kvasize && (bp->b_kvasize < maxphys))
180 maxphys = bp->b_kvasize;
181
182 if(((vm_offset_t) bp->b_data) & PAGE_MASK) {

--- 5 unchanged lines hidden (view full) ---

188 }
189
190 return bp->b_bcount;
191}
192
193struct buf *
194phygetvpbuf(dev_t dev, int resid)
195{
196 struct bdevsw *bdsw;
196 struct cdevsw *bdsw;
197 int maxio;
198
197 int maxio;
198
199 bdsw = cdevsw[major(dev)]->d_bdev;
200 if (bdsw == NULL)
199 bdsw = cdevsw[major(dev)];
200 if ((bdsw == NULL) || (bdsw->d_bmaj == -1))
201 return getpbuf();
202
203 maxio = bdsw->d_maxio;
204 if (resid > maxio)
205 resid = maxio;
206
207 return getpbuf();
208}
209
201 return getpbuf();
202
203 maxio = bdsw->d_maxio;
204 if (resid > maxio)
205 resid = maxio;
206
207 return getpbuf();
208}
209
210int
211rawread(dev, uio, ioflag)
212 dev_t dev;
213 struct uio *uio;
214 int ioflag;
215{
216 return (physio(cdevsw[major(dev)]->d_strategy, (struct buf *)NULL,
217 dev, 1, minphys, uio));
218}
219
220int
221rawwrite(dev, uio, ioflag)
222 dev_t dev;
223 struct uio *uio;
224 int ioflag;
225{
226 return (physio(cdevsw[major(dev)]->d_strategy, (struct buf *)NULL,
227 dev, 0, minphys, uio));
228}
229
230static void
231physwakeup(bp)
232 struct buf *bp;
233{
234 wakeup((caddr_t) bp);
235 bp->b_flags &= ~B_CALL;
236}
210static void
211physwakeup(bp)
212 struct buf *bp;
213{
214 wakeup((caddr_t) bp);
215 bp->b_flags &= ~B_CALL;
216}