From 6d8ae9c708d43ab3d98d6a1f2fbb4e5f74a4a2aa Mon Sep 17 00:00:00 2001 From: Lukas Oesch Date: Sun, 15 Mar 2026 18:51:26 +0100 Subject: improve constness --- kernel/filesystem/include/filesystem/file_descriptor_table.hpp | 2 +- kernel/filesystem/include/filesystem/filesystem.hpp | 2 +- kernel/filesystem/include/filesystem/mount.hpp | 4 ++-- kernel/filesystem/include/filesystem/vfs.hpp | 2 -- 4 files changed, 4 insertions(+), 6 deletions(-) (limited to 'kernel/filesystem/include') diff --git a/kernel/filesystem/include/filesystem/file_descriptor_table.hpp b/kernel/filesystem/include/filesystem/file_descriptor_table.hpp index 44fd428..3ac03d1 100644 --- a/kernel/filesystem/include/filesystem/file_descriptor_table.hpp +++ b/kernel/filesystem/include/filesystem/file_descriptor_table.hpp @@ -16,7 +16,7 @@ namespace filesystem ~file_descriptor_table() = default; auto add_file(open_file_description & f) -> int; - auto get_file(int fd) -> std::optional; + [[nodiscard]] auto get_file(int fd) const -> std::optional; auto remove_file(int fd) -> void; private: diff --git a/kernel/filesystem/include/filesystem/filesystem.hpp b/kernel/filesystem/include/filesystem/filesystem.hpp index 113b239..a5a1047 100644 --- a/kernel/filesystem/include/filesystem/filesystem.hpp +++ b/kernel/filesystem/include/filesystem/filesystem.hpp @@ -12,7 +12,7 @@ namespace filesystem virtual auto mount(devices::device * device) -> int = 0; - auto root_inode() -> inode *; + [[nodiscard]] auto root_inode() const -> inode *; protected: inode * m_root_inode{}; // TODO BA-FS26 set during mount? diff --git a/kernel/filesystem/include/filesystem/mount.hpp b/kernel/filesystem/include/filesystem/mount.hpp index 793c042..fe5d9cc 100644 --- a/kernel/filesystem/include/filesystem/mount.hpp +++ b/kernel/filesystem/include/filesystem/mount.hpp @@ -12,8 +12,8 @@ namespace filesystem mount() = default; // TODO BA-FS26 remove again when kstd::vector is available and used in vfs mount(std::string_view const & path, filesystem * fs); - auto path() const -> std::string_view; - auto get_filesystem() const -> filesystem *; + [[nodiscard]] auto path() const -> std::string_view; + [[nodiscard]] auto get_filesystem() const -> filesystem *; private: std::string_view m_path; diff --git a/kernel/filesystem/include/filesystem/vfs.hpp b/kernel/filesystem/include/filesystem/vfs.hpp index 67fd5df..182666d 100644 --- a/kernel/filesystem/include/filesystem/vfs.hpp +++ b/kernel/filesystem/include/filesystem/vfs.hpp @@ -6,7 +6,6 @@ #include #include -#include namespace filesystem { @@ -17,7 +16,6 @@ namespace filesystem ~vfs() = default; - // auto do_mount(std::string_view const & path) -> auto make_device_node(devices::device * device) -> void; private: -- cgit v1.2.3