Kernel: RamInode verifies that you have not specified mode type
This is kinda weird behaviour, but it ensures the user cannot create e.g. CharacterDevice with mode having IFLNK. The Inode overrider is the only one setting the mode.
This commit is contained in:
parent
8604c55de8
commit
dedb2a2399
|
@ -25,9 +25,9 @@ namespace Kernel
|
|||
{
|
||||
protected:
|
||||
BlockDevice(mode_t mode, uid_t uid, gid_t gid)
|
||||
: Device(Mode::IFBLK | mode, uid, gid)
|
||||
: Device(mode, uid, gid)
|
||||
{
|
||||
ASSERT(Device::mode().ifblk());
|
||||
m_inode_info.mode |= Inode::Mode::IFBLK;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -35,9 +35,9 @@ namespace Kernel
|
|||
{
|
||||
protected:
|
||||
CharacterDevice(mode_t mode, uid_t uid, gid_t gid)
|
||||
: Device(Mode::IFCHR | mode, uid, gid)
|
||||
: Device(mode, uid, gid)
|
||||
{
|
||||
ASSERT(Device::mode().ifchr());
|
||||
m_inode_info.mode |= Inode::Mode::IFCHR;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -52,7 +52,9 @@ namespace Kernel
|
|||
RamInode(RamFileSystem& fs, const FullInodeInfo& inode_info)
|
||||
: m_fs(fs)
|
||||
, m_inode_info(inode_info)
|
||||
{}
|
||||
{
|
||||
ASSERT((inode_info.mode & Inode::Mode::TYPE_MASK) == 0);
|
||||
}
|
||||
|
||||
protected:
|
||||
RamFileSystem& m_fs;
|
||||
|
|
|
@ -45,7 +45,6 @@ namespace Kernel
|
|||
RamFileInode::RamFileInode(RamFileSystem& fs, const FullInodeInfo& inode_info)
|
||||
: RamInode(fs, inode_info)
|
||||
{
|
||||
ASSERT((m_inode_info.mode & Inode::Mode::TYPE_MASK) == 0);
|
||||
m_inode_info.mode |= Inode::Mode::IFREG;
|
||||
}
|
||||
|
||||
|
@ -108,7 +107,6 @@ namespace Kernel
|
|||
: RamInode(fs, inode_info)
|
||||
, m_parent(parent)
|
||||
{
|
||||
ASSERT((m_inode_info.mode & Inode::Mode::TYPE_MASK) == 0);
|
||||
m_inode_info.mode |= Inode::Mode::IFDIR;
|
||||
}
|
||||
|
||||
|
@ -263,7 +261,6 @@ namespace Kernel
|
|||
: RamInode(fs, inode_info)
|
||||
, m_target(BAN::move(target))
|
||||
{
|
||||
ASSERT((m_inode_info.mode & Inode::Mode::TYPE_MASK) == 0);
|
||||
m_inode_info.mode |= Inode::Mode::IFLNK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue