[VFS] more logging for resolving files

This commit is contained in:
Cancerous 2019-12-19 17:30:36 -05:00 committed by illusion
parent 4147e898f9
commit 0be6d3a047
1 changed files with 13 additions and 1 deletions

View File

@ -28,6 +28,7 @@ VirtualFileSystem::~VirtualFileSystem() {
Entry* VirtualFileSystem::ResolveDevice(const std::string& devicepath) { Entry* VirtualFileSystem::ResolveDevice(const std::string& devicepath) {
auto global_lock = global_critical_region_.Acquire(); auto global_lock = global_critical_region_.Acquire();
XELOGI("ResolveDevice (%s) pre-normalized", devicepath.c_str());
// Resolve relative paths // Resolve relative paths
std::string normalized_path(xe::filesystem::CanonicalizePath(devicepath)); std::string normalized_path(xe::filesystem::CanonicalizePath(devicepath));
@ -96,6 +97,7 @@ bool VirtualFileSystem::IsSymbolicLink(const std::string& path) {
bool VirtualFileSystem::FindSymbolicLink(const std::string& path, bool VirtualFileSystem::FindSymbolicLink(const std::string& path,
std::string& target) { std::string& target) {
XELOGI("FindSymbolicLink (%s)", path.c_str());
auto it = auto it =
std::find_if(symlinks_.cbegin(), symlinks_.cend(), [&](const auto& s) { std::find_if(symlinks_.cbegin(), symlinks_.cend(), [&](const auto& s) {
return xe::find_first_of_case(path, s.first) == 0; return xe::find_first_of_case(path, s.first) == 0;
@ -109,6 +111,8 @@ bool VirtualFileSystem::FindSymbolicLink(const std::string& path,
bool VirtualFileSystem::ResolveSymbolicLink(const std::string& path, bool VirtualFileSystem::ResolveSymbolicLink(const std::string& path,
std::string& result) { std::string& result) {
XELOGI("ResolveSymbolicLink (%s)", path.c_str());
result = path; result = path;
bool was_resolved = false; bool was_resolved = false;
while (true) { while (true) {
@ -131,6 +135,8 @@ bool VirtualFileSystem::ResolveSymbolicLink(const std::string& path,
Entry* VirtualFileSystem::ResolvePath(const std::string& path) { Entry* VirtualFileSystem::ResolvePath(const std::string& path) {
auto global_lock = global_critical_region_.Acquire(); auto global_lock = global_critical_region_.Acquire();
XELOGI("ResolvePath (%s) Pre-normalized", path.c_str());
// Resolve relative paths // Resolve relative paths
std::string normalized_path(xe::filesystem::CanonicalizePath(path)); std::string normalized_path(xe::filesystem::CanonicalizePath(path));
@ -156,6 +162,8 @@ Entry* VirtualFileSystem::ResolvePath(const std::string& path) {
} }
Entry* VirtualFileSystem::ResolveBasePath(const std::string& path) { Entry* VirtualFileSystem::ResolveBasePath(const std::string& path) {
XELOGI("ResolveBasePath (%s) Pre-normalized", path.c_str());
auto base_path = xe::find_base_path(path); auto base_path = xe::find_base_path(path);
return ResolvePath(base_path); return ResolvePath(base_path);
} }
@ -163,6 +171,8 @@ Entry* VirtualFileSystem::ResolveBasePath(const std::string& path) {
Entry* VirtualFileSystem::CreatePath(const std::string& path, Entry* VirtualFileSystem::CreatePath(const std::string& path,
uint32_t attributes) { uint32_t attributes) {
// Create all required directories recursively. // Create all required directories recursively.
XELOGI("CreatePath (%s) Pre-normalized", path.c_str());
auto path_parts = xe::split_path(path); auto path_parts = xe::split_path(path);
if (path_parts.empty()) { if (path_parts.empty()) {
return nullptr; return nullptr;
@ -220,6 +230,8 @@ X_STATUS VirtualFileSystem::OpenFile(const std::string& path,
desired_access |= FileAccess::kFileReadData | FileAccess::kFileWriteData; desired_access |= FileAccess::kFileReadData | FileAccess::kFileWriteData;
} }
XELOGI("OpenFile (%s) Pre-normalized", path.c_str());
// Lookup host device/parent path. // Lookup host device/parent path.
// If no device or parent, fail. // If no device or parent, fail.
Entry* parent_entry = nullptr; Entry* parent_entry = nullptr;