diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_path_tool.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_path_tool.hpp
index 37f2c5b5d..9d9e145b8 100644
--- a/libraries/libstratosphere/include/stratosphere/fs/fs_path_tool.hpp
+++ b/libraries/libstratosphere/include/stratosphere/fs/fs_path_tool.hpp
@@ -14,8 +14,8 @@
* along with this program. If not, see .
*/
#pragma once
-#include "fs_common.hpp"
-#include "../fssrv/fssrv_sf_path.hpp"
+#include
+#include
namespace ams::fs {
diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_path_utils.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_path_utils.hpp
index 63cb917d3..59174ce20 100644
--- a/libraries/libstratosphere/include/stratosphere/fs/fs_path_utils.hpp
+++ b/libraries/libstratosphere/include/stratosphere/fs/fs_path_utils.hpp
@@ -14,8 +14,8 @@
* along with this program. If not, see .
*/
#pragma once
-#include "fs_common.hpp"
-#include "../fssrv/fssrv_sf_path.hpp"
+#include
+#include
namespace ams::fs {
diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_query_range.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_query_range.hpp
index 2456f48db..35e684c9c 100644
--- a/libraries/libstratosphere/include/stratosphere/fs/fs_query_range.hpp
+++ b/libraries/libstratosphere/include/stratosphere/fs/fs_query_range.hpp
@@ -14,8 +14,8 @@
* along with this program. If not, see .
*/
#pragma once
-#include "fs_common.hpp"
-#include "fs_file.hpp"
+#include
+#include
namespace ams::fs {
diff --git a/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_ifile.hpp b/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_ifile.hpp
index 422240110..2d262639b 100644
--- a/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_ifile.hpp
+++ b/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_ifile.hpp
@@ -14,10 +14,10 @@
* along with this program. If not, see .
*/
#pragma once
-#include "../fs_common.hpp"
-#include "../fs_file.hpp"
-#include "../fs_filesystem.hpp"
-#include "../fs_operate_range.hpp"
+#include
+#include
+#include
+#include
namespace ams::fs::fsa {
diff --git a/libraries/libstratosphere/include/stratosphere/fssrv.hpp b/libraries/libstratosphere/include/stratosphere/fssrv.hpp
index 91d839512..a2fb95b3d 100644
--- a/libraries/libstratosphere/include/stratosphere/fssrv.hpp
+++ b/libraries/libstratosphere/include/stratosphere/fssrv.hpp
@@ -15,7 +15,8 @@
*/
#pragma once
-#include
+#include
+#include
#include
#include
#include
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 4355176d1..a62bda661 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
@@ -14,13 +14,16 @@
* along with this program. If not, see .
*/
#pragma once
-#include "../../fs/fs_common.hpp"
-#include "../../fs/fs_file.hpp"
-#include "../../fs/fs_directory.hpp"
-#include "../../fs/fs_filesystem.hpp"
-#include "../../fs/fs_query_range.hpp"
-#include "../../fssrv/fssrv_sf_path.hpp"
-#include "../../fssystem/fssystem_utility.hpp"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
namespace ams::fs::fsa {
@@ -34,17 +37,8 @@ namespace ams::fssrv::impl {
class FileSystemInterfaceAdapter;
- class FileInterfaceAdapter final : public ams::sf::IServiceObject {
+ class FileInterfaceAdapter final {
NON_COPYABLE(FileInterfaceAdapter);
- public:
- enum class CommandId {
- Read = 0,
- Write = 1,
- Flush = 2,
- SetSize = 3,
- GetSize = 4,
- OperateRange = 5,
- };
private:
std::shared_ptr parent_filesystem;
std::unique_ptr base_file;
@@ -62,27 +56,11 @@ namespace ams::fssrv::impl {
Result SetSize(s64 size);
Result GetSize(ams::sf::Out out);
Result OperateRange(ams::sf::Out out, s32 op_id, s64 offset, s64 size);
- public:
- DEFINE_SERVICE_DISPATCH_TABLE {
- /* 1.0.0- */
- MAKE_SERVICE_COMMAND_META(Read),
- MAKE_SERVICE_COMMAND_META(Write),
- MAKE_SERVICE_COMMAND_META(Flush),
- MAKE_SERVICE_COMMAND_META(SetSize),
- MAKE_SERVICE_COMMAND_META(GetSize),
-
- /* 4.0.0- */
- MAKE_SERVICE_COMMAND_META(OperateRange, hos::Version_4_0_0),
- };
};
+ static_assert(fssrv::sf::IsIFile);
- class DirectoryInterfaceAdapter final : public ams::sf::IServiceObject {
+ class DirectoryInterfaceAdapter final {
NON_COPYABLE(DirectoryInterfaceAdapter);
- public:
- enum class CommandId {
- Read = 0,
- GetEntryCount = 1,
- };
private:
std::shared_ptr parent_filesystem;
std::unique_ptr base_dir;
@@ -94,39 +72,11 @@ namespace ams::fssrv::impl {
/* Command API */
Result Read(ams::sf::Out out, const ams::sf::OutBuffer &out_entries);
Result GetEntryCount(ams::sf::Out out);
- public:
- DEFINE_SERVICE_DISPATCH_TABLE {
- MAKE_SERVICE_COMMAND_META(Read),
- MAKE_SERVICE_COMMAND_META(GetEntryCount),
- };
};
+ static_assert(fssrv::sf::IsIDirectory);
- class FileSystemInterfaceAdapter final : public std::enable_shared_from_this, public ams::sf::IServiceObject {
+ class FileSystemInterfaceAdapter final : public std::enable_shared_from_this {
NON_COPYABLE(FileSystemInterfaceAdapter);
- public:
- enum class CommandId {
- /* 1.0.0+ */
- CreateFile = 0,
- DeleteFile = 1,
- CreateDirectory = 2,
- DeleteDirectory = 3,
- DeleteDirectoryRecursively = 4,
- RenameFile = 5,
- RenameDirectory = 6,
- GetEntryType = 7,
- OpenFile = 8,
- OpenDirectory = 9,
- Commit = 10,
- GetFreeSpaceSize = 11,
- GetTotalSpaceSize = 12,
-
- /* 3.0.0+ */
- CleanDirectoryRecursively = 13,
- GetFileTimeStampRaw = 14,
-
- /* 4.0.0+ */
- QueryEntry = 15,
- };
private:
std::shared_ptr base_fs;
std::unique_lock mount_count_semaphore;
@@ -153,8 +103,8 @@ namespace ams::fssrv::impl {
Result RenameFile(const fssrv::sf::Path &old_path, const fssrv::sf::Path &new_path);
Result RenameDirectory(const fssrv::sf::Path &old_path, const fssrv::sf::Path &new_path);
Result GetEntryType(ams::sf::Out out, const fssrv::sf::Path &path);
- Result OpenFile(ams::sf::Out> out, const fssrv::sf::Path &path, u32 mode);
- Result OpenDirectory(ams::sf::Out> out, const fssrv::sf::Path &path, u32 mode);
+ Result OpenFile(ams::sf::Out> out, const fssrv::sf::Path &path, u32 mode);
+ Result OpenDirectory(ams::sf::Out> out, const fssrv::sf::Path &path, u32 mode);
Result Commit();
Result GetFreeSpaceSize(ams::sf::Out out, const fssrv::sf::Path &path);
Result GetTotalSpaceSize(ams::sf::Out out, const fssrv::sf::Path &path);
@@ -163,30 +113,6 @@ namespace ams::fssrv::impl {
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);
- public:
- DEFINE_SERVICE_DISPATCH_TABLE {
- /* 1.0.0- */
- MAKE_SERVICE_COMMAND_META(CreateFile),
- MAKE_SERVICE_COMMAND_META(DeleteFile),
- MAKE_SERVICE_COMMAND_META(CreateDirectory),
- MAKE_SERVICE_COMMAND_META(DeleteDirectory),
- MAKE_SERVICE_COMMAND_META(DeleteDirectoryRecursively),
- MAKE_SERVICE_COMMAND_META(RenameFile),
- MAKE_SERVICE_COMMAND_META(RenameDirectory),
- MAKE_SERVICE_COMMAND_META(GetEntryType),
- MAKE_SERVICE_COMMAND_META(OpenFile),
- MAKE_SERVICE_COMMAND_META(OpenDirectory),
- MAKE_SERVICE_COMMAND_META(Commit),
- MAKE_SERVICE_COMMAND_META(GetFreeSpaceSize),
- MAKE_SERVICE_COMMAND_META(GetTotalSpaceSize),
-
- /* 3.0.0- */
- MAKE_SERVICE_COMMAND_META(CleanDirectoryRecursively, hos::Version_3_0_0),
- MAKE_SERVICE_COMMAND_META(GetFileTimeStampRaw, hos::Version_3_0_0),
-
- /* 4.0.0- */
- MAKE_SERVICE_COMMAND_META(QueryEntry, hos::Version_4_0_0),
- };
};
}
diff --git a/libraries/libstratosphere/include/stratosphere/fssrv/interface_adapters/fssrv_storage_interface_adapter.hpp b/libraries/libstratosphere/include/stratosphere/fssrv/interface_adapters/fssrv_storage_interface_adapter.hpp
index 6170e3f08..c1a74b42f 100644
--- a/libraries/libstratosphere/include/stratosphere/fssrv/interface_adapters/fssrv_storage_interface_adapter.hpp
+++ b/libraries/libstratosphere/include/stratosphere/fssrv/interface_adapters/fssrv_storage_interface_adapter.hpp
@@ -14,9 +14,10 @@
* along with this program. If not, see .
*/
#pragma once
-#include "../../fs/fs_common.hpp"
-#include "../../fs/fs_query_range.hpp"
-#include "../../fssystem/fssystem_utility.hpp"
+#include
+#include
+#include
+#include
namespace ams::fs {
@@ -26,17 +27,8 @@ namespace ams::fs {
namespace ams::fssrv::impl {
- class StorageInterfaceAdapter final : public ams::sf::IServiceObject {
+ class StorageInterfaceAdapter final {
NON_COPYABLE(StorageInterfaceAdapter);
- public:
- enum class CommandId {
- Read = 0,
- Write = 1,
- Flush = 2,
- SetSize = 3,
- GetSize = 4,
- OperateRange = 5,
- };
private:
/* TODO: Nintendo uses fssystem::AsynchronousAccessStorage here. */
std::shared_ptr base_storage;
@@ -53,7 +45,7 @@ namespace ams::fssrv::impl {
~StorageInterfaceAdapter();
private:
std::optional> AcquireCacheInvalidationReadLock();
- private:
+ public:
/* Command API. */
Result Read(s64 offset, const ams::sf::OutNonSecureBuffer &buffer, s64 size);
Result Write(s64 offset, const ams::sf::InNonSecureBuffer &buffer, s64 size);
@@ -61,18 +53,7 @@ namespace ams::fssrv::impl {
Result SetSize(s64 size);
Result GetSize(ams::sf::Out out);
Result OperateRange(ams::sf::Out out, s32 op_id, s64 offset, s64 size);
- public:
- DEFINE_SERVICE_DISPATCH_TABLE {
- /* 1.0.0- */
- MAKE_SERVICE_COMMAND_META(Read),
- MAKE_SERVICE_COMMAND_META(Write),
- MAKE_SERVICE_COMMAND_META(Flush),
- MAKE_SERVICE_COMMAND_META(SetSize),
- MAKE_SERVICE_COMMAND_META(GetSize),
-
- /* 4.0.0- */
- MAKE_SERVICE_COMMAND_META(OperateRange, hos::Version_4_0_0),
- };
};
+ static_assert(fssrv::sf::IsIStorage);
}
diff --git a/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_idirectory.hpp b/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_idirectory.hpp
new file mode 100644
index 000000000..422a06dde
--- /dev/null
+++ b/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_idirectory.hpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018-2020 Atmosphère-NX
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+#pragma once
+#include
+#include
+#include
+
+namespace ams::fssrv::sf {
+
+ #define AMS_FSSRV_I_DIRECTORY_INTERFACE_INFO(C, H) \
+ AMS_SF_METHOD_INFO(C, H, 0, Result, Read, (ams::sf::Out out, const ams::sf::OutBuffer &out_entries)) \
+ AMS_SF_METHOD_INFO(C, H, 1, Result, GetEntryCount, (ams::sf::Out out))
+
+ AMS_SF_DEFINE_INTERFACE(IDirectory, AMS_FSSRV_I_DIRECTORY_INTERFACE_INFO)
+
+}
diff --git a/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_ifile.hpp b/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_ifile.hpp
new file mode 100644
index 000000000..03d30b29a
--- /dev/null
+++ b/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_ifile.hpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018-2020 Atmosphère-NX
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+#pragma once
+#include
+#include
+#include
+#include
+
+namespace ams::fssrv::sf {
+
+ #define AMS_FSSRV_I_FILE_INTERFACE_INFO(C, H) \
+ AMS_SF_METHOD_INFO(C, H, 0, Result, Read, (ams::sf::Out out, s64 offset, const ams::sf::OutNonSecureBuffer &buffer, s64 size, ams::fs::ReadOption option)) \
+ AMS_SF_METHOD_INFO(C, H, 1, Result, Write, (s64 offset, const ams::sf::InNonSecureBuffer &buffer, s64 size, ams::fs::WriteOption option)) \
+ AMS_SF_METHOD_INFO(C, H, 2, Result, Flush, ()) \
+ AMS_SF_METHOD_INFO(C, H, 3, Result, SetSize, (s64 size)) \
+ AMS_SF_METHOD_INFO(C, H, 4, Result, GetSize, (ams::sf::Out out)) \
+ AMS_SF_METHOD_INFO(C, H, 5, Result, OperateRange, (ams::sf::Out out, s32 op_id, s64 offset, s64 size), hos::Version_4_0_0) \
+
+ AMS_SF_DEFINE_INTERFACE(IFile, AMS_FSSRV_I_FILE_INTERFACE_INFO)
+
+}
diff --git a/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_ifilesystem.hpp b/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_ifilesystem.hpp
new file mode 100644
index 000000000..90fa215ee
--- /dev/null
+++ b/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_ifilesystem.hpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018-2020 Atmosphère-NX
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+#pragma once
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace ams::fssrv::sf {
+
+ #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)) \
+ AMS_SF_METHOD_INFO(C, H, 1, Result, DeleteFile, (const ams::fssrv::sf::Path &path)) \
+ AMS_SF_METHOD_INFO(C, H, 2, Result, CreateDirectory, (const ams::fssrv::sf::Path &path)) \
+ AMS_SF_METHOD_INFO(C, H, 3, Result, DeleteDirectory, (const ams::fssrv::sf::Path &path)) \
+ AMS_SF_METHOD_INFO(C, H, 4, Result, DeleteDirectoryRecursively, (const ams::fssrv::sf::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)) \
+ AMS_SF_METHOD_INFO(C, H, 6, Result, RenameDirectory, (const ams::fssrv::sf::Path &old_path, const ams::fssrv::sf::Path &new_path)) \
+ AMS_SF_METHOD_INFO(C, H, 7, Result, GetEntryType, (ams::sf::Out out, const ams::fssrv::sf::Path &path)) \
+ AMS_SF_METHOD_INFO(C, H, 8, Result, OpenFile, (ams::sf::Out> out, const ams::fssrv::sf::Path &path, u32 mode)) \
+ AMS_SF_METHOD_INFO(C, H, 9, Result, OpenDirectory, (ams::sf::Out> out, const ams::fssrv::sf::Path &path, u32 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)) \
+ AMS_SF_METHOD_INFO(C, H, 12, Result, GetTotalSpaceSize, (ams::sf::Out out, const ams::fssrv::sf::Path &path)) \
+ AMS_SF_METHOD_INFO(C, H, 13, Result, CleanDirectoryRecursively, (const ams::fssrv::sf::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), 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), hos::Version_4_0_0)
+
+ AMS_SF_DEFINE_INTERFACE(IFileSystem, AMS_FSSRV_I_FILESYSTEM_INTERFACE_INFO)
+
+}
diff --git a/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_istorage.hpp b/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_istorage.hpp
new file mode 100644
index 000000000..5f8cb761f
--- /dev/null
+++ b/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_istorage.hpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018-2020 Atmosphère-NX
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+#pragma once
+#include
+#include
+#include
+#include
+
+namespace ams::fssrv::sf {
+
+ #define AMS_FSSRV_I_STORAGE_INTERFACE_INFO(C, H) \
+ AMS_SF_METHOD_INFO(C, H, 0, Result, Read, (s64 offset, const ams::sf::OutNonSecureBuffer &buffer, s64 size)) \
+ AMS_SF_METHOD_INFO(C, H, 1, Result, Write, (s64 offset, const ams::sf::InNonSecureBuffer &buffer, s64 size)) \
+ AMS_SF_METHOD_INFO(C, H, 2, Result, Flush, ()) \
+ AMS_SF_METHOD_INFO(C, H, 3, Result, SetSize, (s64 size)) \
+ AMS_SF_METHOD_INFO(C, H, 4, Result, GetSize, (ams::sf::Out out)) \
+ AMS_SF_METHOD_INFO(C, H, 5, Result, OperateRange, (ams::sf::Out out, s32 op_id, s64 offset, s64 size), hos::Version_4_0_0)
+
+ AMS_SF_DEFINE_INTERFACE(IStorage, AMS_FSSRV_I_STORAGE_INTERFACE_INFO)
+
+}
diff --git a/libraries/libstratosphere/include/stratosphere/fssrv/fssrv_sf_path.hpp b/libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_path.hpp
similarity index 100%
rename from libraries/libstratosphere/include/stratosphere/fssrv/fssrv_sf_path.hpp
rename to libraries/libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_path.hpp
diff --git a/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp b/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp
index f68bd05e7..aae4a5d2c 100644
--- a/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp
+++ b/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp
@@ -368,22 +368,13 @@ namespace ams::sf::impl {
size_t out_object_index;
};
- template
+ template
struct CommandMetaInfo {
- private:
- template
- static R GetReturnTypeImpl(R(C::*)(A...));
-
- template
- static C *GetClassTypePointerImpl(R(C::*)(A...));
-
- template
- static std::tuple::type...> GetArgsImpl(R(C::*)(A...));
public:
- using ReturnType = decltype(GetReturnTypeImpl(MemberFunction));
- using ClassTypePointer = decltype(GetClassTypePointerImpl(MemberFunction));
- using ArgsType = decltype(GetArgsImpl(MemberFunction));
- using ClassType = typename std::remove_pointer::type;
+ using ReturnType = Return;
+ using ClassType = Class;
+ using ClassTypePointer = ClassType *;
+ using ArgsType = std::tuple::type...>;
static constexpr bool ReturnsResult = std::is_same::value;
static constexpr bool ReturnsVoid = std::is_same::value;
@@ -1045,9 +1036,9 @@ namespace ams::sf::impl {
return ResultSuccess();
}
- template
+ template
constexpr Result InvokeServiceCommandImpl(CmifOutHeader **out_header_ptr, cmif::ServiceDispatchContext &ctx, const cmif::PointerAndSize &in_raw_data) {
- using CommandMeta = CommandMetaInfo;
+ using CommandMeta = CommandMetaInfo;
using ImplProcessorType = HipcCommandProcessor;
using BufferArrayType = std::array;
using OutHandleHolderType = OutHandleHolder;
@@ -1113,7 +1104,7 @@ namespace ams::sf::impl {
}
if constexpr (CommandMeta::ReturnsResult) {
- const auto command_result = std::apply([=](auto&&... args) { return (this_ptr->*ServiceCommandImpl)(args...); }, args_tuple);
+ const auto command_result = std::apply([=](auto&&... args) { return (this_ptr->*ServiceCommandImpl)(std::forward(args)...); }, args_tuple);
if (R_FAILED(command_result)) {
cmif::PointerAndSize out_raw_data;
ctx.processor->PrepareForErrorReply(ctx, out_raw_data, runtime_metadata);
@@ -1121,7 +1112,7 @@ namespace ams::sf::impl {
return command_result;
}
} else {
- std::apply([=](auto&&... args) { (this_ptr->*ServiceCommandImpl)(args...); }, args_tuple);
+ std::apply([=](auto&&... args) { (this_ptr->*ServiceCommandImpl)(std::forward(args)...); }, args_tuple);
}
}
@@ -1150,13 +1141,13 @@ namespace ams::sf::impl {
namespace ams::sf::impl {
- template
+ template
consteval inline cmif::ServiceCommandMeta MakeServiceCommandMeta() {
return {
.hosver_low = Low,
.hosver_high = High,
.cmd_id = static_cast(CommandId),
- .handler = ::ams::sf::impl::InvokeServiceCommandImpl,
+ .handler = ::ams::sf::impl::InvokeServiceCommandImpl,
};
}
diff --git a/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_service_object_macros.hpp b/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_service_object_macros.hpp
index 1193062f1..d5a1a438e 100644
--- a/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_service_object_macros.hpp
+++ b/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_service_object_macros.hpp
@@ -91,11 +91,16 @@ namespace ams::sf::impl {
AMS_SF_IMPL_FUNCTION_POINTER_TYPE(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) NAME;
#define AMS_SF_IMPL_DECLARE_INTERFACE_FUNCTION(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
+ template \
+ requires std::same_as, AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)> \
+ RETURN Invoke##NAME##ByCommandTable (Arguments &&... args) { \
+ return this->cmd_table->NAME(this, std::forward(args)...); \
+ } \
template \
requires (::ams::sf::impl::Invokable && \
std::same_as, AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)>) \
- RETURN NAME (Arguments &&... args) { \
- return this->cmd_table->NAME(this, std::forward(args)...); \
+ ALWAYS_INLINE RETURN NAME (Arguments &&... args) { \
+ return this->Invoke##NAME##ByCommandTable(std::forward(args)...); \
} \
template \
requires (::ams::sf::impl::Invokable && \
@@ -130,13 +135,13 @@ namespace ams::sf::impl {
static constexpr auto Value = static_cast(&ImplHolder::NAME##Invoker); \
};
- #define AMS_SF_IMPL_DEFINE_INTERFACE_SERVICE_COMMAND_META_HOLDER(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
- template struct NAME##ServiceCommandMetaHolder; \
- \
- template \
- requires std::same_as, AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)> \
- struct NAME##ServiceCommandMetaHolder> { \
- static constexpr auto Value = ::ams::sf::impl::MakeServiceCommandMeta>(); \
+ #define AMS_SF_IMPL_DEFINE_INTERFACE_SERVICE_COMMAND_META_HOLDER(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
+ template struct NAME##ServiceCommandMetaHolder; \
+ \
+ template \
+ requires std::same_as, AMS_SF_IMPL_HELPER_FUNCTION_ARGS(CLASSNAME, NAME)> \
+ struct NAME##ServiceCommandMetaHolder> { \
+ static constexpr auto Value = ::ams::sf::impl::MakeServiceCommandMeta, RETURN, CLASSNAME, Arguments...>(); \
};
#define AMS_SF_IMPL_DEFINE_INTERFACE_COMMAND_POINTER_TABLE_MEMBER(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
@@ -145,6 +150,9 @@ namespace ams::sf::impl {
#define AMS_SF_IMPL_DEFINE_CMIF_SERVICE_COMMAND_META_TABLE_ENTRY(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, VERSION_MIN, VERSION_MAX) \
NAME##ServiceCommandMetaHolder::Value,
+ template
+ struct Print;
+
#define AMS_SF_IMPL_DEFINE_CLASS(BASECLASS, CLASSNAME, CMD_MACRO) \
class CLASSNAME : public BASECLASS { \
NON_COPYABLE(CLASSNAME); \
@@ -195,7 +203,7 @@ namespace ams::sf::impl {
CMD_MACRO(CLASSNAME, AMS_SF_IMPL_DEFINE_INTERFACE_SERVICE_COMMAND_META_HOLDER) \
public: \
template requires (!std::same_as&& Is##CLASSNAME) \
- using Impl = typename ImplGenerator::ImplHolder; \
+ using ImplHolder = typename ImplGenerator::ImplHolder; \
\
AMS_SF_CMIF_IMPL_DEFINE_SERVICE_DISPATCH_TABLE { \
CMD_MACRO(CLASSNAME, AMS_SF_IMPL_DEFINE_CMIF_SERVICE_COMMAND_META_TABLE_ENTRY) \
diff --git a/libraries/libstratosphere/source/fssrv/fssrv_filesystem_interface_adapter.cpp b/libraries/libstratosphere/source/fssrv/fssrv_filesystem_interface_adapter.cpp
index 75b2dbd15..3aaa84de5 100644
--- a/libraries/libstratosphere/source/fssrv/fssrv_filesystem_interface_adapter.cpp
+++ b/libraries/libstratosphere/source/fssrv/fssrv_filesystem_interface_adapter.cpp
@@ -232,7 +232,7 @@ namespace ams::fssrv::impl {
return this->base_fs->GetEntryType(reinterpret_cast(out.GetPointer()), normalizer.GetPath());
}
- Result FileSystemInterfaceAdapter::OpenFile(ams::sf::Out> out, const fssrv::sf::Path &path, u32 mode) {
+ Result FileSystemInterfaceAdapter::OpenFile(ams::sf::Out> out, const fssrv::sf::Path &path, u32 mode) {
auto read_lock = this->AcquireCacheInvalidationReadLock();
std::unique_lock open_count_semaphore;
@@ -254,14 +254,14 @@ namespace ams::fssrv::impl {
/* TODO: N creates an nn::fssystem::AsynchronousAccessFile here. */
std::shared_ptr shared_this = this->shared_from_this();
- std::shared_ptr file_intf = std::make_shared(std::move(file), std::move(shared_this), std::move(open_count_semaphore));
+ std::shared_ptr file_intf = std::make_shared>(std::move(file), std::move(shared_this), std::move(open_count_semaphore));
R_UNLESS(file_intf != nullptr, fs::ResultAllocationFailureInFileSystemInterfaceAdapter());
out.SetValue(std::move(file_intf), target_object_id);
return ResultSuccess();
}
- Result FileSystemInterfaceAdapter::OpenDirectory(ams::sf::Out> out, const fssrv::sf::Path &path, u32 mode) {
+ Result FileSystemInterfaceAdapter::OpenDirectory(ams::sf::Out> out, const fssrv::sf::Path &path, u32 mode) {
auto read_lock = this->AcquireCacheInvalidationReadLock();
std::unique_lock open_count_semaphore;
@@ -281,7 +281,7 @@ namespace ams::fssrv::impl {
const auto target_object_id = dir->GetDomainObjectId();
std::shared_ptr shared_this = this->shared_from_this();
- std::shared_ptr dir_intf = std::make_shared(std::move(dir), std::move(shared_this), std::move(open_count_semaphore));
+ std::shared_ptr dir_intf = std::make_shared>(std::move(dir), std::move(shared_this), std::move(open_count_semaphore));
R_UNLESS(dir_intf != nullptr, fs::ResultAllocationFailureInFileSystemInterfaceAdapter());
out.SetValue(std::move(dir_intf), target_object_id);