libnx  v4.7.0
Data Structures | Functions
romfs_dev.h File Reference

RomFS driver. More...

#include "../../types.h"
#include "../../services/fs.h"
#include "../../services/ncm_types.h"

Go to the source code of this file.

Data Structures

struct  romfs_header
 RomFS header. More...
 
struct  romfs_dir
 RomFS directory. More...
 
struct  romfs_file
 RomFS file. More...
 

Functions

Result romfsMountSelf (const char *name)
 Mounts the Application's RomFS. More...
 
Result romfsMountFromFile (FsFile file, u64 offset, const char *name)
 Mounts RomFS from an open file. More...
 
Result romfsMountFromStorage (FsStorage storage, u64 offset, const char *name)
 Mounts RomFS from an open storage. More...
 
Result romfsMountFromCurrentProcess (const char *name)
 Mounts RomFS using the current process host program RomFS. More...
 
Result romfsMountDataStorageFromProgram (u64 program_id, const char *name)
 Mounts RomFS of a running program. More...
 
Result romfsMountFromFsdev (const char *path, u64 offset, const char *name)
 Mounts RomFS from a file path in a mounted fsdev device. More...
 
Result romfsMountFromDataArchive (u64 dataId, NcmStorageId storageId, const char *name)
 Mounts RomFS from SystemData. More...
 
Result romfsUnmount (const char *name)
 Unmounts the RomFS device.
 
static Result romfsInit (void)
 Wrapper for romfsMountSelf with the default "romfs" device name.
 
static Result romfsExit (void)
 Wrapper for romfsUnmount with the default "romfs" device name.
 

Detailed Description

RomFS driver.

Author
yellows8
mtheall
fincs

Function Documentation

◆ romfsMountDataStorageFromProgram()

Result romfsMountDataStorageFromProgram ( u64  program_id,
const char *  name 
)

Mounts RomFS of a running program.

Note
Permission needs to be set in the NPDM.
Parameters
program_idProgramId to mount.
nameDevice mount name.

◆ romfsMountFromCurrentProcess()

Result romfsMountFromCurrentProcess ( const char *  name)

Mounts RomFS using the current process host program RomFS.

Parameters
nameDevice mount name.

◆ romfsMountFromDataArchive()

Result romfsMountFromDataArchive ( u64  dataId,
NcmStorageId  storageId,
const char *  name 
)

Mounts RomFS from SystemData.

Parameters
dataIdSystemDataId to mount.
storageIdStorage ID to mount from.
nameDevice mount name.

◆ romfsMountFromFile()

Result romfsMountFromFile ( FsFile  file,
u64  offset,
const char *  name 
)

Mounts RomFS from an open file.

Parameters
fileFsFile of the RomFS image.
offsetOffset of the RomFS within the file.
nameDevice mount name.

◆ romfsMountFromFsdev()

Result romfsMountFromFsdev ( const char *  path,
u64  offset,
const char *  name 
)

Mounts RomFS from a file path in a mounted fsdev device.

Parameters
pathFile path.
offsetOffset of the RomFS within the file.
nameDevice mount name.

◆ romfsMountFromStorage()

Result romfsMountFromStorage ( FsStorage  storage,
u64  offset,
const char *  name 
)

Mounts RomFS from an open storage.

Parameters
storageFsStorage of the RomFS image.
offsetOffset of the RomFS within the storage.
nameDevice mount name.

◆ romfsMountSelf()

Result romfsMountSelf ( const char *  name)

Mounts the Application's RomFS.

Parameters
nameDevice mount name.
Remarks
This function is intended to be used to access one's own RomFS. If the application is running as NRO, it mounts the embedded RomFS section inside the NRO. If on the other hand it's an NSO, it behaves identically to romfsMountFromCurrentProcess.