public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] module_name()
@ 2002-11-12 17:32 Rusty Russell
  2002-11-12 20:39 ` Robert Love
  2002-11-12 22:03 ` David S. Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Rusty Russell @ 2002-11-12 17:32 UTC (permalink / raw)
  To: davem; +Cc: linux-kernel

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 */
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-11-13 10:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-12 17:32 [PATCH] module_name() Rusty Russell
2002-11-12 20:39 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox