]>
git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blob - include/linux/fs_types.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_FS_TYPES_H
3 #define _LINUX_FS_TYPES_H
6 * This is a header for the common implementation of dirent
7 * to fs on-disk file type conversion. Although the fs on-disk
8 * bits are specific to every file system, in practice, many
9 * file systems use the exact same on-disk format to describe
10 * the lower 3 file type bits that represent the 7 POSIX file
13 * It is important to note that the definitions in this
14 * header MUST NOT change. This would break both the
15 * userspace ABI and the on-disk format of filesystems
18 * All those file systems can use this generic code for the
23 * struct dirent file types
24 * exposed to user via getdents(2), readdir(3)
26 * These match bits 12..15 of stat.st_mode
27 * (ie "(i_mode >> 12) & 15").
30 #define S_DT(mode) (((mode) & S_IFMT) >> S_DT_SHIFT)
31 #define S_DT_MASK (S_IFMT >> S_DT_SHIFT)
33 /* these are defined by POSIX and also present in glibc's dirent.h */
44 #define DT_MAX (S_DT_MASK + 1) /* 16 */
47 * fs on-disk file types.
48 * Only the low 3 bits are used for the POSIX file types.
49 * Other bits are reserved for fs private use.
50 * These definitions are shared and used by multiple filesystems,
51 * and MUST NOT change under any circumstances.
53 * Note that no fs currently stores the whiteout type on-disk,
54 * so whiteout dirents are exposed to user as DT_CHR.
68 * declarations for helper functions, accompanying implementation
71 extern unsigned char fs_ftype_to_dtype(unsigned int filetype
);
72 extern unsigned char fs_umode_to_ftype(umode_t mode
);
73 extern unsigned char fs_umode_to_dtype(umode_t mode
);