From: Libor Vanek <libor@conet.cz>
To: Erik Mouw <erik@harddisk-recovery.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Reading from file in module fails
Date: Mon, 3 May 2004 13:43:16 +0200 [thread overview]
Message-ID: <20040503114316.GA22732@Loki> (raw)
In-Reply-To: <20040503113500.GB31513@harddisk-recovery.com>
> > I need to copy files (yes - I know that kernel shouldn't do this but
> > I REALLY need).
>
> This is ugly, but it should do the trick:
>
> int rv;
> char *argv[4] = {"/bin/cp", "/tmp/foo", "/tmp/bar", NULL};
> char *envp[3] = {"HOME=/", "PATH=/sbin:/bin:/usr/sbin:/usr/bin", NULL};
>
> rv = call_usermodehelper(argv[0], argv, envp, 1);
>
> if(rv < 0) {
> /* error handling */
> }
>
> Called from kernel, done in userspace. And if you want to access an SQL
> database from kernel tomorrow, it's just a matter of changing the
> usermode helper.
>
> (BTW, if you need to copy files from kernel, it's usually a sign of bad
> design)
Geez - that's REALLY ugly :-) But for testing I can use it.
It's not bad design - what I'm doing is writing snapshots for VFS as my diploma thesis. And I need to create copy of file before it's changed (copy-on-write). There is no other way how to do it in kernel-space (and user-space solutions like using LUFS are really slow)
Thx,
Libor
next prev parent reply other threads:[~2004-05-03 11:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-03 10:50 Reading from file in module fails Libor Vanek
2004-05-03 11:35 ` Erik Mouw
2004-05-03 11:43 ` Libor Vanek [this message]
2004-05-03 11:48 ` Erik Mouw
2004-05-03 12:07 ` root
2004-05-03 12:41 ` Jan-Benedict Glaw
[not found] <1RJl8-Eo-5@gated-at.bofh.it>
[not found] ` <1RJXT-19T-37@gated-at.bofh.it>
[not found] ` <1RK7v-1gJ-9@gated-at.bofh.it>
[not found] ` <1RL3A-23k-23@gated-at.bofh.it>
2004-05-03 16:55 ` Pascal Schmidt
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=20040503114316.GA22732@Loki \
--to=libor@conet.cz \
--cc=erik@harddisk-recovery.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox