Re: Persistent module storage [was Linux 2.4 Status / TODO page]

David Woodhouse
2000-11-06T13:22:47Z

I think we're getting confused. What I'm advocating is something like this:

init_module()
{
struct mixer_levels *levels;

levels = inter_module_get("mysoundcard_mixerlevels");

if (!levels)
/* We haven't been loaded before. Default to zero */
levels = &default_levels;

init_hardware(levels);
}

cleanup_module()
{
struct mixer_levels *levels = kmalloc(sizeof *levels);

if (levels) {
/* Record current the levels so we can init the hardware
to the same next time we're loaded */
memcpy(levels, current_levels, sizeof(*levels));
inter_module_register("mysoundcard_mixerlevels", levels);
}
}

(Note it's pseudocode. I _know_ it doesn't compile and that the name we
pass to inter_module_register is removed when the module is unloaded. Oh
and that inter_module_register will panic() and kill the whole system on
the second unload because a registration with that name already exists.)

--
dwmw2