public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix reading string module parameters in sysfs
@ 2004-08-04 17:58 Arnd Bergmann
  0 siblings, 0 replies; only message in thread
From: Arnd Bergmann @ 2004-08-04 17:58 UTC (permalink / raw)
  To: rusty; +Cc: linux-kernel

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

Reading the contents of a module_param_string through sysfs currently
oopses because the param_get_charp() function cannot operate on a
kparam_string struct. This introduces the required param_get_string.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

===== include/linux/moduleparam.h 1.8 vs edited =====
--- 1.8/include/linux/moduleparam.h	Fri May 21 09:50:15 2004
+++ edited/include/linux/moduleparam.h	Wed Aug  4 16:16:23 2004
@@ -73,7 +73,7 @@
 #define module_param_string(name, string, len, perm)			\
 	static struct kparam_string __param_string_##name		\
 		= { len, string };					\
-	module_param_call(name, param_set_copystring, param_get_charp,	\
+	module_param_call(name, param_set_copystring, param_get_string,	\
 		   &__param_string_##name, perm)
 
 /* Called on module insert or kernel boot */
@@ -140,6 +140,7 @@
 extern int param_array_get(char *buffer, struct kernel_param *kp);
 
 extern int param_set_copystring(const char *val, struct kernel_param *kp);
+extern int param_get_string(char *buffer, struct kernel_param *kp);
 
 int param_array(const char *name,
 		const char *val,
===== kernel/params.c 1.8 vs edited =====
--- 1.8/kernel/params.c	Fri May  7 23:22:37 2004
+++ edited/kernel/params.c	Wed Aug  4 16:23:59 2004
@@ -339,6 +339,12 @@
 	return 0;
 }
 
+int param_get_string(char *buffer, struct kernel_param *kp)
+{
+	struct kparam_string *kps = kp->arg;
+	return strlcpy(buffer, kps->string, kps->maxlen);
+}
+
 EXPORT_SYMBOL(param_set_short);
 EXPORT_SYMBOL(param_get_short);
 EXPORT_SYMBOL(param_set_ushort);
@@ -360,3 +366,4 @@
 EXPORT_SYMBOL(param_array_set);
 EXPORT_SYMBOL(param_array_get);
 EXPORT_SYMBOL(param_set_copystring);
+EXPORT_SYMBOL(param_get_string);

[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-08-04 17:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-04 17:58 [PATCH] fix reading string module parameters in sysfs Arnd Bergmann

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