#include <linux/ctype.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/kstrtox.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/overflow.h>
#include <linux/security.h>
#include <linux/slab.h>
#include <linux/string.h>
#ifdef CONFIG_SYSFS
static DEFINE_MUTEX(param_lock);
#ifdef CONFIG_MODULES
#define KPARAM_MUTEX(mod) …
#else
#define KPARAM_MUTEX …
#endif
static inline void check_kparam_locked(struct module *mod)
{ … }
#else
static inline void check_kparam_locked(struct module *mod)
{
}
#endif
struct kmalloced_param { … };
static LIST_HEAD(kmalloced_params);
static DEFINE_SPINLOCK(kmalloced_params_lock);
static void *kmalloc_parameter(unsigned int size)
{ … }
static void maybe_kfree_parameter(void *param)
{ … }
static char dash2underscore(char c)
{ … }
bool parameqn(const char *a, const char *b, size_t n)
{ … }
bool parameq(const char *a, const char *b)
{ … }
static bool param_check_unsafe(const struct kernel_param *kp)
{ … }
static int parse_one(char *param,
char *val,
const char *doing,
const struct kernel_param *params,
unsigned num_params,
s16 min_level,
s16 max_level,
void *arg, parse_unknown_fn handle_unknown)
{ … }
char *parse_args(const char *doing,
char *args,
const struct kernel_param *params,
unsigned num,
s16 min_level,
s16 max_level,
void *arg, parse_unknown_fn unknown)
{ … }
#define STANDARD_PARAM_DEF(name, type, format, strtolfn) …
STANDARD_PARAM_DEF(…);
STANDARD_PARAM_DEF(…);
STANDARD_PARAM_DEF(…);
STANDARD_PARAM_DEF(…);
STANDARD_PARAM_DEF(…);
STANDARD_PARAM_DEF(…);
STANDARD_PARAM_DEF(…);
STANDARD_PARAM_DEF(…);
STANDARD_PARAM_DEF(…);
int param_set_uint_minmax(const char *val, const struct kernel_param *kp,
unsigned int min, unsigned int max)
{ … }
EXPORT_SYMBOL_GPL(…);
int param_set_charp(const char *val, const struct kernel_param *kp)
{ … }
EXPORT_SYMBOL(…);
int param_get_charp(char *buffer, const struct kernel_param *kp)
{ … }
EXPORT_SYMBOL(…);
void param_free_charp(void *arg)
{ … }
EXPORT_SYMBOL(…);
const struct kernel_param_ops param_ops_charp = …;
EXPORT_SYMBOL(…);
int param_set_bool(const char *val, const struct kernel_param *kp)
{ … }
EXPORT_SYMBOL(…);
int param_get_bool(char *buffer, const struct kernel_param *kp)
{ … }
EXPORT_SYMBOL(…);
const struct kernel_param_ops param_ops_bool = …;
EXPORT_SYMBOL(…);
int param_set_bool_enable_only(const char *val, const struct kernel_param *kp)
{ … }
EXPORT_SYMBOL_GPL(…);
const struct kernel_param_ops param_ops_bool_enable_only = …;
EXPORT_SYMBOL_GPL(…);
int param_set_invbool(const char *val, const struct kernel_param *kp)
{ … }
EXPORT_SYMBOL(…);
int param_get_invbool(char *buffer, const struct kernel_param *kp)
{ … }
EXPORT_SYMBOL(…);
const struct kernel_param_ops param_ops_invbool = …;
EXPORT_SYMBOL(…);
int param_set_bint(const char *val, const struct kernel_param *kp)
{ … }
EXPORT_SYMBOL(…);
const struct kernel_param_ops param_ops_bint = …;
EXPORT_SYMBOL(…);
static int param_array(struct module *mod,
const char *name,
const char *val,
unsigned int min, unsigned int max,
void *elem, int elemsize,
int (*set)(const char *, const struct kernel_param *kp),
s16 level,
unsigned int *num)
{ … }
static int param_array_set(const char *val, const struct kernel_param *kp)
{ … }
static int param_array_get(char *buffer, const struct kernel_param *kp)
{ … }
static void param_array_free(void *arg)
{ … }
const struct kernel_param_ops param_array_ops = …;
EXPORT_SYMBOL(…);
int param_set_copystring(const char *val, const struct kernel_param *kp)
{ … }
EXPORT_SYMBOL(…);
int param_get_string(char *buffer, const struct kernel_param *kp)
{ … }
EXPORT_SYMBOL(…);
const struct kernel_param_ops param_ops_string = …;
EXPORT_SYMBOL(…);
#define to_module_attr(n) …
#define to_module_kobject(n) …
struct param_attribute
{ … };
struct module_param_attrs
{ … };
#ifdef CONFIG_SYSFS
#define to_param_attr(n) …
static ssize_t param_attr_show(struct module_attribute *mattr,
struct module_kobject *mk, char *buf)
{ … }
static ssize_t param_attr_store(struct module_attribute *mattr,
struct module_kobject *mk,
const char *buf, size_t len)
{ … }
#endif
#ifdef CONFIG_MODULES
#define __modinit
#else
#define __modinit …
#endif
#ifdef CONFIG_SYSFS
void kernel_param_lock(struct module *mod)
{ … }
void kernel_param_unlock(struct module *mod)
{ … }
EXPORT_SYMBOL(…);
EXPORT_SYMBOL(…);
static __modinit int add_sysfs_param(struct module_kobject *mk,
const struct kernel_param *kp,
const char *name)
{ … }
#ifdef CONFIG_MODULES
static void free_module_param_attrs(struct module_kobject *mk)
{ … }
int module_param_sysfs_setup(struct module *mod,
const struct kernel_param *kparam,
unsigned int num_params)
{ … }
void module_param_sysfs_remove(struct module *mod)
{ … }
#endif
void destroy_params(const struct kernel_param *params, unsigned num)
{ … }
static struct module_kobject * __init locate_module_kobject(const char *name)
{ … }
static void __init kernel_add_sysfs_param(const char *name,
const struct kernel_param *kparam,
unsigned int name_skip)
{ … }
static void __init param_sysfs_builtin(void)
{ … }
ssize_t __modver_version_show(struct module_attribute *mattr,
struct module_kobject *mk, char *buf)
{ … }
extern const struct module_version_attribute __start___modver[];
extern const struct module_version_attribute __stop___modver[];
static void __init version_sysfs_builtin(void)
{ … }
static ssize_t module_attr_show(struct kobject *kobj,
struct attribute *attr,
char *buf)
{ … }
static ssize_t module_attr_store(struct kobject *kobj,
struct attribute *attr,
const char *buf, size_t len)
{ … }
static const struct sysfs_ops module_sysfs_ops = …;
static int uevent_filter(const struct kobject *kobj)
{ … }
static const struct kset_uevent_ops module_uevent_ops = …;
struct kset *module_kset;
static void module_kobj_release(struct kobject *kobj)
{ … }
const struct kobj_type module_ktype = …;
static int __init param_sysfs_init(void)
{ … }
subsys_initcall(param_sysfs_init);
static int __init param_sysfs_builtin_init(void)
{ … }
late_initcall(param_sysfs_builtin_init);
#endif