Source-Changes-HG archive

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

[src/yamt-km]: src/sys convert to new apis.



details:   https://anonhg.NetBSD.org/src/rev/0ccdc9d2a0f3
branches:  yamt-km
changeset: 573292:0ccdc9d2a0f3
user:      yamt <yamt%NetBSD.org@localhost>
date:      Tue Jan 25 12:59:35 2005 +0000

description:
convert to new apis.

diffstat:

 sys/compat/netbsd32/netbsd32_execve.c |  13 +++++++------
 sys/kern/kern_exec.c                  |  13 +++++++------
 sys/kern/kern_lkm.c                   |  10 ++++++----
 sys/kern/kern_malloc.c                |  19 +++++++++++--------
 sys/kern/kern_malloc_debug.c          |  11 ++++++-----
 sys/kern/kern_sig.c                   |  13 +++++++------
 sys/kern/subr_pool.c                  |  13 ++++++-------
 sys/kern/sys_pipe.c                   |  14 ++++++++------
 sys/kern/sysv_msg.c                   |   8 +++++---
 sys/kern/sysv_sem.c                   |   8 +++++---
 sys/kern/sysv_shm.c                   |   7 ++++---
 sys/kern/uipc_mbuf.c                  |   4 ++--
 sys/kern/uipc_socket.c                |   8 ++++----
 sys/kern/vfs_bio.c                    |  14 ++++++++------
 14 files changed, 86 insertions(+), 69 deletions(-)

diffs (truncated from 566 to 300 lines):

diff -r 3ddb4d7c01d4 -r 0ccdc9d2a0f3 sys/compat/netbsd32/netbsd32_execve.c
--- a/sys/compat/netbsd32/netbsd32_execve.c     Tue Jan 25 12:58:28 2005 +0000
+++ b/sys/compat/netbsd32/netbsd32_execve.c     Tue Jan 25 12:59:35 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_execve.c,v 1.18 2004/02/25 18:15:45 drochner Exp $    */
+/*     $NetBSD: netbsd32_execve.c,v 1.18.10.1 2005/01/25 12:59:57 yamt Exp $   */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_execve.c,v 1.18 2004/02/25 18:15:45 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_execve.c,v 1.18.10.1 2005/01/25 12:59:57 yamt Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ktrace.h"
@@ -153,7 +153,8 @@
        /* XXX -- THE FOLLOWING SECTION NEEDS MAJOR CLEANUP */
 
        /* allocate an argument buffer */
-       argp = (char *) uvm_km_valloc_wait(exec_map, NCARGS);
+       argp = (char *) uvm_km_alloc(exec_map, NCARGS, 0,
+           UVM_KMF_PAGEABLE|UVM_KMF_WAITVA);
 #ifdef DIAGNOSTIC
        if (argp == (vaddr_t) 0)
                panic("netbsd32_execve: argp == NULL");
@@ -421,7 +422,7 @@
 
        doexechooks(p);
 
-       uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
+       uvm_km_free(exec_map, (vaddr_t) argp, NCARGS, UVM_KMF_PAGEABLE);
 
        PNBUF_PUT(nid.ni_cnd.cn_pnbuf);
        vn_lock(pack.ep_vp, LK_EXCLUSIVE | LK_RETRY);
@@ -492,7 +493,7 @@
        VOP_CLOSE(pack.ep_vp, FREAD, cred, p);
        vput(pack.ep_vp);
        PNBUF_PUT(nid.ni_cnd.cn_pnbuf);
-       uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
+       uvm_km_free(exec_map, (vaddr_t) argp, NCARGS, UVM_KMF_PAGEABLE);
 
 freehdr:
 #if defined(LKM) || defined(_LKM)
@@ -520,7 +521,7 @@
        vn_lock(pack.ep_vp, LK_EXCLUSIVE | LK_RETRY);
        VOP_CLOSE(pack.ep_vp, FREAD, cred, p);
        vput(pack.ep_vp);
