Compile most genfs routines directly out of the kernel sources.

Move special I/O routines to genfs_io.c to mirror kernel naming.
This commit is contained in:
pooka 2007-10-17 16:48:16 +00:00
parent 735dd21e07
commit b16ab0b2da
4 changed files with 32 additions and 102 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.17 2007/09/11 00:41:46 pooka Exp $
# $NetBSD: Makefile,v 1.18 2007/10/17 16:48:16 pooka Exp $
#
.include <bsd.own.mk>
@ -8,10 +8,11 @@ LIB= rump
.PATH: ${NETBSDSRCDIR}/sys/kern ${NETBSDSRCDIR}/sys/lib/libkern \
${NETBSDSRCDIR}/sys/conf ${NETBSDSRCDIR}/sys/dev \
${NETBSDSRCDIR}/sys/miscfs/genfs \
${NETBSDSRCDIR}/sys/miscfs/syncfs
# implements something
SRCS= rump.c auth.c emul.c lock.c genfs.c pool.c specfs.c vfs.c vm.c
SRCS= rump.c auth.c emul.c lock.c genfs_io.c pool.c specfs.c vfs.c vm.c
# just stubs
SRCS+= fstrans_stub.c lock_stub.c misc_stub.c \
@ -19,9 +20,11 @@ SRCS+= fstrans_stub.c lock_stub.c misc_stub.c \
# sys/kern
SRCS+= clock_subr.c kern_stub.c param.c subr_hash.c subr_prf2.c \
subr_specificdata.c subr_time.c sync_subr.c \
vfs_bio.c vfs_cache.c vfs_vnops.c vfs_init.c vfs_subr2.c \
vnode_if.c
subr_specificdata.c subr_time.c vfs_bio.c vfs_cache.c \
vfs_vnops.c vfs_init.c vfs_subr2.c vnode_if.c
# sys/miscfs
SRCS+= genfs_vnops.c sync_subr.c
# src/lib/libkern
SRCS+= __assert.c scanc.c skpc.c

View File

@ -1,4 +1,4 @@
/* $NetBSD: genfs.c,v 1.19 2007/10/10 20:42:31 ad Exp $ */
/* $NetBSD: genfs_io.c,v 1.1 2007/10/17 16:48:17 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -36,33 +36,6 @@
#include "rump_private.h"
#include "rumpuser.h"
void
genfs_node_init(struct vnode *vp, const struct genfs_ops *ops)
{
struct genfs_node *gp = VTOG(vp);
gp->g_op = ops;
}
void
genfs_node_destroy(struct vnode *vp)
{
return;
}
void
genfs_node_unlock(struct vnode *vp)
{
}
void
genfs_node_wrlock(struct vnode *vp)
{
}
void
genfs_directio(struct vnode *vp, struct uio *uio, int ioflag)
{
@ -70,49 +43,6 @@ genfs_directio(struct vnode *vp, struct uio *uio, int ioflag)
panic("%s: not implemented", __func__);
}
int
genfs_lock(void *v)
{
struct vop_lock_args *ap = v;
return lockmgr(ap->a_vp->v_vnlock, ap->a_flags, &ap->a_vp->v_interlock);
}
int
genfs_unlock(void *v)
{
struct vop_unlock_args *ap = v;
return lockmgr(ap->a_vp->v_vnlock, ap->a_flags | LK_RELEASE,
&ap->a_vp->v_interlock);
}
int
genfs_islocked(void *v)
{
struct vop_islocked_args /* {
struct vnode *a_vp;
} */ *ap = v;
return lockstatus(ap->a_vp->v_vnlock);
}
int
genfs_seek(void *v)
{
struct vop_seek_args /* {
struct vnode *a_vp;
off_t a_oldoff;
off_t a_newoff;
kauth_cred_t a_cred;
} */ *ap = v;
if (ap->a_newoff < 0)
return EINVAL;
return 0;
}
int
genfs_getpages(void *v)
{
@ -233,6 +163,13 @@ genfs_getpages(void *v)
return 0;
}
int
genfs_compat_getpages(void *v)
{
panic("%s: not implemented", __func__);
}
/*
* simplesimplesimple: we put all pages every time.
*/
@ -367,12 +304,15 @@ genfs_do_putpages(struct vnode *vp, off_t startoff, off_t endoff, int flags,
goto restart;
}
void
genfs_size(struct vnode *vp, off_t size, off_t *eobp, int flags)
int
genfs_null_putpages(void *v)
{
int fs_bsize = 1 << vp->v_mount->mnt_fs_bshift;
struct vop_putpages_args *ap = v;
struct vnode *vp = ap->a_vp;
*eobp = (size + fs_bsize - 1) & ~(fs_bsize - 1);
KASSERT(vp->v_uobj.uo_npages == 0);
simple_unlock(&vp->v_interlock);
return 0;
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs.c,v 1.14 2007/10/10 20:42:32 ad Exp $ */
/* $NetBSD: vfs.c,v 1.15 2007/10/17 16:48:17 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -153,6 +153,13 @@ vput(struct vnode *vp)
void
vgone(struct vnode *vp)
{
vgonel(vp, curlwp);
}
void
vgonel(struct vnode *vp, struct lwp *l)
{
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfsops_stub.c,v 1.5 2007/08/13 13:51:39 pooka Exp $ */
/* $NetBSD: vfsops_stub.c,v 1.6 2007/10/17 16:48:17 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -35,9 +35,6 @@
int name(void *); \
int name(void *arg) {panic("%s: unimplemented vfs stub", __func__);}
#define VFSSTUB_RV(name,rv) \
int name(void *); int name(void *arg) {return (rv);}
/* specfs */
VFSSTUB(spec_lookup)
VFSSTUB(spec_open)
@ -66,20 +63,3 @@ VFSSTUB(fifo_pathconf)
VFSSTUB(fifo_bmap)
VFSSTUB(fifo_read)
VFSSTUB(fifo_write)
/* genfs */
VFSSTUB(genfs_abortop)
VFSSTUB(genfs_null_putpages)
VFSSTUB(genfs_fcntl)
VFSSTUB(genfs_poll)
VFSSTUB(genfs_revoke)
VFSSTUB(genfs_kqfilter)
VFSSTUB(genfs_lease_check)
VFSSTUB(genfs_compat_getpages)
VFSSTUB_RV(genfs_nullop, 0)
VFSSTUB_RV(genfs_eopnotsupp, EOPNOTSUPP)
VFSSTUB_RV(genfs_enoioctl, EPASSTHROUGH)
VFSSTUB_RV(genfs_badop, EOPNOTSUPP)
VFSSTUB_RV(genfs_einval, EINVAL)
VFSSTUB_RV(genfs_mmap, 0)