public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: davem@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] module_name()
Date: Wed, 13 Nov 2002 04:32:58 +1100	[thread overview]
Message-ID: <20021112174741.6073E2C2B2@lists.samba.org> (raw)

I prefer this: it also has the advantage of ensuring the name of
built-in modules is consistent across the kernel.

Thanks for the report,
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.5.47-module-alias/crypto/api.c working-2.5.47-modname/crypto/api.c
--- working-2.5.47-module-alias/crypto/api.c	2002-11-11 20:00:55.000000000 +1100
+++ working-2.5.47-modname/crypto/api.c	2002-11-13 04:30:48.000000000 +1100
@@ -263,8 +263,7 @@ static int c_show(struct seq_file *m, vo
 	struct crypto_alg *alg = (struct crypto_alg *)p;
 	
 	seq_printf(m, "name         : %s\n", alg->cra_name);
-	seq_printf(m, "module       : %s\n", alg->cra_module ?
-					alg->cra_module->name : "[static]");
+	seq_printf(m, "module       : %s\n", module_name(alg->cra_module));
 	seq_printf(m, "blocksize    : %u\n", alg->cra_blocksize);
 	
 	switch (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) {
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.5.47-module-alias/include/linux/module.h working-2.5.47-modname/include/linux/module.h
--- working-2.5.47-module-alias/include/linux/module.h	2002-11-12 22:43:55.000000000 +1100
+++ working-2.5.47-modname/include/linux/module.h	2002-11-13 04:31:16.000000000 +1100
@@ -293,6 +293,13 @@ static inline void module_put(struct mod
 
 #endif /* CONFIG_MODULE_UNLOAD */
 
+static inline char *module_name(struct module *module)
+{
+	if (module)
+		return module->name;
+	return "[built-in]";
+}
+
 #define __unsafe(mod)							     \
 do {									     \
 	if (mod && !(mod)->unsafe) {					     \
@@ -315,6 +322,10 @@ do {									     \
 #define try_module_get(module) 1
 #define module_put(module) do { } while(0)
 
+static inline char *module_name(struct module *module)
+{
+	Return "[built-in]";
+}
 #define __unsafe(mod)
 #endif /* CONFIG_MODULES */
 

             reply	other threads:[~2002-11-12 17:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-12 17:32 Rusty Russell [this message]
2002-11-12 20:39 ` [PATCH] module_name() Robert Love
2002-11-12 22:00   ` David S. Miller
2002-11-12 22:03 ` David S. Miller
2002-11-13 10:04   ` Rusty Russell
2002-11-13 10:56     ` David S. Miller

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=20021112174741.6073E2C2B2@lists.samba.org \
    --to=rusty@rustcorp.com.au \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox