From b45671fd35fabb59037ce3f24cdde2fbbb4166c3 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Fri, 8 Apr 2022 11:23:39 -0700 Subject: [PATCH] fs: QueryEntry uses NonSecure buffers --- .../fssrv_filesystem_interface_adapter.hpp | 4 +-- .../fssrv/sf/fssrv_sf_ifilesystem.hpp | 32 +++++++++---------- .../fs_file_system_service_object_adapter.hpp | 2 +- .../fssrv_filesystem_interface_adapter.cpp | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/libraries/libstratosphere/include/stratosphere/fssrv/interface_adapters/fssrv_filesystem_interface_adapter.hpp b/libraries/libstratosphere/include/stratosphere/fssrv/interface_adapters/fssrv_filesystem_interface_adapter.hpp index 6e05130bb..d3f6560c7 100644 --- a/libraries/libstratosphere/include/stratosphere/fssrv/interface_adapters/fssrv_filesystem_interface_adapter.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssrv/interface_adapters/fssrv_filesystem_interface_adapter.hpp @@ -120,7 +120,7 @@ namespace ams::fssrv::impl { Result CleanDirectoryRecursively(const fssrv::sf::Path &path); Result GetFileTimeStampRaw(ams::sf::Out out, const fssrv::sf::Path &path); - Result QueryEntry(const ams::sf::OutBuffer &out_buf, const ams::sf::InBuffer &in_buf, s32 query_id, const fssrv::sf::Path &path); + Result QueryEntry(const ams::sf::OutNonSecureBuffer &out_buf, const ams::sf::InNonSecureBuffer &in_buf, s32 query_id, const fssrv::sf::Path &path); }; #if defined(ATMOSPHERE_OS_HORIZON) @@ -252,7 +252,7 @@ namespace ams::fssrv::impl { R_RETURN(fsFsGetFileTimeStampRaw(std::addressof(m_base_fs), path.str, reinterpret_cast<::FsTimeStampRaw *>(out.GetPointer()))); } - Result QueryEntry(const ams::sf::OutBuffer &out_buf, const ams::sf::InBuffer &in_buf, s32 query_id, const fssrv::sf::Path &path) { + Result QueryEntry(const ams::sf::OutNonSecureBuffer &out_buf, const ams::sf::InNonSecureBuffer &in_buf, s32 query_id, const fssrv::sf::Path &path) { R_RETURN(fsFsQueryEntry(std::addressof(m_base_fs), out_buf.GetPointer(), out_buf.GetSize(), in_buf.GetPointer(), in_buf.GetSize(), path.str, static_cast(query_id))); } diff --git a/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_ifilesystem.hpp b/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_ifilesystem.hpp index bf58649a2..7e9cceda1 100644 --- a/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_ifilesystem.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_ifilesystem.hpp @@ -24,21 +24,21 @@ /* ACCURATE_TO_VERSION: 13.4.0.0 */ #define AMS_FSSRV_I_FILESYSTEM_INTERFACE_INFO(C, H) \ - AMS_SF_METHOD_INFO(C, H, 0, Result, CreateFile, (const ams::fssrv::sf::Path &path, s64 size, s32 option), (path, size, option)) \ - AMS_SF_METHOD_INFO(C, H, 1, Result, DeleteFile, (const ams::fssrv::sf::Path &path), (path)) \ - AMS_SF_METHOD_INFO(C, H, 2, Result, CreateDirectory, (const ams::fssrv::sf::Path &path), (path)) \ - AMS_SF_METHOD_INFO(C, H, 3, Result, DeleteDirectory, (const ams::fssrv::sf::Path &path), (path)) \ - AMS_SF_METHOD_INFO(C, H, 4, Result, DeleteDirectoryRecursively, (const ams::fssrv::sf::Path &path), (path)) \ - AMS_SF_METHOD_INFO(C, H, 5, Result, RenameFile, (const ams::fssrv::sf::Path &old_path, const ams::fssrv::sf::Path &new_path), (old_path, new_path)) \ - AMS_SF_METHOD_INFO(C, H, 6, Result, RenameDirectory, (const ams::fssrv::sf::Path &old_path, const ams::fssrv::sf::Path &new_path), (old_path, new_path)) \ - AMS_SF_METHOD_INFO(C, H, 7, Result, GetEntryType, (ams::sf::Out out, const ams::fssrv::sf::Path &path), (out, path)) \ - AMS_SF_METHOD_INFO(C, H, 8, Result, OpenFile, (ams::sf::Out> out, const ams::fssrv::sf::Path &path, u32 mode), (out, path, mode)) \ - AMS_SF_METHOD_INFO(C, H, 9, Result, OpenDirectory, (ams::sf::Out> out, const ams::fssrv::sf::Path &path, u32 mode), (out, path, mode)) \ - AMS_SF_METHOD_INFO(C, H, 10, Result, Commit, (), ()) \ - AMS_SF_METHOD_INFO(C, H, 11, Result, GetFreeSpaceSize, (ams::sf::Out out, const ams::fssrv::sf::Path &path), (out, path)) \ - AMS_SF_METHOD_INFO(C, H, 12, Result, GetTotalSpaceSize, (ams::sf::Out out, const ams::fssrv::sf::Path &path), (out, path)) \ - AMS_SF_METHOD_INFO(C, H, 13, Result, CleanDirectoryRecursively, (const ams::fssrv::sf::Path &path), (path), hos::Version_3_0_0) \ - AMS_SF_METHOD_INFO(C, H, 14, Result, GetFileTimeStampRaw, (ams::sf::Out out, const ams::fssrv::sf::Path &path), (out, path), hos::Version_3_0_0) \ - AMS_SF_METHOD_INFO(C, H, 15, Result, QueryEntry, (const ams::sf::OutBuffer &out_buf, const ams::sf::InBuffer &in_buf, s32 query_id, const ams::fssrv::sf::Path &path), (out_buf, in_buf, query_id, path), hos::Version_4_0_0) + AMS_SF_METHOD_INFO(C, H, 0, Result, CreateFile, (const ams::fssrv::sf::Path &path, s64 size, s32 option), (path, size, option)) \ + AMS_SF_METHOD_INFO(C, H, 1, Result, DeleteFile, (const ams::fssrv::sf::Path &path), (path)) \ + AMS_SF_METHOD_INFO(C, H, 2, Result, CreateDirectory, (const ams::fssrv::sf::Path &path), (path)) \ + AMS_SF_METHOD_INFO(C, H, 3, Result, DeleteDirectory, (const ams::fssrv::sf::Path &path), (path)) \ + AMS_SF_METHOD_INFO(C, H, 4, Result, DeleteDirectoryRecursively, (const ams::fssrv::sf::Path &path), (path)) \ + AMS_SF_METHOD_INFO(C, H, 5, Result, RenameFile, (const ams::fssrv::sf::Path &old_path, const ams::fssrv::sf::Path &new_path), (old_path, new_path)) \ + AMS_SF_METHOD_INFO(C, H, 6, Result, RenameDirectory, (const ams::fssrv::sf::Path &old_path, const ams::fssrv::sf::Path &new_path), (old_path, new_path)) \ + AMS_SF_METHOD_INFO(C, H, 7, Result, GetEntryType, (ams::sf::Out out, const ams::fssrv::sf::Path &path), (out, path)) \ + AMS_SF_METHOD_INFO(C, H, 8, Result, OpenFile, (ams::sf::Out> out, const ams::fssrv::sf::Path &path, u32 mode), (out, path, mode)) \ + AMS_SF_METHOD_INFO(C, H, 9, Result, OpenDirectory, (ams::sf::Out> out, const ams::fssrv::sf::Path &path, u32 mode), (out, path, mode)) \ + AMS_SF_METHOD_INFO(C, H, 10, Result, Commit, (), ()) \ + AMS_SF_METHOD_INFO(C, H, 11, Result, GetFreeSpaceSize, (ams::sf::Out out, const ams::fssrv::sf::Path &path), (out, path)) \ + AMS_SF_METHOD_INFO(C, H, 12, Result, GetTotalSpaceSize, (ams::sf::Out out, const ams::fssrv::sf::Path &path), (out, path)) \ + AMS_SF_METHOD_INFO(C, H, 13, Result, CleanDirectoryRecursively, (const ams::fssrv::sf::Path &path), (path), hos::Version_3_0_0) \ + AMS_SF_METHOD_INFO(C, H, 14, Result, GetFileTimeStampRaw, (ams::sf::Out out, const ams::fssrv::sf::Path &path), (out, path), hos::Version_3_0_0) \ + AMS_SF_METHOD_INFO(C, H, 15, Result, QueryEntry, (const ams::sf::OutNonSecureBuffer &out_buf, const ams::sf::InNonSecureBuffer &in_buf, s32 query_id, const ams::fssrv::sf::Path &path), (out_buf, in_buf, query_id, path), hos::Version_4_0_0) AMS_SF_DEFINE_INTERFACE(ams::fssrv::sf, IFileSystem, AMS_FSSRV_I_FILESYSTEM_INTERFACE_INFO, 0xD4EA59E7) diff --git a/libraries/libstratosphere/source/fs/impl/fs_file_system_service_object_adapter.hpp b/libraries/libstratosphere/source/fs/impl/fs_file_system_service_object_adapter.hpp index 5fff3299e..1abbfcddb 100644 --- a/libraries/libstratosphere/source/fs/impl/fs_file_system_service_object_adapter.hpp +++ b/libraries/libstratosphere/source/fs/impl/fs_file_system_service_object_adapter.hpp @@ -256,7 +256,7 @@ namespace ams::fs::impl { fssrv::sf::Path fsp_path; R_TRY(GetPathForServiceObject(std::addressof(fsp_path), path)); - R_RETURN(m_x->QueryEntry(sf::OutBuffer(dst, dst_size), sf::InBuffer(src, src_size), static_cast(query), fsp_path)); + R_RETURN(m_x->QueryEntry(sf::OutNonSecureBuffer(dst, dst_size), sf::InNonSecureBuffer(src, src_size), static_cast(query), fsp_path)); } }; diff --git a/libraries/libstratosphere/source/fssrv/fssrv_filesystem_interface_adapter.cpp b/libraries/libstratosphere/source/fssrv/fssrv_filesystem_interface_adapter.cpp index f0e6e7aa3..a9f191643 100644 --- a/libraries/libstratosphere/source/fssrv/fssrv_filesystem_interface_adapter.cpp +++ b/libraries/libstratosphere/source/fssrv/fssrv_filesystem_interface_adapter.cpp @@ -330,7 +330,7 @@ namespace ams::fssrv::impl { R_RETURN(m_base_fs->GetFileTimeStampRaw(out.GetPointer(), fs_path)); } - Result FileSystemInterfaceAdapter::QueryEntry(const ams::sf::OutBuffer &out_buf, const ams::sf::InBuffer &in_buf, s32 query_id, const fssrv::sf::Path &path) { + Result FileSystemInterfaceAdapter::QueryEntry(const ams::sf::OutNonSecureBuffer &out_buf, const ams::sf::InNonSecureBuffer &in_buf, s32 query_id, const fssrv::sf::Path &path) { /* Check that we have permission to perform the operation. */ switch (static_cast(query_id)) { using enum fs::fsa::QueryId;