summaryrefslogtreecommitdiff
path: root/src/core/file_sys
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/archive.h12
-rw-r--r--src/core/file_sys/archive_romfs.cpp18
-rw-r--r--src/core/file_sys/archive_sdmc.cpp18
-rw-r--r--src/core/file_sys/directory_sdmc.cpp2
-rw-r--r--src/core/file_sys/file_sdmc.cpp2
5 files changed, 28 insertions, 24 deletions
diff --git a/src/core/file_sys/archive.h b/src/core/file_sys/archive.h
index f3cb11133..27ed23cd0 100644
--- a/src/core/file_sys/archive.h
+++ b/src/core/file_sys/archive.h
@@ -100,7 +100,8 @@ public:
100 case Wchar: 100 case Wchar:
101 return "[Wchar: " + AsString() + ']'; 101 return "[Wchar: " + AsString() + ']';
102 default: 102 default:
103 ERROR_LOG(KERNEL, "LowPathType cannot be converted to string!"); 103 // TODO(yuriks): Add assert
104 LOG_ERROR(Service_FS, "LowPathType cannot be converted to string!");
104 return {}; 105 return {};
105 } 106 }
106 } 107 }
@@ -114,7 +115,8 @@ public:
114 case Empty: 115 case Empty:
115 return {}; 116 return {};
116 default: 117 default:
117 ERROR_LOG(KERNEL, "LowPathType cannot be converted to string!"); 118 // TODO(yuriks): Add assert
119 LOG_ERROR(Service_FS, "LowPathType cannot be converted to string!");
118 return {}; 120 return {};
119 } 121 }
120 } 122 }
@@ -128,7 +130,8 @@ public:
128 case Empty: 130 case Empty:
129 return {}; 131 return {};
130 default: 132 default:
131 ERROR_LOG(KERNEL, "LowPathType cannot be converted to u16string!"); 133 // TODO(yuriks): Add assert
134 LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
132 return {}; 135 return {};
133 } 136 }
134 } 137 }
@@ -144,7 +147,8 @@ public:
144 case Empty: 147 case Empty:
145 return {}; 148 return {};
146 default: 149 default:
147 ERROR_LOG(KERNEL, "LowPathType cannot be converted to binary!"); 150 // TODO(yuriks): Add assert
151 LOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!");
148 return {}; 152 return {};
149 } 153 }
150 } 154 }
diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp
index 8c2dbeda5..74974c2df 100644
--- a/src/core/file_sys/archive_romfs.cpp
+++ b/src/core/file_sys/archive_romfs.cpp
@@ -16,7 +16,7 @@ namespace FileSys {
16Archive_RomFS::Archive_RomFS(const Loader::AppLoader& app_loader) { 16Archive_RomFS::Archive_RomFS(const Loader::AppLoader& app_loader) {
17 // Load the RomFS from the app 17 // Load the RomFS from the app
18 if (Loader::ResultStatus::Success != app_loader.ReadRomFS(raw_data)) { 18 if (Loader::ResultStatus::Success != app_loader.ReadRomFS(raw_data)) {
19 WARN_LOG(FILESYS, "Unable to read RomFS!"); 19 LOG_ERROR(Service_FS, "Unable to read RomFS!");
20 } 20 }
21} 21}
22 22
@@ -39,12 +39,12 @@ std::unique_ptr<File> Archive_RomFS::OpenFile(const Path& path, const Mode mode)
39 * @return Whether the file could be deleted 39 * @return Whether the file could be deleted
40 */ 40 */
41bool Archive_RomFS::DeleteFile(const FileSys::Path& path) const { 41bool Archive_RomFS::DeleteFile(const FileSys::Path& path) const {
42 ERROR_LOG(FILESYS, "Attempted to delete a file from ROMFS."); 42 LOG_WARNING(Service_FS, "Attempted to delete a file from ROMFS.");
43 return false; 43 return false;
44} 44}
45 45
46bool Archive_RomFS::RenameFile(const FileSys::Path& src_path, const FileSys::Path& dest_path) const { 46bool Archive_RomFS::RenameFile(const FileSys::Path& src_path, const FileSys::Path& dest_path) const {
47 ERROR_LOG(FILESYS, "Attempted to rename a file within ROMFS."); 47 LOG_WARNING(Service_FS, "Attempted to rename a file within ROMFS.");
48 return false; 48 return false;
49} 49}
50 50
@@ -54,7 +54,7 @@ bool Archive_RomFS::RenameFile(const FileSys::Path& src_path, const FileSys::Pat
54 * @return Whether the directory could be deleted 54 * @return Whether the directory could be deleted
55 */ 55 */
56bool Archive_RomFS::DeleteDirectory(const FileSys::Path& path) const { 56bool Archive_RomFS::DeleteDirectory(const FileSys::Path& path) const {
57 ERROR_LOG(FILESYS, "Attempted to delete a directory from ROMFS."); 57 LOG_WARNING(Service_FS, "Attempted to delete a directory from ROMFS.");
58 return false; 58 return false;
59} 59}
60 60
@@ -64,12 +64,12 @@ bool Archive_RomFS::DeleteDirectory(const FileSys::Path& path) const {
64 * @return Whether the directory could be created 64 * @return Whether the directory could be created
65 */ 65 */
66bool Archive_RomFS::CreateDirectory(const Path& path) const { 66bool Archive_RomFS::CreateDirectory(const Path& path) const {
67 ERROR_LOG(FILESYS, "Attempted to create a directory in ROMFS."); 67 LOG_WARNING(Service_FS, "Attempted to create a directory in ROMFS.");
68 return false; 68 return false;
69} 69}
70 70
71bool Archive_RomFS::RenameDirectory(const FileSys::Path& src_path, const FileSys::Path& dest_path) const { 71bool Archive_RomFS::RenameDirectory(const FileSys::Path& src_path, const FileSys::Path& dest_path) const {
72 ERROR_LOG(FILESYS, "Attempted to rename a file within ROMFS."); 72 LOG_WARNING(Service_FS, "Attempted to rename a file within ROMFS.");
73 return false; 73 return false;
74} 74}
75 75
@@ -90,7 +90,7 @@ std::unique_ptr<Directory> Archive_RomFS::OpenDirectory(const Path& path) const
90 * @return Number of bytes read 90 * @return Number of bytes read
91 */ 91 */
92size_t Archive_RomFS::Read(const u64 offset, const u32 length, u8* buffer) const { 92size_t Archive_RomFS::Read(const u64 offset, const u32 length, u8* buffer) const {
93 DEBUG_LOG(FILESYS, "called offset=%llu, length=%d", offset, length); 93 LOG_TRACE(Service_FS, "called offset=%llu, length=%d", offset, length);
94 memcpy(buffer, &raw_data[(u32)offset], length); 94 memcpy(buffer, &raw_data[(u32)offset], length);
95 return length; 95 return length;
96} 96}
@@ -104,7 +104,7 @@ size_t Archive_RomFS::Read(const u64 offset, const u32 length, u8* buffer) const
104 * @return Number of bytes written 104 * @return Number of bytes written
105 */ 105 */
106size_t Archive_RomFS::Write(const u64 offset, const u32 length, const u32 flush, u8* buffer) { 106size_t Archive_RomFS::Write(const u64 offset, const u32 length, const u32 flush, u8* buffer) {
107 ERROR_LOG(FILESYS, "Attempted to write to ROMFS."); 107 LOG_WARNING(Service_FS, "Attempted to write to ROMFS.");
108 return 0; 108 return 0;
109} 109}
110 110
@@ -120,7 +120,7 @@ size_t Archive_RomFS::GetSize() const {
120 * Set the size of the archive in bytes 120 * Set the size of the archive in bytes
121 */ 121 */
122void Archive_RomFS::SetSize(const u64 size) { 122void Archive_RomFS::SetSize(const u64 size) {
123 ERROR_LOG(FILESYS, "Attempted to set the size of ROMFS"); 123 LOG_WARNING(Service_FS, "Attempted to set the size of ROMFS");
124} 124}
125 125
126} // namespace FileSys 126} // namespace FileSys
diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp
index fc0b9b72d..9e524b60e 100644
--- a/src/core/file_sys/archive_sdmc.cpp
+++ b/src/core/file_sys/archive_sdmc.cpp
@@ -19,7 +19,7 @@ namespace FileSys {
19 19
20Archive_SDMC::Archive_SDMC(const std::string& mount_point) { 20Archive_SDMC::Archive_SDMC(const std::string& mount_point) {
21 this->mount_point = mount_point; 21 this->mount_point = mount_point;
22 DEBUG_LOG(FILESYS, "Directory %s set as SDMC.", mount_point.c_str()); 22 LOG_INFO(Service_FS, "Directory %s set as SDMC.", mount_point.c_str());
23} 23}
24 24
25Archive_SDMC::~Archive_SDMC() { 25Archive_SDMC::~Archive_SDMC() {
@@ -31,12 +31,12 @@ Archive_SDMC::~Archive_SDMC() {
31 */ 31 */
32bool Archive_SDMC::Initialize() { 32bool Archive_SDMC::Initialize() {
33 if (!Settings::values.use_virtual_sd) { 33 if (!Settings::values.use_virtual_sd) {
34 WARN_LOG(FILESYS, "SDMC disabled by config."); 34 LOG_WARNING(Service_FS, "SDMC disabled by config.");
35 return false; 35 return false;
36 } 36 }
37 37
38 if (!FileUtil::CreateFullPath(mount_point)) { 38 if (!FileUtil::CreateFullPath(mount_point)) {
39 WARN_LOG(FILESYS, "Unable to create SDMC path."); 39 LOG_ERROR(Service_FS, "Unable to create SDMC path.");
40 return false; 40 return false;
41 } 41 }
42 42
@@ -50,7 +50,7 @@ bool Archive_SDMC::Initialize() {
50 * @return Opened file, or nullptr 50 * @return Opened file, or nullptr
51 */ 51 */
52std::unique_ptr<File> Archive_SDMC::OpenFile(const Path& path, const Mode mode) const { 52std::unique_ptr<File> Archive_SDMC::OpenFile(const Path& path, const Mode mode) const {
53 DEBUG_LOG(FILESYS, "called path=%s mode=%u", path.DebugStr().c_str(), mode.hex); 53 LOG_DEBUG(Service_FS, "called path=%s mode=%u", path.DebugStr().c_str(), mode.hex);
54 File_SDMC* file = new File_SDMC(this, path, mode); 54 File_SDMC* file = new File_SDMC(this, path, mode);
55 if (!file->Open()) 55 if (!file->Open())
56 return nullptr; 56 return nullptr;
@@ -98,7 +98,7 @@ bool Archive_SDMC::RenameDirectory(const FileSys::Path& src_path, const FileSys:
98 * @return Opened directory, or nullptr 98 * @return Opened directory, or nullptr
99 */ 99 */
100std::unique_ptr<Directory> Archive_SDMC::OpenDirectory(const Path& path) const { 100std::unique_ptr<Directory> Archive_SDMC::OpenDirectory(const Path& path) const {
101 DEBUG_LOG(FILESYS, "called path=%s", path.DebugStr().c_str()); 101 LOG_DEBUG(Service_FS, "called path=%s", path.DebugStr().c_str());
102 Directory_SDMC* directory = new Directory_SDMC(this, path); 102 Directory_SDMC* directory = new Directory_SDMC(this, path);
103 if (!directory->Open()) 103 if (!directory->Open())
104 return nullptr; 104 return nullptr;
@@ -113,7 +113,7 @@ std::unique_ptr<Directory> Archive_SDMC::OpenDirectory(const Path& path) const {
113 * @return Number of bytes read 113 * @return Number of bytes read
114 */ 114 */
115size_t Archive_SDMC::Read(const u64 offset, const u32 length, u8* buffer) const { 115size_t Archive_SDMC::Read(const u64 offset, const u32 length, u8* buffer) const {
116 ERROR_LOG(FILESYS, "(UNIMPLEMENTED)"); 116 LOG_ERROR(Service_FS, "(UNIMPLEMENTED)");
117 return -1; 117 return -1;
118} 118}
119 119
@@ -126,7 +126,7 @@ size_t Archive_SDMC::Read(const u64 offset, const u32 length, u8* buffer) const
126 * @return Number of bytes written 126 * @return Number of bytes written
127 */ 127 */
128size_t Archive_SDMC::Write(const u64 offset, const u32 length, const u32 flush, u8* buffer) { 128size_t Archive_SDMC::Write(const u64 offset, const u32 length, const u32 flush, u8* buffer) {
129 ERROR_LOG(FILESYS, "(UNIMPLEMENTED)"); 129 LOG_ERROR(Service_FS, "(UNIMPLEMENTED)");
130 return -1; 130 return -1;
131} 131}
132 132
@@ -135,7 +135,7 @@ size_t Archive_SDMC::Write(const u64 offset, const u32 length, const u32 flush,
135 * @return Size of the archive in bytes 135 * @return Size of the archive in bytes
136 */ 136 */
137size_t Archive_SDMC::GetSize() const { 137size_t Archive_SDMC::GetSize() const {
138 ERROR_LOG(FILESYS, "(UNIMPLEMENTED)"); 138 LOG_ERROR(Service_FS, "(UNIMPLEMENTED)");
139 return 0; 139 return 0;
140} 140}
141 141
@@ -143,7 +143,7 @@ size_t Archive_SDMC::GetSize() const {
143 * Set the size of the archive in bytes 143 * Set the size of the archive in bytes
144 */ 144 */
145void Archive_SDMC::SetSize(const u64 size) { 145void Archive_SDMC::SetSize(const u64 size) {
146 ERROR_LOG(FILESYS, "(UNIMPLEMENTED)"); 146 LOG_ERROR(Service_FS, "(UNIMPLEMENTED)");
147} 147}
148 148
149/** 149/**
diff --git a/src/core/file_sys/directory_sdmc.cpp b/src/core/file_sys/directory_sdmc.cpp
index 0f156a127..519787641 100644
--- a/src/core/file_sys/directory_sdmc.cpp
+++ b/src/core/file_sys/directory_sdmc.cpp
@@ -49,7 +49,7 @@ u32 Directory_SDMC::Read(const u32 count, Entry* entries) {
49 const std::string& filename = file.virtualName; 49 const std::string& filename = file.virtualName;
50 Entry& entry = entries[entries_read]; 50 Entry& entry = entries[entries_read];
51 51
52 WARN_LOG(FILESYS, "File %s: size=%llu dir=%d", filename.c_str(), file.size, file.isDirectory); 52 LOG_TRACE(Service_FS, "File %s: size=%llu dir=%d", filename.c_str(), file.size, file.isDirectory);
53 53
54 // TODO(Link Mauve): use a proper conversion to UTF-16. 54 // TODO(Link Mauve): use a proper conversion to UTF-16.
55 for (size_t j = 0; j < FILENAME_LENGTH; ++j) { 55 for (size_t j = 0; j < FILENAME_LENGTH; ++j) {
diff --git a/src/core/file_sys/file_sdmc.cpp b/src/core/file_sys/file_sdmc.cpp
index b01d96e3d..46c29900b 100644
--- a/src/core/file_sys/file_sdmc.cpp
+++ b/src/core/file_sys/file_sdmc.cpp
@@ -33,7 +33,7 @@ File_SDMC::~File_SDMC() {
33 */ 33 */
34bool File_SDMC::Open() { 34bool File_SDMC::Open() {
35 if (!mode.create_flag && !FileUtil::Exists(path)) { 35 if (!mode.create_flag && !FileUtil::Exists(path)) {
36 ERROR_LOG(FILESYS, "Non-existing file %s can’t be open without mode create.", path.c_str()); 36 LOG_ERROR(Service_FS, "Non-existing file %s can’t be open without mode create.", path.c_str());
37 return false; 37 return false;
38 } 38 }
39 39