Source-Changes-HG archive

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

[src/trunk]: src/sys/kern more debugging



details:   https://anonhg.NetBSD.org/src/rev/eee4bdf08a71
branches:  trunk
changeset: 785205:eee4bdf08a71
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Mar 03 16:55:26 2013 +0000

description:
more debugging

diffstat:

 sys/kern/kern_module.c |  37 +++++++++++++++++++++++++++++--------
 1 files changed, 29 insertions(+), 8 deletions(-)

diffs (96 lines):

diff -r 48775f731221 -r eee4bdf08a71 sys/kern/kern_module.c
--- a/sys/kern/kern_module.c    Sun Mar 03 13:11:33 2013 +0000
+++ b/sys/kern/kern_module.c    Sun Mar 03 16:55:26 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_module.c,v 1.87 2013/02/12 19:14:50 christos Exp $        */
+/*     $NetBSD: kern_module.c,v 1.88 2013/03/03 16:55:26 christos Exp $        */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.87 2013/02/12 19:14:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.88 2013/03/03 16:55:26 christos Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -99,6 +99,15 @@
 static bool    module_merge_dicts(prop_dictionary_t, const prop_dictionary_t);
 
 static void    sysctl_module_setup(void);
+#define MODULE_CLASS_MATCH(mi, class) \
+       ((class) == MODULE_CLASS_ANY || (class) == (mi)->mi_class)
+
+static void
+module_incompat(const modinfo_t *mi, int class)
+{
+       module_error("incompatible module class for `%s' (%d != %d)",
+           mi->mi_name, class, mi->mi_class);
+}
 
 /*
  * module_error:
@@ -451,8 +460,12 @@
        do {
                TAILQ_FOREACH(mod, &module_builtins, mod_chain) {
                        mi = mod->mod_info;
-                       if (class != MODULE_CLASS_ANY && class != mi->mi_class)
+                       if (!MODULE_CLASS_MATCH(mi, class)) {
+#ifdef DIAGNOSTIC
+                               module_incompat(mi, class);
+#endif
                                continue;
+                       }
                        /*
                         * If initializing a builtin module fails, don't try
                         * to load it again.  But keep it around and queue it
@@ -478,8 +491,12 @@
        do {
                TAILQ_FOREACH(mod, &module_bootlist, mod_chain) {
                        mi = mod->mod_info;
-                       if (class != MODULE_CLASS_ANY && class != mi->mi_class)
+                       if (!MODULE_CLASS_MATCH(mi, class)) {
+#ifdef DIAGNOSTIC
+                               module_incompat(mi, class);
+#endif
                                continue;
+                       }
                        module_do_load(mi->mi_name, false, 0, NULL, NULL,
                            class, false);
                        break;
@@ -913,6 +930,8 @@
                error = module_load_vfs_vec(name, flags, autoload, mod,
                                            &filedict);
                if (error != 0) {
+                       module_error("vfs load failed %d for `%s'", error,
+                           name);
                        kmem_free(mod, sizeof(*mod));
                        depth--;
                        return error;
@@ -951,9 +970,8 @@
         * If a specific kind of module was requested, ensure that we have
         * a match.
         */
-       if (class != MODULE_CLASS_ANY && class != mi->mi_class) {
-               module_print("incompatible module class for `%s' (%d != %d)",
-                   name, class, mi->mi_class);
+       if (!MODULE_CLASS_MATCH(mi, class)) {
+               module_incompat(mi, class);
                error = ENOENT;
                goto fail;
        }
@@ -1031,8 +1049,11 @@
                        }
                        error = module_do_load(buf, true, flags, NULL,
                            &mod2, MODULE_CLASS_ANY, true);
-                       if (error != 0)
+                       if (error != 0) {
+                               module_error("recursive load failed for `%s'",
+                                   mi->mi_name);
                                goto fail;
+                       }
                        mod->mod_required[mod->mod_nrequired++] = mod2;
                }
        }



Home | Main Index | Thread Index | Old Index