lkml.org 
[lkml]   [2009]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC PATCH 3/6] module: always prefix module parameters with the module name
    Date
    The parameters in statically linked modules now end up in the
    proper sysfs directories, ie /sys/module/<modname>/parameter/*
    ---
    include/linux/moduleparam.h | 2 +-
    kernel/params.c | 17 ++++++++++++++++-
    2 files changed, 17 insertions(+), 2 deletions(-)

    diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
    index e4af339..0cb2867 100644
    --- a/include/linux/moduleparam.h
    +++ b/include/linux/moduleparam.h
    @@ -7,7 +7,7 @@

    /* You can override this manually, but generally this should match the
    module name. */
    -#ifdef MODULE
    +#if defined(MODULE) && !defined(CONFIG_MODULE_STATIC)
    #define MODULE_PARAM_PREFIX /* empty */
    #else
    #define MODULE_PARAM_PREFIX KBUILD_MODNAME "."
    diff --git a/kernel/params.c b/kernel/params.c
    index a1e3025..22af6ee 100644
    --- a/kernel/params.c
    +++ b/kernel/params.c
    @@ -518,6 +518,19 @@ static void free_module_param_attrs(struct module_kobject *mk)
    mk->mp = NULL;
    }

    +#ifdef CONFIG_MODULE_STATIC
    +static const char *skip_param_modname(const char *name)
    +{
    + const char *dot = strchr(name, '.');
    + return (!dot) ? name : dot + 1;
    +}
    +#else
    +static const char *skip_param_modname(const char *name)
    +{
    + return name;
    +}
    +#endif
    +
    /*
    * module_param_sysfs_setup - setup sysfs support for one module
    * @mod: module
    @@ -535,9 +548,11 @@ int module_param_sysfs_setup(struct module *mod,
    bool params = false;

    for (i = 0; i < num_params; i++) {
    + const char *name;
    if (kparam[i].perm == 0)
    continue;
    - err = add_sysfs_param(&mod->mkobj, &kparam[i], kparam[i].name);
    + name = skip_param_modname(kparam[i].name);
    + err = add_sysfs_param(&mod->mkobj, &kparam[i], name);
    if (err)
    return err;
    params = true;
    --
    1.5.6.3


    \
     
     \ /
      Last update: 2009-02-15 19:23    [W:0.022 / U:181.756 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site