summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-06-27 13:44:26 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-06-27 13:44:26 +0200
commit75a24c3a1fe2c9ff36ca950a0de5b2a15a4db204 (patch)
tree3f2c7ad80e393b5032b1f2e722ff4738725a3f08 /Kernel/FileSystem
parent3bd47a2e09e31ade766d0cf0b743763ff115d0e2 (diff)
downloadserenity-75a24c3a1fe2c9ff36ca950a0de5b2a15a4db204.zip
Kernel: More use of NonnullRefPtrVector in the kernel.
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r--Kernel/FileSystem/FileSystem.cpp6
-rw-r--r--Kernel/FileSystem/Inode.cpp7
-rw-r--r--Kernel/FileSystem/VirtualFileSystem.cpp10
3 files changed, 12 insertions, 11 deletions
diff --git a/Kernel/FileSystem/FileSystem.cpp b/Kernel/FileSystem/FileSystem.cpp
index 885087fbef..1a8753e38a 100644
--- a/Kernel/FileSystem/FileSystem.cpp
+++ b/Kernel/FileSystem/FileSystem.cpp
@@ -58,15 +58,15 @@ void FS::sync()
{
Inode::sync();
- Vector<NonnullRefPtr<FS>, 32> fses;
+ NonnullRefPtrVector<FS, 32> fses;
{
InterruptDisabler disabler;
for (auto& it : all_fses())
fses.append(*it.value);
}
- for (auto fs : fses)
- fs->flush_writes();
+ for (auto& fs : fses)
+ fs.flush_writes();
}
void FS::lock_all()
diff --git a/Kernel/FileSystem/Inode.cpp b/Kernel/FileSystem/Inode.cpp
index 57cd4af8e1..19d78684b3 100644
--- a/Kernel/FileSystem/Inode.cpp
+++ b/Kernel/FileSystem/Inode.cpp
@@ -1,3 +1,4 @@
+#include <AK/NonnullRefPtrVector.h>
#include <AK/StringBuilder.h>
#include <Kernel/FileSystem/Inode.h>
#include <Kernel/Net/LocalSocket.h>
@@ -13,7 +14,7 @@ HashTable<Inode*>& all_inodes()
void Inode::sync()
{
- Vector<NonnullRefPtr<Inode>, 32> inodes;
+ NonnullRefPtrVector<Inode, 32> inodes;
{
InterruptDisabler disabler;
for (auto* inode : all_inodes()) {
@@ -23,8 +24,8 @@ void Inode::sync()
}
for (auto& inode : inodes) {
- ASSERT(inode->is_metadata_dirty());
- inode->flush_metadata();
+ ASSERT(inode.is_metadata_dirty());
+ inode.flush_metadata();
}
}
diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp
index 9d0b126813..1392660952 100644
--- a/Kernel/FileSystem/VirtualFileSystem.cpp
+++ b/Kernel/FileSystem/VirtualFileSystem.cpp
@@ -632,7 +632,7 @@ KResultOr<NonnullRefPtr<Custody>> VFS::resolve_path(StringView path, Custody& ba
auto parts = path.split_view('/');
InodeIdentifier crumb_id;
- Vector<NonnullRefPtr<Custody>, 32> custody_chain;
+ NonnullRefPtrVector<Custody, 32> custody_chain;
if (path[0] == '/') {
custody_chain.append(root_custody());
@@ -661,9 +661,9 @@ KResultOr<NonnullRefPtr<Custody>> VFS::resolve_path(StringView path, Custody& ba
auto& part = parts[i];
if (part.is_empty())
- break;
+ break;
- auto current_parent = custody_chain.last();
+ auto& current_parent = custody_chain.last();
crumb_id = crumb_inode->lookup(part);
if (!crumb_id.is_valid())
return KResult(-ENOENT);
@@ -678,7 +678,7 @@ KResultOr<NonnullRefPtr<Custody>> VFS::resolve_path(StringView path, Custody& ba
crumb_inode = get_inode(crumb_id);
ASSERT(crumb_inode);
- custody_chain.append(Custody::get_or_create(custody_chain.last().ptr(), part, *crumb_inode));
+ custody_chain.append(Custody::get_or_create(&custody_chain.last(), part, *crumb_inode));
metadata = crumb_inode->metadata();
if (metadata.is_directory()) {
@@ -702,7 +702,7 @@ KResultOr<NonnullRefPtr<Custody>> VFS::resolve_path(StringView path, Custody& ba
auto symlink_target = resolve_path(
StringView(symlink_contents.pointer(),
symlink_contents.size()),
- *current_parent,
+ current_parent,
parent_custody,
options);