summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>1999-02-26 05:13:23 +0000
committerArtur Grabowski <art@cvs.openbsd.org>1999-02-26 05:13:23 +0000
commit0bcdaa68dd16b1ab659a27d91f6181029d41f99a (patch)
treef2f110c5fba81e5d4354bb99acd7dd5c8d1b3300 /sys
parent6fe4222e3408e460e52471a7c77eb6a734d91f2b (diff)
mostly name changes and allocation chnges for uvm
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_physio.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/sys/kern/kern_physio.c b/sys/kern/kern_physio.c
index 4945f317074..0a939d7ed72 100644
--- a/sys/kern/kern_physio.c
+++ b/sys/kern/kern_physio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_physio.c,v 1.4 1997/07/25 03:25:32 deraadt Exp $ */
+/* $OpenBSD: kern_physio.c,v 1.5 1999/02/26 05:13:22 art Exp $ */
/* $NetBSD: kern_physio.c,v 1.28 1997/05/19 10:43:28 pk Exp $ */
/*-
@@ -47,9 +47,14 @@
#include <sys/buf.h>
#include <sys/conf.h>
#include <sys/proc.h>
+#include <sys/malloc.h>
#include <vm/vm.h>
+#if defined(UVM)
+#include <uvm/uvm_extern.h>
+#endif
+
/*
* The routines implemented in this file are described in:
* Leffler, et al.: The Design and Implementation of the 4.3BSD
@@ -95,10 +100,17 @@ physio(strategy, bp, dev, flags, minphys, uio)
*/
if (uio->uio_segflg == UIO_USERSPACE)
for (i = 0; i < uio->uio_iovcnt; i++)
+#if defined(UVM) /* XXXCDC: map not locked, rethink */
+ if (!uvm_useracc(uio->uio_iov[i].iov_base,
+ uio->uio_iov[i].iov_len,
+ (flags == B_READ) ? B_WRITE : B_READ))
+ return (EFAULT);
+#else
if (!useracc(uio->uio_iov[i].iov_base,
uio->uio_iov[i].iov_len,
(flags == B_READ) ? B_WRITE : B_READ))
return (EFAULT);
+#endif
/* Make sure we have a buffer, creating one if necessary. */
if ((nobuf = (bp == NULL)) != 0)
@@ -170,7 +182,11 @@ physio(strategy, bp, dev, flags, minphys, uio)
* restores it.
*/
p->p_holdcnt++;
+#if defined(UVM)
+ uvm_vslock(p, bp->b_data, todo);
+#else
vslock(bp->b_data, todo);
+#endif
vmapbuf(bp, todo);
/* [call strategy to start the transfer] */
@@ -201,7 +217,11 @@ physio(strategy, bp, dev, flags, minphys, uio)
* locked]
*/
vunmapbuf(bp, todo);
+#if defined(UVM)
+ uvm_vsunlock(p, bp->b_data, todo);
+#else
vsunlock(bp->b_data, todo);
+#endif
p->p_holdcnt--;
/* remember error value (save a splbio/splx pair) */
@@ -268,6 +288,7 @@ struct buf *
getphysbuf()
{
struct buf *bp;
+#if !defined(UVM)
int s;
s = splbio();
@@ -278,6 +299,15 @@ getphysbuf()
bp = bswlist.b_actf;
bswlist.b_actf = bp->b_actf;
splx(s);
+#else
+
+ bp = malloc(sizeof(*bp), M_TEMP, M_WAITOK);
+ memset(bp, 0, sizeof(*bp));
+
+ /* XXXCDC: are the following two lines necessary? */
+ bp->b_rcred = bp->b_wcred = NOCRED;
+ bp->b_vnbufs.le_next = NOLIST;
+#endif
return (bp);
}
@@ -291,7 +321,7 @@ void
putphysbuf(bp)
struct buf *bp;
{
-
+#if !defined(UVM)
bp->b_actf = bswlist.b_actf;
bswlist.b_actf = bp;
if (bp->b_vp)
@@ -300,6 +330,15 @@ putphysbuf(bp)
bswlist.b_flags &= ~B_WANTED;
wakeup(&bswlist);
}
+#else
+ /* XXXCDC: is this necesary? */
+ if (bp->b_vp)
+ brelvp(bp);
+
+ if (bp->b_flags & B_WANTED)
+ panic("putphysbuf: private buf B_WANTED");
+ free(bp, M_TEMP);
+#endif
}
/*