Use uvm_vnode.c instead of homerolled stuff.

This commit is contained in:
pooka 2009-08-05 00:04:08 +00:00
parent b46117f3cd
commit b2ae25b4cd
2 changed files with 32 additions and 79 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.rumpvfs,v 1.10 2009/08/03 16:22:00 pooka Exp $
# $NetBSD: Makefile.rumpvfs,v 1.11 2009/08/05 00:04:08 pooka Exp $
#
.include "${RUMPTOP}/Makefile.rump"
@ -9,7 +9,7 @@ LIB= rumpvfs
${RUMPTOP}/../kern \
${RUMPTOP}/../miscfs/genfs ${RUMPTOP}/../miscfs/syncfs \
${RUMPTOP}/../miscfs/specfs ${RUMPTOP}/../miscfs/deadfs \
${RUMPTOP}/../compat/common
${RUMPTOP}/../compat/common ${RUMPTOP}/../uvm
#
# Source modules, first the ones specifically implemented for librump.
@ -26,6 +26,9 @@ SRCS+= vfs_bio.c vfs_cache.c vfs_cwd.c vfs_dirhash.c vfs_getcwd.c \
vfs_hooks.c vfs_init.c vfs_lockf.c vfs_lookup.c vfs_subr.c \
vfs_syscalls.c vfs_vnops.c vfs_wapbl.c vfs_xattr.c
# sys/uvm
SRCS+= uvm_vnode.c
# sys/miscfs/syncfs
SRCS+= sync_subr.c sync_vnops.c

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_vfs.c,v 1.7 2009/08/04 20:01:06 pooka Exp $ */
/* $NetBSD: vm_vfs.c,v 1.8 2009/08/05 00:04:08 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.7 2009/08/04 20:01:06 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.8 2009/08/05 00:04:08 pooka Exp $");
#include <sys/param.h>
@ -39,52 +39,6 @@ __KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.7 2009/08/04 20:01:06 pooka Exp $");
#include <uvm/uvm.h>
#include <uvm/uvm_readahead.h>
static int vn_get(struct uvm_object *, voff_t, struct vm_page **,
int *, int, vm_prot_t, int, int);
static int vn_put(struct uvm_object *, voff_t, voff_t, int);
const struct uvm_pagerops uvm_vnodeops = {
.pgo_get = vn_get,
.pgo_put = vn_put,
};
/*
* vnode pager
*/
static int
vn_get(struct uvm_object *uobj, voff_t off, struct vm_page **pgs,
int *npages, int centeridx, vm_prot_t access_type,
int advice, int flags)
{
struct vnode *vp = (struct vnode *)uobj;
return VOP_GETPAGES(vp, off, pgs, npages, centeridx, access_type,
advice, flags);
}
static int
vn_put(struct uvm_object *uobj, voff_t offlo, voff_t offhi, int flags)
{
struct vnode *vp = (struct vnode *)uobj;
return VOP_PUTPAGES(vp, offlo, offhi, flags);
}
void
uvm_aio_biodone1(struct buf *bp)
{
panic("%s: unimplemented", __func__);
}
void
uvm_aio_biodone(struct buf *bp)
{
uvm_aio_aiodone(bp);
}
/*
* release resources held during async io. this is almost the
* same as uvm_aio_aiodone() from uvm_pager.c and only lacks the
@ -117,6 +71,20 @@ uvm_aio_aiodone(struct buf *bp)
kmem_free(pgs, npages * sizeof(*pgs));
}
void
uvm_aio_biodone1(struct buf *bp)
{
panic("%s: unimplemented", __func__);
}
void
uvm_aio_biodone(struct buf *bp)
{
uvm_aio_aiodone(bp);
}
struct uvm_ractx *
uvm_ra_allocctx(void)
{
@ -124,6 +92,14 @@ uvm_ra_allocctx(void)
return NULL;
}
void
uvm_ra_request(struct uvm_ractx *ra, int advice, struct uvm_object *uobj,
off_t reqoff, size_t reqsize)
{
return;
}
void
uvm_ra_freectx(struct uvm_ractx *ra)
{
@ -131,31 +107,9 @@ uvm_ra_freectx(struct uvm_ractx *ra)
return;
}
bool
uvn_clean_p(struct uvm_object *uobj)
{
struct vnode *vp = (void *)uobj;
return (vp->v_iflag & VI_ONWORKLST) == 0;
}
void
uvm_vnp_setsize(struct vnode *vp, voff_t newsize)
{
mutex_enter(&vp->v_interlock);
vp->v_size = vp->v_writesize = newsize;
mutex_exit(&vp->v_interlock);
}
void
uvm_vnp_setwritesize(struct vnode *vp, voff_t newsize)
{
mutex_enter(&vp->v_interlock);
vp->v_writesize = newsize;
mutex_exit(&vp->v_interlock);
}
/*
* UBC
*/
void
uvm_vnp_zerorange(struct vnode *vp, off_t off, size_t len)
@ -194,10 +148,6 @@ uvm_vnp_zerorange(struct vnode *vp, off_t off, size_t len)
return;
}
/*
* UBC
*/
/* dumdidumdum */
#define len2npages(off, len) \
(((((len) + PAGE_MASK) & ~(PAGE_MASK)) >> PAGE_SHIFT) \