mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:38:11 +00:00
Kernel: More use of NonnullRefPtrVector in the kernel.
This commit is contained in:
parent
3bd47a2e09
commit
75a24c3a1f
3 changed files with 12 additions and 11 deletions
|
@ -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()
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue