Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Aug 2013 00:42:22 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r254309 - in head: share/man/man9 sys/cddl/contrib/opensolaris/uts/common/dtrace sys/cddl/dev/dtrace sys/cddl/dev/sdt sys/kern sys/sys
Message-ID:  <201308140042.r7E0gMtf054550@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Wed Aug 14 00:42:21 2013
New Revision: 254309
URL: http://svnweb.freebsd.org/changeset/base/254309

Log:
  Use kld_{load,unload} instead of mod_{load,unload} for the linker file load
  and unload event handlers added in r254266.
  
  Reported by:	jhb
  X-MFC with:	r254266

Modified:
  head/share/man/man9/EVENTHANDLER.9
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
  head/sys/cddl/dev/dtrace/dtrace_load.c
  head/sys/cddl/dev/dtrace/dtrace_unload.c
  head/sys/cddl/dev/sdt/sdt.c
  head/sys/kern/kern_linker.c
  head/sys/sys/eventhandler.h

Modified: head/share/man/man9/EVENTHANDLER.9
==============================================================================
--- head/share/man/man9/EVENTHANDLER.9	Tue Aug 13 22:41:24 2013	(r254308)
+++ head/share/man/man9/EVENTHANDLER.9	Wed Aug 14 00:42:21 2013	(r254309)
@@ -199,10 +199,10 @@ Callbacks invoked when a new network int
 Callbacks invoked when a network interface is taken down.
 .It Vt bpf_track
 Callbacks invoked when a BPF listener attaches to/detaches from network interface.
-.It Vt mod_load
-Callbacks invoked after a module has been loaded.
-.It Vt mod_unload
-Callbacks invoked before a module is about to be unloaded.
+.It Vt kld_load
+Callbacks invoked after a linker file has been loaded.
+.It Vt kld_unload
+Callbacks invoked before a linker file is about to be unloaded.
 These callbacks may be used to return an error and prevent the unload from
 proceeding.
 .It Vt power_profile_change

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c	Tue Aug 13 22:41:24 2013	(r254308)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c	Wed Aug 14 00:42:21 2013	(r254309)
@@ -241,8 +241,8 @@ int		dtrace_in_probe;	/* non-zero if exe
 #if defined(__i386__) || defined(__amd64__) || defined(__mips__) || defined(__powerpc__)
 uintptr_t	dtrace_in_probe_addr;	/* Address of invop when already in probe */
 #endif
-static eventhandler_tag	dtrace_modload_tag;
-static eventhandler_tag	dtrace_modunload_tag;
+static eventhandler_tag	dtrace_kld_load_tag;
+static eventhandler_tag	dtrace_kld_unload_tag;
 #endif
 
 /*
@@ -15344,14 +15344,14 @@ dtrace_module_unloaded(modctl_t *ctl, in
 
 #if !defined(sun)
 static void
-dtrace_mod_load(void *arg __unused, linker_file_t lf)
+dtrace_kld_load(void *arg __unused, linker_file_t lf)
 {
 
 	dtrace_module_loaded(lf);
 }
 
 static void
-dtrace_mod_unload(void *arg __unused, linker_file_t lf, int *error)
+dtrace_kld_unload(void *arg __unused, linker_file_t lf, int *error)
 {
 
 	if (*error != 0)

Modified: head/sys/cddl/dev/dtrace/dtrace_load.c
==============================================================================
--- head/sys/cddl/dev/dtrace/dtrace_load.c	Tue Aug 13 22:41:24 2013	(r254308)
+++ head/sys/cddl/dev/dtrace/dtrace_load.c	Wed Aug 14 00:42:21 2013	(r254309)
@@ -56,11 +56,11 @@ dtrace_load(void *dummy)
 	/* Hang our hook for exceptions. */
 	dtrace_invop_init();
 
