[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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user