lkml.org 
[lkml]   [2004]   [Aug]   [2]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC] [PATCH 1/2] export module parameters in sysfs for modules _and_ built-in code
FromRusty Russell <>
DateMon, 02 Aug 2004 15:59:57 +1000
On Mon, 2004-08-02 at 02:54, Dominik Brodowski wrote:
> Create a new /sys top-level directory named "parameters", and make all
> to-be-sysfs-exported module parameters available as attributes to kobjects.
> Currently, only module parameters in _modules_ are exported in /sys/modules/,
> while those of "modules" built into the kernel can be set by the kernel command 
> line, but not read or set via sysfs.

Thanks for this Dominik!

One question from reading the code:


> diff -ruN linux-original/kernel/module.c linux/kernel/module.c
> --- linux-original/kernel/module.c	2004-08-01 18:40:25.939948264 +0200
> +++ linux/kernel/module.c	2004-08-01 18:39:01.097846224 +0200
> @@ -1131,6 +1131,12 @@
>  };
>  static decl_subsys(module, &module_ktype, NULL);
> 
> +extern int module_param_sysfs_setup(struct module *mod, 
> +				    struct kernel_param *kparam,
> +				    unsigned int num_params);
> +
> +extern void module_param_sysfs_remove(struct module *mod);

Put these in moduleparam.h please, otherwise AKPM will kill us both.

> +	kbuild_modname = kmalloc(sizeof(char) * (MAX_KBUILD_MODNAME + 1), GFP_KERNEL);
> +	if (!kbuild_modname)
> +		return -ENOMEM;
> +	memset(kbuild_modname, 0, sizeof(char) * (MAX_KBUILD_MODNAME + 1));

...

> +	kfree (kbuild_modname);

I would have thought this a good candidate for a stack variable?

> +/* Needs to be before __initcall(module_init) */
> +fs_initcall(param_sysfs_init);

That's horrible.  And I think the initcall in module.c should be removed
in your second patch, no?

Rusty,
-- 
Anyone who quotes me in their signature is an idiot -- Rusty Russell

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:04    [from the cache]
©2003-2008