Kernel: Inode::Mode is now a struct so we can have functions in it

This commit is contained in:
Bananymous
2023-03-30 14:41:15 +03:00
parent e2791e5260
commit 30c33b55e3
10 changed files with 80 additions and 68 deletions

View File

@@ -252,7 +252,7 @@ namespace Kernel
{
// FIXME: update atime if needed
if (ifdir())
if (mode().ifdir())
return BAN::Error::from_errno(EISDIR);
if (offset >= m_inode.size)
@@ -286,7 +286,7 @@ namespace Kernel
BAN::ErrorOr<BAN::Vector<BAN::String>> Ext2Inode::read_directory_entries(size_t index)
{
if (!ifdir())
if (!mode().ifdir())
return BAN::Error::from_errno(ENOTDIR);
uint32_t data_block_count = blocks();
@@ -318,7 +318,7 @@ namespace Kernel
BAN::ErrorOr<void> Ext2Inode::create_file(BAN::StringView name, mode_t mode)
{
if (!ifdir())
if (!this->mode().ifdir())
return BAN::Error::from_errno(ENOTDIR);
if (name.size() > 255)
@@ -403,7 +403,7 @@ namespace Kernel
BAN::ErrorOr<BAN::RefPtr<Inode>> Ext2Inode::read_directory_inode(BAN::StringView file_name)
{
if (!ifdir())
if (!mode().ifdir())
return BAN::Error::from_errno(ENOTDIR);
uint32_t block_size = m_fs.block_size();

View File

@@ -38,7 +38,7 @@ namespace Kernel
BAN::ErrorOr<void> VirtualFileSystem::mount(FileSystem* file_system, BAN::StringView path)
{
auto file = TRY(file_from_absolute_path(path));
if (!file.inode->ifdir())
if (!file.inode->mode().ifdir())
return BAN::Error::from_errno(ENOTDIR);
TRY(m_mount_points.push_back({ file, file_system }));
return {};