/* * Copyright (c) 2018-2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include namespace Kernel { class Ext2FSInode final : public Inode { friend class Ext2FS; public: virtual ~Ext2FSInode() override; u64 size() const; bool is_symlink() const { return Kernel::is_symlink(m_raw_inode.i_mode); } bool is_directory() const { return Kernel::is_directory(m_raw_inode.i_mode); } private: // ^Inode virtual ErrorOr read_bytes_locked(off_t, size_t, UserOrKernelBuffer& buffer, OpenFileDescription*) const override; virtual InodeMetadata metadata() const override; virtual ErrorOr traverse_as_directory(Function(FileSystem::DirectoryEntryView const&)>) const override; virtual ErrorOr> lookup(StringView name) override; virtual ErrorOr flush_metadata() override; virtual ErrorOr write_bytes_locked(off_t, size_t, UserOrKernelBuffer const& data, OpenFileDescription*) override; virtual ErrorOr> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; virtual ErrorOr add_child(Inode& child, StringView name, mode_t) override; virtual ErrorOr remove_child(StringView name) override; virtual ErrorOr replace_child(StringView name, Inode& child) override; virtual ErrorOr update_timestamps(Optional