All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Banks <gnb@sgi.com>
To: Linux Kernel ML <linux-kernel@vger.kernel.org>
Cc: Linux NFS ML <linux-nfs@vger.kernel.org>,
	Linux NFSv4 ML <nfsv4@linux-nfs.org>,
	SystemTAP ML
	<systemtap-R2MHTz/CkKAf7BdofF/totBPR1lH4CV8@public.gmane.org>
Subject: [patch 2/5] Add apply_modules() which applies a function to each module.
Date: Tue, 20 Jan 2009 12:29:32 +1100	[thread overview]
Message-ID: <20090120013258.426205000@sgi.com> (raw)
In-Reply-To: 20090120012930.020621000@sgi.com

The new dprintk module needs to apply a particular function
to each module when the dprintk module loads.

Signed-off-by: Greg Banks <gnb@sgi.com>
---

 include/linux/module.h |    1 +
 kernel/module.c        |   13 +++++++++++++
 2 files changed, 14 insertions(+)

Index: bfields/kernel/module.c
===================================================================
--- bfields.orig/kernel/module.c
+++ bfields/kernel/module.c
@@ -365,6 +365,19 @@ static struct module *find_module(const 
 	return NULL;
 }
 
+void apply_modules(void (*func)(struct module*, void *), void *closure)
+{
+	struct module *mod;
+
+	preempt_disable();
+	list_for_each_entry_rcu(mod, &modules, list) {
+		func(mod, closure);
+	}
+	preempt_enable();
+}
+EXPORT_SYMBOL(apply_modules);
+
+
 #ifdef CONFIG_SMP
 /* Number of blocks used and allocated. */
 static unsigned int pcpu_num_used, pcpu_num_allocated;
Index: bfields/include/linux/module.h
===================================================================
--- bfields.orig/include/linux/module.h
+++ bfields/include/linux/module.h
@@ -475,6 +475,7 @@ extern void module_update_markers(void);
 
 extern void module_update_tracepoints(void);
 extern int module_get_iter_tracepoints(struct tracepoint_iter *iter);
+extern void apply_modules(void (*func)(struct module*, void *), void *closure);
 
 #else /* !CONFIG_MODULES... */
 #define EXPORT_SYMBOL(sym)

--
-- 
Greg Banks, P.Engineer, SGI Australian Software Group.
the brightly coloured sporks of revolution.
I don't speak for SGI.

WARNING: multiple messages have this Message-ID (diff)
From: Greg Banks <gnb@sgi.com>
To: Linux Kernel ML <linux-kernel@vger.kernel.org>
Cc: Linux NFS ML <linux-nfs@vger.kernel.org>,
	Linux NFSv4 ML <nfsv4@linux-nfs.org>,
	SystemTAP ML <systemtap@sources.redhat.com>
Subject: [patch 2/5] Add apply_modules() which applies a function to each module.
Date: Tue, 20 Jan 2009 12:29:32 +1100	[thread overview]
Message-ID: <20090120013258.426205000@sgi.com> (raw)
In-Reply-To: 20090120012930.020621000@sgi.com

[-- Attachment #1: gnb-add-apply-modules --]
[-- Type: text/plain, Size: 1516 bytes --]

The new dprintk module needs to apply a particular function
to each module when the dprintk module loads.

Signed-off-by: Greg Banks <gnb@sgi.com>
---

 include/linux/module.h |    1 +
 kernel/module.c        |   13 +++++++++++++
 2 files changed, 14 insertions(+)

Index: bfields/kernel/module.c
===================================================================
--- bfields.orig/kernel/module.c
+++ bfields/kernel/module.c
@@ -365,6 +365,19 @@ static struct module *find_module(const 
 	return NULL;
 }
 
+void apply_modules(void (*func)(struct module*, void *), void *closure)
+{
+	struct module *mod;
+
+	preempt_disable();
+	list_for_each_entry_rcu(mod, &modules, list) {
+		func(mod, closure);
+	}
+	preempt_enable();
+}
+EXPORT_SYMBOL(apply_modules);
+
+
 #ifdef CONFIG_SMP
 /* Number of blocks used and allocated. */
 static unsigned int pcpu_num_used, pcpu_num_allocated;
Index: bfields/include/linux/module.h
===================================================================
--- bfields.orig/include/linux/module.h
+++ bfields/include/linux/module.h
@@ -475,6 +475,7 @@ extern void module_update_markers(void);
 
 extern void module_update_tracepoints(void);
 extern int module_get_iter_tracepoints(struct tracepoint_iter *iter);
+extern void apply_modules(void (*func)(struct module*, void *), void *closure);
 
 #else /* !CONFIG_MODULES... */
 #define EXPORT_SYMBOL(sym)

--
-- 
Greg Banks, P.Engineer, SGI Australian Software Group.
the brightly coloured sporks of revolution.
I don't speak for SGI.

  parent reply	other threads:[~2009-01-20  1:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-20  1:29 [patch 0/5] activate & deactivate dprintks individually and severally Greg Banks
2009-01-20  1:29 ` Greg Banks
2009-01-20  1:29 ` [patch 1/5] Move definitions of struct module_sect_attr back into module.h Greg Banks
2009-01-20  1:29   ` Greg Banks
2009-01-20  1:29 ` Greg Banks [this message]
2009-01-20  1:29   ` [patch 2/5] Add apply_modules() which applies a function to each module Greg Banks
2009-01-20  1:29 ` [patch 3/5] Make the dprintk() macro record information about the callsite Greg Banks
2009-01-20  1:29   ` Greg Banks
2009-01-20  1:29 ` [patch 4/5] Add the dprintk module to allow dprintks to be activated/deactivated singly Greg Banks
2009-01-20  1:29   ` Greg Banks
2009-01-20  1:29 ` [patch 5/5] Add a module to test the dprintk module Greg Banks
2009-01-20  1:29   ` Greg Banks
2009-01-21 15:28 ` [patch 0/5] activate & deactivate dprintks individually and severally Jason Baron
2009-01-21 15:28   ` Jason Baron
  -- strict thread matches above, loose matches on Subject: below --
2009-01-19  6:40 Greg Banks
2009-01-19  6:40 ` [patch 2/5] Add apply_modules() which applies a function to each module Greg Banks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090120013258.426205000@sgi.com \
    --to=gnb@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=nfsv4@linux-nfs.org \
    --cc=systemtap-R2MHTz/CkKAf7BdofF/totBPR1lH4CV8@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.