Re: Directory Entry for File

Alexander Viro (viro@math.psu.edu)
Sat, 20 Feb 1999 21:23:34 -0500 (EST)


On Sat, 20 Feb 1999, Mike Kennedy wrote:

>
> Ok. Sorry for continuing to pose this question. Say I have the following
> situation where there is a file called foo in the /tmp directory. How can
> I given the inode for the file 'foo' get the inode for the directory,
> /tmp. This is within kernel space.

Erm? Are you dealing with 2.0 or 2.2? On 2.2 you are looking for a
dentry of file and then look for ->d_parent - it will be dentry of parent
directory. For root directory (of filesystem) ->d_parent points to itself.
To find the dentry of mountpoint under it use ->d_covers.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/