|
|
@ -2,274 +2,172 @@
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
|
|
|
|
#include "common/string_util.h"
|
|
|
|
#include "common/string_util.h"
|
|
|
|
|
|
|
|
#include "core/file_sys/fssrv/fssrv_sf_path.h"
|
|
|
|
|
|
|
|
#include "core/hle/service/cmif_serialization.h"
|
|
|
|
#include "core/hle/service/filesystem/fsp/fs_i_directory.h"
|
|
|
|
#include "core/hle/service/filesystem/fsp/fs_i_directory.h"
|
|
|
|
#include "core/hle/service/filesystem/fsp/fs_i_file.h"
|
|
|
|
#include "core/hle/service/filesystem/fsp/fs_i_file.h"
|
|
|
|
#include "core/hle/service/filesystem/fsp/fs_i_filesystem.h"
|
|
|
|
#include "core/hle/service/filesystem/fsp/fs_i_filesystem.h"
|
|
|
|
#include "core/hle/service/ipc_helpers.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Service::FileSystem {
|
|
|
|
namespace Service::FileSystem {
|
|
|
|
|
|
|
|
|
|
|
|
IFileSystem::IFileSystem(Core::System& system_, FileSys::VirtualDir dir_, SizeGetter size_)
|
|
|
|
IFileSystem::IFileSystem(Core::System& system_, FileSys::VirtualDir dir_, SizeGetter size_getter_)
|
|
|
|
: ServiceFramework{system_, "IFileSystem"},
|
|
|
|
: ServiceFramework{system_, "IFileSystem"},
|
|
|
|
backend{std::make_unique<FileSys::Fsa::IFileSystem>(dir_)}, size{std::move(size_)} {
|
|
|
|
backend{std::make_unique<FileSys::Fsa::IFileSystem>(dir_)},
|
|
|
|
|
|
|
|
size_getter{std::move(size_getter_)} {
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, &IFileSystem::CreateFile, "CreateFile"},
|
|
|
|
{0, D<&IFileSystem::CreateFile>, "CreateFile"},
|
|
|
|
{1, &IFileSystem::DeleteFile, "DeleteFile"},
|
|
|
|
{1, D<&IFileSystem::DeleteFile>, "DeleteFile"},
|
|
|
|
{2, &IFileSystem::CreateDirectory, "CreateDirectory"},
|
|
|
|
{2, D<&IFileSystem::CreateDirectory>, "CreateDirectory"},
|
|
|
|
{3, &IFileSystem::DeleteDirectory, "DeleteDirectory"},
|
|
|
|
{3, D<&IFileSystem::DeleteDirectory>, "DeleteDirectory"},
|
|
|
|
{4, &IFileSystem::DeleteDirectoryRecursively, "DeleteDirectoryRecursively"},
|
|
|
|
{4, D<&IFileSystem::DeleteDirectoryRecursively>, "DeleteDirectoryRecursively"},
|
|
|
|
{5, &IFileSystem::RenameFile, "RenameFile"},
|
|
|
|
{5, D<&IFileSystem::RenameFile>, "RenameFile"},
|
|
|
|
{6, nullptr, "RenameDirectory"},
|
|
|
|
{6, nullptr, "RenameDirectory"},
|
|
|
|
{7, &IFileSystem::GetEntryType, "GetEntryType"},
|
|
|
|
{7, D<&IFileSystem::GetEntryType>, "GetEntryType"},
|
|
|
|
{8, &IFileSystem::OpenFile, "OpenFile"},
|
|
|
|
{8, D<&IFileSystem::OpenFile>, "OpenFile"},
|
|
|
|
{9, &IFileSystem::OpenDirectory, "OpenDirectory"},
|
|
|
|
{9, D<&IFileSystem::OpenDirectory>, "OpenDirectory"},
|
|
|
|
{10, &IFileSystem::Commit, "Commit"},
|
|
|
|
{10, D<&IFileSystem::Commit>, "Commit"},
|
|
|
|
{11, &IFileSystem::GetFreeSpaceSize, "GetFreeSpaceSize"},
|
|
|
|
{11, D<&IFileSystem::GetFreeSpaceSize>, "GetFreeSpaceSize"},
|
|
|
|
{12, &IFileSystem::GetTotalSpaceSize, "GetTotalSpaceSize"},
|
|
|
|
{12, D<&IFileSystem::GetTotalSpaceSize>, "GetTotalSpaceSize"},
|
|
|
|
{13, &IFileSystem::CleanDirectoryRecursively, "CleanDirectoryRecursively"},
|
|
|
|
{13, D<&IFileSystem::CleanDirectoryRecursively>, "CleanDirectoryRecursively"},
|
|
|
|
{14, &IFileSystem::GetFileTimeStampRaw, "GetFileTimeStampRaw"},
|
|
|
|
{14, D<&IFileSystem::GetFileTimeStampRaw>, "GetFileTimeStampRaw"},
|
|
|
|
{15, nullptr, "QueryEntry"},
|
|
|
|
{15, nullptr, "QueryEntry"},
|
|
|
|
{16, &IFileSystem::GetFileSystemAttribute, "GetFileSystemAttribute"},
|
|
|
|
{16, D<&IFileSystem::GetFileSystemAttribute>, "GetFileSystemAttribute"},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IFileSystem::CreateFile(HLERequestContext& ctx) {
|
|
|
|
Result IFileSystem::CreateFile(const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path,
|
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
s32 option, s64 size) {
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called. file={}, option=0x{:X}, size=0x{:08X}", path->str, option, size);
|
|
|
|
|
|
|
|
|
|
|
|
const auto file_buffer = ctx.ReadBuffer();
|
|
|
|
R_RETURN(backend->CreateFile(FileSys::Path(path->str), size));
|
|
|
|
const std::string name = Common::StringFromBuffer(file_buffer);
|
|
|
|
|
|
|
|
const auto path = FileSys::Path(name.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const u64 file_mode = rp.Pop<u64>();
|
|
|
|
|
|
|
|
const u32 file_size = rp.Pop<u32>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called. file={}, mode=0x{:X}, size=0x{:08X}", name, file_mode,
|
|
|
|
|
|
|
|
file_size);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
|
|
|
rb.Push(backend->CreateFile(path, file_size));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IFileSystem::DeleteFile(HLERequestContext& ctx) {
|
|
|
|
Result IFileSystem::DeleteFile(const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path) {
|
|
|
|
const auto file_buffer = ctx.ReadBuffer();
|
|
|
|
LOG_DEBUG(Service_FS, "called. file={}", path->str);
|
|
|
|
const std::string name = Common::StringFromBuffer(file_buffer);
|
|
|
|
|
|
|
|
const auto path = FileSys::Path(name.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called. file={}", name);
|
|
|
|
R_RETURN(backend->DeleteFile(FileSys::Path(path->str)));
|
|
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
|
|
|
rb.Push(backend->DeleteFile(path));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IFileSystem::CreateDirectory(HLERequestContext& ctx) {
|
|
|
|
Result IFileSystem::CreateDirectory(
|
|
|
|
const auto file_buffer = ctx.ReadBuffer();
|
|
|
|
const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path) {
|
|
|
|
const std::string name = Common::StringFromBuffer(file_buffer);
|
|
|
|
LOG_DEBUG(Service_FS, "called. directory={}", path->str);
|
|
|
|
const auto path = FileSys::Path(name.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called. directory={}", name);
|
|
|
|
R_RETURN(backend->CreateDirectory(FileSys::Path(path->str)));
|
|
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
|
|
|
rb.Push(backend->CreateDirectory(path));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IFileSystem::DeleteDirectory(HLERequestContext& ctx) {
|
|
|
|
Result IFileSystem::DeleteDirectory(
|
|
|
|
const auto file_buffer = ctx.ReadBuffer();
|
|
|
|
const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path) {
|
|
|
|
const std::string name = Common::StringFromBuffer(file_buffer);
|
|
|
|
LOG_DEBUG(Service_FS, "called. directory={}", path->str);
|
|
|
|
const auto path = FileSys::Path(name.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called. directory={}", name);
|
|
|
|
R_RETURN(backend->DeleteDirectory(FileSys::Path(path->str)));
|
|
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
|
|
|
rb.Push(backend->DeleteDirectory(path));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IFileSystem::DeleteDirectoryRecursively(HLERequestContext& ctx) {
|
|
|
|
Result IFileSystem::DeleteDirectoryRecursively(
|
|
|
|
const auto file_buffer = ctx.ReadBuffer();
|
|
|
|
const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path) {
|
|
|
|
const std::string name = Common::StringFromBuffer(file_buffer);
|
|
|
|
LOG_DEBUG(Service_FS, "called. directory={}", path->str);
|
|
|
|
const auto path = FileSys::Path(name.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called. directory={}", name);
|
|
|
|
R_RETURN(backend->DeleteDirectoryRecursively(FileSys::Path(path->str)));
|
|
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
|
|
|
rb.Push(backend->DeleteDirectoryRecursively(path));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IFileSystem::CleanDirectoryRecursively(HLERequestContext& ctx) {
|
|
|
|
Result IFileSystem::CleanDirectoryRecursively(
|
|
|
|
const auto file_buffer = ctx.ReadBuffer();
|
|
|
|
const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path) {
|
|
|
|
const std::string name = Common::StringFromBuffer(file_buffer);
|
|
|
|
LOG_DEBUG(Service_FS, "called. Directory: {}", path->str);
|
|
|
|
const auto path = FileSys::Path(name.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called. Directory: {}", name);
|
|
|
|
R_RETURN(backend->CleanDirectoryRecursively(FileSys::Path(path->str)));
|
|
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
|
|
|
rb.Push(backend->CleanDirectoryRecursively(path));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IFileSystem::RenameFile(HLERequestContext& ctx) {
|
|
|
|
Result IFileSystem::RenameFile(
|
|
|
|
const std::string src_name = Common::StringFromBuffer(ctx.ReadBuffer(0));
|
|
|
|
const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> old_path,
|
|
|
|
const std::string dst_name = Common::StringFromBuffer(ctx.ReadBuffer(1));
|
|
|
|
const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> new_path) {
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called. file '{}' to file '{}'", old_path->str, new_path->str);
|
|
|
|
|
|
|
|
|
|
|
|
const auto src_path = FileSys::Path(src_name.c_str());
|
|
|
|
R_RETURN(backend->RenameFile(FileSys::Path(old_path->str), FileSys::Path(new_path->str)));
|
|
|
|
const auto dst_path = FileSys::Path(dst_name.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called. file '{}' to file '{}'", src_name, dst_name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
|
|
|
rb.Push(backend->RenameFile(src_path, dst_path));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IFileSystem::OpenFile(HLERequestContext& ctx) {
|
|
|
|
Result IFileSystem::OpenFile(OutInterface<IFile> out_interface,
|
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path,
|
|
|
|
|
|
|
|
u32 mode) {
|
|
|
|
const auto file_buffer = ctx.ReadBuffer();
|
|
|
|
LOG_DEBUG(Service_FS, "called. file={}, mode={}", path->str, mode);
|
|
|
|
const std::string name = Common::StringFromBuffer(file_buffer);
|
|
|
|
|
|
|
|
const auto path = FileSys::Path(name.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const auto mode = static_cast<FileSys::OpenMode>(rp.Pop<u32>());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called. file={}, mode={}", name, mode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileSys::VirtualFile vfs_file{};
|
|
|
|
FileSys::VirtualFile vfs_file{};
|
|
|
|
auto result = backend->OpenFile(&vfs_file, path, mode);
|
|
|
|
R_TRY(backend->OpenFile(&vfs_file, FileSys::Path(path->str),
|
|
|
|
if (result != ResultSuccess) {
|
|
|
|
static_cast<FileSys::OpenMode>(mode)));
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
|
|
|
rb.Push(result);
|
|
|
|
*out_interface = std::make_shared<IFile>(system, vfs_file);
|
|
|
|
return;
|
|
|
|
R_SUCCEED();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
auto file = std::make_shared<IFile>(system, vfs_file);
|
|
|
|
Result IFileSystem::OpenDirectory(OutInterface<IDirectory> out_interface,
|
|
|
|
|
|
|
|
const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path,
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
u32 mode) {
|
|
|
|
rb.Push(ResultSuccess);
|
|
|
|
LOG_DEBUG(Service_FS, "called. directory={}, mode={}", path->str, mode);
|
|
|
|
rb.PushIpcInterface<IFile>(std::move(file));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void IFileSystem::OpenDirectory(HLERequestContext& ctx) {
|
|
|
|
|
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const auto file_buffer = ctx.ReadBuffer();
|
|
|
|
|
|
|
|
const std::string name = Common::StringFromBuffer(file_buffer);
|
|
|
|
|
|
|
|
const auto path = FileSys::Path(name.c_str());
|
|
|
|
|
|
|
|
const auto mode = rp.PopRaw<FileSys::OpenDirectoryMode>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called. directory={}, mode={}", name, mode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileSys::VirtualDir vfs_dir{};
|
|
|
|
FileSys::VirtualDir vfs_dir{};
|
|
|
|
auto result = backend->OpenDirectory(&vfs_dir, path, mode);
|
|
|
|
R_TRY(backend->OpenDirectory(&vfs_dir, FileSys::Path(path->str),
|
|
|
|
if (result != ResultSuccess) {
|
|
|
|
static_cast<FileSys::OpenDirectoryMode>(mode)));
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
|
|
|
|
rb.Push(result);
|
|
|
|
*out_interface = std::make_shared<IDirectory>(system, vfs_dir,
|
|
|
|
return;
|
|
|
|
static_cast<FileSys::OpenDirectoryMode>(mode));
|
|
|
|
|
|
|
|
R_SUCCEED();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
auto directory = std::make_shared<IDirectory>(system, vfs_dir, mode);
|
|
|
|
Result IFileSystem::GetEntryType(
|
|
|
|
|
|
|
|
Out<u32> out_type, const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path) {
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
LOG_DEBUG(Service_FS, "called. file={}", path->str);
|
|
|
|
rb.Push(ResultSuccess);
|
|
|
|
|
|
|
|
rb.PushIpcInterface<IDirectory>(std::move(directory));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void IFileSystem::GetEntryType(HLERequestContext& ctx) {
|
|
|
|
|
|
|
|
const auto file_buffer = ctx.ReadBuffer();
|
|
|
|
|
|
|
|
const std::string name = Common::StringFromBuffer(file_buffer);
|
|
|
|
|
|
|
|
const auto path = FileSys::Path(name.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_DEBUG(Service_FS, "called. file={}", name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileSys::DirectoryEntryType vfs_entry_type{};
|
|
|
|
FileSys::DirectoryEntryType vfs_entry_type{};
|
|
|
|
auto result = backend->GetEntryType(&vfs_entry_type, path);
|
|
|
|
R_TRY(backend->GetEntryType(&vfs_entry_type, FileSys::Path(path->str)));
|
|
|
|
if (result != ResultSuccess) {
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
*out_type = static_cast<u32>(vfs_entry_type);
|
|
|
|
rb.Push(result);
|
|
|
|
R_SUCCEED();
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 3};
|
|
|
|
Result IFileSystem::Commit() {
|
|
|
|
rb.Push(ResultSuccess);
|
|
|
|
|
|
|
|
rb.Push<u32>(static_cast<u32>(vfs_entry_type));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void IFileSystem::Commit(HLERequestContext& ctx) {
|
|
|
|
|
|
|
|
LOG_WARNING(Service_FS, "(STUBBED) called");
|
|
|
|
LOG_WARNING(Service_FS, "(STUBBED) called");
|
|
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
R_SUCCEED();
|
|
|
|
rb.Push(ResultSuccess);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IFileSystem::GetFreeSpaceSize(HLERequestContext& ctx) {
|
|
|
|
Result IFileSystem::GetFreeSpaceSize(
|
|
|
|
|
|
|
|
Out<s64> out_size, const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path) {
|
|
|
|
LOG_DEBUG(Service_FS, "called");
|
|
|
|
LOG_DEBUG(Service_FS, "called");
|
|
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 4};
|
|
|
|
*out_size = size_getter.get_free_size();
|
|
|
|
rb.Push(ResultSuccess);
|
|
|
|
R_SUCCEED();
|
|
|
|
rb.Push(size.get_free_size());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IFileSystem::GetTotalSpaceSize(HLERequestContext& ctx) {
|
|
|
|
Result IFileSystem::GetTotalSpaceSize(
|
|
|
|
|
|
|
|
Out<s64> out_size, const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path) {
|
|
|
|
LOG_DEBUG(Service_FS, "called");
|
|
|
|
LOG_DEBUG(Service_FS, "called");
|
|
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 4};
|
|
|
|
*out_size = size_getter.get_total_size();
|
|
|
|
rb.Push(ResultSuccess);
|
|
|
|
R_SUCCEED();
|
|
|
|
rb.Push(size.get_total_size());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IFileSystem::GetFileTimeStampRaw(HLERequestContext& ctx) {
|
|
|
|
Result IFileSystem::GetFileTimeStampRaw(
|
|
|
|
const auto file_buffer = ctx.ReadBuffer();
|
|
|
|
Out<FileSys::FileTimeStampRaw> out_timestamp,
|
|
|
|
const std::string name = Common::StringFromBuffer(file_buffer);
|
|
|
|
const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path) {
|
|
|
|
const auto path = FileSys::Path(name.c_str());
|
|
|
|
LOG_WARNING(Service_FS, "(Partial Implementation) called. file={}", path->str);
|
|
|
|
|
|
|
|
|
|
|
|
LOG_WARNING(Service_FS, "(Partial Implementation) called. file={}", name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileSys::FileTimeStampRaw vfs_timestamp{};
|
|
|
|
FileSys::FileTimeStampRaw vfs_timestamp{};
|
|
|
|
auto result = backend->GetFileTimeStampRaw(&vfs_timestamp, path);
|
|
|
|
R_TRY(backend->GetFileTimeStampRaw(&vfs_timestamp, FileSys::Path(path->str)));
|
|
|
|
if (result != ResultSuccess) {
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
*out_timestamp = vfs_timestamp;
|
|
|
|
rb.Push(result);
|
|
|
|
R_SUCCEED();
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 10};
|
|
|
|
Result IFileSystem::GetFileSystemAttribute(Out<FileSystemAttribute> out_attribute) {
|
|
|
|
rb.Push(ResultSuccess);
|
|
|
|
|
|
|
|
rb.PushRaw(vfs_timestamp);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void IFileSystem::GetFileSystemAttribute(HLERequestContext& ctx) {
|
|
|
|
|
|
|
|
LOG_WARNING(Service_FS, "(STUBBED) called");
|
|
|
|
LOG_WARNING(Service_FS, "(STUBBED) called");
|
|
|
|
|
|
|
|
|
|
|
|
struct FileSystemAttribute {
|
|
|
|
|
|
|
|
u8 dir_entry_name_length_max_defined;
|
|
|
|
|
|
|
|
u8 file_entry_name_length_max_defined;
|
|
|
|
|
|
|
|
u8 dir_path_name_length_max_defined;
|
|
|
|
|
|
|
|
u8 file_path_name_length_max_defined;
|
|
|
|
|
|
|
|
INSERT_PADDING_BYTES_NOINIT(0x5);
|
|
|
|
|
|
|
|
u8 utf16_dir_entry_name_length_max_defined;
|
|
|
|
|
|
|
|
u8 utf16_file_entry_name_length_max_defined;
|
|
|
|
|
|
|
|
u8 utf16_dir_path_name_length_max_defined;
|
|
|
|
|
|
|
|
u8 utf16_file_path_name_length_max_defined;
|
|
|
|
|
|
|
|
INSERT_PADDING_BYTES_NOINIT(0x18);
|
|
|
|
|
|
|
|
s32 dir_entry_name_length_max;
|
|
|
|
|
|
|
|
s32 file_entry_name_length_max;
|
|
|
|
|
|
|
|
s32 dir_path_name_length_max;
|
|
|
|
|
|
|
|
s32 file_path_name_length_max;
|
|
|
|
|
|
|
|
INSERT_PADDING_WORDS_NOINIT(0x5);
|
|
|
|
|
|
|
|
s32 utf16_dir_entry_name_length_max;
|
|
|
|
|
|
|
|
s32 utf16_file_entry_name_length_max;
|
|
|
|
|
|
|
|
s32 utf16_dir_path_name_length_max;
|
|
|
|
|
|
|
|
s32 utf16_file_path_name_length_max;
|
|
|
|
|
|
|
|
INSERT_PADDING_WORDS_NOINIT(0x18);
|
|
|
|
|
|
|
|
INSERT_PADDING_WORDS_NOINIT(0x1);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
static_assert(sizeof(FileSystemAttribute) == 0xc0, "FileSystemAttribute has incorrect size");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileSystemAttribute savedata_attribute{};
|
|
|
|
FileSystemAttribute savedata_attribute{};
|
|
|
|
savedata_attribute.dir_entry_name_length_max_defined = true;
|
|
|
|
savedata_attribute.dir_entry_name_length_max_defined = true;
|
|
|
|
savedata_attribute.file_entry_name_length_max_defined = true;
|
|
|
|
savedata_attribute.file_entry_name_length_max_defined = true;
|
|
|
|
savedata_attribute.dir_entry_name_length_max = 0x40;
|
|
|
|
savedata_attribute.dir_entry_name_length_max = 0x40;
|
|
|
|
savedata_attribute.file_entry_name_length_max = 0x40;
|
|
|
|
savedata_attribute.file_entry_name_length_max = 0x40;
|
|
|
|
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 50};
|
|
|
|
*out_attribute = savedata_attribute;
|
|
|
|
rb.Push(ResultSuccess);
|
|
|
|
R_SUCCEED();
|
|
|
|
rb.PushRaw(savedata_attribute);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace Service::FileSystem
|
|
|
|
} // namespace Service::FileSystem
|
|
|
|