-	/* Register callbacks for module load and unload events. */
-	dtrace_modload_tag = EVENTHANDLER_REGISTER(mod_load,
-	    dtrace_mod_load, NULL, EVENTHANDLER_PRI_ANY);
-	dtrace_modunload_tag = EVENTHANDLER_REGISTER(mod_unload,
-	    dtrace_mod_unload, NULL, EVENTHANDLER_PRI_ANY);
+	/* Register callbacks for linker file load and unload events. */
+	dtrace_kld_load_tag = EVENTHANDLER_REGISTER(kld_load,
+	    dtrace_kld_load, NULL, EVENTHANDLER_PRI_ANY);
+	dtrace_kld_unload_tag = EVENTHANDLER_REGISTER(kld_unload,
+	    dtrace_kld_unload, NULL, EVENTHANDLER_PRI_ANY);
 
 	/*
 	 * Initialise the mutexes without 'witness' because the dtrace

Modified: head/sys/cddl/dev/dtrace/dtrace_unload.c
==============================================================================
--- head/sys/cddl/dev/dtrace/dtrace_unload.c	Tue Aug 13 22:41:24 2013	(r254308)
+++ head/sys/cddl/dev/dtrace/dtrace_unload.c	Wed Aug 14 00:42:21 2013	(r254309)
@@ -67,8 +67,8 @@ dtrace_unload()
 	}
 
 	dtrace_provider = NULL;
-	EVENTHANDLER_DEREGISTER(mod_load, dtrace_modload_tag);
-	EVENTHANDLER_DEREGISTER(mod_unload, dtrace_modunload_tag);
+	EVENTHANDLER_DEREGISTER(kld_load, dtrace_kld_load_tag);
+	EVENTHANDLER_DEREGISTER(kld_unload, dtrace_kld_unload_tag);
 
 	if ((state = dtrace_anon_grab()) != NULL) {
 		/*

Modified: head/sys/cddl/dev/sdt/sdt.c
==============================================================================
--- head/sys/cddl/dev/sdt/sdt.c	Tue Aug 13 22:41:24 2013	(r254308)
+++ head/sys/cddl/dev/sdt/sdt.c	Wed Aug 14 00:42:21 2013	(r254309)
@@ -58,8 +58,8 @@ static void	sdt_load(void *);
 static int	sdt_unload(void *);
 static void	sdt_create_provider(struct sdt_provider *);
 static void	sdt_create_probe(struct sdt_probe *);
-static void	sdt_modload(void *, struct linker_file *);
-static void	sdt_modunload(void *, struct linker_file *, int *);
+static void	sdt_kld_load(void *, struct linker_file *);
+static void	sdt_kld_unload(void *, struct linker_file *, int *);
 
 static MALLOC_DEFINE(M_SDT, "SDT", "DTrace SDT providers");
 
@@ -94,8 +94,8 @@ static struct cdev	*sdt_cdev;
 
 static TAILQ_HEAD(, sdt_provider) sdt_prov_list;
 
-eventhandler_tag	modload_tag;
-eventhandler_tag	modunload_tag;
+eventhandler_tag	sdt_kld_load_tag;
+eventhandler_tag	sdt_kld_unload_tag;
 
 static void
 sdt_create_provider(struct sdt_provider *prov)
@@ -229,7 +229,7 @@ sdt_destroy(void *arg, dtrace_id_t id, v
  * and dtrace_register() will try to acquire it again.
  */
 static void
