diff options
| -rw-r--r-- | arch/x86_64/arch/memory/region_allocator.cpp | 3 | ||||
| -rw-r--r-- | kapi/kapi/cpu.hpp | 2 | ||||
| -rw-r--r-- | kapi/kapi/devices.hpp | 5 | ||||
| -rw-r--r-- | kapi/kapi/filesystem.hpp | 27 | ||||
| -rw-r--r-- | kapi/kapi/filesystem/file_status.hpp | 4 | ||||
| -rw-r--r-- | kapi/kapi/filesystem/file_type.hpp | 4 | ||||
| -rw-r--r-- | kapi/kapi/interrupts.hpp | 2 | ||||
| -rw-r--r-- | kapi/kapi/test_support/devices.hpp | 4 | ||||
| -rw-r--r-- | kernel/kernel/test_support/log_buffer.hpp | 4 | ||||
| -rw-r--r-- | kernel/kernel/vfs.hpp | 21 | ||||
| -rw-r--r-- | kernel/kernel/vfs/dentry.hpp | 2 | ||||
| -rw-r--r-- | kernel/kernel/vfs/driver_state.hpp | 4 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/parse_context.hpp | 2 |
13 files changed, 44 insertions, 40 deletions
diff --git a/arch/x86_64/arch/memory/region_allocator.cpp b/arch/x86_64/arch/memory/region_allocator.cpp index 4086a10b..ece492f3 100644 --- a/arch/x86_64/arch/memory/region_allocator.cpp +++ b/arch/x86_64/arch/memory/region_allocator.cpp @@ -20,8 +20,7 @@ namespace arch::memory return kapi::memory::frame::containing(kapi::memory::physical_address{region.base + region.size_in_B - 1}); } - constexpr auto falls_within(kapi::memory::frame const & candidate, kapi::memory::frame const & start, - kapi::memory::frame const & end) + constexpr auto falls_within(kapi::memory::frame candidate, kapi::memory::frame start, kapi::memory::frame end) { return candidate >= start && candidate <= end; } diff --git a/kapi/kapi/cpu.hpp b/kapi/kapi/cpu.hpp index ce35c18b..18ff104e 100644 --- a/kapi/kapi/cpu.hpp +++ b/kapi/kapi/cpu.hpp @@ -19,7 +19,7 @@ namespace kapi::cpu struct exception { //! The type of the exception, which identifies the reason for it being raised. - enum class type : std::uint8_t + enum struct type : std::uint8_t { //! The reason for the exception is unknown or platform-specific unknown, diff --git a/kapi/kapi/devices.hpp b/kapi/kapi/devices.hpp index 21ecde14..c4bda9b9 100644 --- a/kapi/kapi/devices.hpp +++ b/kapi/kapi/devices.hpp @@ -46,7 +46,7 @@ namespace kapi::devices //! @param device The device to publish the facet for. //! @param name A stable name for the device. template<typename Facet> - auto publish_facet(kstd::shared_ptr<device> device, kstd::string name) -> kstd::result<void> + [[nodiscard]] auto publish_facet(kstd::shared_ptr<device> device, kstd::string name) -> kstd::result<void> { return facet_registry::get().publish<Facet>(device, std::move(name)); } @@ -58,7 +58,8 @@ namespace kapi::devices //! @param name A stable name for the device. //! @param implementation The implementation of the facet for the device. template<typename Facet> - auto publish_facet(kstd::shared_ptr<device> device, kstd::string name, Facet * implementation) -> kstd::result<void> + [[nodiscard]] auto publish_facet(kstd::shared_ptr<device> device, kstd::string name, Facet * implementation) + -> kstd::result<void> { return facet_registry::get().publish(device, std::move(name), implementation); } diff --git a/kapi/kapi/filesystem.hpp b/kapi/kapi/filesystem.hpp index 99466dfd..076edbb3 100644 --- a/kapi/kapi/filesystem.hpp +++ b/kapi/kapi/filesystem.hpp @@ -36,39 +36,39 @@ namespace kapi::filesystem //! @param source The source device or filesystem to mount. //! @param target The target mount point. //! @return Nothing on success, an error code otherwise. - auto mount(std::string_view source, std::string_view target) -> kstd::result<void>; + [[nodiscard]] auto mount(std::string_view source, std::string_view target) -> kstd::result<void>; //! Unmount a filesystem from the specified target path. //! //! @param target The target mount point to unmount. //! @return Nothing on success, an error code otherwise. - auto umount(std::string_view target) -> kstd::result<void>; + [[nodiscard]] auto umount(std::string_view target) -> kstd::result<void>; //! Open a file at the specified path. //! //! @param path The path to the file to open. //! @return A file descriptor on success, an error code otherwise. - auto open(std::string_view path) -> kstd::result<std::size_t>; + [[nodiscard]] auto open(std::string_view path) -> kstd::result<std::size_t>; //! Close a file descriptor. //! //! @param file_descriptor The file descriptor to close. //! @return Nothing on success, an error code otherwise . - auto close(std::size_t file_descriptor) -> kstd::result<void>; + [[nodiscard]] auto close(std::size_t file_descriptor) -> kstd::result<void>; //! Read bytes from a file into a given buffer. //! //! @param file_descriptor The file descriptor to read from. //! @param buffer The buffer to store the read data. //! @return The number of bytes read on success, an error code otherwise. - auto read(std::size_t file_descriptor, std::span<std::byte> buffer) -> kstd::result<kstd::bytes>; + [[nodiscard]] auto read(std::size_t file_descriptor, std::span<std::byte> buffer) -> kstd::result<kstd::bytes>; //! Write bytes from a given buffer to a file descriptor. //! //! @param file_descriptor The file descriptor to write to. //! @param buffer The buffer containing the data to write. //! @return The number of bytes written on success, an error code otherwise. - auto write(std::size_t file_descriptor, std::span<std::byte const> buffer) -> kstd::result<kstd::bytes>; + [[nodiscard]] auto write(std::size_t file_descriptor, std::span<std::byte const> buffer) -> kstd::result<kstd::bytes>; //! Adjust the current position in the file. //! @@ -76,13 +76,14 @@ namespace kapi::filesystem //! @param offset The offset to seek to, relative to the origin. //! @param origin The origing to seek relatively to. //! @return The new position in the file on success, an error code otherwise. - auto seek(std::size_t file_descriptor, kstd::offset offset, seek_origin origin) -> kstd::result<kstd::bytes>; + [[nodiscard]] auto seek(std::size_t file_descriptor, kstd::offset offset, seek_origin origin) + -> kstd::result<kstd::bytes>; //! 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 on failure. - auto mkdir(std::string_view path) -> kstd::result<void>; + [[nodiscard]] auto mkdir(std::string_view path) -> kstd::result<void>; //! Create a new file at the specified path. //! @@ -91,13 +92,13 @@ namespace kapi::filesystem //! //! @param path The path where the new file should be created. //! @return Nothing on success, an error on failure. - auto create(std::string_view path) -> kstd::result<void>; + [[nodiscard]] auto create(std::string_view path) -> kstd::result<void>; //! Get the status information for the file at a given path. //! //! @param path The path to the file to query information for. //! @return A populated file status object on success, an error otherwise. - auto status(std::string_view path) -> kstd::result<file_status>; + [[nodiscard]] auto status(std::string_view path) -> kstd::result<file_status>; //! Create a persistent device node at the given path //! @@ -105,14 +106,16 @@ namespace kapi::filesystem //! @param type The type of device referenced by the new node. //! @param number The number of the reference device. //! @return Nothing on success, an error on failure - auto create_device_node(std::string_view path, file_type type, device_number number) -> kstd::result<void>; + [[nodiscard]] auto create_device_node(std::string_view path, file_type type, device_number number) + -> kstd::result<void>; //! List the contents of a directory. //! //! @param file_descriptor A file descriptor pointing to an open directory. //! @param buffer A buffer to write the directory entries into. //! @return The number of entries read on success, an error otherwise. - auto read_directory(std::size_t file_descriptor, std::span<directory_entry> buffer) -> kstd::result<std::size_t>; + [[nodiscard]] auto read_directory(std::size_t file_descriptor, std::span<directory_entry> buffer) + -> kstd::result<std::size_t>; //! @} } // namespace kapi::filesystem diff --git a/kapi/kapi/filesystem/file_status.hpp b/kapi/kapi/filesystem/file_status.hpp index 25ea16f6..6a57bd6f 100644 --- a/kapi/kapi/filesystem/file_status.hpp +++ b/kapi/kapi/filesystem/file_status.hpp @@ -1,5 +1,5 @@ -#ifndef TEACH_KAPI_FILESYSTEM_FILE_STATUS_HPP -#define TEACH_KAPI_FILESYSTEM_FILE_STATUS_HPP +#ifndef TEACHOS_KAPI_FILESYSTEM_FILE_STATUS_HPP +#define TEACHOS_KAPI_FILESYSTEM_FILE_STATUS_HPP // IWYU pragma: private, include <kapi/filesystem.hpp> diff --git a/kapi/kapi/filesystem/file_type.hpp b/kapi/kapi/filesystem/file_type.hpp index 6b1124bf..3aef28c9 100644 --- a/kapi/kapi/filesystem/file_type.hpp +++ b/kapi/kapi/filesystem/file_type.hpp @@ -1,5 +1,5 @@ -#ifndef TEACH_KAPI_FILESYSTEM_FILE_TYPE_HPP -#define TEACH_KAPI_FILESYSTEM_FILE_TYPE_HPP +#ifndef TEACHOS_KAPI_FILESYSTEM_FILE_TYPE_HPP +#define TEACHOS_KAPI_FILESYSTEM_FILE_TYPE_HPP // IWYU pragma: private, include <kapi/filesystem.hpp> diff --git a/kapi/kapi/interrupts.hpp b/kapi/kapi/interrupts.hpp index 41710c2b..9e41b727 100644 --- a/kapi/kapi/interrupts.hpp +++ b/kapi/kapi/interrupts.hpp @@ -12,7 +12,7 @@ namespace kapi::interrupts //! @{ //! A status that indicates whether an interrupt was handled by a handler. - enum class status : bool + enum struct status : bool { //! The interrupt was not handled by any handler. unhandled, diff --git a/kapi/kapi/test_support/devices.hpp b/kapi/kapi/test_support/devices.hpp index 623bb87a..9c5e29ac 100644 --- a/kapi/kapi/test_support/devices.hpp +++ b/kapi/kapi/test_support/devices.hpp @@ -1,5 +1,5 @@ -#ifndef KAPI_TEST_SUPPORT_DEVICES_HPP -#define KAPI_TEST_SUPPORT_DEVICES_HPP +#ifndef TEACHOS_KAPI_TEST_SUPPORT_DEVICES_HPP +#define TEACHOS_KAPI_TEST_SUPPORT_DEVICES_HPP namespace kapi::test_support::devices { 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 <mutex> #include <string> 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<dentry_ptr>; + [[nodiscard]] auto open(std::string_view path) -> kstd::result<dentry_ptr>; //! 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<void>; + [[nodiscard]] auto close(std::string_view path) -> kstd::result<void>; //! 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<void>; + [[nodiscard]] auto mount(std::string_view source, std::string_view target) -> kstd::result<void>; //! 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<void>; + [[nodiscard]] auto unmount(std::string_view path) -> kstd::result<void>; //! 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<void>; + [[nodiscard]] auto mkdir(std::string_view path) -> kstd::result<void>; //! 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<void>; + [[nodiscard]] auto create(std::string_view path) -> kstd::result<void>; //! 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<void>; + [[nodiscard]] auto create_device_node(std::string_view path, std::uint32_t mode, + kapi::filesystem::device_number device) -> kstd::result<void>; //! 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<mount_ptr>; - auto create_inode(std::string_view path, kapi::filesystem::file_type type, - std::optional<kapi::filesystem::device_number> raw_device = std::nullopt) -> kstd::result<void>; + [[nodiscard]] auto create_inode(std::string_view path, kapi::filesystem::file_type type, + std::optional<kapi::filesystem::device_number> raw_device = std::nullopt) + -> kstd::result<void>; 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<kernel::vfs::inode>; //! 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 <kstd/memory.hpp> diff --git a/libs/kstd/kstd/bits/format/parse_context.hpp b/libs/kstd/kstd/bits/format/parse_context.hpp index 81ed52cf..c4cff3ba 100644 --- a/libs/kstd/kstd/bits/format/parse_context.hpp +++ b/libs/kstd/kstd/bits/format/parse_context.hpp @@ -89,7 +89,7 @@ namespace kstd } private: - enum class index_mode + enum struct index_mode { unknown, automatic, |
