From: Matti Aarnio <matti.aarnio@zmailer.org>
To: Sumit Narayan <sumit_uconn@lycos.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Write file in EXT2
Date: Tue, 6 May 2003 10:17:08 +0300 [thread overview]
Message-ID: <20030506071708.GM24892@mea-ext.zmailer.org> (raw)
In-Reply-To: <FCLJBBJOHCHPBDAA@mailcity.com>
On Mon, May 05, 2003 at 11:14:46PM -0400, Sumit Narayan wrote:
> Hi,
>
> I would like to create a log file containing the reads and writes made
> on a disk, by adding a function in the kernel. And once this log table
> reaches a limit, say 10,000 records, I would like it to be written on
> hard disk automatically. I am unable to do this, since I dont know how
> to write to a file, while in the kernel. I tried System Calls, but they
> dont seem to work. Could someone tell me what is the list of functions
> that I need to use to do this job. I think I have to play with
> super-blocks and inodes. But I dont know how to do that. :) Please help
> me.
Considering how to do that log writing:
Kernel contains several codes that are writing data to disk for
various "logging" tasks. Most promimnent example of them is:
kernel/acct.c
It keeps kernel internal file descriptor ("filp") for its
internal use. It has code that opens a file for writing
to it, actual writer (one smallish block at the time, but
that is merely size parameter issue), and it also closes
the file when wanted (e.g. under administrator control).
All that completely independent of target filesystem.
Oh, and of course it has management interface, so that
sysadmin can tell to it:
- when to activate / deactivate
- into which file to log
In your application there is a danger of snaring
yourself: disk activity must not stop at logging
something, when the log buffer is full and flushing
it is under way. Otherwise you are in danger of
halting the log-flush, and then you have a dead
machine.
> Thanks.
> Sumit
>
> p.s. I am using Kernel 2.4.20 and want this in EXT2 FS
/Matti Aarnio
next prev parent reply other threads:[~2003-05-06 7:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-06 3:14 Write file in EXT2 Sumit Narayan
2003-05-06 4:10 ` Valdis.Kletnieks
2003-05-06 7:17 ` Matti Aarnio [this message]
2003-05-06 14:45 Sumit Narayan
2003-05-06 15:34 ` Richard B. Johnson
2003-05-06 14:52 Sumit Narayan
2003-05-07 16:55 ` Amol P Dharmadhikari
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=20030506071708.GM24892@mea-ext.zmailer.org \
--to=matti.aarnio@zmailer.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sumit_uconn@lycos.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).