-sdt_modload(void *arg __unused, struct linker_file *lf)
+sdt_kld_load(void *arg __unused, struct linker_file *lf)
 {
 	struct sdt_provider **prov, **begin, **end;
 	struct sdt_probe **probe, **p_begin, **p_end;
@@ -260,7 +260,7 @@ sdt_modload(void *arg __unused, struct l
 }
 
 static void
-sdt_modunload(void *arg __unused, struct linker_file *lf, int *error __unused)
+sdt_kld_unload(void *arg __unused, struct linker_file *lf, int *error __unused)
 {
 	struct sdt_provider *prov, **curr, **begin, **end, *tmp;
 
@@ -268,12 +268,12 @@ sdt_modunload(void *arg __unused, struct
 		/* We already have an error, so don't do anything. */
 		return;
 	else if (linker_file_lookup_set(lf, "sdt_providers_set", &begin, &end, NULL))
-		/* No DTrace providers are declared in this module. */
+		/* No DTrace providers are declared in this file. */
 		return;
 
 	/*
-	 * Go through all the providers declared in this module and unregister
-	 * any that aren't declared in another loaded module.
+	 * Go through all the providers declared in this linker file and
+	 * unregister any that aren't declared in another loaded file.
 	 */
 	for (curr = begin; curr < end; curr++) {
 		TAILQ_FOREACH_SAFE(prov, &sdt_prov_list, prov_entry, tmp) {
@@ -296,7 +296,7 @@ static int
 sdt_linker_file_cb(linker_file_t lf, void *arg __unused)
 {
 
-	sdt_modload(NULL, lf);
+	sdt_kld_load(NULL, lf);
 
 	return (0);
 }
@@ -313,12 +313,12 @@ sdt_load(void *arg __unused)
 
 	sdt_probe_func = dtrace_probe;
 
-	modload_tag = EVENTHANDLER_REGISTER(mod_load, sdt_modload, NULL,
-	    EVENTHANDLER_PRI_ANY);
-	modunload_tag = EVENTHANDLER_REGISTER(mod_unload, sdt_modunload, NULL,
+	sdt_kld_load_tag = EVENTHANDLER_REGISTER(kld_load, sdt_kld_load, NULL,
 	    EVENTHANDLER_PRI_ANY);
+	sdt_kld_unload_tag = EVENTHANDLER_REGISTER(kld_unload, sdt_kld_unload,
+	    NULL, EVENTHANDLER_PRI_ANY);
 
-	/* Pick up probes from the kernel and already-loaded modules. */
+	/* Pick up probes from the kernel and already-loaded linker files. */
 	linker_file_foreach(sdt_linker_file_cb, NULL);
 }
 
@@ -327,8 +327,8 @@ sdt_unload(void *arg __unused)
 {
 	struct sdt_provider *prov, *tmp;
 
-	EVENTHANDLER_DEREGISTER(mod_load, modload_tag);
-	EVENTHANDLER_DEREGISTER(mod_unload, modunload_tag);
+	EVENTHANDLER_DEREGISTER(kld_load, sdt_kld_load_tag);
+	EVENTHANDLER_DEREGISTER(kld_unload, sdt_kld_unload_tag);
 
 	sdt_probe_func = sdt_probe_stub;
 

Modified: head/sys/kern/kern_linker.c
==============================================================================
--- head/sys/kern/kern_linker.c	Tue Aug 13 22:41:24 2013	(r254308)
+++ head/sys/kern/kern_linker.c	Wed Aug 14 00:42:21 2013	(r254309)
@@ -1046,7 +1046,7 @@ kern_kldload(struct thread *td, const ch
 	if (fileid != NULL)
 		*fileid = lf->id;
 
-	EVENTHANDLER_INVOKE(mod_load, lf);
+	EVENTHANDLER_INVOKE(kld_load, lf);
 
 #ifdef HWPMC_HOOKS
 	KLD_DOWNGRADE();
@@ -1103,7 +1103,7 @@ kern_kldunload(struct thread *td, int fi
 	if (lf) {
 		KLD_DPF(FILE, ("kldunload: lf->userrefs=%d\n", lf->userrefs));
 
-		EVENTHANDLER_INVOKE(mod_unload, lf, &error);
+		EVENTHANDLER_INVOKE(kld_unload, lf, &error);
 		if (error != 0)
 			error = EBUSY;
 		else if (lf->userrefs == 0) {

Modified: head/sys/sys/eventhandler.h
==============================================================================
--- head/sys/sys/eventhandler.h	Tue Aug 13 22:41:24 2013	(r254308)
+++ head/sys/sys/eventhandler.h	Wed Aug 14 00:42:21 2013	(r254309)
@@ -266,11 +266,11 @@ EVENTHANDLER_DECLARE(nmbclusters_change,
 EVENTHANDLER_DECLARE(nmbufs_change, uma_zone_chfn);
 EVENTHANDLER_DECLARE(maxsockets_change, uma_zone_chfn);
 
-/* Module load and unload events */
+/* Kernel linker file load and unload events */
 struct linker_file;
-typedef void (*mod_load_fn)(void *, struct linker_file *);
-typedef void (*mod_unload_fn)(void *, struct linker_file *, int *);
-EVENTHANDLER_DECLARE(mod_load, mod_load_fn);
-EVENTHANDLER_DECLARE(mod_unload, mod_unload_fn);
+typedef void (*kld_load_fn)(void *, struct linker_file *);
+typedef void (*kld_unload_fn)(void *, struct linker_file *, int *);
+EVENTHANDLER_DECLARE(kld_load, kld_load_fn);
+EVENTHANDLER_DECLARE(kld_unload, kld_unload_fn);
 
 #endif /* SYS_EVENTHANDLER_H */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308140042.r7E0gMtf054550>