Commit f1577452 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Linus Torvalds

[PATCH] fix reading string module parameters in sysfs

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: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4b4b699d
......@@ -73,7 +73,7 @@ struct kparam_array
#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_set(const char *val, struct kernel_param *kp);
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,
......
......@@ -339,6 +339,12 @@ int param_set_copystring(const char *val, struct kernel_param *kp)
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_get_invbool);
EXPORT_SYMBOL(param_array_set);
EXPORT_SYMBOL(param_array_get);
EXPORT_SYMBOL(param_set_copystring);
EXPORT_SYMBOL(param_get_string);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment