sysupdater: begin implementing api

This commit is contained in:
Michael Scire 2020-06-25 21:59:59 -07:00
parent 3b4b19893b
commit 8f0ee258ac
4 changed files with 26 additions and 12 deletions

View File

@ -57,10 +57,11 @@ namespace ams::impl {
AMS_DEFINE_SYSTEM_THREAD(-1, boot, Main);
/* Mitm. */
AMS_DEFINE_SYSTEM_THREAD(-7, mitm, InitializeThread);
AMS_DEFINE_SYSTEM_THREAD(-1, mitm_sf, QueryServerProcessThread);
AMS_DEFINE_SYSTEM_THREAD(16, mitm_fs, RomFileSystemInitializeThread);
AMS_DEFINE_SYSTEM_THREAD(21, mitm, DebugThrowThread);
AMS_DEFINE_SYSTEM_THREAD(-7, mitm, InitializeThread);
AMS_DEFINE_SYSTEM_THREAD(-1, mitm_sf, QueryServerProcessThread);
AMS_DEFINE_SYSTEM_THREAD(16, mitm_fs, RomFileSystemInitializeThread);
AMS_DEFINE_SYSTEM_THREAD(21, mitm, DebugThrowThread);
AMS_DEFINE_SYSTEM_THREAD(21, mitm_sysupdater, IpcServer);
/* boot2. */
AMS_DEFINE_SYSTEM_THREAD(20, boot2, Main);

View File

@ -23,8 +23,11 @@
namespace ams::ncm {
Result ReadContentMetaPath(AutoBuffer *out, const char *path);
using MountContentMetaFunction = Result (*)(const char *mount_name, const char *path);
Result ReadContentMetaPath(AutoBuffer *out, const char *path);
Result ReadVariationContentMetaInfoList(s32 *out_count, std::unique_ptr<ContentMetaInfo[]> *out_meta_infos, const Path &path, FirmwareVariationId firmware_variation_id);
void SetMountContentMetaFunction(MountContentMetaFunction func);
}

View File

@ -24,12 +24,12 @@ namespace ams::fssystem {
/* Official FS has a 4.5 MB exp heap, a 6 MB buffer pool, an 8 MB device buffer manager heap, and a 14 MB buffer manager heap. */
/* We don't need so much memory for ams.mitm (as we're servicing a much more limited context). */
/* We'll give ourselves a 2.5 MB exp heap, a 2 MB buffer pool, a 2 MB device buffer manager heap, and a 2 MB buffer manager heap. */
/* These numbers match signed-system-partition safe FS. */
constexpr size_t ExpHeapSize = 2_MB + 512_KB;
constexpr size_t BufferPoolSize = 2_MB;
constexpr size_t DeviceBufferSize = 2_MB;
constexpr size_t BufferManagerHeapSize = 2_MB;
/* We'll give ourselves a 1.5 MB exp heap, a 1 MB buffer pool, a 1 MB device buffer manager heap, and a 1 MB buffer manager heap. */
/* These numbers are 1 MB less than signed-system-partition safe FS in all pools. */
constexpr size_t ExpHeapSize = 1_MB + 512_KB;
constexpr size_t BufferPoolSize = 1_MB;
constexpr size_t DeviceBufferSize = 1_MB;
constexpr size_t BufferManagerHeapSize = 1_MB;
constexpr size_t MaxCacheCount = 1024;
constexpr size_t BlockSize = 16_KB;

View File

@ -26,12 +26,18 @@ namespace ams::ncm {
return impl::PathView(name).HasSuffix(".cnmt");
}
Result MountContentMetaByRemoteFileSystemProxy(const char *mount_name, const char *path) {
return fs::MountContent(mount_name, path, fs::ContentType_Meta);
}
constinit MountContentMetaFunction g_mount_content_meta_func = MountContentMetaByRemoteFileSystemProxy;
}
Result ReadContentMetaPath(AutoBuffer *out, const char *path) {
/* Mount the content. */
auto mount_name = impl::CreateUniqueMountName();
R_TRY(fs::MountContent(mount_name.str, path, fs::ContentType_Meta));
R_TRY(g_mount_content_meta_func(mount_name.str, path));
ON_SCOPE_EXIT { fs::Unmount(mount_name.str); };
/* Open the root directory. */
@ -156,4 +162,8 @@ namespace ams::ncm {
return ResultSuccess();
}
void SetMountContentMetaFunction(MountContentMetaFunction func) {
g_mount_content_meta_func = func;
}
}