7

I am reading the source code of the dirent.h there's a enum

enum
{
    DT_UNKNOWN = 0,  // unknown type
    #define DT_UNKNOWN DT_UNKNOWN
    DT_FIFO = 1,     // a named pipe, or FIFO
    #define DT_FIFO DT_FIFO
    DT_CHR = 2,     // a character device
    #define DT_CHR DT_CHR
    DT_DIR = 4,     // a directory
    #define DT_DIR DT_DIR
    DT_BLK = 6,     // a block device
    #define DT_BLK DT_BLK
    DT_REG = 8,     // regular file
    #define DT_REG DT_REG
    DT_LNK = 10,    // symbolic link
    #define DT_LNK DT_LNK
    DT_SOCK = 12,   // local domain socket
    #define DT_SOCK DT_SOCK
    DT_WHT = 14     // ?
    #define DT_WHT DT_WHT
};

SO what is DT_WHT? I've searched the Single Unix Specification Version 4, and got nothing. My distro is CentOS 6.2 x64 Linux Kernel Version is: 2.6.32-220.x16.x86_64.

Thank you very much!

user1570120
  • 87
  • 1
  • 6

2 Answers2

3

I googled readdir DT_WHT and found this thread which explains that it's a "whiteout" from BSD.

Barmar
  • 741,623
  • 53
  • 500
  • 612
0

In a layered filesystem, an upper layer may contain "whiteout" inodes to hide files from lower layer.

DT_WHT inode type is supported but ignored in Linux kernel. This is also documented in man page rename(2):

BSD union mount employs a separate inode type, DT_WHT, which, while supported by some filesystems available in Linux, such as CODA and XFS, is ignored by the kernel's whiteout support code, as of Linux 4.19, at least.

youfu
  • 1,547
  • 3
  • 15
  • 21