1*49677Smckusick /*
2*49677Smckusick  * Copyright (c) 1982, 1986, 1990 Regents of the University of California.
3*49677Smckusick  * All rights reserved.
4*49677Smckusick  *
5*49677Smckusick  * %sccs.include.redist.c%
6*49677Smckusick  *
7*49677Smckusick  *	from: @(#)kern_physio.c	7.20 (Berkeley) 5/11/91
8*49677Smckusick  */
9*49677Smckusick 
10*49677Smckusick #include "param.h"
11*49677Smckusick #include "systm.h"
12*49677Smckusick #include "buf.h"
13*49677Smckusick #include "conf.h"
14*49677Smckusick #include "proc.h"
15*49677Smckusick #include "seg.h"
16*49677Smckusick #include "trace.h"
17*49677Smckusick #include "map.h"
18*49677Smckusick #include "vnode.h"
19*49677Smckusick #include "specdev.h"
20*49677Smckusick 
21*49677Smckusick #ifdef HPUXCOMPAT
22*49677Smckusick #include "user.h"
23*49677Smckusick #endif
24*49677Smckusick 
25*49677Smckusick static	struct buf *getswbuf();
26*49677Smckusick static	freeswbuf();
27*49677Smckusick 
28*49677Smckusick /*
29*49677Smckusick  * This routine does device I/O for a user process.
30*49677Smckusick  *
31*49677Smckusick  * If the user has the proper access privilidges, the process is
32*49677Smckusick  * marked 'delayed unlock' and the pages involved in the I/O are
33*49677Smckusick  * faulted and locked. After the completion of the I/O, the pages
34*49677Smckusick  * are unlocked.
35*49677Smckusick  */
36*49677Smckusick physio(strat, bp, dev, rw, mincnt, uio)
37*49677Smckusick 	int (*strat)();
38*49677Smckusick 	register struct buf *bp;
39*49677Smckusick 	dev_t dev;
40*49677Smckusick 	int rw;
41*49677Smckusick 	u_int (*mincnt)();
42*49677Smckusick 	struct uio *uio;
43*49677Smckusick {
44*49677Smckusick 
45*49677Smckusick 	/*
46*49677Smckusick 	 * Body deleted.
47*49677Smckusick 	 */
48*49677Smckusick 	return (EIO);
49*49677Smckusick }
50*49677Smckusick 
51*49677Smckusick /*
52*49677Smckusick  * Calculate the maximum size of I/O request that can be requested
53*49677Smckusick  * in a single operation. This limit is necessary to prevent a single
54*49677Smckusick  * process from being able to lock more than a fixed amount of memory
55*49677Smckusick  * in the kernel.
56*49677Smckusick  */
57*49677Smckusick u_int
58*49677Smckusick minphys(bp)
59*49677Smckusick 	struct buf *bp;
60*49677Smckusick {
61*49677Smckusick 
62*49677Smckusick 	/*
63*49677Smckusick 	 * Body deleted.
64*49677Smckusick 	 */
65*49677Smckusick 	return;
66*49677Smckusick }
67*49677Smckusick 
68*49677Smckusick /*
69*49677Smckusick  * Do a read on a device for a user process.
70*49677Smckusick  */
71*49677Smckusick rawread(dev, uio)
72*49677Smckusick 	dev_t dev;
73*49677Smckusick 	struct uio *uio;
74*49677Smckusick {
75*49677Smckusick 	return (physio(cdevsw[major(dev)].d_strategy, (struct buf *)NULL,
76*49677Smckusick 	    dev, B_READ, minphys, uio));
77*49677Smckusick }
78*49677Smckusick 
79*49677Smckusick /*
80*49677Smckusick  * Do a write on a device for a user process.
81*49677Smckusick  */
82*49677Smckusick rawwrite(dev, uio)
83*49677Smckusick 	dev_t dev;
84*49677Smckusick 	struct uio *uio;
85*49677Smckusick {
86*49677Smckusick 	return (physio(cdevsw[major(dev)].d_strategy, (struct buf *)NULL,
87*49677Smckusick 	    dev, B_WRITE, minphys, uio));
88*49677Smckusick }
89