[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20100119141906.GA3473@hack>
Date: Tue, 19 Jan 2010 22:19:06 +0800
From: Américo Wang <xiyou.wangcong@...il.com>
To: mojtaba <kernelppc@...il.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: module init data
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists