From b5b613ea29d7d6d2ea2c11396c6464078082c62d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 24 Apr 2018 10:20:50 -0400 Subject: filesystem: Move logging macros over to new fmt-compatible ones --- src/core/hle/service/filesystem/filesystem.cpp | 8 ++-- src/core/hle/service/filesystem/fsp_srv.cpp | 51 +++++++++++++------------- 2 files changed, 29 insertions(+), 30 deletions(-) (limited to 'src/core/hle') diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index 9e504992f..c2951c560 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp @@ -25,14 +25,14 @@ ResultCode RegisterFileSystem(std::unique_ptr&& fact ASSERT_MSG(inserted, "Tried to register more than one system with same id code"); auto& filesystem = result.first->second; - LOG_DEBUG(Service_FS, "Registered file system %s with id code 0x%08X", - filesystem->GetName().c_str(), static_cast(type)); + NGLOG_DEBUG(Service_FS, "Registered file system {} with id code {:#010X}", + filesystem->GetName(), static_cast(type)); return RESULT_SUCCESS; } ResultVal> OpenFileSystem(Type type, FileSys::Path& path) { - LOG_TRACE(Service_FS, "Opening FileSystem with type=%d", type); + NGLOG_TRACE(Service_FS, "Opening FileSystem with type={}", static_cast(type)); auto itr = filesystem_map.find(type); if (itr == filesystem_map.end()) { @@ -44,7 +44,7 @@ ResultVal> OpenFileSystem(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(type)); auto itr = filesystem_map.find(type); if (itr == filesystem_map.end()) { diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 02e270f26..ed9f2ef72 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -35,7 +35,7 @@ private: const s64 offset = rp.Pop(); const s64 length = rp.Pop(); - 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 if (length < 0) { @@ -87,7 +87,7 @@ private: const s64 offset = rp.Pop(); const s64 length = rp.Pop(); - 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 if (length < 0) { @@ -124,7 +124,7 @@ private: const s64 offset = rp.Pop(); const s64 length = rp.Pop(); - 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 if (length < 0) { @@ -152,7 +152,7 @@ private: } void Flush(Kernel::HLERequestContext& ctx) { - LOG_DEBUG(Service_FS, "called"); + NGLOG_DEBUG(Service_FS, "called"); backend->Flush(); IPC::ResponseBuilder rb{ctx, 2}; @@ -163,7 +163,7 @@ private: IPC::RequestParser rp{ctx}; const u64 size = rp.Pop(); backend->SetSize(size); - LOG_DEBUG(Service_FS, "called, size=%" PRIu64, size); + NGLOG_DEBUG(Service_FS, "called, size={}", size); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); @@ -171,7 +171,7 @@ private: void GetSize(Kernel::HLERequestContext& ctx) { 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}; rb.Push(RESULT_SUCCESS); @@ -197,7 +197,7 @@ private: IPC::RequestParser rp{ctx}; const u64 unk = rp.Pop(); - 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 u64 count_entries = ctx.GetWriteBufferSize() / sizeof(FileSys::Entry); @@ -219,7 +219,7 @@ private: } void GetEntryCount(Kernel::HLERequestContext& ctx) { - LOG_DEBUG(Service_FS, "called"); + NGLOG_DEBUG(Service_FS, "called"); u64 count = backend->GetEntryCount(); @@ -265,8 +265,7 @@ public: u64 mode = rp.Pop(); u32 size = rp.Pop(); - LOG_DEBUG(Service_FS, "called file %s mode 0x%" PRIX64 " size 0x%08X", name.c_str(), mode, - size); + NGLOG_DEBUG(Service_FS, "called file {} mode {:#X} size {:#010X}", name, mode, size); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(backend->CreateFile(name, size)); @@ -280,7 +279,7 @@ public: 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}; rb.Push(backend->DeleteFile(name)); @@ -294,7 +293,7 @@ public: 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}; rb.Push(backend->CreateDirectory(name)); @@ -314,7 +313,7 @@ public: end = std::find(buffer.begin(), buffer.end(), '\0'); 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}; rb.Push(backend->RenameFile(src_name, dst_name)); @@ -330,7 +329,7 @@ public: auto mode = static_cast(rp.Pop()); - LOG_DEBUG(Service_FS, "called file %s mode %u", name.c_str(), static_cast(mode)); + NGLOG_DEBUG(Service_FS, "called file {} mode {}", name, static_cast(mode)); auto result = backend->OpenFile(name, mode); if (result.Failed()) { @@ -357,7 +356,7 @@ public: // TODO(Subv): Implement this filter. u32 filter_flags = rp.Pop(); - 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); if (result.Failed()) { @@ -381,7 +380,7 @@ public: 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); if (result.Failed()) { @@ -396,7 +395,7 @@ public: } void Commit(Kernel::HLERequestContext& ctx) { - LOG_WARNING(Service_FS, "(STUBBED) called"); + NGLOG_WARNING(Service_FS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); @@ -512,14 +511,14 @@ void FSP_SRV::TryLoadRomFS() { } void FSP_SRV::Initialize(Kernel::HLERequestContext& ctx) { - LOG_WARNING(Service_FS, "(STUBBED) called"); + NGLOG_WARNING(Service_FS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } void FSP_SRV::MountSdCard(Kernel::HLERequestContext& ctx) { - LOG_DEBUG(Service_FS, "called"); + NGLOG_DEBUG(Service_FS, "called"); FileSys::Path unused; auto filesystem = OpenFileSystem(Type::SDMC, unused).Unwrap(); @@ -536,14 +535,14 @@ void FSP_SRV::CreateSaveData(Kernel::HLERequestContext& ctx) { auto save_create_struct = rp.PopRaw>(); u128 uid = rp.PopRaw(); - 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}; rb.Push(RESULT_SUCCESS); } void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) { - LOG_WARNING(Service_FS, "(STUBBED) called"); + NGLOG_WARNING(Service_FS, "(STUBBED) called"); FileSys::Path unused; 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) { - LOG_WARNING(Service_FS, "(STUBBED) called"); + NGLOG_WARNING(Service_FS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); @@ -562,12 +561,12 @@ void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) { } void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) { - LOG_DEBUG(Service_FS, "called"); + NGLOG_DEBUG(Service_FS, "called"); TryLoadRomFS(); if (!romfs) { // 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}; rb.Push(ResultCode(-1)); return; @@ -576,7 +575,7 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) { // Attempt to open a StorageBackend interface to the RomFS auto storage = romfs->OpenFile({}, {}); if (storage.Failed()) { - LOG_CRITICAL(Service_FS, "no storage interface available!"); + NGLOG_CRITICAL(Service_FS, "no storage interface available!"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(storage.Code()); return; @@ -588,7 +587,7 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(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); } -- cgit v1.2.3