Commit dfd79772 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Introduce module_param_array_named to allow for module options with

name different form corresponding array variable. Allows using short
(but descriptive) option names without hurting code readability.

Modeled after module_param_named.
parent ba1889da
...@@ -126,13 +126,16 @@ extern int param_get_invbool(char *buffer, struct kernel_param *kp); ...@@ -126,13 +126,16 @@ extern int param_get_invbool(char *buffer, struct kernel_param *kp);
#define param_check_invbool(name, p) __param_check(name, p, int) #define param_check_invbool(name, p) __param_check(name, p, int)
/* Comma-separated array: num is set to number they actually specified. */ /* Comma-separated array: num is set to number they actually specified. */
#define module_param_array(name, type, num, perm) \ #define module_param_array_named(name, array, type, num, perm) \
static struct kparam_array __param_arr_##name \ static struct kparam_array __param_arr_##name \
= { ARRAY_SIZE(name), &num, param_set_##type, param_get_##type, \ = { ARRAY_SIZE(array), &num, param_set_##type, param_get_##type,\
sizeof(name[0]), name }; \ sizeof(array[0]), array }; \
module_param_call(name, param_array_set, param_array_get, \ module_param_call(name, param_array_set, param_array_get, \
&__param_arr_##name, perm) &__param_arr_##name, perm)
#define module_param_array(name, type, num, perm) \
module_param_array_named(name, name, type, num, perm)
extern int param_array_set(const char *val, struct kernel_param *kp); 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_array_get(char *buffer, struct kernel_param *kp);
......
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