2002-09-16 23:18:06

by Chin-Tser Huang

[permalink] [raw]
Subject: save variables to hard disk at kernel mode

Hi,

I would like to implement at the kernel a save that
can periodically store the value of some variables
to the hard disk. Could anyone please tell me what
function can I use to achieve this? Will this save
block the operation of other functions? Thank you
very much for your help!

Henry


2002-09-17 00:47:51

by Neale Banks

[permalink] [raw]
Subject: Re: save variables to hard disk at kernel mode

On Mon, 16 Sep 2002, Chin-Tser Huang wrote:

> I would like to implement at the kernel a save that
> can periodically store the value of some variables
> to the hard disk. Could anyone please tell me what
> function can I use to achieve this? Will this save
> block the operation of other functions? Thank you
> very much for your help!

Write a module to publish the variables, and do teh rest in user-space
(e.g. cron-job)?

The book "Linux Device Drivers" (2nd Ed) does this kind of thing as an
example for PCI data.

HTH,
Neale.

2002-09-17 15:07:15

by Erik Mouw

[permalink] [raw]
Subject: Re: save variables to hard disk at kernel mode

On Mon, Sep 16, 2002 at 06:23:04PM -0500, Chin-Tser Huang wrote:
> I would like to implement at the kernel a save that
> can periodically store the value of some variables
> to the hard disk. Could anyone please tell me what
> function can I use to achieve this? Will this save
> block the operation of other functions? Thank you
> very much for your help!

This is policy, and policy should be implemented in userland. Have your
driver implement a device node that presents the value when userland
reads it. Imlement a simple userland program that read()s the device
and writes it to whatever file you like. The advantage of this approach
is that userland can decide *where* to write it: on a hard disk, send
it over a network, etc. etc.


Erik

--
J.A.K. (Erik) Mouw
Email: [email protected]
WWW: http://www-ict.its.tudelft.nl/~erik/


Attachments:
(No filename) (845.00 B)
(No filename) (189.00 B)
Download all attachments