From: Arnd Bergmann <arnd@arndb.de>
To: rusty@rustcorp.com.au
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] fix reading string module parameters in sysfs
Date: Wed, 4 Aug 2004 19:58:46 +0200 [thread overview]
Message-ID: <200408041958.46589.arnd@arndb.de> (raw)
[-- 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 --]
reply other threads:[~2004-08-04 17:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200408041958.46589.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
/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