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:14:49 +0500 Message-ID: <1e62d1370605040414j4987a5f6x5acd63b6d14d56b3@mail.gmail.com> References: <20060504094513.75349.qmail@web37901.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7BIT Cc: linux-fsdevel@vger.kernel.org Return-path: Received: from nf-out-0910.google.com ([64.233.182.191]:10136 "EHLO nf-out-0910.google.com") by vger.kernel.org with ESMTP id S1751489AbWEDLOu convert rfc822-to-8bit (ORCPT ); Thu, 4 May 2006 07:14:50 -0400 Received: by nf-out-0910.google.com with SMTP id b2so329535nfe for ; Thu, 04 May 2006 04:14:49 -0700 (PDT) To: "UZAIR LAKHANI" In-Reply-To: <20060504094513.75349.qmail@web37901.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: > Hello All, > > I want to find out how the file pointer from > inode/dentry can be get. For example we can get inode > pointer by using iget. In the struct file we can get > inode/dentry (filp->f_dentry->d_inode) but how can we > reversely get the struct file pointer from > dentry/inode etc. > You can try to get the filp from filp->f_dentry->d_inode using the same way as list_entry macro in include/linux/list.h do and you have to do that list_entry kind of stuff two times to get to the filp from d_inode (as in one pass you can get f_dentry and then from f_dentry you can get to filp). I hope it will help but can't say that its a good way ! > Secondly is this logically correct to get the file > pointer from inode/dentry etc. > I can't say doing this is logically correct or not, but I can say if this really helps and you won't able to get the better way of accessing filp then you can do so or other people might give you some better idea but they probably need to know why and where you want to do this :) -- Fawad Lateef