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

From: David Woodhouse (dwmw2@infradead.org)
Date: Mon Nov 06 2000 - 08:21:44 EST


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

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



This archive was generated by hypermail 2b29 : Tue Nov 07 2000 - 21:00:19 EST