1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to change vnode operation

Discussion in 'FreeBSD Development' started by lithius, Apr 22, 2010.

  1. lithius

    lithius New Member

    Messages:
    6
    Thanks Received:
    0
    Hi all,

    this may sound a little odd, since I have noticed that there is much work done to not allow such a thing ($SUBJ). But may be you can help me and point me to the right direction.

    I am writing a kernel module with somewhat similar functionality like nullfs has, BUT it has to have some features which nullfs itself does not provide :

    1. I need the new layer to completely hide underlaying layer so no one can bypass it.
    2. Nullfs allows me to to overlay just one directory, but i want to include another directories and/or exclude subdirectories/files.
    3. Nullfs just redirects vnode operations to lower layer, I need to catch that operation, do something (for example alter the arguments somehow etc..), pass the operation (with possibly altered arguments) to the lower layer, get the result and then return the result.

    The best way to do that (I think) is to change vnode operations of particular vnodes to point to functions defined in that module. At this point, I can catch any operations with the vnode and this is the base of what i want.

    So my question is. I there any "clean" way to chande vnode operations ? If not, is there any "not so clean" way ? Anyway I will appreciate any good idea how to do what I have described.


    Thanks!
    -Lukas.