From: "Américo Wang" <xiyou.wangcong@gmail.com>
To: mojtaba <kernelppc@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: module init data
Date: Tue, 19 Jan 2010 22:19:06 +0800 [thread overview]
Message-ID: <20100119141906.GA3473@hack> (raw)
In-Reply-To: <1dec3f771001180601jd511ab0g51aaaf8ed2195e9d@mail.gmail.com>
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.
prev parent reply other threads:[~2010-01-19 14:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-18 14:01 module init data mojtaba
2010-01-19 14:19 ` Américo Wang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100119141906.GA3473@hack \
--to=xiyou.wangcong@gmail.com \
--cc=kernelppc@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.