Re: How can LKM store persistent data?

From: Alan Cox
Date: Mon Oct 03 2011 - 06:07:09 EST


> Our device has some configuration data like DVB standard and operation
> mode which is not changes frequently. Currently it can be changed using
> module parameters and by ioctl calls. But when the driver is down and up
> again (meaning - every restart, sleep, reboot etc.) the module is back

Shouldn't be every sleep - you can reload across a suspend/resume
yourself simply by remembering the module settings in the driver.

> Our users asked us to keep this data persistent, if someone is using
> ISDBT he would probably use it forever unless traveling to another
> region. So the request is once a mode was set, do not change it on the
> next reload just work at that mode until instructed otherwise. Therefore
> the driver needs to save this data somehow, and read it when it loads
> and work according to it.

The usual way is to load the settings when the driver is loaded. udev has
rules for what to do on driver loads (create things, configure stuff etc)
so you can use a udev rule to run a program on driver load which loads
the settings.

Saving them in userspace so the udev app can reload them is then up to
your configuration tool/apps.

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