1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

Implement read/write to kernel space - I use this for a self-loading/

self-decompressing ram disk that I'm fiddling with..

(Note, this depends on the various syscalls having correctly set uio_segflag
 before calling physio - I've checked and they look correct.)
This commit is contained in:
Peter Wemm 1995-11-28 02:40:38 +00:00
parent 59a4c16a68
commit 6884d2aae7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=12498

View File

@ -16,7 +16,7 @@
* 4. Modifications may be freely made to this file if the above conditions
* are met.
*
* $Id: kern_physio.c,v 1.11 1995/05/30 08:05:36 rgrimes Exp $
* $Id: kern_physio.c,v 1.12 1995/09/08 11:08:36 bde Exp $
*/
#include <sys/param.h>
@ -91,16 +91,19 @@ physio(strategy, bp, dev, rw, minp, uio)
bp->b_blkno = btodb(uio->uio_offset);
if (rw && !useracc(bp->b_data, bp->b_bufsize, B_WRITE)) {
error = EFAULT;
goto doerror;
}
if (!rw && !useracc(bp->b_data, bp->b_bufsize, B_READ)) {
error = EFAULT;
goto doerror;
}
if (uio->uio_segflg == UIO_USERSPACE) {
if (rw && !useracc(bp->b_data, bp->b_bufsize, B_WRITE)) {
error = EFAULT;
goto doerror;
}
if (!rw && !useracc(bp->b_data, bp->b_bufsize, B_READ)) {
error = EFAULT;
goto doerror;
}
vmapbuf(bp);
/* bring buffer into kernel space */
vmapbuf(bp);
}
/* perform transfer */
(*strategy)(bp);
@ -110,7 +113,9 @@ physio(strategy, bp, dev, rw, minp, uio)
tsleep((caddr_t)bp, PRIBIO, "physstr", 0);
splx(spl);
vunmapbuf(bp);
/* release mapping into kernel space */
if (uio->uio_segflg == UIO_USERSPACE)
vunmapbuf(bp);
/*
* update the uio data