vfs: add d_is_dir()
Add d_is_dir(dentry) helper which is analogous to S_ISDIR(). To avoid confusion, rename d_is_directory() to d_can_lookup(). Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Reviewed-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
@@ -429,7 +429,7 @@ static inline unsigned __d_entry_type(const struct dentry *dentry)
|
||||
return dentry->d_flags & DCACHE_ENTRY_TYPE;
|
||||
}
|
||||
|
||||
static inline bool d_is_directory(const struct dentry *dentry)
|
||||
static inline bool d_can_lookup(const struct dentry *dentry)
|
||||
{
|
||||
return __d_entry_type(dentry) == DCACHE_DIRECTORY_TYPE;
|
||||
}
|
||||
@@ -439,6 +439,11 @@ static inline bool d_is_autodir(const struct dentry *dentry)
|
||||
return __d_entry_type(dentry) == DCACHE_AUTODIR_TYPE;
|
||||
}
|
||||
|
||||
static inline bool d_is_dir(const struct dentry *dentry)
|
||||
{
|
||||
return d_can_lookup(dentry) || d_is_autodir(dentry);
|
||||
}
|
||||
|
||||
static inline bool d_is_symlink(const struct dentry *dentry)
|
||||
{
|
||||
return __d_entry_type(dentry) == DCACHE_SYMLINK_TYPE;
|
||||
|
Reference in New Issue
Block a user