filesystem: Move logging macros over to new fmt-compatible ones
This commit is contained in:
parent
c6a740d7c2
commit
b5b613ea29
|
@ -25,14 +25,14 @@ ResultCode RegisterFileSystem(std::unique_ptr<FileSys::FileSystemFactory>&& fact
|
||||||
ASSERT_MSG(inserted, "Tried to register more than one system with same id code");
|
ASSERT_MSG(inserted, "Tried to register more than one system with same id code");
|
||||||
|
|
||||||
auto& filesystem = result.first->second;
|
auto& filesystem = result.first->second;
|
||||||
LOG_DEBUG(Service_FS, "Registered file system %s with id code 0x%08X",
|
NGLOG_DEBUG(Service_FS, "Registered file system {} with id code {:#010X}",
|
||||||
filesystem->GetName().c_str(), static_cast<u32>(type));
|
filesystem->GetName(), static_cast<u32>(type));
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<std::unique_ptr<FileSys::FileSystemBackend>> OpenFileSystem(Type type,
|
ResultVal<std::unique_ptr<FileSys::FileSystemBackend>> OpenFileSystem(Type type,
|
||||||
FileSys::Path& path) {
|
FileSys::Path& path) {
|
||||||
LOG_TRACE(Service_FS, "Opening FileSystem with type=%d", type);
|
NGLOG_TRACE(Service_FS, "Opening FileSystem with type={}", static_cast<u32>(type));
|
||||||
|
|
||||||
auto itr = filesystem_map.find(type);
|
auto itr = filesystem_map.find(type);
|
||||||
if (itr == filesystem_map.end()) {
|
if (itr == filesystem_map.end()) {
|
||||||
|
@ -44,7 +44,7 @@ ResultVal<std::unique_ptr<FileSys::FileSystemBackend>> OpenFileSystem(Type type,
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode FormatFileSystem(Type type) {
|
ResultCode FormatFileSystem(Type type) {
|
||||||
LOG_TRACE(Service_FS, "Formatting FileSystem with type=%d", type);
|
NGLOG_TRACE(Service_FS, "Formatting FileSystem with type={}", static_cast<u32>(type));
|
||||||
|
|
||||||
auto itr = filesystem_map.find(type);
|
auto itr = filesystem_map.find(type);
|
||||||
if (itr == filesystem_map.end()) {
|
if (itr == filesystem_map.end()) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ private:
|
||||||
const s64 offset = rp.Pop<s64>();
|
const s64 offset = rp.Pop<s64>();
|
||||||
const s64 length = rp.Pop<s64>();
|
const s64 length = rp.Pop<s64>();
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "called, offset=0x%ld, length=0x%ld", offset, length);
|
NGLOG_DEBUG(Service_FS, "called, offset={:#X}, length={}", offset, length);
|
||||||
|
|
||||||
// Error checking
|
// Error checking
|
||||||
if (length < 0) {
|
if (length < 0) {
|
||||||
|
@ -87,7 +87,7 @@ private:
|
||||||
const s64 offset = rp.Pop<s64>();
|
const s64 offset = rp.Pop<s64>();
|
||||||
const s64 length = rp.Pop<s64>();
|
const s64 length = rp.Pop<s64>();
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "called, offset=0x%ld, length=0x%ld", offset, length);
|
NGLOG_DEBUG(Service_FS, "called, offset={:#X}, length={}", offset, length);
|
||||||
|
|
||||||
// Error checking
|
// Error checking
|
||||||
if (length < 0) {
|
if (length < 0) {
|
||||||
|
@ -124,7 +124,7 @@ private:
|
||||||
const s64 offset = rp.Pop<s64>();
|
const s64 offset = rp.Pop<s64>();
|
||||||
const s64 length = rp.Pop<s64>();
|
const s64 length = rp.Pop<s64>();
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "called, offset=0x%ld, length=0x%ld", offset, length);
|
NGLOG_DEBUG(Service_FS, "called, offset={:#X}, length={}", offset, length);
|
||||||
|
|
||||||
// Error checking
|
// Error checking
|
||||||
if (length < 0) {
|
if (length < 0) {
|
||||||
|
@ -152,7 +152,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void Flush(Kernel::HLERequestContext& ctx) {
|
void Flush(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_FS, "called");
|
NGLOG_DEBUG(Service_FS, "called");
|
||||||
backend->Flush();
|
backend->Flush();
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
@ -163,7 +163,7 @@ private:
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const u64 size = rp.Pop<u64>();
|
const u64 size = rp.Pop<u64>();
|
||||||
backend->SetSize(size);
|
backend->SetSize(size);
|
||||||
LOG_DEBUG(Service_FS, "called, size=%" PRIu64, size);
|
NGLOG_DEBUG(Service_FS, "called, size={}", size);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
@ -171,7 +171,7 @@ private:
|
||||||
|
|
||||||
void GetSize(Kernel::HLERequestContext& ctx) {
|
void GetSize(Kernel::HLERequestContext& ctx) {
|
||||||
const u64 size = backend->GetSize();
|
const u64 size = backend->GetSize();
|
||||||
LOG_DEBUG(Service_FS, "called, size=%" PRIu64, size);
|
NGLOG_DEBUG(Service_FS, "called, size={}", size);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 4};
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
@ -197,7 +197,7 @@ private:
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const u64 unk = rp.Pop<u64>();
|
const u64 unk = rp.Pop<u64>();
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "called, unk=0x%llx", unk);
|
NGLOG_DEBUG(Service_FS, "called, unk={:#X}", unk);
|
||||||
|
|
||||||
// Calculate how many entries we can fit in the output buffer
|
// Calculate how many entries we can fit in the output buffer
|
||||||
u64 count_entries = ctx.GetWriteBufferSize() / sizeof(FileSys::Entry);
|
u64 count_entries = ctx.GetWriteBufferSize() / sizeof(FileSys::Entry);
|
||||||
|
@ -219,7 +219,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetEntryCount(Kernel::HLERequestContext& ctx) {
|
void GetEntryCount(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_FS, "called");
|
NGLOG_DEBUG(Service_FS, "called");
|
||||||
|
|
||||||
u64 count = backend->GetEntryCount();
|
u64 count = backend->GetEntryCount();
|
||||||
|
|
||||||
|
@ -265,8 +265,7 @@ public:
|
||||||
u64 mode = rp.Pop<u64>();
|
u64 mode = rp.Pop<u64>();
|
||||||
u32 size = rp.Pop<u32>();
|
u32 size = rp.Pop<u32>();
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "called file %s mode 0x%" PRIX64 " size 0x%08X", name.c_str(), mode,
|
NGLOG_DEBUG(Service_FS, "called file {} mode {:#X} size {:#010X}", name, mode, size);
|
||||||
size);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(backend->CreateFile(name, size));
|
rb.Push(backend->CreateFile(name, size));
|
||||||
|
@ -280,7 +279,7 @@ public:
|
||||||
|
|
||||||
std::string name(file_buffer.begin(), end);
|
std::string name(file_buffer.begin(), end);
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "called file %s", name.c_str());
|
NGLOG_DEBUG(Service_FS, "called file {}", name);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(backend->DeleteFile(name));
|
rb.Push(backend->DeleteFile(name));
|
||||||
|
@ -294,7 +293,7 @@ public:
|
||||||
|
|
||||||
std::string name(file_buffer.begin(), end);
|
std::string name(file_buffer.begin(), end);
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "called directory %s", name.c_str());
|
NGLOG_DEBUG(Service_FS, "called directory {}", name);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(backend->CreateDirectory(name));
|
rb.Push(backend->CreateDirectory(name));
|
||||||
|
@ -314,7 +313,7 @@ public:
|
||||||
end = std::find(buffer.begin(), buffer.end(), '\0');
|
end = std::find(buffer.begin(), buffer.end(), '\0');
|
||||||
std::string dst_name(buffer.begin(), end);
|
std::string dst_name(buffer.begin(), end);
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "called file '%s' to file '%s'", src_name.c_str(), dst_name.c_str());
|
NGLOG_DEBUG(Service_FS, "called file '{}' to file '{}'", src_name, dst_name);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(backend->RenameFile(src_name, dst_name));
|
rb.Push(backend->RenameFile(src_name, dst_name));
|
||||||
|
@ -330,7 +329,7 @@ public:
|
||||||
|
|
||||||
auto mode = static_cast<FileSys::Mode>(rp.Pop<u32>());
|
auto mode = static_cast<FileSys::Mode>(rp.Pop<u32>());
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "called file %s mode %u", name.c_str(), static_cast<u32>(mode));
|
NGLOG_DEBUG(Service_FS, "called file {} mode {}", name, static_cast<u32>(mode));
|
||||||
|
|
||||||
auto result = backend->OpenFile(name, mode);
|
auto result = backend->OpenFile(name, mode);
|
||||||
if (result.Failed()) {
|
if (result.Failed()) {
|
||||||
|
@ -357,7 +356,7 @@ public:
|
||||||
// TODO(Subv): Implement this filter.
|
// TODO(Subv): Implement this filter.
|
||||||
u32 filter_flags = rp.Pop<u32>();
|
u32 filter_flags = rp.Pop<u32>();
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "called directory %s filter %u", name.c_str(), filter_flags);
|
NGLOG_DEBUG(Service_FS, "called directory {} filter {}", name, filter_flags);
|
||||||
|
|
||||||
auto result = backend->OpenDirectory(name);
|
auto result = backend->OpenDirectory(name);
|
||||||
if (result.Failed()) {
|
if (result.Failed()) {
|
||||||
|
@ -381,7 +380,7 @@ public:
|
||||||
|
|
||||||
std::string name(file_buffer.begin(), end);
|
std::string name(file_buffer.begin(), end);
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "called file %s", name.c_str());
|
NGLOG_DEBUG(Service_FS, "called file {}", name);
|
||||||
|
|
||||||
auto result = backend->GetEntryType(name);
|
auto result = backend->GetEntryType(name);
|
||||||
if (result.Failed()) {
|
if (result.Failed()) {
|
||||||
|
@ -396,7 +395,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void Commit(Kernel::HLERequestContext& ctx) {
|
void Commit(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_FS, "(STUBBED) called");
|
NGLOG_WARNING(Service_FS, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
@ -512,14 +511,14 @@ void FSP_SRV::TryLoadRomFS() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSP_SRV::Initialize(Kernel::HLERequestContext& ctx) {
|
void FSP_SRV::Initialize(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_FS, "(STUBBED) called");
|
NGLOG_WARNING(Service_FS, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSP_SRV::MountSdCard(Kernel::HLERequestContext& ctx) {
|
void FSP_SRV::MountSdCard(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_FS, "called");
|
NGLOG_DEBUG(Service_FS, "called");
|
||||||
|
|
||||||
FileSys::Path unused;
|
FileSys::Path unused;
|
||||||
auto filesystem = OpenFileSystem(Type::SDMC, unused).Unwrap();
|
auto filesystem = OpenFileSystem(Type::SDMC, unused).Unwrap();
|
||||||
|
@ -536,14 +535,14 @@ void FSP_SRV::CreateSaveData(Kernel::HLERequestContext& ctx) {
|
||||||
auto save_create_struct = rp.PopRaw<std::array<u8, 0x40>>();
|
auto save_create_struct = rp.PopRaw<std::array<u8, 0x40>>();
|
||||||
u128 uid = rp.PopRaw<u128>();
|
u128 uid = rp.PopRaw<u128>();
|
||||||
|
|
||||||
LOG_WARNING(Service_FS, "(STUBBED) called uid = %016" PRIX64 "%016" PRIX64, uid[1], uid[0]);
|
NGLOG_WARNING(Service_FS, "(STUBBED) called uid = {:016X}{:016X}", uid[1], uid[0]);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) {
|
void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_FS, "(STUBBED) called");
|
NGLOG_WARNING(Service_FS, "(STUBBED) called");
|
||||||
|
|
||||||
FileSys::Path unused;
|
FileSys::Path unused;
|
||||||
auto filesystem = OpenFileSystem(Type::SaveData, unused).Unwrap();
|
auto filesystem = OpenFileSystem(Type::SaveData, unused).Unwrap();
|
||||||
|
@ -554,7 +553,7 @@ void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {
|
void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_FS, "(STUBBED) called");
|
NGLOG_WARNING(Service_FS, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
@ -562,12 +561,12 @@ void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
|
void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_FS, "called");
|
NGLOG_DEBUG(Service_FS, "called");
|
||||||
|
|
||||||
TryLoadRomFS();
|
TryLoadRomFS();
|
||||||
if (!romfs) {
|
if (!romfs) {
|
||||||
// TODO (bunnei): Find the right error code to use here
|
// TODO (bunnei): Find the right error code to use here
|
||||||
LOG_CRITICAL(Service_FS, "no file system interface available!");
|
NGLOG_CRITICAL(Service_FS, "no file system interface available!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultCode(-1));
|
rb.Push(ResultCode(-1));
|
||||||
return;
|
return;
|
||||||
|
@ -576,7 +575,7 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
|
||||||
// Attempt to open a StorageBackend interface to the RomFS
|
// Attempt to open a StorageBackend interface to the RomFS
|
||||||
auto storage = romfs->OpenFile({}, {});
|
auto storage = romfs->OpenFile({}, {});
|
||||||
if (storage.Failed()) {
|
if (storage.Failed()) {
|
||||||
LOG_CRITICAL(Service_FS, "no storage interface available!");
|
NGLOG_CRITICAL(Service_FS, "no storage interface available!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(storage.Code());
|
rb.Push(storage.Code());
|
||||||
return;
|
return;
|
||||||
|
@ -588,7 +587,7 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSP_SRV::OpenRomStorage(Kernel::HLERequestContext& ctx) {
|
void FSP_SRV::OpenRomStorage(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_FS, "(STUBBED) called, using OpenDataStorageByCurrentProcess");
|
NGLOG_WARNING(Service_FS, "(STUBBED) called, using OpenDataStorageByCurrentProcess");
|
||||||
OpenDataStorageByCurrentProcess(ctx);
|
OpenDataStorageByCurrentProcess(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue