Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/librump Decide it's not worth the fuss to have rump...



details:   https://anonhg.NetBSD.org/src/rev/6b5fea3b9d54
branches:  trunk
changeset: 749582:6b5fea3b9d54
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Dec 03 12:35:34 2009 +0000

description:
Decide it's not worth the fuss to have rumpfs as a module and just
hardcode attach into rump_vfs_init().  Saves us from a lot of
pingpong init bouncing from one component to another to get the order
right.

diffstat:

 sys/rump/librump/rumpkern/emul.c            |   9 +++------
 sys/rump/librump/rumpkern/rump.c            |  13 +++++++------
 sys/rump/librump/rumpkern/rump_private.h    |   5 +++--
 sys/rump/librump/rumpvfs/rump_vfs.c         |  23 +++++------------------
 sys/rump/librump/rumpvfs/rump_vfs_private.h |   3 +--
 sys/rump/librump/rumpvfs/rumpfs.c           |  20 ++------------------
 6 files changed, 21 insertions(+), 52 deletions(-)

diffs (227 lines):

diff -r 783027e0c938 -r 6b5fea3b9d54 sys/rump/librump/rumpkern/emul.c
--- a/sys/rump/librump/rumpkern/emul.c  Thu Dec 03 12:22:58 2009 +0000
+++ b/sys/rump/librump/rumpkern/emul.c  Thu Dec 03 12:35:34 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: emul.c,v 1.111 2009/12/01 09:52:29 pooka Exp $ */
+/*     $NetBSD: emul.c,v 1.112 2009/12/03 12:35:34 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.111 2009/12/01 09:52:29 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.112 2009/12/03 12:35:34 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/null.h>
@@ -123,10 +123,7 @@
 device_class(device_t dev)
 {
 
-       if (dev != RUMP_VFSROOTDEV)
-               panic("%s: dev != root_device not supported", __func__);
-
-       return DV_VIRTUAL;
+       return dev->dv_class;
 }
 
 void
diff -r 783027e0c938 -r 6b5fea3b9d54 sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c  Thu Dec 03 12:22:58 2009 +0000
+++ b/sys/rump/librump/rumpkern/rump.c  Thu Dec 03 12:35:34 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump.c,v 1.143 2009/12/01 09:50:51 pooka Exp $ */
+/*     $NetBSD: rump.c,v 1.144 2009/12/03 12:35:34 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.143 2009/12/01 09:50:51 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.144 2009/12/03 12:35:34 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -36,6 +36,7 @@
 #include <sys/callout.h>
 #include <sys/conf.h>
 #include <sys/cpu.h>
+#include <sys/device.h>
 #include <sys/evcnt.h>
 #include <sys/event.h>
 #include <sys/exec_elf.h>
@@ -102,6 +103,10 @@
 
 sigset_t sigcantmask;
 
+struct device rump_rootdev = {
+       .dv_class = DV_VIRTUAL
+};
+
 #ifdef RUMP_WITHOUT_THREADS
 int rump_threads = 0;
 #else
@@ -124,7 +129,6 @@
 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);
@@ -308,9 +312,6 @@
 
        rumpuser_dl_module_bootstrap(rump_module_init, rump_kernelfsym_load);
 
-       /* mount rootfs, etcetc. */
-       rump_vfs_init2();
-
        rumpuser_gethostname(hostname, MAXHOSTNAMELEN, &error);
        hostnamelen = strlen(hostname);
 
diff -r 783027e0c938 -r 6b5fea3b9d54 sys/rump/librump/rumpkern/rump_private.h
--- a/sys/rump/librump/rumpkern/rump_private.h  Thu Dec 03 12:22:58 2009 +0000
+++ b/sys/rump/librump/rumpkern/rump_private.h  Thu Dec 03 12:35:34 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump_private.h,v 1.38 2009/12/02 08:31:56 uebayasi Exp $       */
+/*     $NetBSD: rump_private.h,v 1.39 2009/12/03 12:35:34 pooka Exp $  */
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -32,6 +32,7 @@
 
 #include <sys/param.h>
 #include <sys/cpu.h>
+#include <sys/device.h>
 #include <sys/lwp.h>
 #include <sys/proc.h>
 #include <sys/systm.h>