-       uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
+       uvm_km_free(exec_map, (vaddr_t) argp, NCARGS, UVM_KMF_PAGEABLE);
        free(pack.ep_hdr, M_EXEC);
        exit1(l, W_EXITCODE(error, SIGABRT));
 
diff -r 3ddb4d7c01d4 -r 0ccdc9d2a0f3 sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c      Tue Jan 25 12:58:28 2005 +0000
+++ b/sys/kern/kern_exec.c      Tue Jan 25 12:59:35 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exec.c,v 1.191 2004/10/01 16:30:52 yamt Exp $     */
+/*     $NetBSD: kern_exec.c,v 1.191.6.1 2005/01/25 12:59:35 yamt Exp $ */
 
 /*-
  * Copyright (C) 1993, 1994, 1996 Christopher G. Demetriou
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.191 2004/10/01 16:30:52 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.191.6.1 2005/01/25 12:59:35 yamt Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_syscall_debug.h"
@@ -442,7 +442,8 @@
        /* XXX -- THE FOLLOWING SECTION NEEDS MAJOR CLEANUP */
 
        /* allocate an argument buffer */
-       argp = (char *) uvm_km_valloc_wait(exec_map, NCARGS);
+       argp = (char *) uvm_km_alloc(exec_map, NCARGS, 0,
+           UVM_KMF_PAGEABLE|UVM_KMF_WAITVA);
 #ifdef DIAGNOSTIC
        if (argp == (vaddr_t) 0)
                panic("execve: argp == NULL");
@@ -762,7 +763,7 @@
 
        doexechooks(p);
 
-       uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
+       uvm_km_free(exec_map, (vaddr_t) argp, NCARGS, UVM_KMF_PAGEABLE);
 
        PNBUF_PUT(nid.ni_cnd.cn_pnbuf);
 
@@ -853,7 +854,7 @@
        VOP_CLOSE(pack.ep_vp, FREAD, cred, p);
        vput(pack.ep_vp);
        PNBUF_PUT(nid.ni_cnd.cn_pnbuf);
-       uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
+       uvm_km_free(exec_map, (vaddr_t) argp, NCARGS, UVM_KMF_PAGEABLE);
 
  freehdr:
        l->l_flag |= oldlwpflags;
@@ -881,7 +882,7 @@
        if (pack.ep_emul_arg)
                FREE(pack.ep_emul_arg, M_TEMP);
        PNBUF_PUT(nid.ni_cnd.cn_pnbuf);
-       uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
+       uvm_km_free(exec_map, (vaddr_t) argp, NCARGS, UVM_KMF_PAGEABLE);
        free(pack.ep_hdr, M_EXEC);
        exit1(l, W_EXITCODE(error, SIGABRT));
 
