Kernel: Rename RefCounted -> RefPtr and implement RefCounted

This commit is contained in:
Bananymous
2023-03-08 03:21:30 +02:00
parent f7ebda3bf1
commit 23b3028e15
12 changed files with 98 additions and 133 deletions

View File

@@ -131,8 +131,8 @@ namespace Kernel
virtual BAN::StringView name() const override { return m_name; }
virtual BAN::ErrorOr<BAN::Vector<uint8_t>> read_all() override;
virtual BAN::ErrorOr<BAN::Vector<BAN::RefCounted<Inode>>> directory_inodes() override;
virtual BAN::ErrorOr<BAN::RefCounted<Inode>> directory_find(BAN::StringView) override;
virtual BAN::ErrorOr<BAN::Vector<BAN::RefPtr<Inode>>> directory_inodes() override;
virtual BAN::ErrorOr<BAN::RefPtr<Inode>> directory_find(BAN::StringView) override;
private:
BAN::ErrorOr<void> for_each_block(BAN::Function<BAN::ErrorOr<bool>(const BAN::Vector<uint8_t>&)>&);
@@ -158,7 +158,7 @@ namespace Kernel
public:
static BAN::ErrorOr<Ext2FS*> create(StorageDevice::Partition&);
virtual const BAN::RefCounted<Inode> root_inode() const override { return m_root_inode; }
virtual const BAN::RefPtr<Inode> root_inode() const override { return m_root_inode; }
private:
Ext2FS(StorageDevice::Partition& partition)
@@ -179,7 +179,7 @@ namespace Kernel
private:
StorageDevice::Partition& m_partition;
BAN::RefCounted<Inode> m_root_inode;
BAN::RefPtr<Inode> m_root_inode;
Ext2::Superblock m_superblock;
BAN::Vector<Ext2::BlockGroupDescriptor> m_block_group_descriptors;

View File

@@ -9,7 +9,7 @@ namespace Kernel
class FileSystem
{
public:
virtual const BAN::RefCounted<Inode> root_inode() const = 0;
virtual const BAN::RefPtr<Inode> root_inode() const = 0;
};
}

View File

@@ -8,7 +8,7 @@
namespace Kernel
{
class Inode
class Inode : public BAN::RefCounted<Inode>
{
public:
union Mode
@@ -48,8 +48,8 @@ namespace Kernel
virtual BAN::StringView name() const = 0;
virtual BAN::ErrorOr<BAN::Vector<uint8_t>> read_all() = 0;
virtual BAN::ErrorOr<BAN::Vector<BAN::RefCounted<Inode>>> directory_inodes() = 0;
virtual BAN::ErrorOr<BAN::RefCounted<Inode>> directory_find(BAN::StringView) = 0;
virtual BAN::ErrorOr<BAN::Vector<BAN::RefPtr<Inode>>> directory_inodes() = 0;
virtual BAN::ErrorOr<BAN::RefPtr<Inode>> directory_find(BAN::StringView) = 0;
};
}

View File

@@ -13,16 +13,16 @@ namespace Kernel
static VirtualFileSystem& get();
static bool is_initialized();
virtual const BAN::RefCounted<Inode> root_inode() const override { return m_root_inode; }
virtual const BAN::RefPtr<Inode> root_inode() const override { return m_root_inode; }
BAN::ErrorOr<BAN::RefCounted<Inode>> from_absolute_path(BAN::StringView);
BAN::ErrorOr<BAN::RefPtr<Inode>> from_absolute_path(BAN::StringView);
private:
VirtualFileSystem() = default;
BAN::ErrorOr<void> initialize_impl();
private:
BAN::RefCounted<Inode> m_root_inode;
BAN::RefPtr<Inode> m_root_inode;
BAN::Vector<StorageController*> m_storage_controllers;
};