* getting file pointer from dentry/inode
@ 2006-05-04 9:45 UZAIR LAKHANI
2006-05-04 10:02 ` Tomas Hruby
2006-05-04 11:14 ` Fawad Lateef
0 siblings, 2 replies; 5+ messages in thread
From: UZAIR LAKHANI @ 2006-05-04 9:45 UTC (permalink / raw)
To: linux-fsdevel
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.
Secondly is this logically correct to get the file
pointer from inode/dentry etc.
Thanks,
Uzair Lakhnai
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: getting file pointer from dentry/inode
2006-05-04 9:45 getting file pointer from dentry/inode UZAIR LAKHANI
@ 2006-05-04 10:02 ` Tomas Hruby
2006-05-04 10:48 ` UZAIR LAKHANI
2006-05-04 11:14 ` Fawad Lateef
1 sibling, 1 reply; 5+ messages in thread
From: Tomas Hruby @ 2006-05-04 10:02 UTC (permalink / raw)
To: linux-fsdevel; +Cc: UZAIR LAKHANI
> 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.
TH
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: getting file pointer from dentry/inode
2006-05-04 10:02 ` Tomas Hruby
@ 2006-05-04 10:48 ` UZAIR LAKHANI
2006-05-04 11:23 ` Fawad Lateef
0 siblings, 1 reply; 5+ messages in thread
From: UZAIR LAKHANI @ 2006-05-04 10:48 UTC (permalink / raw)
To: Tomas Hruby, linux-fsdevel; +Cc: UZAIR LAKHANI
--- Tomas Hruby <thruby@gmail.com> 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.
>
> TH
Hello All,
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.
Thanks,
Uzair Lakhani
> -
> To unsubscribe from this list: send the line
> "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at
> http://vger.kernel.org/majordomo-info.html
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: getting file pointer from dentry/inode
2006-05-04 9:45 getting file pointer from dentry/inode UZAIR LAKHANI
2006-05-04 10:02 ` Tomas Hruby
@ 2006-05-04 11:14 ` Fawad Lateef
1 sibling, 0 replies; 5+ messages in thread
From: Fawad Lateef @ 2006-05-04 11:14 UTC (permalink / raw)
To: UZAIR LAKHANI; +Cc: linux-fsdevel
On 5/4/06, UZAIR LAKHANI <uzairr_bs1b@yahoo.com> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: getting file pointer from dentry/inode
2006-05-04 10:48 ` UZAIR LAKHANI
@ 2006-05-04 11:23 ` Fawad Lateef
0 siblings, 0 replies; 5+ messages in thread
From: Fawad Lateef @ 2006-05-04 11:23 UTC (permalink / raw)
To: UZAIR LAKHANI; +Cc: Tomas Hruby, linux-fsdevel
On 5/4/06, UZAIR LAKHANI <uzairr_bs1b@yahoo.com> wrote:
> --- Tomas Hruby <thruby@gmail.com> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-05-04 11:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-04 9:45 getting file pointer from dentry/inode UZAIR LAKHANI
2006-05-04 10:02 ` Tomas Hruby
2006-05-04 10:48 ` UZAIR LAKHANI
2006-05-04 11:23 ` Fawad Lateef
2006-05-04 11:14 ` Fawad Lateef
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).