Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/gehenna-devsw]: src/sys/uvm Add bdevsw/cdevsw for swap device.



details:   https://anonhg.NetBSD.org/src/rev/922fd92dbcfa
branches:  gehenna-devsw
changeset: 527029:922fd92dbcfa
user:      gehenna <gehenna%NetBSD.org@localhost>
date:      Thu May 16 03:43:24 2002 +0000

description:
Add bdevsw/cdevsw for swap device.
Replace with devsw APIs.

diffstat:

 sys/uvm/uvm_swap.c |  27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diffs (69 lines):

diff -r 81cba2c50646 -r 922fd92dbcfa sys/uvm/uvm_swap.c
--- a/sys/uvm/uvm_swap.c        Thu May 16 03:39:13 2002 +0000
+++ b/sys/uvm/uvm_swap.c        Thu May 16 03:43:24 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_swap.c,v 1.64 2002/05/09 21:43:44 fredette Exp $   */
+/*     $NetBSD: uvm_swap.c,v 1.64.2.1 2002/05/16 03:43:24 gehenna Exp $        */
 
 /*
  * Copyright (c) 1995, 1996, 1997 Matthew R. Green
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.64 2002/05/09 21:43:44 fredette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.64.2.1 2002/05/16 03:43:24 gehenna Exp $");
 
 #include "fs_nfs.h"
 #include "opt_uvmhist.h"
@@ -202,10 +202,6 @@
        pool_put(&vndbuf_pool, (void *)(vbp));                          \
 }
 
-/* /dev/drum */
-bdev_decl(sw);
-cdev_decl(sw);
-
 /*
  * local variables
  */
@@ -237,6 +233,19 @@
 
 static int uvm_swap_io __P((struct vm_page **, int, int, int));
 
+dev_type_read(swread);
+dev_type_write(swwrite);
+dev_type_strategy(swstrategy);
+
+const struct bdevsw swap_bdevsw = {
+       noopen, noclose, swstrategy, noioctl, nodump, nosize,
+};
+
+const struct cdevsw swap_cdevsw = {
+       nullopen, nullclose, swread, swwrite, noioctl,
+       nostop, notty, nopoll, nommap,
+};
+
 /*
  * uvm_swap_init: init the swap system data structures and locks
  *
@@ -769,6 +778,7 @@
 #ifdef NFS
        extern int (**nfsv2_vnodeop_p) __P((void *));
 #endif /* NFS */
+       const struct bdevsw *bdev;
        dev_t dev;
        UVMHIST_FUNC("swap_on"); UVMHIST_CALLED(pdhist);
 
@@ -807,8 +817,9 @@
         */
        switch (vp->v_type) {
        case VBLK:
-               if (bdevsw[major(dev)].d_psize == 0 ||
-                   (nblocks = (*bdevsw[major(dev)].d_psize)(dev)) == -1) {
+               bdev = bdevsw_lookup(dev);
+               if (bdev == NULL || bdev->d_psize == NULL ||
+                   (nblocks = (*bdev->d_psize)(dev)) == -1) {
                        error = ENXIO;
                        goto bad;
                }



Home | Main Index | Thread Index | Old Index