Module Name:    src
Committed By:   pgoyette
Date:           Tue Nov  3 02:04:12 UTC 2015

Modified Files:
        src/sys/kern: kern_module.c

Log Message:
Add some additional status messages for kern.module.verbose=TRUE


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/kern/kern_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.106 src/sys/kern/kern_module.c:1.107
--- src/sys/kern/kern_module.c:1.106	Mon Jun 22 16:35:13 2015
+++ src/sys/kern/kern_module.c	Tue Nov  3 02:04:12 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.106 2015/06/22 16:35:13 matt Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.107 2015/11/03 02:04:12 pgoyette 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.106 2015/06/22 16:35:13 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.107 2015/11/03 02:04:12 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -945,6 +945,8 @@ module_do_load(const char *name, bool is
 				if (modp != NULL) {
 					*modp = mod;
 				}
+				module_print("dependent module `%s' already "
+				    "loaded", name);
 				depth--;
 				return 0;
 			}
@@ -1153,6 +1155,7 @@ module_do_load(const char *name, bool is
 		module_thread_kick();
 	}
 	depth--;
+	module_print("module `%s' loaded successfully", mi->mi_name);
 	return 0;
 
  fail:
@@ -1183,13 +1186,16 @@ module_do_unload(const char *name, bool 
 	KASSERT(kernconfig_is_held());
 	KASSERT(name != NULL);
 
+	module_print("unload requested for '%s' (%s)", name,
+	    load_requires_force?"TRUE":"FALSE");
 	mod = module_lookup(name);
 	if (mod == NULL) {
 		module_error("module `%s' not found", name);
 		return ENOENT;
 	}
 	if (mod->mod_refcnt != 0) {
-		module_print("module `%s' busy", name);
+		module_print("module `%s' busy (%d refs)", name,
+		    mod->mod_refcnt));
 		return EBUSY;
 	}
 
@@ -1198,6 +1204,8 @@ module_do_unload(const char *name, bool 
 	 */
 	if (mod->mod_source == MODULE_SOURCE_KERNEL &&
 	    mod->mod_info->mi_class == MODULE_CLASS_SECMODEL) {
+		module_print("cannot unload built-in secmodel module `%s'",
+		    name);
 		return EPERM;
 	}
 
@@ -1369,7 +1377,10 @@ module_thread(void *cookie)
 			error = (*mi->mi_modcmd)(MODULE_CMD_AUTOUNLOAD, NULL);
 			if (error == 0 || error == ENOTTY) {
 				(void)module_do_unload(mi->mi_name, false);
-			}
+			} else
+				module_print("module `%s' declined to be "
+				    "auto-unloaded error=%d", mi->mi_name,
+				    error);
 		}
 		kernconfig_unlock();
 

Reply via email to