diff options
Diffstat (limited to 'kernel/params.c')
-rw-r--r-- | kernel/params.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/kernel/params.c b/kernel/params.c index 508828afb874..f37d82631347 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
@@ -87,6 +87,8 @@ static int parse_one(char *param, | |||
87 | char *val, | 87 | char *val, |
88 | const struct kernel_param *params, | 88 | const struct kernel_param *params, |
89 | unsigned num_params, | 89 | unsigned num_params, |
90 | s16 min_level, | ||
91 | s16 max_level, | ||
90 | int (*handle_unknown)(char *param, char *val)) | 92 | int (*handle_unknown)(char *param, char *val)) |
91 | { | 93 | { |
92 | unsigned int i; | 94 | unsigned int i; |
@@ -95,6 +97,9 @@ static int parse_one(char *param, | |||
95 | /* Find parameter */ | 97 | /* Find parameter */ |
96 | for (i = 0; i < num_params; i++) { | 98 | for (i = 0; i < num_params; i++) { |
97 | if (parameq(param, params[i].name)) { | 99 | if (parameq(param, params[i].name)) { |
100 | if (params[i].level < min_level | ||
101 | || params[i].level > max_level) | ||
102 | return 0; | ||
98 | /* No one handled NULL, so do it here. */ | 103 | /* No one handled NULL, so do it here. */ |
99 | if (!val && params[i].ops->set != param_set_bool | 104 | if (!val && params[i].ops->set != param_set_bool |
100 | && params[i].ops->set != param_set_bint) | 105 | && params[i].ops->set != param_set_bint) |
@@ -174,6 +179,8 @@ int parse_args(const char *name, | |||
174 | char *args, | 179 | char *args, |
175 | const struct kernel_param *params, | 180 | const struct kernel_param *params, |
176 | unsigned num, | 181 | unsigned num, |
182 | s16 min_level, | ||
183 | s16 max_level, | ||
177 | int (*unknown)(char *param, char *val)) | 184 | int (*unknown)(char *param, char *val)) |
178 | { | 185 | { |
179 | char *param, *val; | 186 | char *param, *val; |
@@ -189,7 +196,8 @@ int parse_args(const char *name, | |||
189 | 196 | ||
190 | args = next_arg(args, ¶m, &val); | 197 | args = next_arg(args, ¶m, &val); |
191 | irq_was_disabled = irqs_disabled(); | 198 | irq_was_disabled = irqs_disabled(); |
192 | ret = parse_one(param, val, params, num, unknown); | 199 | ret = parse_one(param, val, params, num, |
200 | min_level, max_level, unknown); | ||
193 | if (irq_was_disabled && !irqs_disabled()) { | 201 | if (irq_was_disabled && !irqs_disabled()) { |
194 | printk(KERN_WARNING "parse_args(): option '%s' enabled " | 202 | printk(KERN_WARNING "parse_args(): option '%s' enabled " |
195 | "irq's!\n", param); | 203 | "irq's!\n", param); |
@@ -374,7 +382,7 @@ static int param_array(const char *name, | |||
374 | unsigned int min, unsigned int max, | 382 | unsigned int min, unsigned int max, |
375 | void *elem, int elemsize, | 383 | void *elem, int elemsize, |
376 | int (*set)(const char *, const struct kernel_param *kp), | 384 | int (*set)(const char *, const struct kernel_param *kp), |
377 | u16 flags, | 385 | s16 level, |
378 | unsigned int *num) | 386 | unsigned int *num) |
379 | { | 387 | { |
380 | int ret; | 388 | int ret; |
@@ -384,7 +392,7 @@ static int param_array(const char *name, | |||
384 | /* Get the name right for errors. */ | 392 | /* Get the name right for errors. */ |
385 | kp.name = name; | 393 | kp.name = name; |
386 | kp.arg = elem; | 394 | kp.arg = elem; |
387 | kp.flags = flags; | 395 | kp.level = level; |
388 | 396 | ||
389 | *num = 0; | 397 | *num = 0; |
390 | /* We expect a comma-separated list of values. */ | 398 | /* We expect a comma-separated list of values. */ |
@@ -425,7 +433,7 @@ static int param_array_set(const char *val, const struct kernel_param *kp) | |||
425 | unsigned int temp_num; | 433 | unsigned int temp_num; |
426 | 434 | ||
427 | return param_array(kp->name, val, 1, arr->max, arr->elem, | 435 | return param_array(kp->name, val, 1, arr->max, arr->elem, |
428 | arr->elemsize, arr->ops->set, kp->flags, | 436 | arr->elemsize, arr->ops->set, kp->level, |
429 | arr->num ?: &temp_num); | 437 | arr->num ?: &temp_num); |
430 | } | 438 | } |
431 | 439 | ||