diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/filesystem/fsp_srv.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 48c45b1b4..2f476c869 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -14,8 +14,7 @@ #include "core/hle/service/filesystem/filesystem.h" #include "core/hle/service/filesystem/fsp_srv.h" -namespace Service { -namespace FileSystem { +namespace Service::FileSystem { class IStorage final : public ServiceFramework<IStorage> { public: @@ -73,7 +72,7 @@ public: : ServiceFramework("IFile"), backend(std::move(backend)) { static const FunctionInfo functions[] = { {0, &IFile::Read, "Read"}, {1, &IFile::Write, "Write"}, - {2, nullptr, "Flush"}, {3, &IFile::SetSize, "SetSize"}, + {2, &IFile::Flush, "Flush"}, {3, &IFile::SetSize, "SetSize"}, {4, &IFile::GetSize, "GetSize"}, {5, nullptr, "OperateRange"}, }; RegisterHandlers(functions); @@ -152,6 +151,14 @@ private: rb.Push(RESULT_SUCCESS); } + void Flush(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_FS, "called"); + backend->Flush(); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); + } + void SetSize(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u64 size = rp.Pop<u64>(); @@ -228,7 +235,7 @@ public: : ServiceFramework("IFileSystem"), backend(std::move(backend)) { static const FunctionInfo functions[] = { {0, &IFileSystem::CreateFile, "CreateFile"}, - {1, nullptr, "DeleteFile"}, + {1, &IFileSystem::DeleteFile, "DeleteFile"}, {2, &IFileSystem::CreateDirectory, "CreateDirectory"}, {3, nullptr, "DeleteDirectory"}, {4, nullptr, "DeleteDirectoryRecursively"}, @@ -265,6 +272,20 @@ public: rb.Push(backend->CreateFile(name, size)); } + void DeleteFile(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + + auto file_buffer = ctx.ReadBuffer(); + auto end = std::find(file_buffer.begin(), file_buffer.end(), '\0'); + + std::string name(file_buffer.begin(), end); + + LOG_DEBUG(Service_FS, "called file %s", name.c_str()); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(backend->DeleteFile(name)); + } + void CreateDirectory(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; @@ -551,5 +572,4 @@ void FSP_SRV::OpenRomStorage(Kernel::HLERequestContext& ctx) { OpenDataStorageByCurrentProcess(ctx); } -} // namespace FileSystem -} // namespace Service +} // namespace Service::FileSystem |