From bb95c10727d4a5b9f8226462ed1bee15a71fd33c Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 31 Aug 2026 09:21:51 +0200 Subject: chore: minor stylistic cleanups --- kernel/kernel/test_support/log_buffer.hpp | 4 ++-- kernel/kernel/vfs.hpp | 21 +++++++++++---------- kernel/kernel/vfs/dentry.hpp | 2 +- kernel/kernel/vfs/driver_state.hpp | 4 ++-- 4 files changed, 16 insertions(+), 15 deletions(-) (limited to 'kernel') diff --git a/kernel/kernel/test_support/log_buffer.hpp b/kernel/kernel/test_support/log_buffer.hpp index b1ba6e0a..f3ac3e10 100644 --- a/kernel/kernel/test_support/log_buffer.hpp +++ b/kernel/kernel/test_support/log_buffer.hpp @@ -1,5 +1,5 @@ -#ifndef KERNEL_TEST_SUPPORT_LOG_BUFFER_HPP -#define KERNEL_TEST_SUPPORT_LOG_BUFFER_HPP +#ifndef TEACHOS_KERNEL_TEST_SUPPORT_LOG_BUFFER_HPP +#define TEACHOS_KERNEL_TEST_SUPPORT_LOG_BUFFER_HPP #include #include diff --git a/kernel/kernel/vfs.hpp b/kernel/kernel/vfs.hpp index a722a48d..4225eef9 100644 --- a/kernel/kernel/vfs.hpp +++ b/kernel/kernel/vfs.hpp @@ -64,39 +64,39 @@ namespace kernel::vfs //! //! @param path The path to the file to open. //! @return A shared pointer to the dentry on success or an error code on failure. - auto open(std::string_view path) -> kstd::result; + [[nodiscard]] auto open(std::string_view path) -> kstd::result; //! Close a file by its associated path. //! //! @param path The path to the file to close. //! @return Nothing on success or an error code on failure. - auto close(std::string_view path) -> kstd::result; + [[nodiscard]] auto close(std::string_view path) -> kstd::result; //! Mount a source path to a specific target path. //! //! @param source The source of the filesystem to mount. //! @param target The path where the filesystem should be mounted. //! @return Nothing on success or an error code on failure. - auto mount(std::string_view source, std::string_view target) -> kstd::result; + [[nodiscard]] auto mount(std::string_view source, std::string_view target) -> kstd::result; //! Unmount the filesystem mounted at the specified path. //! //! @param path The path where the filesystem is mounted. //! @return Nothing on success or an error code on failure. - auto unmount(std::string_view path) -> kstd::result; + [[nodiscard]] auto unmount(std::string_view path) -> kstd::result; //! Create a new directory at the specified path. //! //! @param path The path where the new directory should be created. //! @return Nothing on success, an error otherwise. - auto mkdir(std::string_view path) -> kstd::result; + [[nodiscard]] auto mkdir(std::string_view path) -> kstd::result; //! Create a new file at the specified path. //! //! @param path The path where the new file should be created. //! @return Nothing on success, an error otherwise. // TODO remove after the open method supports flags. - auto create(std::string_view path) -> kstd::result; + [[nodiscard]] auto create(std::string_view path) -> kstd::result; //! Get the status of the file at a given path. //! @@ -106,8 +106,8 @@ namespace kernel::vfs //! Create a new device node at a given path. //! //! @return Nothing on success, an error otherwise. - auto create_device_node(std::string_view path, std::uint32_t mode, kapi::filesystem::device_number device) - -> kstd::result; + [[nodiscard]] auto create_device_node(std::string_view path, std::uint32_t mode, + kapi::filesystem::device_number device) -> kstd::result; //! Check if a given given dentry houses any mounts. //! @@ -138,8 +138,9 @@ namespace kernel::vfs [[nodiscard]] auto find_mount(std::string_view path) const -> kstd::result; - auto create_inode(std::string_view path, kapi::filesystem::file_type type, - std::optional raw_device = std::nullopt) -> kstd::result; + [[nodiscard]] auto create_inode(std::string_view path, kapi::filesystem::file_type type, + std::optional raw_device = std::nullopt) + -> kstd::result; mount_table m_mount_table{}; }; diff --git a/kernel/kernel/vfs/dentry.hpp b/kernel/kernel/vfs/dentry.hpp index 0c669854..5bb77fab 100644 --- a/kernel/kernel/vfs/dentry.hpp +++ b/kernel/kernel/vfs/dentry.hpp @@ -19,7 +19,7 @@ namespace kernel::vfs using inode_ptr = kstd::shared_ptr; //! Flags for the dentry. - enum class dentry_flags : std::uint32_t + enum struct dentry_flags : std::uint32_t { is_mount_point = 1 << 0 }; diff --git a/kernel/kernel/vfs/driver_state.hpp b/kernel/kernel/vfs/driver_state.hpp index 2756ea8a..b354f6b1 100644 --- a/kernel/kernel/vfs/driver_state.hpp +++ b/kernel/kernel/vfs/driver_state.hpp @@ -1,5 +1,5 @@ -#ifndef KERNEL_VFS_DRIVER_STATE_HPP -#define KERNEL_VFS_DRIVER_STATE_HPP +#ifndef TEACHOS_KERNEL_VFS_DRIVER_STATE_HPP +#define TEACHOS_KERNEL_VFS_DRIVER_STATE_HPP #include -- cgit v1.2.3