diff options
| author | Lukas Oesch <lukasoesch20@gmail.com> | 2026-03-15 18:51:26 +0100 |
|---|---|---|
| committer | Lukas Oesch <lukasoesch20@gmail.com> | 2026-03-17 16:43:13 +0100 |
| commit | 6d8ae9c708d43ab3d98d6a1f2fbb4e5f74a4a2aa (patch) | |
| tree | fe737124834802a6592b3278b55faa5b75792cea | |
| parent | f52f4eb4aff3f8346c9ba73bcc57db4ca6fc6cb2 (diff) | |
| download | teachos-6d8ae9c708d43ab3d98d6a1f2fbb4e5f74a4a2aa.tar.xz teachos-6d8ae9c708d43ab3d98d6a1f2fbb4e5f74a4a2aa.zip | |
improve constness
6 files changed, 6 insertions, 8 deletions
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<open_file_description>; + [[nodiscard]] auto get_file(int fd) const -> std::optional<open_file_description>; 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 <array> #include <optional> -#include <string_view> 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: diff --git a/kernel/filesystem/src/file_descriptor_table.cpp b/kernel/filesystem/src/file_descriptor_table.cpp index 49c08cd..eb9a281 100644 --- a/kernel/filesystem/src/file_descriptor_table.cpp +++ b/kernel/filesystem/src/file_descriptor_table.cpp @@ -47,7 +47,7 @@ namespace filesystem return -1; } - auto file_descriptor_table::get_file(int fd) -> std::optional<open_file_description> + auto file_descriptor_table::get_file(int fd) const -> std::optional<open_file_description> { if (fd < 0) { diff --git a/kernel/filesystem/src/filesystem.cpp b/kernel/filesystem/src/filesystem.cpp index d6a2f25..2c63766 100644 --- a/kernel/filesystem/src/filesystem.cpp +++ b/kernel/filesystem/src/filesystem.cpp @@ -4,7 +4,7 @@ namespace filesystem { - auto filesystem::root_inode() -> inode * + auto filesystem::root_inode() const -> inode * { return m_root_inode; } |
