From owner-svn-src-head@FreeBSD.ORG Wed Aug 14 00:42:23 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 9D7CBB42; Wed, 14 Aug 2013 00:42:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8919821AC; Wed, 14 Aug 2013 00:42:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7E0gNu0054557; Wed, 14 Aug 2013 00:42:23 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7E0gMtf054550; Wed, 14 Aug 2013 00:42:22 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201308140042.r7E0gMtf054550@svn.freebsd.org> From: Mark Johnston Date: Wed, 14 Aug 2013 00:42:22 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Aug 2013 00:42:23 -0000 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 */