From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Fawad Lateef" Subject: Re: getting file pointer from dentry/inode Date: Thu, 4 May 2006 16:23:50 +0500 Message-ID: <1e62d1370605040423i60c5bca6g18e51de6c0da2f2b@mail.gmail.com> References: <20060504100211.GA19970@fspc268> <20060504104812.61391.qmail@web37902.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7BIT Cc: "Tomas Hruby" , linux-fsdevel@vger.kernel.org Return-path: Received: from nf-out-0910.google.com ([64.233.182.189]:33709 "EHLO nf-out-0910.google.com") by vger.kernel.org with ESMTP id S932069AbWEDLXv convert rfc822-to-8bit (ORCPT ); Thu, 4 May 2006 07:23:51 -0400 Received: by nf-out-0910.google.com with SMTP id y38so295649nfb for ; Thu, 04 May 2006 04:23:50 -0700 (PDT) To: "UZAIR LAKHANI" In-Reply-To: <20060504104812.61391.qmail@web37902.mail.mud.yahoo.com> Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On 5/4/06, UZAIR LAKHANI wrote: > --- Tomas Hruby wrote: > > > > Secondly is this logically correct to get the file > > > pointer from inode/dentry etc. > > > > I don't think so. A single file on a disk (inode) > > can be opened concurrently, > > with different mode, with different read position, > > etc. Many file structures > > share the same inode then. > > > > ok I agree that > "A single file on a disk (inode) > > can be opened concurrently, > > with different mode, with different read position, > > etc. Many file structures > > share the same inode then." > > but since I am getting the dentry so can I use the > dentry_open function. If this is ok then additionally > what is the purpose of dentry_open function. > Ya, I think its ok to do so, as nfsd and others also do so (see http://sosdg.org/~coywolf/lxr/source/fs/nfsd/vfs.c#L684). dentry_open actually gets a new filp and then fill it with the information got from dentry (many from dentry_d_inode) and returns that newly created filp see the code for it (http://sosdg.org/~coywolf/lxr/source/fs/open.c#L784) -- Fawad Lateef