Source-Changes-HG archive

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

[src/trunk]: src During bootstrap, process all modinfos in a DSO in one go. Get



details:   https://anonhg.NetBSD.org/src/rev/0ae8ae8724fc
branches:  trunk
changeset: 752750:0ae8ae8724fc
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri Mar 05 18:47:49 2010 +0000

description:
During bootstrap, process all modinfos in a DSO in one go.  Get
rid of dependency tricks, since they are no longer necessary.

diffstat:

 lib/librumpuser/rumpuser_dl.c    |  33 +++++++++++----------------------
 sys/rump/include/rump/rumpuser.h |  14 ++------------
 2 files changed, 13 insertions(+), 34 deletions(-)

diffs (115 lines):

diff -r 5ca5aff27c06 -r 0ae8ae8724fc lib/librumpuser/rumpuser_dl.c
--- a/lib/librumpuser/rumpuser_dl.c     Fri Mar 05 18:43:58 2010 +0000
+++ b/lib/librumpuser/rumpuser_dl.c     Fri Mar 05 18:47:49 2010 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rumpuser_dl.c,v 1.2 2010/03/01 13:13:48 pooka Exp $   */
+/*      $NetBSD: rumpuser_dl.c,v 1.3 2010/03/05 18:47:50 pooka Exp $   */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: rumpuser_dl.c,v 1.2 2010/03/01 13:13:48 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_dl.c,v 1.3 2010/03/05 18:47:50 pooka Exp $");
 
 #include <sys/types.h>
 #include <sys/time.h>
@@ -296,35 +296,30 @@
        return 0;
 }
 
-static int
+static void
 process(const char *soname, rump_modinit_fn domodinit)
 {
        void *handle;
-       struct modinfo **mi, **mi_end;
-       int loaded = 0;
+       const struct modinfo *const *mi_start, *const *mi_end;
 
        if (strstr(soname, "librump") == NULL)
-               return 0;
+               return;
 
        handle = dlopen(soname, RTLD_LAZY);
        if (handle == NULL)
-               return 0;
+               return;
 
-       mi = dlsym(handle, "__start_link_set_modules");
-       if (!mi)
+       mi_start = dlsym(handle, "__start_link_set_modules");
+       if (!mi_start)
                goto out;
        mi_end = dlsym(handle, "__stop_link_set_modules");
        if (!mi_end)
                goto out;
 
-       for (; mi < mi_end; mi++)
-               if (domodinit(*mi, NULL) == 0)
-                       loaded = 1;
-       assert(mi == mi_end);
+       domodinit(mi_start, (size_t)(mi_end-mi_start));
 
  out:
        dlclose(handle);
-       return loaded;
 }
 
 /*
@@ -336,7 +331,6 @@
        rump_symload_fn symload)
 {
        struct link_map *map, *origmap;
-       int couldload;
        int error;
 
        if (dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &origmap) == -1) {
@@ -394,13 +388,8 @@
        /*
         * Next, load modules from dynlibs.
         */
-       do {
-               couldload = 0;
-               map = origmap;
-               for (; map; map = map->l_prev)
-                       if (process(map->l_name, domodinit))
-                               couldload = 1;
-       } while (couldload);
+       for (map = origmap; map; map = map->l_prev)
+               process(map->l_name, domodinit);
 }
 
 void
diff -r 5ca5aff27c06 -r 0ae8ae8724fc sys/rump/include/rump/rumpuser.h
--- a/sys/rump/include/rump/rumpuser.h  Fri Mar 05 18:43:58 2010 +0000
+++ b/sys/rump/include/rump/rumpuser.h  Fri Mar 05 18:47:49 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser.h,v 1.37 2010/03/01 13:12:20 pooka Exp $      */
+/*     $NetBSD: rumpuser.h,v 1.38 2010/03/05 18:47:49 pooka Exp $      */
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -187,19 +187,9 @@
 
 /* rumpuser dynloader */
 
-/* XXX: go _t, go */
-#ifdef __NetBSD__
-#include <prop/proplib.h>
-#else
-#ifndef HAVE_PROP_DICTIONARY_T
-#define HAVE_PROP_DICTIONARY_T
-typedef struct prop_dictionary *prop_dictionary_t;
-#endif
-#endif
-
 struct modinfo;
 struct rump_component;
-typedef int (*rump_modinit_fn)(struct modinfo *, prop_dictionary_t);
+typedef void (*rump_modinit_fn)(const struct modinfo *const *, size_t);
 typedef int (*rump_symload_fn)(void *, uint64_t, char *, uint64_t);
 typedef void (*rump_component_init_fn)(struct rump_component *, int);
 void rumpuser_dl_bootstrap(rump_modinit_fn, rump_symload_fn);



Home | Main Index | Thread Index | Old Index