kernel: Add a subclass of VFS::Inode to make it easier to implement file inodes
This commit is contained in:
parent
045efc7046
commit
5edd316198
@ -20,7 +20,23 @@ namespace VFS
|
||||
|
||||
virtual ~Inode() = default;
|
||||
|
||||
InodeType type;
|
||||
virtual InodeType type() const = 0;
|
||||
};
|
||||
|
||||
class FileInode : Inode
|
||||
{
|
||||
public:
|
||||
Result<Inode*> find(const char*) const override
|
||||
{
|
||||
return err(ENOTDIR);
|
||||
}
|
||||
|
||||
InodeType type() const override
|
||||
{
|
||||
return InodeType::RegularFile;
|
||||
}
|
||||
|
||||
virtual ~FileInode() = default;
|
||||
};
|
||||
|
||||
class FileSystem
|
||||
|
@ -26,18 +26,13 @@ namespace TmpFS
|
||||
Vector<SharedPtr<VFS::Inode>> m_inodes;
|
||||
};
|
||||
|
||||
class Inode : public VFS::Inode
|
||||
class Inode : public VFS::FileInode
|
||||
{
|
||||
public:
|
||||
Inode();
|
||||
|
||||
void set_fs(FileSystem& fs, Badge<FileSystem>);
|
||||
|
||||
Result<VFS::Inode*> find(const char*) const override
|
||||
{
|
||||
return err(ENOTSUP);
|
||||
}
|
||||
|
||||
VFS::FileSystem& fs() const override
|
||||
{
|
||||
return *m_fs;
|
||||
|
Loading…
Reference in New Issue
Block a user