Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/librump For rumpfs, do mountroot instead of the bun...
details: https://anonhg.NetBSD.org/src/rev/a3581c9e9a8b
branches: trunk
changeset: 749335:a3581c9e9a8b
user: pooka <pooka%NetBSD.org@localhost>
date: Thu Nov 26 20:58:51 2009 +0000
description:
For rumpfs, do mountroot instead of the bunch of homegrown hacks
currently there. Still needs a little massage to get the kernel
interfaces right and avoid copypaste especially from main().
Also, move it a bit more into the direction of a real file system
(finally!) by giving it a vfsops. Most ops are still unimplemented,
though.
diffstat:
sys/rump/librump/rumpkern/emul.c | 9 +-
sys/rump/librump/rumpkern/rump.c | 11 +-
sys/rump/librump/rumpkern/rump_private.h | 3 +-
sys/rump/librump/rumpvfs/Makefile.rumpvfs | 6 +-
sys/rump/librump/rumpvfs/rump_vfs.c | 18 ++-
sys/rump/librump/rumpvfs/rump_vfs_private.h | 3 +-
sys/rump/librump/rumpvfs/rumpfs.c | 159 +++++++++++++++++++++++----
7 files changed, 166 insertions(+), 43 deletions(-)
diffs (truncated from 445 to 300 lines):
diff -r 2048921af95e -r a3581c9e9a8b sys/rump/librump/rumpkern/emul.c
--- a/sys/rump/librump/rumpkern/emul.c Thu Nov 26 20:52:19 2009 +0000
+++ b/sys/rump/librump/rumpkern/emul.c Thu Nov 26 20:58:51 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emul.c,v 1.109 2009/11/04 19:21:51 pooka Exp $ */
+/* $NetBSD: emul.c,v 1.110 2009/11/26 20:58:51 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.109 2009/11/04 19:21:51 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.110 2009/11/26 20:58:51 pooka Exp $");
#include <sys/param.h>
#include <sys/null.h>
@@ -67,7 +67,6 @@
kmutex_t *proc_lock;
struct lwp lwp0;
struct vnode *rootvp;
-struct device *root_device;
dev_t rootdev;
int physmem = 256*256; /* 256 * 1024*1024 / 4k, PAGE_SIZE not always set */
int doing_shutdown;
@@ -124,10 +123,10 @@
device_class(device_t dev)
{
- if (dev != root_device)
+ if (dev != RUMP_VFSROOTDEV)
panic("%s: dev != root_device not supported", __func__);
- return DV_DISK;
+ return DV_VIRTUAL;
}
void
diff -r 2048921af95e -r a3581c9e9a8b sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c Thu Nov 26 20:52:19 2009 +0000
+++ b/sys/rump/librump/rumpkern/rump.c Thu Nov 26 20:58:51 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rump.c,v 1.139 2009/11/26 17:36:22 pooka Exp $ */
+/* $NetBSD: rump.c,v 1.140 2009/11/26 20:58:51 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.139 2009/11/26 17:36:22 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.140 2009/11/26 20:58:51 pooka Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -123,6 +123,7 @@
int rump__unavailable() {return EOPNOTSUPP;}
__weak_alias(rump_net_init,rump__unavailable);
__weak_alias(rump_vfs_init,rump__unavailable);
+__weak_alias(rump_vfs_init2,rump__unavailable);
__weak_alias(rump_dev_init,rump__unavailable);
__weak_alias(rump_vfs_fini,rump__unavailable);
@@ -300,6 +301,11 @@
sysctl_finalize();
+ rumpuser_dl_module_bootstrap(rump_module_init, rump_kernelfsym_load);
+
+ /* mount rootfs, etcetc. */
+ rump_vfs_init2();
+
rumpuser_gethostname(hostname, MAXHOSTNAMELEN, &error);
hostnamelen = strlen(hostname);
@@ -312,7 +318,6 @@
vmem_rehash_start();
#endif
- rumpuser_dl_module_bootstrap(rump_module_init, rump_kernelfsym_load);
rump_unschedule();
return 0;
diff -r 2048921af95e -r a3581c9e9a8b sys/rump/librump/rumpkern/rump_private.h
--- a/sys/rump/librump/rumpkern/rump_private.h Thu Nov 26 20:52:19 2009 +0000
+++ b/sys/rump/librump/rumpkern/rump_private.h Thu Nov 26 20:58:51 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_private.h,v 1.35 2009/11/09 19:17:42 pooka Exp $ */
+/* $NetBSD: rump_private.h,v 1.36 2009/11/26 20:58:51 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -54,6 +54,7 @@
#define UIO_VMSPACE_SYS (&rump_vmspace)
#define RUMP_LMUTEX_MAGIC ((kmutex_t *)0x101)
+#define RUMP_VFSROOTDEV ((struct device *)-11)
extern int rump_threads;
diff -r 2048921af95e -r a3581c9e9a8b sys/rump/librump/rumpvfs/Makefile.rumpvfs
--- a/sys/rump/librump/rumpvfs/Makefile.rumpvfs Thu Nov 26 20:52:19 2009 +0000
+++ b/sys/rump/librump/rumpvfs/Makefile.rumpvfs Thu Nov 26 20:58:51 2009 +0000
@@ -1,11 +1,11 @@
-# $NetBSD: Makefile.rumpvfs,v 1.19 2009/11/26 07:30:24 pooka Exp $
+# $NetBSD: Makefile.rumpvfs,v 1.20 2009/11/26 20:58:51 pooka Exp $
#
.include "${RUMPTOP}/Makefile.rump"
LIB= rumpvfs
-.PATH: ${RUMPTOP}/librump/rumpvfs \
+.PATH: ${RUMPTOP}/librump/rumpvfs ${RUMPTOP}/librump \
${RUMPTOP}/../kern \
${RUMPTOP}/../miscfs/genfs ${RUMPTOP}/../miscfs/syncfs \
${RUMPTOP}/../miscfs/specfs ${RUMPTOP}/../miscfs/deadfs \
@@ -17,7 +17,7 @@
#
SRCS= rump_vfs.c devnodes.c rumpblk.c rumpfs.c vm_vfs.c
-SRCS+= fstrans_stub.c vfsops_stub.c
+SRCS+= fstrans_stub.c vfsops_stub.c rump_module.c
SRCS+= rumpvfs_if_wrappers.c
diff -r 2048921af95e -r a3581c9e9a8b sys/rump/librump/rumpvfs/rump_vfs.c
--- a/sys/rump/librump/rumpvfs/rump_vfs.c Thu Nov 26 20:52:19 2009 +0000
+++ b/sys/rump/librump/rumpvfs/rump_vfs.c Thu Nov 26 20:58:51 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_vfs.c,v 1.34 2009/11/19 14:44:58 pooka Exp $ */
+/* $NetBSD: rump_vfs.c,v 1.35 2009/11/26 20:58:51 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump_vfs.c,v 1.34 2009/11/19 14:44:58 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_vfs.c,v 1.35 2009/11/26 20:58:51 pooka Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -102,7 +102,17 @@
rumpuser_biothread, rump_biodone, NULL, "rmpabio")) != 0)
panic("syncer thread create failed: %d", rv);
}
- rumpfs_init();
+}
+
+void
+rump_vfs_init2()
+{
+ int rv;
+
+ rootfstype = ROOT_FSTYPE_ANY;
+ root_device = RUMP_VFSROOTDEV;
+ vfs_mountroot();
+ VFS_ROOT(CIRCLEQ_FIRST(&mountlist), &rootvnode);
rump_proc_vfs_init = pvfs_init;
rump_proc_vfs_release = pvfs_rele;
@@ -114,6 +124,8 @@
proc0.p_cwdi = &cwdi0;
proc0.p_cwdi = cwdinit();
+ VOP_UNLOCK(rootvnode, 0);
+
if (rump_threads) {
if ((rv = kthread_create(PRI_IOFLUSH, KTHREAD_MPSAFE, NULL,
sched_sync, NULL, NULL, "ioflush")) != 0)
diff -r 2048921af95e -r a3581c9e9a8b sys/rump/librump/rumpvfs/rump_vfs_private.h
--- a/sys/rump/librump/rumpvfs/rump_vfs_private.h Thu Nov 26 20:52:19 2009 +0000
+++ b/sys/rump/librump/rumpvfs/rump_vfs_private.h Thu Nov 26 20:58:51 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_vfs_private.h,v 1.7 2009/10/14 17:29:20 pooka Exp $ */
+/* $NetBSD: rump_vfs_private.h,v 1.8 2009/11/26 20:58:51 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@@ -31,6 +31,7 @@
#include <sys/types.h>
void rump_vfs_init(void);
+void rump_vfs_init2(void);
void rump_vfs_fini(void);
void rumpfs_init(void);
diff -r 2048921af95e -r a3581c9e9a8b sys/rump/librump/rumpvfs/rumpfs.c
--- a/sys/rump/librump/rumpvfs/rumpfs.c Thu Nov 26 20:52:19 2009 +0000
+++ b/sys/rump/librump/rumpvfs/rumpfs.c Thu Nov 26 20:58:51 2009 +0000
@@ -1,9 +1,7 @@
-/* $NetBSD: rumpfs.c,v 1.29 2009/10/14 18:18:53 pooka Exp $ */
+/* $NetBSD: rumpfs.c,v 1.30 2009/11/26 20:58:51 pooka Exp $ */
/*
- * Copyright (c) 2007 Antti Kantee. All Rights Reserved.
- *
- * Development of this software was supported by Google Summer of Code.
+ * Copyright (c) 2009 Antti Kantee. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.29 2009/10/14 18:18:53 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.30 2009/11/26 20:58:51 pooka Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -37,6 +35,7 @@
#include <sys/fcntl.h>
#include <sys/kauth.h>
#include <sys/malloc.h>
+#include <sys/module.h>
#include <sys/mount.h>
#include <sys/namei.h>
#include <sys/lock.h>
@@ -140,6 +139,10 @@
#define rn_offset rn_u.reg.offset
#define rn_dir rn_u.dir
+struct rumpfs_mount {
+ struct vnode *rfsmp_rvp;
+};
+
static struct rumpfs_node *makeprivate(enum vtype, dev_t, off_t);
/*
@@ -310,7 +313,6 @@
* rumpfs
*/
-static struct mount rump_mnt;
static int lastino = 1;
static kmutex_t reclock;
@@ -365,7 +367,7 @@
}
static int
-makevnode(struct rumpfs_node *rn, struct vnode **vpp)
+makevnode(struct mount *mp, struct rumpfs_node *rn, struct vnode **vpp)
{
struct vnode *vp;
int (**vpops)(void *);
@@ -384,7 +386,7 @@
&& va->va_type != VSOCK)
return EOPNOTSUPP;
- rv = getnewvnode(VT_RUMP, &rump_mnt, vpops, &vp);
+ rv = getnewvnode(VT_RUMP, mp, vpops, &vp);
if (rv)
return rv;
@@ -476,7 +478,7 @@
goto getvnode;
*vpp = vp;
} else {
- rv = makevnode(rn, vpp);
+ rv = makevnode(dvp->v_mount, rn, vpp);
rn->rn_vp = *vpp;
mutex_exit(&reclock);
if (rv)
@@ -518,7 +520,7 @@
rn = makeprivate(VDIR, NODEV, DEV_BSIZE);
mutex_enter(&reclock);
- rv = makevnode(rn, vpp);
+ rv = makevnode(dvp->v_mount, rn, vpp);
mutex_exit(&reclock);
if (rv)
goto out;
@@ -554,7 +556,7 @@
rn = makeprivate(va->va_type, va->va_rdev, DEV_BSIZE);
mutex_enter(&reclock);
- rv = makevnode(rn, vpp);
+ rv = makevnode(dvp->v_mount, rn, vpp);
mutex_exit(&reclock);
if (rv)
goto out;
@@ -595,7 +597,7 @@
}
rn = makeprivate(VSOCK, NODEV, DEV_BSIZE);
mutex_enter(&reclock);
- rv = makevnode(rn, vpp);
+ rv = makevnode(dvp->v_mount, rn, vpp);
mutex_exit(&reclock);
if (rv)
goto out;
@@ -770,30 +772,133 @@
return VOCALL(opvec, ap->a_desc->vdesc_offset, v);
}
Home |
Main Index |
Thread Index |
Old Index