public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* module init data
@ 2010-01-18 14:01 mojtaba
  2010-01-19 14:19 ` Américo Wang
  0 siblings, 1 reply; 2+ messages in thread
From: mojtaba @ 2010-01-18 14:01 UTC (permalink / raw)
  To: linux-kernel

Hi there,

I have a kernel modules which needs to maintain a table of some
information. the data in the table can be changed during the system
run and some new raws might be added to the  table. The table also
must be initialized at the system startup with the values from the
previous run.

As using files is not good in kernel mode, how can I load the data at
the startup and store them as they changed? These information are
device related. Can I use sysfs for this issue? Is there any tutorial
on how to do that?

Regards,
moji

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: module init data
  2010-01-18 14:01 module init data mojtaba
@ 2010-01-19 14:19 ` Américo Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Américo Wang @ 2010-01-19 14:19 UTC (permalink / raw)
  To: mojtaba; +Cc: linux-kernel

On Mon, Jan 18, 2010 at 03:01:56PM +0100, mojtaba wrote:
>Hi there,
>
>I have a kernel modules which needs to maintain a table of some
>information. the data in the table can be changed during the system
>run and some new raws might be added to the  table. The table also
>must be initialized at the system startup with the values from the
>previous run.
>
>As using files is not good in kernel mode, how can I load the data at
>the startup and store them as they changed? These information are
>device related. Can I use sysfs for this issue? Is there any tutorial
>on how to do that?
>

You can't use sysfs here, since it also stays in memory.

What you want is an interface to read and write those information
to/from the userspace, you can take iptables-save and iptables-restore
as an example.

One design of such interface would be passing a data structure which
contains all the table information from user space to kernel space
via syscall. Thus a user-space program will need to parse the data in
a file into that data structure and then do that syscall.

With this interface on hand, you can write an init-script to load the
table info during boot and to save the info during shutdown.

-- 
Live like a child, think like the god.
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-19 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-18 14:01 module init data mojtaba
2010-01-19 14:19 ` Américo Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox