Monday, October 22, 2007

Dentry explained...

Dentry is a name to inode translation also known as the Directory Cache. Each name component of a pathname is represented by a dentry object for fast access from the Dcache. The name lookup gets a hash of the name from the dentry hash table. The dentry data structure contains a pointer to the inode and to a parent dentry for the parent directory. The latter is useful to get the whole pathname by going back the parent dentry. Similarly a set of dentry operations is defined for manipulating the dentry from the cache.


struct dentry_operations {
int (*d_revalidate)(struct dentry *, int);
int (*d_hash) (struct dentry *, struct qstr *);
int (*d_compare) (struct dentry *, struct qstr *, struct qstr *);
void (*d_delete)(struct dentry *);
void (*d_release)(struct dentry *);
void (*d_iput)(struct dentry *, struct inode *);
};

No comments: