mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
FileSystem: Make Inode::lookup() take a StringView.
This avoids a lot of String allocation during path resolution.
This commit is contained in:
parent
49768524d4
commit
bba2c062fe
7 changed files with 7 additions and 7 deletions
|
@ -1221,7 +1221,7 @@ void Ext2FSInode::populate_lookup_cache() const
|
|||
m_lookup_cache = move(children);
|
||||
}
|
||||
|
||||
InodeIdentifier Ext2FSInode::lookup(const String& name)
|
||||
InodeIdentifier Ext2FSInode::lookup(StringView name)
|
||||
{
|
||||
ASSERT(is_directory());
|
||||
populate_lookup_cache();
|
||||
|
|
|
@ -28,7 +28,7 @@ private:
|
|||
virtual ssize_t read_bytes(off_t, ssize_t, byte* buffer, FileDescriptor*) const override;
|
||||
virtual InodeMetadata metadata() const override;
|
||||
virtual bool traverse_as_directory(Function<bool(const FS::DirectoryEntry&)>) const override;
|
||||
virtual InodeIdentifier lookup(const String& name) override;
|
||||
virtual InodeIdentifier lookup(StringView name) override;
|
||||
virtual void flush_metadata() override;
|
||||
virtual ssize_t write_bytes(off_t, ssize_t, const byte* data, FileDescriptor*) override;
|
||||
virtual KResult add_child(InodeIdentifier child_id, const String& name, mode_t) override;
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
|
||||
virtual ssize_t read_bytes(off_t, ssize_t, byte* buffer, FileDescriptor*) const = 0;
|
||||
virtual bool traverse_as_directory(Function<bool(const FS::DirectoryEntry&)>) const = 0;
|
||||
virtual InodeIdentifier lookup(const String& name) = 0;
|
||||
virtual InodeIdentifier lookup(StringView name) = 0;
|
||||
virtual ssize_t write_bytes(off_t, ssize_t, const byte* data, FileDescriptor*) = 0;
|
||||
virtual KResult add_child(InodeIdentifier child_id, const String& name, mode_t) = 0;
|
||||
virtual KResult remove_child(const String& name) = 0;
|
||||
|
|
|
@ -957,7 +957,7 @@ bool ProcFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry&)
|
|||
return true;
|
||||
}
|
||||
|
||||
InodeIdentifier ProcFSInode::lookup(const String& name)
|
||||
InodeIdentifier ProcFSInode::lookup(StringView name)
|
||||
{
|
||||
ASSERT(is_directory());
|
||||
if (name == ".")
|
||||
|
|
|
@ -83,7 +83,7 @@ private:
|
|||
virtual ssize_t read_bytes(off_t, ssize_t, byte* buffer, FileDescriptor*) const override;
|
||||
virtual InodeMetadata metadata() const override;
|
||||
virtual bool traverse_as_directory(Function<bool(const FS::DirectoryEntry&)>) const override;
|
||||
virtual InodeIdentifier lookup(const String& name) override;
|
||||
virtual InodeIdentifier lookup(StringView name) override;
|
||||
virtual void flush_metadata() override;
|
||||
virtual ssize_t write_bytes(off_t, ssize_t, const byte* buffer, FileDescriptor*) override;
|
||||
virtual KResult add_child(InodeIdentifier child_id, const String& name, mode_t) override;
|
||||
|
|
|
@ -231,7 +231,7 @@ bool SynthFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry&
|
|||
return true;
|
||||
}
|
||||
|
||||
InodeIdentifier SynthFSInode::lookup(const String& name)
|
||||
InodeIdentifier SynthFSInode::lookup(StringView name)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
ASSERT(is_directory());
|
||||
|
|
|
@ -60,7 +60,7 @@ private:
|
|||
virtual ssize_t read_bytes(off_t, ssize_t, byte* buffer, FileDescriptor*) const override;
|
||||
virtual InodeMetadata metadata() const override;
|
||||
virtual bool traverse_as_directory(Function<bool(const FS::DirectoryEntry&)>) const override;
|
||||
virtual InodeIdentifier lookup(const String& name) override;
|
||||
virtual InodeIdentifier lookup(StringView name) override;
|
||||
virtual void flush_metadata() override;
|
||||
virtual ssize_t write_bytes(off_t, ssize_t, const byte* buffer, FileDescriptor*) override;
|
||||
virtual KResult add_child(InodeIdentifier child_id, const String& name, mode_t) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue