Info

struct dentry_operations {

int (*d_revalidate)(struct dentry *, struct nameidata *); int (*d_hash) (struct dentry *, struct qstr *);

int (*d_compare) (struct dentry *, struct qstr *, struct qstr *);

□ d_iput releases an inode from a dentry object no longer in use (in the default implementation, the usage counter is decremented, and the inode is removed from the various lists once the counter reaches 0).

□ d_delete is invoked after the last reference has been removed (when d_count reaches 0).

□ d_release is invoked before a dentry object is finally deleted. The two default implementations for d_release and d_delete do nothing.

□ d_hash calculates hash values that can be used to place objects in the dentry hash table.

□ d_compare compares the filenames of two dentrys. Whereas VFS performs a simple string comparison, filesystems can override this behavior to suit their own requirements. For example, the filenames in the FAT implementation are not case-sensitive. As no distinction is made between uppercase and lowercase, a simple string match would return an incorrect result. A FAT-specific function must be provided in this case.

□ d_revalidate is of particular relevance for network filesystems. It checks whether the structure set up by the individual dentry objects in memory still reflects the current situation. Because the underlying filesystem is not directly linked with the kernel/VFS and all information must be gathered via a network connection, some dentrys may no longer be valid as a result of changes to the filesystem made at the other end. This function ensures consistency.

As inconsistencies of this kind do not usually occur in local filesystems, the default implementation in VFS does nothing when d_revalidate is invoked.

As the functions in the preceding list are not implemented by most filesystems, the convention is that the operations are always replaced with the VFS default implementation if a null pointer is found for a function.

Continue reading here: Standard Functions

Was this article helpful?

0 0