Kernel: Convert Inode event APIs to use StringViews instead of Strings
These APIs allocate a copy internally anyways, so there's no point to making another one for them.
This commit is contained in:
parent
d1d24eaef4
commit
e236f9d85a
Notes:
sideshowbarker
2024-07-17 21:03:24 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/e236f9d85ab Pull-request: https://github.com/SerenityOS/serenity/pull/11817 Reviewed-by: https://github.com/bgianfo ✅
4 changed files with 7 additions and 6 deletions
|
@ -202,7 +202,7 @@ void Inode::set_metadata_dirty(bool metadata_dirty)
|
|||
}
|
||||
}
|
||||
|
||||
void Inode::did_add_child(InodeIdentifier, String const& name)
|
||||
void Inode::did_add_child(InodeIdentifier, StringView name)
|
||||
{
|
||||
MutexLocker locker(m_inode_lock);
|
||||
|
||||
|
@ -211,7 +211,7 @@ void Inode::did_add_child(InodeIdentifier, String const& name)
|
|||
}
|
||||
}
|
||||
|
||||
void Inode::did_remove_child(InodeIdentifier, String const& name)
|
||||
void Inode::did_remove_child(InodeIdentifier, StringView name)
|
||||
{
|
||||
MutexLocker locker(m_inode_lock);
|
||||
|
||||
|
|
|
@ -106,8 +106,8 @@ protected:
|
|||
void set_metadata_dirty(bool);
|
||||
ErrorOr<void> prepare_to_write_data();
|
||||
|
||||
void did_add_child(InodeIdentifier child_id, String const& name);
|
||||
void did_remove_child(InodeIdentifier child_id, String const& name);
|
||||
void did_add_child(InodeIdentifier child_id, StringView);
|
||||
void did_remove_child(InodeIdentifier child_id, StringView);
|
||||
void did_modify_contents();
|
||||
void did_delete_self();
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ ErrorOr<NonnullOwnPtr<KString>> InodeWatcher::pseudo_path(const OpenFileDescript
|
|||
return KString::formatted("InodeWatcher:({})", m_wd_to_watches.size());
|
||||
}
|
||||
|
||||
void InodeWatcher::notify_inode_event(Badge<Inode>, InodeIdentifier inode_id, InodeWatcherEvent::Type event_type, String const& name)
|
||||
void InodeWatcher::notify_inode_event(Badge<Inode>, InodeIdentifier inode_id, InodeWatcherEvent::Type event_type, StringView name)
|
||||
{
|
||||
MutexLocker locker(m_lock);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <AK/CircularQueue.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <Kernel/API/InodeWatcherEvent.h>
|
||||
#include <Kernel/FileSystem/File.h>
|
||||
#include <Kernel/Forward.h>
|
||||
|
@ -54,7 +55,7 @@ public:
|
|||
virtual StringView class_name() const override { return "InodeWatcher"sv; };
|
||||
virtual bool is_inode_watcher() const override { return true; }
|
||||
|
||||
void notify_inode_event(Badge<Inode>, InodeIdentifier, InodeWatcherEvent::Type, String const& name = {});
|
||||
void notify_inode_event(Badge<Inode>, InodeIdentifier, InodeWatcherEvent::Type, StringView name = {});
|
||||
|
||||
ErrorOr<int> register_inode(Inode&, unsigned event_mask);
|
||||
ErrorOr<void> unregister_by_wd(int);
|
||||
|
|
Loading…
Add table
Reference in a new issue