aboutsummaryrefslogtreecommitdiff
path: root/kernel/include
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/include')
-rw-r--r--kernel/include/kernel/filesystem/file_descriptor_table.hpp10
-rw-r--r--kernel/include/kernel/filesystem/vfs.hpp2
2 files changed, 5 insertions, 7 deletions
diff --git a/kernel/include/kernel/filesystem/file_descriptor_table.hpp b/kernel/include/kernel/filesystem/file_descriptor_table.hpp
index 6d78532..bc6fb24 100644
--- a/kernel/include/kernel/filesystem/file_descriptor_table.hpp
+++ b/kernel/include/kernel/filesystem/file_descriptor_table.hpp
@@ -3,10 +3,9 @@
#include "open_file_description.hpp"
+#include <kstd/memory>
#include <kstd/vector>
-#include <optional>
-
namespace filesystem
{
struct file_descriptor_table
@@ -16,15 +15,14 @@ namespace filesystem
~file_descriptor_table() = default;
- auto add_file(open_file_description & f) -> int;
- [[nodiscard]] auto get_file(int fd) const -> std::optional<open_file_description>;
+ auto add_file(kstd::shared_ptr<open_file_description> const & f) -> int;
+ [[nodiscard]] auto get_file(int fd) const -> kstd::shared_ptr<open_file_description>;
auto remove_file(int fd) -> void;
private:
file_descriptor_table() = default;
- // TODO BA-FS26 use kstd::shared_ptr when available
- kstd::vector<std::optional<open_file_description>> m_open_files{};
+ kstd::vector<kstd::shared_ptr<open_file_description>> m_open_files{};
};
} // namespace filesystem
diff --git a/kernel/include/kernel/filesystem/vfs.hpp b/kernel/include/kernel/filesystem/vfs.hpp
index 2ad570b..ca51d90 100644
--- a/kernel/include/kernel/filesystem/vfs.hpp
+++ b/kernel/include/kernel/filesystem/vfs.hpp
@@ -23,7 +23,7 @@ namespace filesystem
~vfs() = default;
- auto open(std::string_view path) -> std::optional<open_file_description>;
+ auto open(std::string_view path) -> kstd::shared_ptr<open_file_description>;
auto do_mount(std::string_view path, kstd::shared_ptr<filesystem> const & filesystem) -> int;
private: