summaryrefslogtreecommitdiffstats
path: root/sys/vm/device_pager.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1999-05-11 19:55:07 +0000
committerphk <phk@FreeBSD.org>1999-05-11 19:55:07 +0000
commit7e26ca1d1a4bb6507cb6f9241f2d35b1048eaecd (patch)
tree31ecebf331e4a644fafb96ecafe7d2b6b1a24d39 /sys/vm/device_pager.c
parentc783fdfffac012af2a31c3939b62a23b94680404 (diff)
downloadFreeBSD-src-7e26ca1d1a4bb6507cb6f9241f2d35b1048eaecd.zip
FreeBSD-src-7e26ca1d1a4bb6507cb6f9241f2d35b1048eaecd.tar.gz
Divorce "dev_t" from the "major|minor" bitmap, which is now called
udev_t in the kernel but still called dev_t in userland. Provide functions to manipulate both types: major() umajor() minor() uminor() makedev() umakedev() dev2udev() udev2dev() For now they're functions, they will become in-line functions after one of the next two steps in this process. Return major/minor/makedev to macro-hood for userland. Register a name in cdevsw[] for the "filedescriptor" driver. In the kernel the udev_t appears in places where we have the major/minor number combination, (ie: a potential device: we may not have the driver nor the device), like in inodes, vattr, cdevsw registration and so on, whereas the dev_t appears where we carry around a reference to a actual device. In the future the cdevsw and the aliased-from vnode will be hung directly from the dev_t, along with up to two softc pointers for the device driver and a few houskeeping bits. This will essentially replace the current "alias" check code (same buck, bigger bang). A little stunt has been provided to try to catch places where the wrong type is being used (dev_t vs udev_t), if you see something not working, #undef DEVT_FASCIST in kern/kern_conf.c and see if it makes a difference. If it does, please try to track it down (many hands make light work) or at least try to reproduce it as simply as possible, and describe how to do that. Without DEVT_FASCIST I belive this patch is a no-op. Stylistic/posixoid comments about the userland view of the <sys/*.h> files welcome now, from userland they now contain the end result. Next planned step: make all dev_t's refer to the same devsw[] which means convert BLK's to CHR's at the perimeter of the vnodes and other places where they enter the game (bootdev, mknod, sysctl).
Diffstat (limited to 'sys/vm/device_pager.c')
-rw-r--r--sys/vm/device_pager.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c
index c8e241a..997667d 100644
--- a/sys/vm/device_pager.c
+++ b/sys/vm/device_pager.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)device_pager.c 8.1 (Berkeley) 6/11/93
- * $Id: device_pager.c,v 1.39 1999/01/24 02:32:14 dillon Exp $
+ * $Id: device_pager.c,v 1.40 1999/05/08 06:40:29 phk Exp $
*/
#include <sys/param.h>
@@ -103,7 +103,7 @@ dev_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t fo
/*
* Make sure this device can be mapped.
*/
- dev = (dev_t) (uintptr_t) handle;
+ dev = udev2dev((uintptr_t) handle, 2);
mapfunc = devsw(dev)->d_mmap;
if (mapfunc == NULL || mapfunc == (d_mmap_t *)nullop) {
printf("obsolete map function %p\n", (void *)mapfunc);
@@ -199,7 +199,7 @@ dev_pager_getpages(object, m, count, reqpage)
d_mmap_t *mapfunc;
int prot;
- dev = (dev_t) (uintptr_t) object->handle;
+ dev = udev2dev((uintptr_t) object->handle, 2);
offset = m[reqpage]->pindex;
prot = PROT_READ; /* XXX should pass in? */
mapfunc = devsw(dev)->d_mmap;
@@ -207,7 +207,7 @@ dev_pager_getpages(object, m, count, reqpage)
if (mapfunc == NULL || mapfunc == (d_mmap_t *)nullop)
panic("dev_pager_getpage: no map function");
- paddr = pmap_phys_address((*mapfunc) ((dev_t) dev, (vm_offset_t) offset << PAGE_SHIFT, prot));
+ paddr = pmap_phys_address((*mapfunc) (dev, (vm_offset_t) offset << PAGE_SHIFT, prot));
KASSERT(paddr != -1,("dev_pager_getpage: map function returns error"));
/*
* Replace the passed in reqpage page with our own fake page and free up the
OpenPOWER on IntegriCloud