[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Difference between dentry and directory?
On 6/6/05, Xiangfei Jia <xjianz@xxxxxxxxx> wrote:
> I'm reading the VFS implementation. The VFS has four primary object types:
> superblock, inode, dentry, file. A book says that " a dentry represents a
> component in path, which might include a regular file. In other words, a
> dentry is not the same as a directory, but a directory is the same as a
> file.". I so confused about the difference dentry and directory. Can anyone
> explain more about it?
Sure, if you for example access a file
/home/xiangfei/.emacs
then there will be a dentry in kernel for all components of that its
path, i.e. "home," "xiangfei" and ".emacs."
A directory may not necessarily be the same thing as a file. For
example ramfs implements directories only through dentries in memory
while files actually have cache pages and stuff. In fact they always
behave substantially differently from files even though the underlying
implementation is often identical.
HTH
Martin
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/