Source-Changes-HG archive

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

[src/trunk]: src/sys/rump Pass modinit to rumpuser_dl_module_bootstrap() as a...



details:   https://anonhg.NetBSD.org/src/rev/13edb21b4c45
branches:  trunk
changeset: 748450:13edb21b4c45
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sat Oct 24 11:36:59 2009 +0000

description:
Pass modinit to rumpuser_dl_module_bootstrap() as a function pointer
to avoid linker rump -> rumpuser -> rump dependency which is annoying
redundancy in static linking.

diffstat:

 sys/rump/include/rump/rumpuser.h        |  13 +++++++++++--
 sys/rump/librump/rumpkern/rump.c        |  10 +++-------
 sys/rump/librump/rumpuser/rumpuser_dl.c |  13 ++++++-------
 3 files changed, 20 insertions(+), 16 deletions(-)

diffs (118 lines):

diff -r 1dde84e63ab5 -r 13edb21b4c45 sys/rump/include/rump/rumpuser.h
--- a/sys/rump/include/rump/rumpuser.h  Sat Oct 24 11:29:55 2009 +0000
+++ b/sys/rump/include/rump/rumpuser.h  Sat Oct 24 11:36:59 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser.h,v 1.30 2009/10/24 11:29:55 pooka Exp $      */
+/*     $NetBSD: rumpuser.h,v 1.31 2009/10/24 11:36:59 pooka Exp $      */
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -187,6 +187,15 @@
 
 /* rumpuser dynloader */
 
-void rumpuser_dl_module_bootstrap(void);
+/* XXX: go _t, go */
+#ifdef __NetBSD__
+#include <prop/proplib.h>
+#else
+typedef struct prop_dictionary *prop_dictionary_t;
+#endif
+
+struct modinfo;
+typedef int (*rump_modinit_fn)(struct modinfo *, prop_dictionary_t);
+void rumpuser_dl_module_bootstrap(rump_modinit_fn);
 
 #endif /* _RUMP_RUMPUSER_H_ */
diff -r 1dde84e63ab5 -r 13edb21b4c45 sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c  Sat Oct 24 11:29:55 2009 +0000
+++ b/sys/rump/librump/rumpkern/rump.c  Sat Oct 24 11:36:59 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump.c,v 1.128 2009/10/20 10:42:41 pooka Exp $ */
+/*     $NetBSD: rump.c,v 1.129 2009/10/24 11:36:59 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.128 2009/10/20 10:42:41 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.129 2009/10/24 11:36:59 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -294,12 +294,8 @@
                vmem_rehash_start();
 #endif
 
-       /*
-        * Module bootstrap makes calls back into rump, so
-        * unschedule before calling.
-        */
+       rumpuser_dl_module_bootstrap(rump_module_init);
        rump_unschedule();
-       rumpuser_dl_module_bootstrap();
 
        return 0;
 }
diff -r 1dde84e63ab5 -r 13edb21b4c45 sys/rump/librump/rumpuser/rumpuser_dl.c
--- a/sys/rump/librump/rumpuser/rumpuser_dl.c   Sat Oct 24 11:29:55 2009 +0000
+++ b/sys/rump/librump/rumpuser/rumpuser_dl.c   Sat Oct 24 11:36:59 2009 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rumpuser_dl.c,v 1.3 2009/10/14 18:18:53 pooka Exp $   */
+/*      $NetBSD: rumpuser_dl.c,v 1.4 2009/10/24 11:36:59 pooka Exp $   */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: rumpuser_dl.c,v 1.3 2009/10/14 18:18:53 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_dl.c,v 1.4 2009/10/24 11:36:59 pooka Exp $");
 
 #include <sys/types.h>
 #include <sys/time.h>
@@ -41,13 +41,12 @@
 #include <stdio.h>
 #include <string.h>
 
-#include <rump/rump.h>
 #include <rump/rumpuser.h>
 
 #if defined(__NetBSD__) || defined(__FreeBSD__)                                \
     || (defined(__sun__) && defined(__svr4__))
 static void
-process(const char *soname)
+process(const char *soname, rump_modinit_fn domodinit)
 {
        void *handle;
        struct modinfo **mi, **mi_end;
@@ -67,7 +66,7 @@
                goto out;
 
        for (; mi < mi_end; mi++)
-               rump_pub_module_init(*mi, NULL);
+               domodinit(*mi, NULL);
        assert(mi == mi_end);
 
  out:
@@ -79,7 +78,7 @@
  * from all objects in the linkmap.
  */
 void
-rumpuser_dl_module_bootstrap(void)
+rumpuser_dl_module_bootstrap(rump_modinit_fn domodinit)
 {
        struct link_map *map;
 
@@ -98,7 +97,7 @@
        for (; map->l_next; map = map->l_next)
                continue;
        for (; map; map = map->l_prev)
-               process(map->l_name);
+               process(map->l_name, domodinit);
 }
 #else
 void



Home | Main Index | Thread Index | Old Index