diff options
author | Phillip Potter <phil@philpotter.co.uk> | 2019-01-20 19:54:27 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2019-01-21 11:48:13 -0500 |
commit | bbe7449e2599b58cf7b995461e2189998111f907 (patch) | |
tree | 45fb7c60c894558ebbeda7c2c444447739c8cd02 /include/linux/fs.h | |
parent | 49a57857aeea06ca831043acbb0fa5e0f50602fd (diff) |
fs: common implementation of file type
Many file systems use a copy&paste implementation
of dirent to on-disk file type conversions.
Create a common implementation to be used by file systems
with some useful conversion helpers to reduce open coded
file type conversions in file system code.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 811c77743dad..92966678539d 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/uuid.h> | 37 | #include <linux/uuid.h> |
38 | #include <linux/errseq.h> | 38 | #include <linux/errseq.h> |
39 | #include <linux/ioprio.h> | 39 | #include <linux/ioprio.h> |
40 | #include <linux/fs_types.h> | ||
40 | 41 | ||
41 | #include <asm/byteorder.h> | 42 | #include <asm/byteorder.h> |
42 | #include <uapi/linux/fs.h> | 43 | #include <uapi/linux/fs.h> |
@@ -1700,22 +1701,6 @@ int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical, | |||
1700 | int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags); | 1701 | int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags); |
1701 | 1702 | ||
1702 | /* | 1703 | /* |
1703 | * File types | ||
1704 | * | ||
1705 | * NOTE! These match bits 12..15 of stat.st_mode | ||
1706 | * (ie "(i_mode >> 12) & 15"). | ||
1707 | */ | ||
1708 | #define DT_UNKNOWN 0 | ||
1709 | #define DT_FIFO 1 | ||
1710 | #define DT_CHR 2 | ||
1711 | #define DT_DIR 4 | ||
1712 | #define DT_BLK 6 | ||
1713 | #define DT_REG 8 | ||
1714 | #define DT_LNK 10 | ||
1715 | #define DT_SOCK 12 | ||
1716 | #define DT_WHT 14 | ||
1717 | |||
1718 | /* | ||
1719 | * This is the "filldir" function type, used by readdir() to let | 1704 | * This is the "filldir" function type, used by readdir() to let |
1720 | * the kernel specify what kind of dirent layout it wants to have. | 1705 | * the kernel specify what kind of dirent layout it wants to have. |
1721 | * This allows the kernel to read directories into kernel space or | 1706 | * This allows the kernel to read directories into kernel space or |