[Kernel/VFS] Specify root entry to open from + cleanup.

[VFS] Allow specifying root entry to open from with OpenFile.
[Kernel] NtCreateFile now opens from root entry when available instead
         of needlessly building a full path and resolving from that.
[VFS] Reduce code duplication by adding Entry::ResolvePath.
[VFS] Remove ResolveBasePath to avoid multiple calls to find_base_guest_path.
This commit is contained in:
gibbed
2020-04-20 00:44:19 -05:00
committed by Rick Gibbed
parent 725f3ce17f
commit 1c2d6753bb
9 changed files with 33 additions and 60 deletions

View File

@@ -58,6 +58,19 @@ Entry* Entry::GetChild(const std::string_view name) {
return (*it).get();
}
Entry* Entry::ResolvePath(const std::string_view path) {
// Walk the path, one separator at a time.
Entry* entry = this;
for (auto& part : xe::utf8::split_path(path)) {
entry = entry->GetChild(part);
if (!entry) {
// Not found.
return nullptr;
}
}
return entry;
}
Entry* Entry::IterateChildren(const xe::filesystem::WildcardEngine& engine,
size_t* current_index) {
auto global_lock = global_critical_region_.Acquire();