From owner-freebsd-hackers@FreeBSD.ORG Thu Apr 22 19:18:59 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 467AA10656BA for ; Thu, 22 Apr 2010 19:18:59 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.158]) by mx1.freebsd.org (Postfix) with ESMTP id 253078FC19 for ; Thu, 22 Apr 2010 19:18:57 +0000 (UTC) Received: by fg-out-1718.google.com with SMTP id 22so8125fge.13 for ; Thu, 22 Apr 2010 12:18:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=CoA9q1cg0DDilc1fmFFPwyNuHElPAyUvK6z7nsejhgs=; b=ujLfLqL+qJjxyP+xamaHdXKLmWsS2AXtefZJiI8hWs0dC4YrL3EZBVZAhn8yustbp4 4+2gxf2XZpJiQ0J90kMYgYWZqHhZgf+NhWc3iZ6VrPZPsVfySIuZcIJlUSwrl1Tacr/W MWnhYagSBhn7PjrtwS+Y01UbbtgpQWYOdQ+zY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; b=fexQe/gW6iZ5ROZzC126ITAvzUfQYmU2WMwFTfDgMH1YvtLxZX44dT5iTvcVpjrslt OzCDHnw/pA7OzI2vALkA3q0/Qw8WxQFVQqXeL0EVynbkw+HzJUGusLHPVx4Pyu9A6j8a lxWDGXVIcsMiiC0eU9gYDneCjd8UH5Ft1YSy0= Received: by 10.87.2.15 with SMTP id e15mr8531605fgi.23.1271963936047; Thu, 22 Apr 2010 12:18:56 -0700 (PDT) Received: from localhost ([212.98.186.134]) by mx.google.com with ESMTPS id b17sm513784fka.13.2010.04.22.12.18.54 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 22 Apr 2010 12:18:55 -0700 (PDT) Date: Thu, 22 Apr 2010 22:18:49 +0300 From: Gleb Kurtsou To: =?utf-8?B?THVrw6HFoQ==?= Czerner Message-ID: <20100422191849.GA9895@tops> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-hackers@freebsd.org Subject: Re: 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 19:18:59 -0000 On (22/04/2010 16:02), Lukáš Czerner wrote: > 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. Is hypothetic 'mount -t mynullfs /a /a' good enough for you? I'm not sure what your goals are but completely finding underlaying filesystem won't be easy because of VFS_GET, getfh and other stuff operating with inode numbers. > 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. I'd suggest to take a look at pefs: http://github.com/glk/pefs It's cryptographic stacked filesystem for FreeBSD. It changes file names, hides directory entries, modifies data from lower layer (encrypts or decrypts), supports mounting on same directory, etc. > 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. Imho, stacked filesystem is the only right way to do it (see null, unionfs, pefs). > Thanks! > -Lukas. > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"