use super::*;
impl Ext4Inode {
pub const EXT4_SECRM_FL: u32 = 0x00000001; pub const EXT4_UNRM_FL: u32 = 0x00000002; pub const EXT4_COMPR_FL: u32 = 0x00000004; pub const EXT4_SYNC_FL: u32 = 0x00000008; pub const EXT4_IMMUTABLE_FL: u32 = 0x00000010; pub const EXT4_APPEND_FL: u32 = 0x00000020; pub const EXT4_NODUMP_FL: u32 = 0x00000040; pub const EXT4_NOATIME_FL: u32 = 0x00000080; pub const EXT4_DIRTY_FL: u32 = 0x00000100; pub const EXT4_COMPRBLK_FL: u32 = 0x00000200; pub const EXT4_NOCOMPR_FL: u32 = 0x00000400; pub const EXT4_ENCRYPT_FL: u32 = 0x00000800; pub const EXT4_INDEX_FL: u32 = 0x00001000; pub const EXT4_IMAGIC_FL: u32 = 0x00002000; pub const EXT4_JOURNAL_DATA_FL: u32 = 0x00004000; pub const EXT4_NOTAIL_FL: u32 = 0x00008000; pub const EXT4_DIRSYNC_FL: u32 = 0x00010000; pub const EXT4_TOPDIR_FL: u32 = 0x00020000; pub const EXT4_HUGE_FILE_FL: u32 = 0x00040000; pub const EXT4_EXTENTS_FL: u32 = 0x00080000; pub const EXT4_EA_INODE_FL: u32 = 0x00200000; pub const EXT4_EOFBLOCKS_FL: u32 = 0x00400000; pub const EXT4_SNAPFILE_FL: u32 = 0x01000000; pub const EXT4_SNAPFILE_DELETED_FL: u32 = 0x04000000; pub const EXT4_SNAPFILE_SHRUNK_FL: u32 = 0x08000000; pub const EXT4_INLINE_DATA_FL: u32 = 0x10000000; pub const EXT4_PROJINHERIT_FL: u32 = 0x20000000; pub const EXT4_RESERVED_FL: u32 = 0x80000000;
pub const EXT4_FL_USER_MODIFIABLE: u32 = Self::EXT4_SYNC_FL
| Self::EXT4_IMMUTABLE_FL
| Self::EXT4_APPEND_FL
| Self::EXT4_NODUMP_FL
| Self::EXT4_NOATIME_FL
| Self::EXT4_DIRSYNC_FL
| Self::EXT4_TOPDIR_FL
| Self::EXT4_PROJINHERIT_FL;
pub const EXT4_FL_USER_VISIBLE: u32 = Self::EXT4_FL_USER_MODIFIABLE
| Self::EXT4_DIRTY_FL
| Self::EXT4_COMPRBLK_FL
| Self::EXT4_NOCOMPR_FL
| Self::EXT4_ENCRYPT_FL
| Self::EXT4_INDEX_FL
| Self::EXT4_HUGE_FILE_FL
| Self::EXT4_EXTENTS_FL
| Self::EXT4_EA_INODE_FL
| Self::EXT4_EOFBLOCKS_FL
| Self::EXT4_INLINE_DATA_FL;
pub const EXT4_FL_INHERITED: u32 = Self::EXT4_SYNC_FL
| Self::EXT4_NODUMP_FL
| Self::EXT4_NOATIME_FL
| Self::EXT4_DIRSYNC_FL
| Self::EXT4_PROJINHERIT_FL;
pub fn mask_flags_for_mode(mode: u16, flags: u32) -> u32 {
if mode & Self::S_IFMT == Self::S_IFDIR {
flags
} else if mode & Self::S_IFMT == Self::S_IFREG {
flags & !(Self::EXT4_DIRSYNC_FL | Self::EXT4_TOPDIR_FL | Self::EXT4_PROJINHERIT_FL)
} else {
flags & (Self::EXT4_NODUMP_FL | Self::EXT4_NOATIME_FL)
}
}
}