diff options
author | Andreas Kling <kling@serenityos.org> | 2021-07-17 21:32:16 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-17 21:32:59 +0200 |
commit | 6766efff9c8984fd51eba9a360569d7229dcad9d (patch) | |
tree | 8784284fd307519fe5accb5fa13bcf0fdccec49a | |
parent | 9359f7801f84eda7c7ae3fbe24dd3a8411f7a2b7 (diff) | |
download | serenity-6766efff9c8984fd51eba9a360569d7229dcad9d.zip |
Kernel: Make Inode::create_child() take the name as a StringView
No sense in forcing callers to construct a String. One more small step
towards not using String in the kernel.
-rw-r--r-- | Kernel/FileSystem/DevFS.cpp | 4 | ||||
-rw-r--r-- | Kernel/FileSystem/DevFS.h | 4 | ||||
-rw-r--r-- | Kernel/FileSystem/DevPtsFS.cpp | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/DevPtsFS.h | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/Ext2FileSystem.cpp | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/Ext2FileSystem.h | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/Inode.h | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/Plan9FileSystem.cpp | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/Plan9FileSystem.h | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/ProcFS.cpp | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/ProcFS.h | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/SysFS.cpp | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/SysFS.h | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/TmpFS.cpp | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/TmpFS.h | 2 |
15 files changed, 17 insertions, 17 deletions
diff --git a/Kernel/FileSystem/DevFS.cpp b/Kernel/FileSystem/DevFS.cpp index 9828d33b96..ea60808cb6 100644 --- a/Kernel/FileSystem/DevFS.cpp +++ b/Kernel/FileSystem/DevFS.cpp @@ -104,7 +104,7 @@ KResultOr<size_t> DevFSInode::write_bytes(off_t, size_t, const UserOrKernelBuffe VERIFY_NOT_REACHED(); } -KResultOr<NonnullRefPtr<Inode>> DevFSInode::create_child(const String&, mode_t, dev_t, uid_t, gid_t) +KResultOr<NonnullRefPtr<Inode>> DevFSInode::create_child(StringView, mode_t, dev_t, uid_t, gid_t) { return EROFS; } @@ -262,7 +262,7 @@ RefPtr<Inode> DevFSRootDirectoryInode::lookup(StringView name) } return nullptr; } -KResultOr<NonnullRefPtr<Inode>> DevFSRootDirectoryInode::create_child(const String& name, mode_t mode, dev_t, uid_t, gid_t) +KResultOr<NonnullRefPtr<Inode>> DevFSRootDirectoryInode::create_child(StringView name, mode_t mode, dev_t, uid_t, gid_t) { Locker locker(m_parent_fs.m_lock); diff --git a/Kernel/FileSystem/DevFS.h b/Kernel/FileSystem/DevFS.h index 60f071bc46..6d0523c812 100644 --- a/Kernel/FileSystem/DevFS.h +++ b/Kernel/FileSystem/DevFS.h @@ -55,7 +55,7 @@ protected: virtual RefPtr<Inode> lookup(StringView name) override; virtual void flush_metadata() override; virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, FileDescription*) override; - virtual KResultOr<NonnullRefPtr<Inode>> create_child(const String& name, mode_t, dev_t, uid_t, gid_t) override; + virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) override; virtual KResult add_child(Inode&, const StringView& name, mode_t) override; virtual KResult remove_child(const StringView& name) override; virtual KResultOr<size_t> directory_entry_count() const override; @@ -150,7 +150,7 @@ public: private: explicit DevFSRootDirectoryInode(DevFS&); - virtual KResultOr<NonnullRefPtr<Inode>> create_child(const String& name, mode_t, dev_t, uid_t, gid_t) override; + virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) override; virtual KResult traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)>) const override; virtual RefPtr<Inode> lookup(StringView name) override; virtual InodeMetadata metadata() const override; diff --git a/Kernel/FileSystem/DevPtsFS.cpp b/Kernel/FileSystem/DevPtsFS.cpp index 88d2cef921..172ef6514f 100644 --- a/Kernel/FileSystem/DevPtsFS.cpp +++ b/Kernel/FileSystem/DevPtsFS.cpp @@ -169,7 +169,7 @@ KResult DevPtsFSInode::add_child(Inode&, const StringView&, mode_t) return EROFS; } -KResultOr<NonnullRefPtr<Inode>> DevPtsFSInode::create_child(const String&, mode_t, dev_t, uid_t, gid_t) +KResultOr<NonnullRefPtr<Inode>> DevPtsFSInode::create_child(StringView, mode_t, dev_t, uid_t, gid_t) { return EROFS; } diff --git a/Kernel/FileSystem/DevPtsFS.h b/Kernel/FileSystem/DevPtsFS.h index 72a046c1cf..d32a4e4dd7 100644 --- a/Kernel/FileSystem/DevPtsFS.h +++ b/Kernel/FileSystem/DevPtsFS.h @@ -53,7 +53,7 @@ private: virtual RefPtr<Inode> lookup(StringView name) override; virtual void flush_metadata() override; virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, FileDescription*) override; - virtual KResultOr<NonnullRefPtr<Inode>> create_child(const String& name, mode_t, dev_t, uid_t, gid_t) override; + virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) override; virtual KResult add_child(Inode&, const StringView& name, mode_t) override; virtual KResult remove_child(const StringView& name) override; virtual KResultOr<size_t> directory_entry_count() const override; diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index cfb387c39f..82df1eb9de 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -1164,7 +1164,7 @@ KResult Ext2FSInode::write_directory(Vector<Ext2FSDirectoryEntry>& entries) return KSuccess; } -KResultOr<NonnullRefPtr<Inode>> Ext2FSInode::create_child(const String& name, mode_t mode, dev_t dev, uid_t uid, gid_t gid) +KResultOr<NonnullRefPtr<Inode>> Ext2FSInode::create_child(StringView name, mode_t mode, dev_t dev, uid_t uid, gid_t gid) { if (::is_directory(mode)) return fs().create_directory(*this, name, mode, uid, gid); diff --git a/Kernel/FileSystem/Ext2FileSystem.h b/Kernel/FileSystem/Ext2FileSystem.h index 0f7a5b2b14..77cefcb4d4 100644 --- a/Kernel/FileSystem/Ext2FileSystem.h +++ b/Kernel/FileSystem/Ext2FileSystem.h @@ -44,7 +44,7 @@ private: virtual RefPtr<Inode> lookup(StringView name) override; virtual void flush_metadata() override; virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& data, FileDescription*) override; - virtual KResultOr<NonnullRefPtr<Inode>> create_child(const String& name, mode_t, dev_t, uid_t, gid_t) override; + virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) override; virtual KResult add_child(Inode& child, const StringView& name, mode_t) override; virtual KResult remove_child(const StringView& name) override; virtual KResult set_atime(time_t) override; diff --git a/Kernel/FileSystem/Inode.h b/Kernel/FileSystem/Inode.h index 2ef33d402b..31c1230c68 100644 --- a/Kernel/FileSystem/Inode.h +++ b/Kernel/FileSystem/Inode.h @@ -56,7 +56,7 @@ public: virtual KResult traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)>) const = 0; virtual RefPtr<Inode> lookup(StringView name) = 0; virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& data, FileDescription*) = 0; - virtual KResultOr<NonnullRefPtr<Inode>> create_child(const String& name, mode_t, dev_t, uid_t, gid_t) = 0; + virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) = 0; virtual KResult add_child(Inode&, const StringView& name, mode_t) = 0; virtual KResult remove_child(const StringView& name) = 0; virtual KResultOr<size_t> directory_entry_count() const = 0; diff --git a/Kernel/FileSystem/Plan9FileSystem.cpp b/Kernel/FileSystem/Plan9FileSystem.cpp index d0fdbc64d7..7ee81bc7d8 100644 --- a/Kernel/FileSystem/Plan9FileSystem.cpp +++ b/Kernel/FileSystem/Plan9FileSystem.cpp @@ -941,7 +941,7 @@ RefPtr<Inode> Plan9FSInode::lookup(StringView name) return Plan9FSInode::create(fs(), newfid); } -KResultOr<NonnullRefPtr<Inode>> Plan9FSInode::create_child(const String&, mode_t, dev_t, uid_t, gid_t) +KResultOr<NonnullRefPtr<Inode>> Plan9FSInode::create_child(StringView, mode_t, dev_t, uid_t, gid_t) { // TODO return ENOTIMPL; diff --git a/Kernel/FileSystem/Plan9FileSystem.h b/Kernel/FileSystem/Plan9FileSystem.h index 53f1621a89..243c695889 100644 --- a/Kernel/FileSystem/Plan9FileSystem.h +++ b/Kernel/FileSystem/Plan9FileSystem.h @@ -160,7 +160,7 @@ public: virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& data, FileDescription*) override; virtual KResult traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)>) const override; virtual RefPtr<Inode> lookup(StringView name) override; - virtual KResultOr<NonnullRefPtr<Inode>> create_child(const String& name, mode_t, dev_t, uid_t, gid_t) override; + virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) override; virtual KResult add_child(Inode&, const StringView& name, mode_t) override; virtual KResult remove_child(const StringView& name) override; virtual KResultOr<size_t> directory_entry_count() const override; diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index f443e467c8..8084ef6554 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -158,7 +158,7 @@ KResultOr<size_t> ProcFSInode::write_bytes(off_t offset, size_t count, const Use return m_associated_component->write_bytes(offset, count, buffer, fd); } -KResultOr<NonnullRefPtr<Inode>> ProcFSInode::create_child(const String&, mode_t, dev_t, uid_t, gid_t) +KResultOr<NonnullRefPtr<Inode>> ProcFSInode::create_child(StringView, mode_t, dev_t, uid_t, gid_t) { return EROFS; } diff --git a/Kernel/FileSystem/ProcFS.h b/Kernel/FileSystem/ProcFS.h index 6677f42898..d88df337ac 100644 --- a/Kernel/FileSystem/ProcFS.h +++ b/Kernel/FileSystem/ProcFS.h @@ -55,7 +55,7 @@ protected: virtual void flush_metadata() override; virtual InodeMetadata metadata() const override; virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, FileDescription*) override; - virtual KResultOr<NonnullRefPtr<Inode>> create_child(const String& name, mode_t, dev_t, uid_t, gid_t) override; + virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) override; virtual KResult add_child(Inode&, const StringView& name, mode_t) override; virtual KResult remove_child(const StringView& name) override; virtual void did_seek(FileDescription&, off_t) override; diff --git a/Kernel/FileSystem/SysFS.cpp b/Kernel/FileSystem/SysFS.cpp index bf08129363..c7cb243f3a 100644 --- a/Kernel/FileSystem/SysFS.cpp +++ b/Kernel/FileSystem/SysFS.cpp @@ -130,7 +130,7 @@ KResultOr<size_t> SysFSInode::write_bytes(off_t offset, size_t count, UserOrKern return m_associated_component->write_bytes(offset, count, buffer, fd); } -KResultOr<NonnullRefPtr<Inode>> SysFSInode::create_child(String const&, mode_t, dev_t, uid_t, gid_t) +KResultOr<NonnullRefPtr<Inode>> SysFSInode::create_child(StringView, mode_t, dev_t, uid_t, gid_t) { return EROFS; } diff --git a/Kernel/FileSystem/SysFS.h b/Kernel/FileSystem/SysFS.h index e3d2f58127..204c333bde 100644 --- a/Kernel/FileSystem/SysFS.h +++ b/Kernel/FileSystem/SysFS.h @@ -75,7 +75,7 @@ protected: virtual void flush_metadata() override; virtual InodeMetadata metadata() const override; virtual KResultOr<size_t> write_bytes(off_t, size_t, UserOrKernelBuffer const&, FileDescription*) override; - virtual KResultOr<NonnullRefPtr<Inode>> create_child(String const& name, mode_t, dev_t, uid_t, gid_t) override; + virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) override; virtual KResult add_child(Inode&, StringView const& name, mode_t) override; virtual KResult remove_child(StringView const& name) override; virtual KResultOr<size_t> directory_entry_count() const override; diff --git a/Kernel/FileSystem/TmpFS.cpp b/Kernel/FileSystem/TmpFS.cpp index ea7d4a6171..7f9365592a 100644 --- a/Kernel/FileSystem/TmpFS.cpp +++ b/Kernel/FileSystem/TmpFS.cpp @@ -254,7 +254,7 @@ KResult TmpFSInode::chown(uid_t uid, gid_t gid) return KSuccess; } -KResultOr<NonnullRefPtr<Inode>> TmpFSInode::create_child(const String& name, mode_t mode, dev_t dev, uid_t uid, gid_t gid) +KResultOr<NonnullRefPtr<Inode>> TmpFSInode::create_child(StringView name, mode_t mode, dev_t dev, uid_t uid, gid_t gid) { Locker locker(m_inode_lock); diff --git a/Kernel/FileSystem/TmpFS.h b/Kernel/FileSystem/TmpFS.h index 178b17bddc..3b747d7194 100644 --- a/Kernel/FileSystem/TmpFS.h +++ b/Kernel/FileSystem/TmpFS.h @@ -60,7 +60,7 @@ public: virtual RefPtr<Inode> lookup(StringView name) override; virtual void flush_metadata() override; virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, FileDescription*) override; - virtual KResultOr<NonnullRefPtr<Inode>> create_child(const String& name, mode_t, dev_t, uid_t, gid_t) override; + virtual KResultOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, uid_t, gid_t) override; virtual KResult add_child(Inode&, const StringView& name, mode_t) override; virtual KResult remove_child(const StringView& name) override; virtual KResultOr<size_t> directory_entry_count() const override; |