aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kapi/kapi/devices/facet_registry.hpp9
-rw-r--r--kapi/kapi/devices/power.hpp2
-rw-r--r--kernel/kernel/devices/block_device_utils.hpp8
-rw-r--r--kernel/kernel/filesystems/devfs/inode.hpp3
-rw-r--r--kernel/kernel/filesystems/ext2/inode.hpp3
-rw-r--r--kernel/kernel/filesystems/rootfs/inode.hpp3
-rw-r--r--kernel/kernel/vfs/inode.hpp3
-rw-r--r--kernel/kernel/vfs/mount.hpp5
-rw-r--r--kernel/kernel/vfs/open_file_descriptor.hpp10
-rw-r--r--kernel/kernel/vfs/open_file_table.hpp4
10 files changed, 29 insertions, 21 deletions
diff --git a/kapi/kapi/devices/facet_registry.hpp b/kapi/kapi/devices/facet_registry.hpp
index 7006c026..3c405923 100644
--- a/kapi/kapi/devices/facet_registry.hpp
+++ b/kapi/kapi/devices/facet_registry.hpp
@@ -150,7 +150,7 @@ namespace kapi::devices
//! @param device The device to publish the facet for.
//! @param name A stable name for the device.
template<typename FacetType>
- auto publish(kstd::shared_ptr<device> device, kstd::string name) -> kstd::result<void>
+ [[nodiscard]] auto publish(kstd::shared_ptr<device> device, kstd::string name) -> kstd::result<void>
{
if (!device)
{
@@ -172,7 +172,8 @@ namespace kapi::devices
//! @param name A stable name for the device.
//! @param facet The implementation of the facet for the device.
template<typename FacetType>
- auto publish(kstd::shared_ptr<device> device, kstd::string name, FacetType * facet) -> kstd::result<void>
+ [[nodiscard]] auto publish(kstd::shared_ptr<device> device, kstd::string name, FacetType * facet)
+ -> kstd::result<void>
{
return do_publish(device, std::move(name), FacetType::id, facet);
}
@@ -254,8 +255,8 @@ namespace kapi::devices
//! @param name A stable name for the device.
//! @param id The id of the facet to be published for the device.
//! @param facet The facet of the device.
- auto do_publish(kstd::shared_ptr<device> device, kstd::string name, kapi::capabilities::facet_id id, void * facet)
- -> kstd::result<void>;
+ [[nodiscard]] auto do_publish(kstd::shared_ptr<device> device, kstd::string name, kapi::capabilities::facet_id id,
+ void * facet) -> kstd::result<void>;
//! Notify all subscribed observers about a new facet having been published for a device.
//!
diff --git a/kapi/kapi/devices/power.hpp b/kapi/kapi/devices/power.hpp
index 44837a65..a87ebc78 100644
--- a/kapi/kapi/devices/power.hpp
+++ b/kapi/kapi/devices/power.hpp
@@ -21,7 +21,7 @@ namespace kapi::devices
//!
//! @param root The root of the tree to suspend.
//! @return nothing on success, the first error to occur otherwise.
- auto suspend_tree(bus & root) -> kstd::result<void>;
+ [[nodiscard]] auto suspend_tree(bus & root) -> kstd::result<void>;
//! Resume a device (sub-)tree rooted in a given bus.
//!
diff --git a/kernel/kernel/devices/block_device_utils.hpp b/kernel/kernel/devices/block_device_utils.hpp
index 1fb7cd9d..d6a6724c 100644
--- a/kernel/kernel/devices/block_device_utils.hpp
+++ b/kernel/kernel/devices/block_device_utils.hpp
@@ -30,8 +30,8 @@ namespace kernel::devices::block_device_utils
//! @param buffer The buffer to read data into.
//! @param offset The offset on the block device to start reading from.
//! @return The number of bytes actually read, which may be less than the requested size.
- auto read(kapi::filesystem::block_special_file & device, std::span<std::byte> buffer, kstd::bytes offset)
- -> kstd::result<kstd::bytes>;
+ [[nodiscard]] auto read(kapi::filesystem::block_special_file & device, std::span<std::byte> buffer,
+ kstd::bytes offset) -> kstd::result<kstd::bytes>;
//! @brief Write data from a buffer to a given block device.
//!
@@ -39,8 +39,8 @@ namespace kernel::devices::block_device_utils
//! @param buffer The buffer to write data from.
//! @param offset The offset on the block device to start writing to.
//! @return The number of bytes actually written, which may be less than the requested size.
- auto write(kapi::filesystem::block_special_file & device, std::span<std::byte const> buffer, kstd::bytes offset)
- -> kstd::result<kstd::bytes>;
+ [[nodiscard]] auto write(kapi::filesystem::block_special_file & device, std::span<std::byte const> buffer,
+ kstd::bytes offset) -> kstd::result<kstd::bytes>;
} // namespace kernel::devices::block_device_utils
#endif \ No newline at end of file
diff --git a/kernel/kernel/filesystems/devfs/inode.hpp b/kernel/kernel/filesystems/devfs/inode.hpp
index c19671df..9a01d777 100644
--- a/kernel/kernel/filesystems/devfs/inode.hpp
+++ b/kernel/kernel/filesystems/devfs/inode.hpp
@@ -22,7 +22,8 @@ namespace kernel::filesystems::devfs
[[nodiscard]] auto read(std::span<std::byte> buffer, kstd::bytes offset) const
-> kstd::result<kstd::bytes> override;
- auto write(std::span<std::byte const> buffer, kstd::bytes offset) -> kstd::result<kstd::bytes> override;
+ [[nodiscard]] auto write(std::span<std::byte const> buffer, kstd::bytes offset)
+ -> kstd::result<kstd::bytes> override;
[[nodiscard]] auto is_directory() const -> bool override;
diff --git a/kernel/kernel/filesystems/ext2/inode.hpp b/kernel/kernel/filesystems/ext2/inode.hpp
index 9a3561f7..206d2a48 100644
--- a/kernel/kernel/filesystems/ext2/inode.hpp
+++ b/kernel/kernel/filesystems/ext2/inode.hpp
@@ -64,7 +64,8 @@ namespace kernel::filesystems::ext2
[[nodiscard]] auto read(std::span<std::byte> buffer, kstd::bytes offset) const
-> kstd::result<kstd::bytes> override;
- auto write(std::span<std::byte const> buffer, kstd::bytes offset) -> kstd::result<kstd::bytes> override;
+ [[nodiscard]] auto write(std::span<std::byte const> buffer, kstd::bytes offset)
+ -> kstd::result<kstd::bytes> override;
//! @}
diff --git a/kernel/kernel/filesystems/rootfs/inode.hpp b/kernel/kernel/filesystems/rootfs/inode.hpp
index 10e6a4e1..2bd5863f 100644
--- a/kernel/kernel/filesystems/rootfs/inode.hpp
+++ b/kernel/kernel/filesystems/rootfs/inode.hpp
@@ -23,7 +23,8 @@ namespace kernel::filesystems::rootfs
[[nodiscard]] auto read(std::span<std::byte> buffer, kstd::bytes offset) const
-> kstd::result<kstd::bytes> override;
- auto write(std::span<std::byte const> buffer, kstd::bytes offset) -> kstd::result<kstd::bytes> override;
+ [[nodiscard]] auto write(std::span<std::byte const> buffer, kstd::bytes offset)
+ -> kstd::result<kstd::bytes> override;
[[nodiscard]] auto is_directory() const -> bool override;
diff --git a/kernel/kernel/vfs/inode.hpp b/kernel/kernel/vfs/inode.hpp
index 63e73315..37fed901 100644
--- a/kernel/kernel/vfs/inode.hpp
+++ b/kernel/kernel/vfs/inode.hpp
@@ -55,7 +55,8 @@ namespace kernel::vfs
//! @param buffer Source buffer.
//! @param offset Write offset in bytes.
//! @return The number of bytes written on success, an error otherwise.
- virtual auto write(std::span<std::byte const> buffer, kstd::bytes offset) -> kstd::result<kstd::bytes> = 0;
+ [[nodiscard]] virtual auto write(std::span<std::byte const> buffer, kstd::bytes offset)
+ -> kstd::result<kstd::bytes> = 0;
//! @}
diff --git a/kernel/kernel/vfs/mount.hpp b/kernel/kernel/vfs/mount.hpp
index dc49212c..4b303297 100644
--- a/kernel/kernel/vfs/mount.hpp
+++ b/kernel/kernel/vfs/mount.hpp
@@ -43,8 +43,9 @@ namespace kernel::vfs
//! @param parent_mount The parent mount which contains the mount_dentry.
//! @param source_mount The mount that the filesystem originates from.
//! @param backing_inode The backing inode for the filesystem, if any.
- auto static create(dentry_ptr const & mount_dentry, filesystem_ptr const & fs, mount_ptr const & parent_mount,
- mount_ptr const & source_mount, inode_ptr const & backing_inode) -> kstd::result<mount_ptr>;
+ [[nodiscard]] auto static create(dentry_ptr const & mount_dentry, filesystem_ptr const & fs,
+ mount_ptr const & parent_mount, mount_ptr const & source_mount,
+ inode_ptr const & backing_inode) -> kstd::result<mount_ptr>;
//! Get the directory entry where the filesystem is mounted.
[[nodiscard]] auto mount_dentry() const -> dentry_ptr const &;
diff --git a/kernel/kernel/vfs/open_file_descriptor.hpp b/kernel/kernel/vfs/open_file_descriptor.hpp
index 587105b8..5cac23e8 100644
--- a/kernel/kernel/vfs/open_file_descriptor.hpp
+++ b/kernel/kernel/vfs/open_file_descriptor.hpp
@@ -32,26 +32,28 @@ namespace kernel::vfs
//!
//! @param buffer The buffer to read data into.
//! @return The number of bytes read on success, an error otherwise.
- virtual auto read(std::span<std::byte> buffer) -> kstd::result<kstd::bytes>;
+ [[nodiscard]] virtual auto read(std::span<std::byte> buffer) -> kstd::result<kstd::bytes>;
//! Write data to the open file descriptor from a buffer.
//!
//! @param buffer The buffer to write data from.
//! @return The number of bytes written on success, an error otherwise.
- virtual auto write(std::span<std::byte const> buffer) -> kstd::result<kstd::bytes>;
+ [[nodiscard]] virtual auto write(std::span<std::byte const> buffer) -> kstd::result<kstd::bytes>;
//! Move the read/write offset of the file.
//!
//! @param offset The offset to apply relative to the given origin.
//! @param origin The origin of the offset.
//! @return the new offset on success, an error otherwise.
- virtual auto seek(kstd::offset offset, kapi::filesystem::seek_origin origin) -> kstd::result<kstd::bytes>;
+ [[nodiscard]] virtual auto seek(kstd::offset offset, kapi::filesystem::seek_origin origin)
+ -> kstd::result<kstd::bytes>;
//! Read directory entries from the file.
//!
//! @param entries A buffer to read the entries into.
//! @return The number of read entries on success, an error otherwise.
- virtual auto read_directory(std::span<kapi::filesystem::directory_entry> entries) -> kstd::result<std::size_t>;
+ [[nodiscard]] virtual auto read_directory(std::span<kapi::filesystem::directory_entry> entries)
+ -> kstd::result<std::size_t>;
//! Get a reference to the directory entry associated with this open file descriptor.
//!
diff --git a/kernel/kernel/vfs/open_file_table.hpp b/kernel/kernel/vfs/open_file_table.hpp
index 8d6a2341..e7e57f6b 100644
--- a/kernel/kernel/vfs/open_file_table.hpp
+++ b/kernel/kernel/vfs/open_file_table.hpp
@@ -33,7 +33,7 @@ namespace kernel::vfs
//!
//! @param fd The file descriptor to add.
//! @return The file descriptor index assigned to the file on success, an error otherwise.
- auto add_file(kstd::shared_ptr<open_file_descriptor> const & fd) -> kstd::result<std::size_t>;
+ [[nodiscard]] auto add_file(kstd::shared_ptr<open_file_descriptor> const & fd) -> kstd::result<std::size_t>;
//! Get a file from the open file table.
//!
@@ -45,7 +45,7 @@ namespace kernel::vfs
//!
//! @param fd The file descriptor index to remove.
//! @return Nothin on success, an error otherwise.
- auto remove_file(std::size_t fd) -> kstd::result<void>;
+ [[nodiscard]] auto remove_file(std::size_t fd) -> kstd::result<void>;
private:
open_file_table() = default;