[lkml]   [2004]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Reading from file in module fails
    > > 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)


    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 14:02    [W:0.019 / U:26.352 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site