diff options
author | David Howells <dhowells@redhat.com> | 2015-01-29 07:02:29 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-02-22 11:38:38 -0500 |
commit | 44bdb5e5f6382ba88f7678d6f535f879324522ae (patch) | |
tree | e9aab8e53a78446f60e4036cb617c9dd10655228 /include/linux/dcache.h | |
parent | df1a085af1f652a02238168c4f2b730c8c90dd4a (diff) |
VFS: Split DCACHE_FILE_TYPE into regular and special types
Split DCACHE_FILE_TYPE into DCACHE_REGULAR_TYPE (dentries representing regular
files) and DCACHE_SPECIAL_TYPE (representing blockdev, chardev, FIFO and
socket files).
d_is_reg() and d_is_special() are added to detect these subtypes and
d_is_file() is left as the union of the two.
This allows a number of places that use S_ISREG(dentry->d_inode->i_mode) to
use d_is_reg(dentry) instead.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/dcache.h')
-rw-r--r-- | include/linux/dcache.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 728f5d31b5e6..d8358799c594 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -219,8 +219,9 @@ struct dentry_operations { | |||
219 | #define DCACHE_WHITEOUT_TYPE 0x00100000 /* Whiteout dentry (stop pathwalk) */ | 219 | #define DCACHE_WHITEOUT_TYPE 0x00100000 /* Whiteout dentry (stop pathwalk) */ |
220 | #define DCACHE_DIRECTORY_TYPE 0x00200000 /* Normal directory */ | 220 | #define DCACHE_DIRECTORY_TYPE 0x00200000 /* Normal directory */ |
221 | #define DCACHE_AUTODIR_TYPE 0x00300000 /* Lookupless directory (presumed automount) */ | 221 | #define DCACHE_AUTODIR_TYPE 0x00300000 /* Lookupless directory (presumed automount) */ |
222 | #define DCACHE_SYMLINK_TYPE 0x00400000 /* Symlink (or fallthru to such) */ | 222 | #define DCACHE_REGULAR_TYPE 0x00400000 /* Regular file type (or fallthru to such) */ |
223 | #define DCACHE_FILE_TYPE 0x00500000 /* Other file type (or fallthru to such) */ | 223 | #define DCACHE_SPECIAL_TYPE 0x00500000 /* Other file type (or fallthru to such) */ |
224 | #define DCACHE_SYMLINK_TYPE 0x00600000 /* Symlink (or fallthru to such) */ | ||
224 | 225 | ||
225 | #define DCACHE_MAY_FREE 0x00800000 | 226 | #define DCACHE_MAY_FREE 0x00800000 |
226 | #define DCACHE_FALLTHRU 0x01000000 /* Fall through to lower layer */ | 227 | #define DCACHE_FALLTHRU 0x01000000 /* Fall through to lower layer */ |
@@ -455,9 +456,19 @@ static inline bool d_is_symlink(const struct dentry *dentry) | |||
455 | return __d_entry_type(dentry) == DCACHE_SYMLINK_TYPE; | 456 | return __d_entry_type(dentry) == DCACHE_SYMLINK_TYPE; |
456 | } | 457 | } |
457 | 458 | ||
459 | static inline bool d_is_reg(const struct dentry *dentry) | ||
460 | { | ||
461 | return __d_entry_type(dentry) == DCACHE_REGULAR_TYPE; | ||
462 | } | ||
463 | |||
464 | static inline bool d_is_special(const struct dentry *dentry) | ||
465 | { | ||
466 | return __d_entry_type(dentry) == DCACHE_SPECIAL_TYPE; | ||
467 | } | ||
468 | |||
458 | static inline bool d_is_file(const struct dentry *dentry) | 469 | static inline bool d_is_file(const struct dentry *dentry) |
459 | { | 470 | { |
460 | return __d_entry_type(dentry) == DCACHE_FILE_TYPE; | 471 | return d_is_reg(dentry) || d_is_special(dentry); |
461 | } | 472 | } |
462 | 473 | ||
463 | static inline bool d_is_negative(const struct dentry *dentry) | 474 | static inline bool d_is_negative(const struct dentry *dentry) |