aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/params.c39
1 files changed, 13 insertions, 26 deletions
diff --git a/kernel/params.c b/kernel/params.c
index 3c4a9f1b095e..3e78fdb445e7 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -193,7 +193,9 @@ int parse_args(const char *name,
193 int param_get_##name(char *buffer, struct kernel_param *kp) \ 193 int param_get_##name(char *buffer, struct kernel_param *kp) \
194 { \ 194 { \
195 return sprintf(buffer, format, *((type *)kp->arg)); \ 195 return sprintf(buffer, format, *((type *)kp->arg)); \
196 } 196 } \
197 EXPORT_SYMBOL(param_set_##name); \
198 EXPORT_SYMBOL(param_get_##name)
197 199
198STANDARD_PARAM_DEF(byte, unsigned char, "%c", unsigned long, strict_strtoul); 200STANDARD_PARAM_DEF(byte, unsigned char, "%c", unsigned long, strict_strtoul);
199STANDARD_PARAM_DEF(short, short, "%hi", long, strict_strtol); 201STANDARD_PARAM_DEF(short, short, "%hi", long, strict_strtol);
@@ -222,11 +224,13 @@ int param_set_charp(const char *val, struct kernel_param *kp)
222 224
223 return 0; 225 return 0;
224} 226}
227EXPORT_SYMBOL(param_set_charp);
225 228
226int param_get_charp(char *buffer, struct kernel_param *kp) 229int param_get_charp(char *buffer, struct kernel_param *kp)
227{ 230{
228 return sprintf(buffer, "%s", *((char **)kp->arg)); 231 return sprintf(buffer, "%s", *((char **)kp->arg));
229} 232}
233EXPORT_SYMBOL(param_get_charp);
230 234
231/* Actually could be a bool or an int, for historical reasons. */ 235/* Actually could be a bool or an int, for historical reasons. */
232int param_set_bool(const char *val, struct kernel_param *kp) 236int param_set_bool(const char *val, struct kernel_param *kp)
@@ -254,6 +258,7 @@ int param_set_bool(const char *val, struct kernel_param *kp)
254 *(int *)kp->arg = v; 258 *(int *)kp->arg = v;
255 return 0; 259 return 0;
256} 260}
261EXPORT_SYMBOL(param_set_bool);
257 262
258int param_get_bool(char *buffer, struct kernel_param *kp) 263int param_get_bool(char *buffer, struct kernel_param *kp)
259{ 264{
@@ -266,6 +271,7 @@ int param_get_bool(char *buffer, struct kernel_param *kp)
266 /* Y and N chosen as being relatively non-coder friendly */ 271 /* Y and N chosen as being relatively non-coder friendly */
267 return sprintf(buffer, "%c", val ? 'Y' : 'N'); 272 return sprintf(buffer, "%c", val ? 'Y' : 'N');
268} 273}
274EXPORT_SYMBOL(param_get_bool);
269 275
270/* This one must be bool. */ 276/* This one must be bool. */
271int param_set_invbool(const char *val, struct kernel_param *kp) 277int param_set_invbool(const char *val, struct kernel_param *kp)
@@ -281,11 +287,13 @@ int param_set_invbool(const char *val, struct kernel_param *kp)
281 *(bool *)kp->arg = !boolval; 287 *(bool *)kp->arg = !boolval;
282 return ret; 288 return ret;
283} 289}
290EXPORT_SYMBOL(param_set_invbool);
284 291
285int param_get_invbool(char *buffer, struct kernel_param *kp) 292int param_get_invbool(char *buffer, struct kernel_param *kp)
286{ 293{
287 return sprintf(buffer, "%c", (*(bool *)kp->arg) ? 'N' : 'Y'); 294 return sprintf(buffer, "%c", (*(bool *)kp->arg) ? 'N' : 'Y');
288} 295}
296EXPORT_SYMBOL(param_get_invbool);
289 297
290/* We break the rule and mangle the string. */ 298/* We break the rule and mangle the string. */
291static int param_array(const char *name, 299static int param_array(const char *name,
@@ -346,6 +354,7 @@ int param_array_set(const char *val, struct kernel_param *kp)
346 arr->elemsize, arr->set, kp->flags, 354 arr->elemsize, arr->set, kp->flags,
347 arr->num ?: &temp_num); 355 arr->num ?: &temp_num);
348} 356}
357EXPORT_SYMBOL(param_array_set);
349 358
350int param_array_get(char *buffer, struct kernel_param *kp) 359int param_array_get(char *buffer, struct kernel_param *kp)
351{ 360{
@@ -366,6 +375,7 @@ int param_array_get(char *buffer, struct kernel_param *kp)
366 buffer[off] = '\0'; 375 buffer[off] = '\0';
367 return off; 376 return off;
368} 377}
378EXPORT_SYMBOL(param_array_get);
369 379
370int param_set_copystring(const char *val, struct kernel_param *kp) 380int param_set_copystring(const char *val, struct kernel_param *kp)
371{ 381{
@@ -379,12 +389,14 @@ int param_set_copystring(const char *val, struct kernel_param *kp)
379 strcpy(kps->string, val); 389 strcpy(kps->string, val);
380 return 0; 390 return 0;
381} 391}
392EXPORT_SYMBOL(param_set_copystring);
382 393
383int param_get_string(char *buffer, struct kernel_param *kp) 394int param_get_string(char *buffer, struct kernel_param *kp)
384{ 395{
385 const struct kparam_string *kps = kp->str; 396 const struct kparam_string *kps = kp->str;
386 return strlcpy(buffer, kps->string, kps->maxlen); 397 return strlcpy(buffer, kps->string, kps->maxlen);
387} 398}
399EXPORT_SYMBOL(param_get_string);
388 400
389/* sysfs output in /sys/modules/XYZ/parameters/ */ 401/* sysfs output in /sys/modules/XYZ/parameters/ */
390#define to_module_attr(n) container_of(n, struct module_attribute, attr) 402#define to_module_attr(n) container_of(n, struct module_attribute, attr)
@@ -754,28 +766,3 @@ static int __init param_sysfs_init(void)
754subsys_initcall(param_sysfs_init); 766subsys_initcall(param_sysfs_init);
755 767
756#endif /* CONFIG_SYSFS */ 768#endif /* CONFIG_SYSFS */
757
758EXPORT_SYMBOL(param_set_byte);
759EXPORT_SYMBOL(param_get_byte);
760EXPORT_SYMBOL(param_set_short);
761EXPORT_SYMBOL(param_get_short);
762EXPORT_SYMBOL(param_set_ushort);
763EXPORT_SYMBOL(param_get_ushort);
764EXPORT_SYMBOL(param_set_int);
765EXPORT_SYMBOL(param_get_int);
766EXPORT_SYMBOL(param_set_uint);
767EXPORT_SYMBOL(param_get_uint);
768EXPORT_SYMBOL(param_set_long);
769EXPORT_SYMBOL(param_get_long);
770EXPORT_SYMBOL(param_set_ulong);
771EXPORT_SYMBOL(param_get_ulong);
772EXPORT_SYMBOL(param_set_charp);
773EXPORT_SYMBOL(param_get_charp);
774EXPORT_SYMBOL(param_set_bool);
775EXPORT_SYMBOL(param_get_bool);
776EXPORT_SYMBOL(param_set_invbool);
777EXPORT_SYMBOL(param_get_invbool);
778EXPORT_SYMBOL(param_array_set);
779EXPORT_SYMBOL(param_array_get);
780EXPORT_SYMBOL(param_set_copystring);
781EXPORT_SYMBOL(param_get_string);