add romfs wrapper for program mounting

This commit is contained in:
HookedBehemoth 2020-06-05 18:19:52 +02:00
parent e9f2ca9a99
commit 86577c2c72
2 changed files with 18 additions and 0 deletions

View File

@ -82,6 +82,14 @@ Result romfsMountFromStorage(FsStorage storage, u64 offset, const char *name);
*/
Result romfsMountFromCurrentProcess(const char *name);
/**
* @brief Mounts RomFS of a running program.
* @note Permission needs to be set in the NPDM.
* @param program_id ProgramId to mount.
* @param name Device mount name.
*/
Result romfsMountProgram(u64 program_id, const char *name);
/**
* @brief Mounts RomFS from a file path in a mounted fsdev device.
* @param path File path.

View File

@ -342,6 +342,16 @@ Result romfsMountFromCurrentProcess(const char *name) {
return romfsMountFromStorage(storage, 0, name);
}
Result romfsMountProgram(u64 program_id, const char *name) {
FsStorage storage;
Result rc = fsOpenDataStorageByProgramId(&storage, program_id);
if (R_FAILED(rc))
return rc;
return romfsMountFromStorage(storage, 0, name);
}
Result romfsMountFromFsdev(const char *path, u64 offset, const char *name)
{
FsFileSystem *tmpfs = NULL;