On Mon, Jan 22, 2024 at 12:00:49AM +0300, Askar Safin wrote: > Wedson Almeida Filho: > > + /// White-out type. > > + Wht = bindings::DT_WHT, > > As well as I understand, filesystems supposed not to return > DT_WHT from readdir to user space. But I'm not sure. Please, > do expirement! Create whiteout on ext4 and see what readdir > will return. As well as I understand, it will return DT_CHR. DT_WHT is defined in /usr/include/dirent.h, so it is actually present in the userspace support for readdir. If the kernel returns DT_WHT to userspace, applications should know what it is. However, filesystems like ext4 and btrfs don't have DT_WHT on disk and few userspace applications support it. Way back when overlay required whiteout support to be added, the magical char device representation was invented for filesystems without DT_WHT and that was exposed to userspace. We're kind of stuck with it now, though there is nothign stopping filesysetms from returning DT_WHT to userspace instead of DT_CHR and requiring userspace to stat the inode to look at the major/minor numbers to determine if the dirent is a whiteout or not. Indeed, it would be more optimal for overlay if filesystems returned DT_WHT instead of DT_CHR for whiteouts. Put simply: DT_WHT is part of the readdir kernel and userspace API and therefore should be present in the Rust interfaces. Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx