From owner-freebsd-hackers@FreeBSD.ORG Thu Apr 22 14:30:48 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFFB01065670 for ; Thu, 22 Apr 2010 14:30:48 +0000 (UTC) (envelope-from czerner.lukas@gmail.com) Received: from mail-bw0-f228.google.com (mail-bw0-f228.google.com [209.85.218.228]) by mx1.freebsd.org (Postfix) with ESMTP id 7BC968FC19 for ; Thu, 22 Apr 2010 14:30:48 +0000 (UTC) Received: by bwz28 with SMTP id 28so9656074bwz.14 for ; Thu, 22 Apr 2010 07:30:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:x-x-sender:to :subject:message-id:user-agent:mime-version:content-type; bh=+q9G/HYLoC3qkU5yVPEuWSfAM9Rm17bVvvSfhzAAHRc=; b=NnazvUap51hk/3JWHr/3VUvivFSLYAeEI7mGbUZVoMe6cJ5XZgWyV79IJVq10iDgn1 a8kPURqbAFrcvtcwEic+NzJHQBMqBSXpFHPh3qc7X52UpNHCCIZw6U7BihsZGGbqALwa jqyxqbr1tcfyBJvl9DES9xRCyqSa2L6Z5hXuQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:x-x-sender:to:subject:message-id:user-agent:mime-version :content-type; b=MKvDMJVvtOSz8E/9oYly9/6Mj3JFp4TsN0CHrVKLZmd5elOcmgUw8nPRQPUZmi9tCv A/csDeF3jUZGbIgmvqaeTD39lW6L/+saAbzmj+fNs1mxANmekRNIPYwoOWs8yyYrDKty n5v2c+FunjfdWyt8PYQXWlogKk0ysQFtx1FyI= Received: by 10.87.76.7 with SMTP id d7mr1213111fgl.65.1271944938593; Thu, 22 Apr 2010 07:02:18 -0700 (PDT) Received: from a04-0215a.kn.vutbr.cz (a04-0215a.kn.vutbr.cz [147.229.216.20]) by mx.google.com with ESMTPS id 12sm4598845fgg.24.2010.04.22.07.02.17 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 22 Apr 2010 07:02:17 -0700 (PDT) Date: Thu, 22 Apr 2010 16:02:16 +0200 (CEST) From: "=?ISO-8859-15?Q?Luk=E1=A8_Czerner?=" X-X-Sender: bratt@a04-0215a.kn.vutbr.cz To: freebsd-hackers@freebsd.org Message-ID: User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: How to change vnode operations ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2010 14:30:49 -0000 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.