public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruen@suse.de>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Sam Ravnborg <sam@ravnborg.org>, Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: [kbuild 4/5] Include type information as module info where possible
Date: Wed, 19 Jan 2005 17:14:15 +0100	[thread overview]
Message-ID: <1106151255.8642.11.camel@winden.suse.de> (raw)
In-Reply-To: <20050118192608.578877000.suse.de>

[-- Attachment #1: Type: text/plain, Size: 193 bytes --]

Hello,

MODULE_PARM_TYPE needs to be moved to moduleparam.h: several files
include moduleparam.h but not module.h.

Regards,
-- 
Andreas Gruenbacher <agruen@suse.de>
SUSE Labs, SUSE LINUX GMBH

[-- Attachment #2: mod_param-typeinfo.diff --]
[-- Type: message/rfc822, Size: 3464 bytes --]

From: Andreas Gruenbacher <agruen@suse.de>
Subject: Include type information as module info where possible
Date: Wed, 19 Jan 2005 17:12:48 +0100
Message-ID: <1106151168.8642.9.camel@winden.suse.de>

Module parameters no longer have a type in general, as we use a callback
system (module_param_call()).  However, it's useful to include type
information in the commonly-used wrappers: module_param,
module_param_string and module_param_array.

This adds a parmtype modinfo tag for each parameter defined using
module_param() or MODULE_PARM(). This allows modinfo to easily print all
parameters and their types, independent of whether or not the parameter
has a description (MODULE_PARM_DESC()).

Originally-signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>

Index: linux-2.6.11-rc1-bk6/include/linux/moduleparam.h
===================================================================
--- linux-2.6.11-rc1-bk6.orig/include/linux/moduleparam.h
+++ linux-2.6.11-rc1-bk6/include/linux/moduleparam.h
@@ -13,6 +13,10 @@
 #define MODULE_PARAM_PREFIX __stringify(KBUILD_MODNAME) "."
 #endif
 
+/* Type information for a module parameter. */
+#define MODULE_PARM_TYPE(name, _type) \
+	__MODULE_INFO(parmtype, name##type, #name ":" _type)
+
 struct kernel_param;
 
 /* Returns 0, or -errno.  arg is in kp->arg. */
@@ -64,7 +68,8 @@ struct kparam_array
    param_set_XXX and param_check_XXX. */
 #define module_param_named(name, value, type, perm)			   \
 	param_check_##type(name, &(value));				   \
-	module_param_call(name, param_set_##type, param_get_##type, &value, perm)
+	module_param_call(name, param_set_##type, param_get_##type, &value, perm); \
+	MODULE_PARM_TYPE(name, #type)
 
 #define module_param(name, type, perm)				\
 	module_param_named(name, name, type, perm)
@@ -74,7 +79,8 @@ struct kparam_array
 	static struct kparam_string __param_string_##name		\
 		= { len, string };					\
 	module_param_call(name, param_set_copystring, param_get_string,	\
-		   &__param_string_##name, perm)
+		   &__param_string_##name, perm);			\
+	MODULE_PARM_TYPE(name, "string")
 
 /* Called on module insert or kernel boot */
 extern int parse_args(const char *name,
@@ -135,7 +141,8 @@ extern int param_get_invbool(char *buffe
 	= { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type,\
 	    sizeof(array[0]), array };					\
 	module_param_call(name, param_array_set, param_array_get, 	\
-			  &__param_arr_##name, perm)
+			  &__param_arr_##name, perm);			\
+	MODULE_PARM_TYPE(name, "array of " #type)
 
 #define module_param_array(name, type, nump, perm)		\
 	module_param_array_named(name, name, type, nump, perm)
Index: linux-2.6.11-rc1-bk6/include/linux/module.h
===================================================================
--- linux-2.6.11-rc1-bk6.orig/include/linux/module.h
+++ linux-2.6.11-rc1-bk6/include/linux/module.h
@@ -560,7 +560,8 @@ static inline void MODULE_PARM_(void) { 
 /* DEPRECATED: Do not use. */
 #define MODULE_PARM(var,type)						    \
 struct obsolete_modparm __parm_##var __attribute__((section("__obsparm"))) = \
-{ __stringify(var), type, &MODULE_PARM_ };
+{ __stringify(var), type, &MODULE_PARM_ }; \
+MODULE_PARM_TYPE(var, type);
 #else
 #define MODULE_PARM(var,type) static void __attribute__((__unused__)) *__parm_##var = &MODULE_PARM_;
 #endif

  reply	other threads:[~2005-01-19 16:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-18 18:41 [kbuild 0/5] Some of our patches Andreas Gruenbacher
2005-01-18 18:41 ` [kbuild 5/5] Dont include absolute filenames in binaries Andreas Gruenbacher
2005-01-18 18:41 ` [kbuild 3/5] Add cloneconfig target Andreas Gruenbacher
2005-01-18 18:41 ` [kbuild 4/5] Include type information as module info where possible Andreas Gruenbacher
2005-01-19 16:14   ` Andreas Gruenbacher [this message]
2005-01-20 11:54     ` Andreas Gruenbacher
2005-01-30 15:56       ` Sam Ravnborg
2005-01-30 22:06         ` Andreas Gruenbacher
2005-01-30 22:19           ` Sam Ravnborg
2005-01-18 18:41 ` [kbuild 1/5] Warn when building external modules without modversions Andreas Gruenbacher
2005-01-18 18:41 ` [kbuild 2/5] Dont use the running kernels config file by default Andreas Gruenbacher
2005-01-18 20:15   ` Roman Zippel
2005-01-19 17:51     ` Andreas Gruenbacher
2005-01-19 18:18       ` Roman Zippel
2005-01-19 18:42         ` Andreas Gruenbacher
2005-01-19 19:27           ` Roman Zippel
2005-01-19 23:41           ` Gerd Knorr

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=1106151255.8642.11.camel@winden.suse.de \
    --to=agruen@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=sam@ravnborg.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