Kernel: Rename RefCounted -> RefPtr and implement RefCounted
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Kernel
|
||||
void start();
|
||||
void reschedule();
|
||||
|
||||
BAN::ErrorOr<void> add_thread(BAN::RefCounted<Thread>);
|
||||
BAN::ErrorOr<void> add_thread(BAN::RefPtr<Thread>);
|
||||
|
||||
void set_current_thread_sleeping(uint64_t);
|
||||
[[noreturn]] void set_current_thread_done();
|
||||
@@ -24,7 +24,7 @@ namespace Kernel
|
||||
private:
|
||||
Scheduler() = default;
|
||||
|
||||
BAN::RefCounted<Thread> current_thread();
|
||||
BAN::RefPtr<Thread> current_thread();
|
||||
|
||||
void wake_threads();
|
||||
[[nodiscard]] bool save_current_thread();
|
||||
@@ -34,17 +34,17 @@ namespace Kernel
|
||||
private:
|
||||
struct ActiveThread
|
||||
{
|
||||
BAN::RefCounted<Thread> thread;
|
||||
uint64_t padding;
|
||||
BAN::RefPtr<Thread> thread;
|
||||
uint64_t padding = 0;
|
||||
};
|
||||
|
||||
struct SleepingThread
|
||||
{
|
||||
BAN::RefCounted<Thread> thread;
|
||||
uint64_t wake_delta;
|
||||
BAN::RefPtr<Thread> thread;
|
||||
uint64_t wake_time;
|
||||
};
|
||||
|
||||
BAN::RefCounted<Thread> m_idle_thread;
|
||||
BAN::RefPtr<Thread> m_idle_thread;
|
||||
BAN::LinkedList<ActiveThread> m_active_threads;
|
||||
BAN::LinkedList<SleepingThread> m_sleeping_threads;
|
||||
|
||||
|
||||
@@ -6,13 +6,10 @@
|
||||
namespace Kernel
|
||||
{
|
||||
|
||||
class Thread
|
||||
class Thread : public BAN::RefCounted<Thread>
|
||||
{
|
||||
BAN_NON_COPYABLE(Thread);
|
||||
BAN_NON_MOVABLE(Thread);
|
||||
|
||||
public:
|
||||
static BAN::ErrorOr<BAN::RefCounted<Thread>> create(const BAN::Function<void()>&);
|
||||
static BAN::ErrorOr<BAN::RefPtr<Thread>> create(const BAN::Function<void()>&);
|
||||
~Thread();
|
||||
|
||||
uint32_t tid() const { return m_tid; }
|
||||
@@ -40,7 +37,7 @@ namespace Kernel
|
||||
|
||||
BAN::Function<void()> m_function;
|
||||
|
||||
friend class BAN::RefCounted<Thread>;
|
||||
friend class BAN::RefPtr<Thread>;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user