diff options
author | Jan Beulich <jbeulich@novell.com> | 2007-10-16 23:29:34 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 08:42:56 -0700 |
commit | 22e48eaf587d044ba311a73c6fe0d0deaa8fdb63 (patch) | |
tree | 8407d8f3f9a69b275e9008249e678499ce92253d /kernel/params.c | |
parent | d5aa0daf6d9f327a9c13bc3a203bfac2b8707e2f (diff) | |
download | linux-22e48eaf587d044ba311a73c6fe0d0deaa8fdb63.tar.gz linux-22e48eaf587d044ba311a73c6fe0d0deaa8fdb63.tar.bz2 linux-22e48eaf587d044ba311a73c6fe0d0deaa8fdb63.zip |
constify string/array kparam tracking structures
.. in an effort to make read-only whatever can be made, so that
CONFIG_DEBUG_RODATA can catch as many issues as possible.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/params.c')
-rw-r--r-- | kernel/params.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/kernel/params.c b/kernel/params.c index 4e57732fcfb4..1d6aca288cdc 100644 --- a/kernel/params.c +++ b/kernel/params.c @@ -252,8 +252,9 @@ int param_get_bool(char *buffer, struct kernel_param *kp) int param_set_invbool(const char *val, struct kernel_param *kp) { int boolval, ret; - struct kernel_param dummy = { .arg = &boolval }; + struct kernel_param dummy; + dummy.arg = &boolval; ret = param_set_bool(val, &dummy); if (ret == 0) *(int *)kp->arg = !boolval; @@ -262,11 +263,7 @@ int param_set_invbool(const char *val, struct kernel_param *kp) int param_get_invbool(char *buffer, struct kernel_param *kp) { - int val; - struct kernel_param dummy = { .arg = &val }; - - val = !*(int *)kp->arg; - return param_get_bool(buffer, &dummy); + return sprintf(buffer, "%c", (*(int *)kp->arg) ? 'N' : 'Y'); } /* We break the rule and mangle the string. */ @@ -325,7 +322,7 @@ static int param_array(const char *name, int param_array_set(const char *val, struct kernel_param *kp) { - struct kparam_array *arr = kp->arg; + const struct kparam_array *arr = kp->arr; unsigned int temp_num; return param_array(kp->name, val, 1, arr->max, arr->elem, @@ -335,7 +332,7 @@ int param_array_set(const char *val, struct kernel_param *kp) int param_array_get(char *buffer, struct kernel_param *kp) { int i, off, ret; - struct kparam_array *arr = kp->arg; + const struct kparam_array *arr = kp->arr; struct kernel_param p; p = *kp; @@ -354,7 +351,7 @@ int param_array_get(char *buffer, struct kernel_param *kp) int param_set_copystring(const char *val, struct kernel_param *kp) { - struct kparam_string *kps = kp->arg; + const struct kparam_string *kps = kp->str; if (!val) { printk(KERN_ERR "%s: missing param set value\n", kp->name); @@ -371,7 +368,7 @@ int param_set_copystring(const char *val, struct kernel_param *kp) int param_get_string(char *buffer, struct kernel_param *kp) { - struct kparam_string *kps = kp->arg; + const struct kparam_string *kps = kp->str; return strlcpy(buffer, kps->string, kps->maxlen); } |