Re: 答复: parent inode from the current struct inode

2 messages, 2 authors, 2012-02-08 · open the first message on its own page

Re: 答复: parent inode from the current struct inode

From: Jack David <hidden>
Date: 2012-02-08 13:00:26

2012/2/8 Tom Lai(IT) [off-list ref]:
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 [off-list ref] wrote:
quoted
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

Re: 答复: parent inode from the current struct inode

From: Philipp Ittershagen <hidden>
Date: 2012-02-08 13:55:28

Hi Jack,

On Wed, Feb 8, 2012 at 2:00 PM, Jack David [off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help