file-sys: Move logging macros over to the new fmt-capable ones
This commit is contained in:
parent
ea3151f475
commit
5aafc83cc9
8 changed files with 58 additions and 64 deletions
|
@ -80,19 +80,19 @@ ResultCode Disk_FileSystem::RenameFile(const std::string& src_path,
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode Disk_FileSystem::DeleteDirectory(const Path& path) const {
|
ResultCode Disk_FileSystem::DeleteDirectory(const Path& path) const {
|
||||||
LOG_WARNING(Service_FS, "(STUBBED) called");
|
NGLOG_WARNING(Service_FS, "(STUBBED) called");
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode Disk_FileSystem::DeleteDirectoryRecursively(const Path& path) const {
|
ResultCode Disk_FileSystem::DeleteDirectoryRecursively(const Path& path) const {
|
||||||
LOG_WARNING(Service_FS, "(STUBBED) called");
|
NGLOG_WARNING(Service_FS, "(STUBBED) called");
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode Disk_FileSystem::CreateFile(const std::string& path, u64 size) const {
|
ResultCode Disk_FileSystem::CreateFile(const std::string& path, u64 size) const {
|
||||||
LOG_WARNING(Service_FS, "(STUBBED) called");
|
NGLOG_WARNING(Service_FS, "(STUBBED) called");
|
||||||
|
|
||||||
std::string full_path = base_directory + path;
|
std::string full_path = base_directory + path;
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
|
@ -107,7 +107,7 @@ ResultCode Disk_FileSystem::CreateFile(const std::string& path, u64 size) const
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_ERROR(Service_FS, "Too large file");
|
NGLOG_ERROR(Service_FS, "Too large file");
|
||||||
// TODO(Subv): Find out the correct error code
|
// TODO(Subv): Find out the correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
@ -120,13 +120,13 @@ ResultCode Disk_FileSystem::CreateDirectory(const std::string& path) const {
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating %s", full_path.c_str());
|
NGLOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating {}", full_path);
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode Disk_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const {
|
ResultCode Disk_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const {
|
||||||
LOG_WARNING(Service_FS, "(STUBBED) called");
|
NGLOG_WARNING(Service_FS, "(STUBBED) called");
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> Disk_FileSystem::OpenDirectory(
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 Disk_FileSystem::GetFreeSpaceSize() const {
|
u64 Disk_FileSystem::GetFreeSpaceSize() const {
|
||||||
LOG_WARNING(Service_FS, "(STUBBED) called");
|
NGLOG_WARNING(Service_FS, "(STUBBED) called");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,14 +163,14 @@ ResultVal<FileSys::EntryType> Disk_FileSystem::GetEntryType(const std::string& p
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<size_t> Disk_Storage::Read(const u64 offset, const size_t length, u8* buffer) const {
|
ResultVal<size_t> Disk_Storage::Read(const u64 offset, const size_t length, u8* buffer) const {
|
||||||
LOG_TRACE(Service_FS, "called offset=%llu, length=%zu", offset, length);
|
NGLOG_TRACE(Service_FS, "called offset={}, length={}", offset, length);
|
||||||
file->Seek(offset, SEEK_SET);
|
file->Seek(offset, SEEK_SET);
|
||||||
return MakeResult<size_t>(file->ReadBytes(buffer, length));
|
return MakeResult<size_t>(file->ReadBytes(buffer, length));
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<size_t> Disk_Storage::Write(const u64 offset, const size_t length, const bool flush,
|
ResultVal<size_t> Disk_Storage::Write(const u64 offset, const size_t length, const bool flush,
|
||||||
const u8* buffer) const {
|
const u8* buffer) const {
|
||||||
LOG_WARNING(Service_FS, "(STUBBED) called");
|
NGLOG_WARNING(Service_FS, "(STUBBED) called");
|
||||||
file->Seek(offset, SEEK_SET);
|
file->Seek(offset, SEEK_SET);
|
||||||
size_t written = file->WriteBytes(buffer, length);
|
size_t written = file->WriteBytes(buffer, length);
|
||||||
if (flush) {
|
if (flush) {
|
||||||
|
@ -204,8 +204,7 @@ u64 Disk_Directory::Read(const u64 count, Entry* entries) {
|
||||||
const std::string& filename = file.virtualName;
|
const std::string& filename = file.virtualName;
|
||||||
Entry& entry = entries[entries_read];
|
Entry& entry = entries[entries_read];
|
||||||
|
|
||||||
LOG_TRACE(Service_FS, "File %s: size=%llu dir=%d", filename.c_str(), file.size,
|
NGLOG_TRACE(Service_FS, "File {}: size={} dir={}", filename, file.size, file.isDirectory);
|
||||||
file.isDirectory);
|
|
||||||
|
|
||||||
// TODO(Link Mauve): use a proper conversion to UTF-16.
|
// TODO(Link Mauve): use a proper conversion to UTF-16.
|
||||||
for (size_t j = 0; j < FILENAME_LENGTH; ++j) {
|
for (size_t j = 0; j < FILENAME_LENGTH; ++j) {
|
||||||
|
|
|
@ -71,7 +71,7 @@ std::string Path::AsString() const {
|
||||||
case Binary:
|
case Binary:
|
||||||
default:
|
default:
|
||||||
// TODO(yuriks): Add assert
|
// TODO(yuriks): Add assert
|
||||||
LOG_ERROR(Service_FS, "LowPathType cannot be converted to string!");
|
NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to string!");
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ std::u16string Path::AsU16Str() const {
|
||||||
case Invalid:
|
case Invalid:
|
||||||
case Binary:
|
case Binary:
|
||||||
// TODO(yuriks): Add assert
|
// TODO(yuriks): Add assert
|
||||||
LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
|
NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ std::vector<u8> Path::AsBinary() const {
|
||||||
case Invalid:
|
case Invalid:
|
||||||
default:
|
default:
|
||||||
// TODO(yuriks): Add assert
|
// TODO(yuriks): Add assert
|
||||||
LOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!");
|
NGLOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!");
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <cinttypes>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "common/file_util.h"
|
#include "common/file_util.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
|
@ -40,7 +39,7 @@ Loader::ResultStatus PartitionFilesystem::Load(const std::string& file_path, siz
|
||||||
|
|
||||||
Loader::ResultStatus result = Load(file_data);
|
Loader::ResultStatus result = Load(file_data);
|
||||||
if (result != Loader::ResultStatus::Success)
|
if (result != Loader::ResultStatus::Success)
|
||||||
LOG_ERROR(Service_FS, "Failed to load PFS from file %s!", file_path.c_str());
|
NGLOG_ERROR(Service_FS, "Failed to load PFS from file {}!", file_path);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <cinttypes>
|
|
||||||
#include "common/file_util.h"
|
#include "common/file_util.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/file_sys/program_metadata.h"
|
#include "core/file_sys/program_metadata.h"
|
||||||
|
@ -22,7 +21,7 @@ Loader::ResultStatus ProgramMetadata::Load(const std::string& file_path) {
|
||||||
|
|
||||||
Loader::ResultStatus result = Load(file_data);
|
Loader::ResultStatus result = Load(file_data);
|
||||||
if (result != Loader::ResultStatus::Success)
|
if (result != Loader::ResultStatus::Success)
|
||||||
LOG_ERROR(Service_FS, "Failed to load NPDM from file %s!", file_path.c_str());
|
NGLOG_ERROR(Service_FS, "Failed to load NPDM from file {}!", file_path);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -77,13 +76,13 @@ u64 ProgramMetadata::GetFilesystemPermissions() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgramMetadata::Print() const {
|
void ProgramMetadata::Print() const {
|
||||||
LOG_DEBUG(Service_FS, "Magic: %.4s", npdm_header.magic.data());
|
NGLOG_DEBUG(Service_FS, "Magic: {:.4}", npdm_header.magic.data());
|
||||||
LOG_DEBUG(Service_FS, "Main thread priority: 0x%02x", npdm_header.main_thread_priority);
|
NGLOG_DEBUG(Service_FS, "Main thread priority: {:#04X}", npdm_header.main_thread_priority);
|
||||||
LOG_DEBUG(Service_FS, "Main thread core: %u", npdm_header.main_thread_cpu);
|
NGLOG_DEBUG(Service_FS, "Main thread core: {}", npdm_header.main_thread_cpu);
|
||||||
LOG_DEBUG(Service_FS, "Main thread stack size: 0x%x bytes", npdm_header.main_stack_size);
|
NGLOG_DEBUG(Service_FS, "Main thread stack size: {:#X} bytes", npdm_header.main_stack_size);
|
||||||
LOG_DEBUG(Service_FS, "Process category: %u", npdm_header.process_category);
|
NGLOG_DEBUG(Service_FS, "Process category: {}", npdm_header.process_category);
|
||||||
LOG_DEBUG(Service_FS, "Flags: %02x", npdm_header.flags);
|
NGLOG_DEBUG(Service_FS, "Flags: {:02X}", npdm_header.flags);
|
||||||
LOG_DEBUG(Service_FS, " > 64-bit instructions: %s",
|
NGLOG_DEBUG(Service_FS, " > 64-bit instructions: {}",
|
||||||
npdm_header.has_64_bit_instructions ? "YES" : "NO");
|
npdm_header.has_64_bit_instructions ? "YES" : "NO");
|
||||||
|
|
||||||
auto address_space = "Unknown";
|
auto address_space = "Unknown";
|
||||||
|
@ -96,19 +95,19 @@ void ProgramMetadata::Print() const {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, " > Address space: %s\n", address_space);
|
NGLOG_DEBUG(Service_FS, " > Address space: {}\n", address_space);
|
||||||
|
|
||||||
// Begin ACID printing (potential perms, signed)
|
// Begin ACID printing (potential perms, signed)
|
||||||
LOG_DEBUG(Service_FS, "Magic: %.4s", acid_header.magic.data());
|
NGLOG_DEBUG(Service_FS, "Magic: {:.4}", acid_header.magic.data());
|
||||||
LOG_DEBUG(Service_FS, "Flags: %02x", acid_header.flags);
|
NGLOG_DEBUG(Service_FS, "Flags: {:02X}", acid_header.flags);
|
||||||
LOG_DEBUG(Service_FS, " > Is Retail: %s", acid_header.is_retail ? "YES" : "NO");
|
NGLOG_DEBUG(Service_FS, " > Is Retail: {}", acid_header.is_retail ? "YES" : "NO");
|
||||||
LOG_DEBUG(Service_FS, "Title ID Min: %016" PRIX64, acid_header.title_id_min);
|
NGLOG_DEBUG(Service_FS, "Title ID Min: {:016X}", acid_header.title_id_min);
|
||||||
LOG_DEBUG(Service_FS, "Title ID Max: %016" PRIX64, acid_header.title_id_max);
|
NGLOG_DEBUG(Service_FS, "Title ID Max: {:016X}", acid_header.title_id_max);
|
||||||
LOG_DEBUG(Service_FS, "Filesystem Access: %016" PRIX64 "\n", acid_file_access.permissions);
|
NGLOG_DEBUG(Service_FS, "Filesystem Access: {:016X}\n", acid_file_access.permissions);
|
||||||
|
|
||||||
// Begin ACI0 printing (actual perms, unsigned)
|
// Begin ACI0 printing (actual perms, unsigned)
|
||||||
LOG_DEBUG(Service_FS, "Magic: %.4s", aci_header.magic.data());
|
NGLOG_DEBUG(Service_FS, "Magic: {:.4}", aci_header.magic.data());
|
||||||
LOG_DEBUG(Service_FS, "Title ID: %016" PRIX64, aci_header.title_id);
|
NGLOG_DEBUG(Service_FS, "Title ID: {:016X}", aci_header.title_id);
|
||||||
LOG_DEBUG(Service_FS, "Filesystem Access: %016" PRIX64 "\n", aci_file_access.permissions);
|
NGLOG_DEBUG(Service_FS, "Filesystem Access: {:016X}\n", aci_file_access.permissions);
|
||||||
}
|
}
|
||||||
} // namespace FileSys
|
} // namespace FileSys
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace FileSys {
|
||||||
RomFS_Factory::RomFS_Factory(Loader::AppLoader& app_loader) {
|
RomFS_Factory::RomFS_Factory(Loader::AppLoader& app_loader) {
|
||||||
// Load the RomFS from the app
|
// Load the RomFS from the app
|
||||||
if (Loader::ResultStatus::Success != app_loader.ReadRomFS(romfs_file, data_offset, data_size)) {
|
if (Loader::ResultStatus::Success != app_loader.ReadRomFS(romfs_file, data_offset, data_size)) {
|
||||||
LOG_ERROR(Service_FS, "Unable to read RomFS!");
|
NGLOG_ERROR(Service_FS, "Unable to read RomFS!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,13 +24,13 @@ ResultVal<std::unique_ptr<FileSystemBackend>> RomFS_Factory::Open(const Path& pa
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode RomFS_Factory::Format(const Path& path) {
|
ResultCode RomFS_Factory::Format(const Path& path) {
|
||||||
LOG_ERROR(Service_FS, "Unimplemented Format archive %s", GetName().c_str());
|
NGLOG_ERROR(Service_FS, "Unimplemented Format archive {}", GetName());
|
||||||
// TODO(bunnei): Find the right error code for this
|
// TODO(bunnei): Find the right error code for this
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<ArchiveFormatInfo> RomFS_Factory::GetFormatInfo(const Path& path) const {
|
ResultVal<ArchiveFormatInfo> RomFS_Factory::GetFormatInfo(const Path& path) const {
|
||||||
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str());
|
NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
||||||
// TODO(bunnei): Find the right error code for this
|
// TODO(bunnei): Find the right error code for this
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,74 +21,72 @@ ResultVal<std::unique_ptr<StorageBackend>> RomFS_FileSystem::OpenFile(const std:
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode RomFS_FileSystem::DeleteFile(const std::string& path) const {
|
ResultCode RomFS_FileSystem::DeleteFile(const std::string& path) const {
|
||||||
LOG_CRITICAL(Service_FS, "Attempted to delete a file from an ROMFS archive (%s).",
|
NGLOG_CRITICAL(Service_FS, "Attempted to delete a file from an ROMFS archive ({}).", GetName());
|
||||||
GetName().c_str());
|
|
||||||
// TODO(bunnei): Use correct error code
|
// TODO(bunnei): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode RomFS_FileSystem::RenameFile(const std::string& src_path,
|
ResultCode RomFS_FileSystem::RenameFile(const std::string& src_path,
|
||||||
const std::string& dest_path) const {
|
const std::string& dest_path) const {
|
||||||
LOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive (%s).",
|
NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive ({}).",
|
||||||
GetName().c_str());
|
GetName());
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode RomFS_FileSystem::DeleteDirectory(const Path& path) const {
|
ResultCode RomFS_FileSystem::DeleteDirectory(const Path& path) const {
|
||||||
LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive (%s).",
|
NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive ({}).",
|
||||||
GetName().c_str());
|
GetName());
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode RomFS_FileSystem::DeleteDirectoryRecursively(const Path& path) const {
|
ResultCode RomFS_FileSystem::DeleteDirectoryRecursively(const Path& path) const {
|
||||||
LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive (%s).",
|
NGLOG_CRITICAL(Service_FS, "Attempted to delete a directory from an ROMFS archive ({}).",
|
||||||
GetName().c_str());
|
GetName());
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode RomFS_FileSystem::CreateFile(const std::string& path, u64 size) const {
|
ResultCode RomFS_FileSystem::CreateFile(const std::string& path, u64 size) const {
|
||||||
LOG_CRITICAL(Service_FS, "Attempted to create a file in an ROMFS archive (%s).",
|
NGLOG_CRITICAL(Service_FS, "Attempted to create a file in an ROMFS archive ({}).", GetName());
|
||||||
GetName().c_str());
|
|
||||||
// TODO(bunnei): Use correct error code
|
// TODO(bunnei): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode RomFS_FileSystem::CreateDirectory(const std::string& path) const {
|
ResultCode RomFS_FileSystem::CreateDirectory(const std::string& path) const {
|
||||||
LOG_CRITICAL(Service_FS, "Attempted to create a directory in an ROMFS archive (%s).",
|
NGLOG_CRITICAL(Service_FS, "Attempted to create a directory in an ROMFS archive ({}).",
|
||||||
GetName().c_str());
|
GetName());
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode RomFS_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const {
|
ResultCode RomFS_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const {
|
||||||
LOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive (%s).",
|
NGLOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive ({}).",
|
||||||
GetName().c_str());
|
GetName());
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<std::unique_ptr<DirectoryBackend>> RomFS_FileSystem::OpenDirectory(
|
ResultVal<std::unique_ptr<DirectoryBackend>> RomFS_FileSystem::OpenDirectory(
|
||||||
const std::string& path) const {
|
const std::string& path) const {
|
||||||
LOG_WARNING(Service_FS, "Opening Directory in a ROMFS archive");
|
NGLOG_WARNING(Service_FS, "Opening Directory in a ROMFS archive");
|
||||||
return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<ROMFSDirectory>());
|
return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<ROMFSDirectory>());
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 RomFS_FileSystem::GetFreeSpaceSize() const {
|
u64 RomFS_FileSystem::GetFreeSpaceSize() const {
|
||||||
LOG_WARNING(Service_FS, "Attempted to get the free space in an ROMFS archive");
|
NGLOG_WARNING(Service_FS, "Attempted to get the free space in an ROMFS archive");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<FileSys::EntryType> RomFS_FileSystem::GetEntryType(const std::string& path) const {
|
ResultVal<FileSys::EntryType> RomFS_FileSystem::GetEntryType(const std::string& path) const {
|
||||||
LOG_CRITICAL(Service_FS, "Called within an ROMFS archive (path %s).", path.c_str());
|
NGLOG_CRITICAL(Service_FS, "Called within an ROMFS archive (path {}).", path);
|
||||||
// TODO(wwylele): Use correct error code
|
// TODO(wwylele): Use correct error code
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<size_t> RomFS_Storage::Read(const u64 offset, const size_t length, u8* buffer) const {
|
ResultVal<size_t> RomFS_Storage::Read(const u64 offset, const size_t length, u8* buffer) const {
|
||||||
LOG_TRACE(Service_FS, "called offset=%llu, length=%zu", offset, length);
|
NGLOG_TRACE(Service_FS, "called offset={}, length={}", offset, length);
|
||||||
romfs_file->Seek(data_offset + offset, SEEK_SET);
|
romfs_file->Seek(data_offset + offset, SEEK_SET);
|
||||||
size_t read_length = (size_t)std::min((u64)length, data_size - offset);
|
size_t read_length = (size_t)std::min((u64)length, data_size - offset);
|
||||||
|
|
||||||
|
@ -97,7 +95,7 @@ ResultVal<size_t> RomFS_Storage::Read(const u64 offset, const size_t length, u8*
|
||||||
|
|
||||||
ResultVal<size_t> RomFS_Storage::Write(const u64 offset, const size_t length, const bool flush,
|
ResultVal<size_t> RomFS_Storage::Write(const u64 offset, const size_t length, const bool flush,
|
||||||
const u8* buffer) const {
|
const u8* buffer) const {
|
||||||
LOG_ERROR(Service_FS, "Attempted to write to ROMFS file");
|
NGLOG_ERROR(Service_FS, "Attempted to write to ROMFS file");
|
||||||
// TODO(Subv): Find error code
|
// TODO(Subv): Find error code
|
||||||
return MakeResult<size_t>(0);
|
return MakeResult<size_t>(0);
|
||||||
}
|
}
|
||||||
|
@ -107,7 +105,7 @@ u64 RomFS_Storage::GetSize() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RomFS_Storage::SetSize(const u64 size) const {
|
bool RomFS_Storage::SetSize(const u64 size) const {
|
||||||
LOG_ERROR(Service_FS, "Attempted to set the size of an ROMFS file");
|
NGLOG_ERROR(Service_FS, "Attempted to set the size of an ROMFS file");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ ResultVal<std::unique_ptr<FileSystemBackend>> SaveData_Factory::Open(const Path&
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode SaveData_Factory::Format(const Path& path) {
|
ResultCode SaveData_Factory::Format(const Path& path) {
|
||||||
LOG_WARNING(Service_FS, "Format archive %s", GetName().c_str());
|
NGLOG_WARNING(Service_FS, "Format archive {}", GetName());
|
||||||
// Create the save data directory.
|
// Create the save data directory.
|
||||||
if (!FileUtil::CreateFullPath(GetFullPath())) {
|
if (!FileUtil::CreateFullPath(GetFullPath())) {
|
||||||
// TODO(Subv): Find the correct error code.
|
// TODO(Subv): Find the correct error code.
|
||||||
|
@ -41,7 +41,7 @@ ResultCode SaveData_Factory::Format(const Path& path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<ArchiveFormatInfo> SaveData_Factory::GetFormatInfo(const Path& path) const {
|
ResultVal<ArchiveFormatInfo> SaveData_Factory::GetFormatInfo(const Path& path) const {
|
||||||
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str());
|
NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
||||||
// TODO(bunnei): Find the right error code for this
|
// TODO(bunnei): Find the right error code for this
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <cinttypes>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
|
@ -26,13 +25,13 @@ ResultVal<std::unique_ptr<FileSystemBackend>> SDMC_Factory::Open(const Path& pat
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode SDMC_Factory::Format(const Path& path) {
|
ResultCode SDMC_Factory::Format(const Path& path) {
|
||||||
LOG_ERROR(Service_FS, "Unimplemented Format archive %s", GetName().c_str());
|
NGLOG_ERROR(Service_FS, "Unimplemented Format archive {}", GetName());
|
||||||
// TODO(Subv): Find the right error code for this
|
// TODO(Subv): Find the right error code for this
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<ArchiveFormatInfo> SDMC_Factory::GetFormatInfo(const Path& path) const {
|
ResultVal<ArchiveFormatInfo> SDMC_Factory::GetFormatInfo(const Path& path) const {
|
||||||
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str());
|
NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
|
||||||
// TODO(bunnei): Find the right error code for this
|
// TODO(bunnei): Find the right error code for this
|
||||||
return ResultCode(-1);
|
return ResultCode(-1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue