* parent inode from the current struct inode
@ 2012-02-08 7:48 Jack David
2012-02-08 8:39 ` Philipp Ittershagen
0 siblings, 1 reply; 4+ messages in thread
From: Jack David @ 2012-02-08 7:48 UTC (permalink / raw)
To: kernelnewbies
Hi All,
Is possible to get parent directory's inode structure from the current
inode? If so, how can I do that?
Also, is it possible to get the "struct file" if we have "struct inode" ??
Thanks,
J
^ permalink raw reply [flat|nested] 4+ messages in thread
* parent inode from the current struct inode
2012-02-08 7:48 parent inode from the current struct inode Jack David
@ 2012-02-08 8:39 ` Philipp Ittershagen
[not found] ` <9F2B2656C8747B498D56A7B30FF5EB9F01C0964B@CNMAIL13.cn.utstarcom.com>
0 siblings, 1 reply; 4+ messages in thread
From: Philipp Ittershagen @ 2012-02-08 8:39 UTC (permalink / raw)
To: kernelnewbies
Hi Jack,
On Wed, Feb 8, 2012 at 8:48 AM, Jack David <jd6589@gmail.com> wrote:
> Hi All,
>
> Is possible to get parent directory's inode structure from the current
> inode? If so, how can I do that?
It should be possible to use the container_of macro to get the parent
dentry struct. Then, you can get the parent dentry d_parent and access
its inode. (Please correct me, if I'm wrong. I didn't test it).
Philipp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: 答复: parent inode from the current struct inode
[not found] ` <9F2B2656C8747B498D56A7B30FF5EB9F01C0964B@CNMAIL13.cn.utstarcom.com>
@ 2012-02-08 13:00 ` Jack David
2012-02-08 13:55 ` Philipp Ittershagen
0 siblings, 1 reply; 4+ messages in thread
From: Jack David @ 2012-02-08 13:00 UTC (permalink / raw)
To: kernelnewbies
2012/2/8 Tom Lai(IT) <tomlai@utstar.com>:
> Hi Philipp,
>
> I checked 2.6.32 that dentry struct contained parent dentry struct.
>
>
> Hi Jack,
>
> On Wed, Feb 8, 2012 at 8:48 AM, Jack David <jd6589@gmail.com> wrote:
>> Hi All,
>>
>> Is possible to get parent directory's inode structure from the current
>> inode? If so, how can I do that?
>
> It should be possible to use the container_of macro to get the parent
> dentry struct. Then, you can get the parent dentry d_parent and access
> its inode. (Please correct me, if I'm wrong. I didn't test it).
>
Okay, I tried container_of, but it did not work. So I tried
d_obtain_alias() which worked.
But I am not sure if I have to make a call to dput() as well in order
to free the dentry obtained.
Anyone can confirm this?
J
>
>
> Philipp
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
--
J
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: 答复: parent inode from the current struct inode
2012-02-08 13:00 ` 答复: " Jack David
@ 2012-02-08 13:55 ` Philipp Ittershagen
0 siblings, 0 replies; 4+ messages in thread
From: Philipp Ittershagen @ 2012-02-08 13:55 UTC (permalink / raw)
To: kernelnewbies
Hi Jack,
On Wed, Feb 8, 2012 at 2:00 PM, Jack David <jd6589@gmail.com> wrote:
> Okay, I tried container_of, but it did not work. So I tried
> d_obtain_alias() which worked.
>
> But I am not sure if I ?have to make a call to dput() as well in order
> to free the dentry obtained.
> Anyone can confirm this?
since d_obtain_alias() calls dput when something goes wrong after
allocating the dentry, I'm assuming that you also have to call dput to
free the dentry.
Philipp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-02-08 13:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-08 7:48 parent inode from the current struct inode Jack David
2012-02-08 8:39 ` Philipp Ittershagen
[not found] ` <9F2B2656C8747B498D56A7B30FF5EB9F01C0964B@CNMAIL13.cn.utstarcom.com>
2012-02-08 13:00 ` 答复: " Jack David
2012-02-08 13:55 ` Philipp Ittershagen
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).