diff options
| author | pooka <pooka@NetBSD.org> | 2009-08-04 23:31:57 +0000 |
|---|---|---|
| committer | pooka <pooka@NetBSD.org> | 2009-08-04 23:31:57 +0000 |
| commit | e0fc658a3c1b52f36ffbdba76ef940ae240ea8d3 (patch) | |
| tree | ec03ea46abed57259e37707531d0dccac1d9afdf /sys | |
| parent | bb3158c0b1e11b6a406ba0e48b65c66f45f3a9e0 (diff) | |
uvm_vnp_zerorange() logically and by implementation more a part of
ubc than uvm_vnode, so move it over.
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/uvm/uvm_bio.c | 34 | ||||
| -rw-r--r-- | sys/uvm/uvm_vnode.c | 32 |
2 files changed, 34 insertions, 32 deletions
diff --git a/sys/uvm/uvm_bio.c b/sys/uvm/uvm_bio.c index 95f10a3ba98..5fa07ce88b5 100644 --- a/sys/uvm/uvm_bio.c +++ b/sys/uvm/uvm_bio.c @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_bio.c,v 1.66 2008/11/27 08:46:09 pooka Exp $ */ +/* $NetBSD: uvm_bio.c,v 1.67 2009/08/04 23:31:57 pooka Exp $ */ /* * Copyright (c) 1998 Chuck Silvers. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.66 2008/11/27 08:46:09 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.67 2009/08/04 23:31:57 pooka Exp $"); #include "opt_uvmhist.h" #include "opt_ubc.h" @@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.66 2008/11/27 08:46:09 pooka Exp $"); #include <sys/kmem.h> #include <sys/kernel.h> #include <sys/proc.h> +#include <sys/vnode.h> #include <uvm/uvm.h> @@ -696,3 +697,32 @@ ubc_uiomove(struct uvm_object *uobj, struct uio *uio, vsize_t todo, int advice, return error; } + + +/* + * uvm_vnp_zerorange: set a range of bytes in a file to zero. + */ + +void +uvm_vnp_zerorange(struct vnode *vp, off_t off, size_t len) +{ + void *win; + int flags; + + /* + * XXXUBC invent kzero() and use it + */ + + while (len) { + vsize_t bytelen = len; + + win = ubc_alloc(&vp->v_uobj, off, &bytelen, UVM_ADV_NORMAL, + UBC_WRITE); + memset(win, 0, bytelen); + flags = UBC_WANT_UNMAP(vp) ? UBC_UNMAP : 0; + ubc_release(win, flags); + + off += bytelen; + len -= bytelen; + } +} diff --git a/sys/uvm/uvm_vnode.c b/sys/uvm/uvm_vnode.c index ecb32bd7abb..7fb98b6086a 100644 --- a/sys/uvm/uvm_vnode.c +++ b/sys/uvm/uvm_vnode.c @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_vnode.c,v 1.91 2009/08/04 23:03:01 pooka Exp $ */ +/* $NetBSD: uvm_vnode.c,v 1.92 2009/08/04 23:31:57 pooka Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -50,7 +50,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.91 2009/08/04 23:03:01 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.92 2009/08/04 23:31:57 pooka Exp $"); #include "opt_uvmhist.h" @@ -372,34 +372,6 @@ uvm_vnp_setwritesize(struct vnode *vp, voff_t newsize) mutex_exit(&vp->v_interlock); } -/* - * uvm_vnp_zerorange: set a range of bytes in a file to zero. - */ - -void -uvm_vnp_zerorange(struct vnode *vp, off_t off, size_t len) -{ - void *win; - int flags; - - /* - * XXXUBC invent kzero() and use it - */ - - while (len) { - vsize_t bytelen = len; - - win = ubc_alloc(&vp->v_uobj, off, &bytelen, UVM_ADV_NORMAL, - UBC_WRITE); - memset(win, 0, bytelen); - flags = UBC_WANT_UNMAP(vp) ? UBC_UNMAP : 0; - ubc_release(win, flags); - - off += bytelen; - len -= bytelen; - } -} - bool uvn_text_p(struct uvm_object *uobj) { |