diff -r 3ddb4d7c01d4 -r 0ccdc9d2a0f3 sys/kern/kern_lkm.c
--- a/sys/kern/kern_lkm.c       Tue Jan 25 12:58:28 2005 +0000
+++ b/sys/kern/kern_lkm.c       Tue Jan 25 12:59:35 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_lkm.c,v 1.82 2005/01/23 08:41:02 yamt Exp $       */
+/*     $NetBSD: kern_lkm.c,v 1.82.2.1 2005/01/25 12:59:35 yamt Exp $   */
 
 /*
  * Copyright (c) 1994 Christopher G. Demetriou
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lkm.c,v 1.82 2005/01/23 08:41:02 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lkm.c,v 1.82.2.1 2005/01/25 12:59:35 yamt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_malloclog.h"
@@ -75,8 +75,10 @@
 
 struct vm_map *lkm_map;
 
-#define        LKM_SPACE_ALLOC(size)           uvm_km_alloc(lkm_map, (size))
-#define        LKM_SPACE_FREE(addr, size)      uvm_km_free(lkm_map, (addr), (size))
+#define        LKM_SPACE_ALLOC(size) \
+       uvm_km_alloc(lkm_map, (size), 0, UVM_KMF_WIRED)
+#define        LKM_SPACE_FREE(addr, size) \
+       uvm_km_free(lkm_map, (addr), (size), UVM_KMF_WIRED)
 
 #if !defined(DEBUG) && defined(LKMDEBUG)
 # define DEBUG
diff -r 3ddb4d7c01d4 -r 0ccdc9d2a0f3 sys/kern/kern_malloc.c
--- a/sys/kern/kern_malloc.c    Tue Jan 25 12:58:28 2005 +0000
+++ b/sys/kern/kern_malloc.c    Tue Jan 25 12:59:35 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_malloc.c,v 1.95 2005/01/14 17:03:58 christos Exp $        */
+/*     $NetBSD: kern_malloc.c,v 1.95.4.1 2005/01/25 12:59:35 yamt Exp $        */
 
 /*
  * Copyright (c) 1987, 1991, 1993
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.95 2005/01/14 17:03:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.95.4.1 2005/01/25 12:59:35 yamt Exp $");
 
 #include "opt_lockdebug.h"
 
@@ -307,10 +307,11 @@
                        allocsize = 1 << indx;
                npg = btoc(allocsize);
                simple_unlock(&malloc_slock);
-               va = (caddr_t) uvm_km_kmemalloc(kmem_map, NULL,
-                   (vsize_t)ctob(npg),
+               va = (caddr_t) uvm_km_alloc(kmem_map,
+                   (vsize_t)ctob(npg), 0,
                    ((flags & M_NOWAIT) ? UVM_KMF_NOWAIT : 0) |
-                   ((flags & M_CANFAIL) ? UVM_KMF_CANFAIL : 0));
+                   ((flags & M_CANFAIL) ? UVM_KMF_CANFAIL : 0) |
+                   UVM_KMF_WIRED);
                if (__predict_false(va == NULL)) {
                        /*
                         * Kmem_malloc() can return NULL, even if it can
@@ -517,7 +518,8 @@
                    addr, size, ksp->ks_shortdesc, alloc);
 #endif /* DIAGNOSTIC */
        if (size > MAXALLOCSAVE) {
-               uvm_km_free(kmem_map, (vaddr_t)addr, ctob(kup->ku_pagecnt));
+               uvm_km_free(kmem_map, (vaddr_t)addr, ctob(kup->ku_pagecnt),
+                   UVM_KMF_WIRED);
 #ifdef KMEMSTATS
                size = kup->ku_pagecnt << PGSHIFT;
                ksp->ks_memuse -= size;
@@ -842,8 +844,9 @@
         */
        kmeminit_nkmempages();
 
-       kmemusage = (struct kmemusage *) uvm_km_zalloc(kernel_map,
-           (vsize_t)(nkmempages * sizeof(struct kmemusage)));
+       kmemusage = (struct kmemusage *) uvm_km_alloc(kernel_map,
+           (vsize_t)(nkmempages * sizeof(struct kmemusage)), 0,
+           UVM_KMF_WIRED|UVM_KMF_ZERO);
        kmb = 0;
        kmem_map = uvm_km_suballoc(kernel_map, &kmb,
            &kml, ((vsize_t)nkmempages << PAGE_SHIFT), 
diff -r 3ddb4d7c01d4 -r 0ccdc9d2a0f3 sys/kern/kern_malloc_debug.c
--- a/sys/kern/kern_malloc_debug.c      Tue Jan 25 12:58:28 2005 +0000
+++ b/sys/kern/kern_malloc_debug.c      Tue Jan 25 12:59:35 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_malloc_debug.c,v 1.13 2004/04/25 16:42:41 simonb Exp $    */
+/*     $NetBSD: kern_malloc_debug.c,v 1.13.6.1 2005/01/25 12:59:35 yamt Exp $  */
 
 /*
  * Copyright (c) 1999, 2000 Artur Grabowski <art%openbsd.org@localhost>
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_malloc_debug.c,v 1.13 2004/04/25 16:42:41 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_malloc_debug.c,v 1.13.6.1 2005/01/25 12:59:35 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -239,8 +239,8 @@
        if (md == NULL)
                return;
 
-       va = uvm_km_kmemalloc(kmem_map, NULL, PAGE_SIZE * 2,
-           UVM_KMF_VALLOC | (wait ? UVM_KMF_NOWAIT : 0));
+       va = uvm_km_alloc(kmem_map, PAGE_SIZE * 2, 0,
+           UVM_KMF_VAONLY | (wait ? UVM_KMF_NOWAIT : 0));
        if (va == 0) {
                pool_put(&debug_malloc_pool, md);
                return;
@@ -258,7 +258,8 @@
                        break;
 
                if (wait == 0) {
-                       uvm_unmap(kmem_map, va, va + PAGE_SIZE * 2);
+                       uvm_km_free(kmem_map, va, va + PAGE_SIZE * 2,
+                           UVM_KMF_VAONLY);
                        pool_put(&debug_malloc_pool, md);
                        return;
                }
diff -r 3ddb4d7c01d4 -r 0ccdc9d2a0f3 sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c       Tue Jan 25 12:58:28 2005 +0000
+++ b/sys/kern/kern_sig.c       Tue Jan 25 12:59:35 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sig.c,v 1.201 2005/01/09 19:22:55 christos Exp $  */
+/*     $NetBSD: kern_sig.c,v 1.201.4.1 2005/01/25 12:59:35 yamt Exp $  */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.201 2005/01/09 19:22:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.201.4.1 2005/01/25 12:59:35 yamt Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_compat_sunos.h"
@@ -100,15 +100,16 @@
 sigacts_poolpage_alloc(struct pool *pp, int flags)
 {
 
-       return (void *)uvm_km_kmemalloc1(kernel_map,
-           uvm.kernel_object, (PAGE_SIZE)*2, (PAGE_SIZE)*2, UVM_UNKNOWN_OFFSET,
-           (flags & PR_WAITOK) ? 0 : UVM_KMF_NOWAIT | UVM_KMF_TRYLOCK);
+       return (void *)uvm_km_alloc(kernel_map,
+           (PAGE_SIZE)*2, (PAGE_SIZE)*2,
+           ((flags & PR_WAITOK) ? 0 : UVM_KMF_NOWAIT | UVM_KMF_TRYLOCK)
+           | UVM_KMF_WIRED);
 }
 
 static void
 sigacts_poolpage_free(struct pool *pp, void *v)
 {
-        uvm_km_free(kernel_map, (vaddr_t)v, (PAGE_SIZE)*2);
+        uvm_km_free(kernel_map, (vaddr_t)v, (PAGE_SIZE)*2, UVM_KMF_WIRED);
 }
 
 static struct pool_allocator sigactspool_allocator = {
diff -r 3ddb4d7c01d4 -r 0ccdc9d2a0f3 sys/kern/subr_pool.c
--- a/sys/kern/subr_pool.c      Tue Jan 25 12:58:28 2005 +0000
+++ b/sys/kern/subr_pool.c      Tue Jan 25 12:59:35 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pool.c,v 1.99 2005/01/01 21:09:56 yamt Exp $      */
+/*     $NetBSD: subr_pool.c,v 1.99.4.1 2005/01/25 12:59:35 yamt Exp $  */
 
 /*-
  * Copyright (c) 1997, 1999, 2000 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.99 2005/01/01 21:09:56 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.99.4.1 2005/01/25 12:59:35 yamt Exp $");
 
 #include "opt_pool.h"
 #include "opt_poollog.h"
@@ -2251,7 +2251,7 @@
 {
        boolean_t waitok = (flags & PR_WAITOK) ? TRUE : FALSE;
 
-       return ((void *) uvm_km_alloc_poolpage_cache(kmem_map, NULL, waitok));
+       return ((void *) uvm_km_alloc_poolpage_cache(kmem_map, waitok));
 }
 



Home | Main Index | Thread Index | Old Index