@@ -54,9 +55,9 @@
 #define UIO_VMSPACE_SYS (&rump_vmspace)
 
 #define RUMP_LMUTEX_MAGIC ((kmutex_t *)0x101)
-#define RUMP_VFSROOTDEV ((struct device *)-11)
 
 extern int rump_threads;
+extern struct device rump_rootdev;
 
 extern struct sysent rump_sysent[];
 
diff -r 783027e0c938 -r 6b5fea3b9d54 sys/rump/librump/rumpvfs/rump_vfs.c
--- a/sys/rump/librump/rumpvfs/rump_vfs.c       Thu Dec 03 12:22:58 2009 +0000
+++ b/sys/rump/librump/rumpvfs/rump_vfs.c       Thu Dec 03 12:35:34 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump_vfs.c,v 1.38 2009/12/01 09:56:59 pooka Exp $      */
+/*     $NetBSD: rump_vfs.c,v 1.39 2009/12/03 12:35:35 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.38 2009/12/01 09:56:59 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_vfs.c,v 1.39 2009/12/03 12:35:35 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -75,6 +75,7 @@
 void
 rump_vfs_init(void)
 {
+       extern struct vfsops rumpfs_vfsops;
        char buf[64];
        int error;
        int rv, i;
@@ -105,30 +106,16 @@
                    rumpuser_biothread, rump_biodone, NULL, "rmpabio")) != 0)
                        panic("syncer thread create failed: %d", rv);
        }
-}
-
-void
-rump_vfs_init2()
-{
-       extern struct vfsops rumpfs_vfsops;
-       int rv;
 
        rootfstype = ROOT_FSTYPE_ANY;
-       root_device = RUMP_VFSROOTDEV;
+       root_device = &rump_rootdev;
 
        /* bootstrap cwdi (rest done in vfs_mountroot() */
        rw_init(&cwdi0.cwdi_lock);
        proc0.p_cwdi = &cwdi0;
        proc0.p_cwdi = cwdinit();
 
-       /*
-        * XXX: make sure rumpfs is attached.  The opposite can
-        * happen e.g. on Linux where the dynlinker doesn't work
-        * like we would want it to.
-        */
-       if (!vfs_getopsbyname(MOUNT_RUMPFS))
-               vfs_attach(&rumpfs_vfsops);
-
+       vfs_attach(&rumpfs_vfsops);
        vfs_mountroot();
 
        rump_proc_vfs_init = pvfs_init;
diff -r 783027e0c938 -r 6b5fea3b9d54 sys/rump/librump/rumpvfs/rump_vfs_private.h
--- a/sys/rump/librump/rumpvfs/rump_vfs_private.h       Thu Dec 03 12:22:58 2009 +0000
+++ b/sys/rump/librump/rumpvfs/rump_vfs_private.h       Thu Dec 03 12:35:34 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump_vfs_private.h,v 1.8 2009/11/26 20:58:51 pooka Exp $       */
+/*     $NetBSD: rump_vfs_private.h,v 1.9 2009/12/03 12:35:35 pooka Exp $       */
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,6 @@
 #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 783027e0c938 -r 6b5fea3b9d54 sys/rump/librump/rumpvfs/rumpfs.c
--- a/sys/rump/librump/rumpvfs/rumpfs.c Thu Dec 03 12:22:58 2009 +0000
+++ b/sys/rump/librump/rumpvfs/rumpfs.c Thu Dec 03 12:35:34 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpfs.c,v 1.34 2009/11/30 12:32:13 pooka Exp $        */
+/*     $NetBSD: rumpfs.c,v 1.35 2009/12/03 12:35:35 pooka Exp $        */
 
 /*
  * Copyright (c) 2009  Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.34 2009/11/30 12:32:13 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.35 2009/12/03 12:35:35 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -900,19 +900,3 @@
 
        return 0;
 }
-
-MODULE(MODULE_CLASS_VFS, rumpfs, NULL);
-
-static int
-rumpfs_modcmd(modcmd_t cmd, void *arg)
-{
-
-       switch (cmd) {
-       case MODULE_CMD_INIT:
-               return vfs_attach(&rumpfs_vfsops);
-       case MODULE_CMD_FINI:
-               return vfs_detach(&rumpfs_vfsops);
-       default:
-               return ENOTTY;
-       }
-}



Home | Main Index | Thread Index | Old Index