KallistiOS  2.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Macros | Functions
fs_romdisk.h File Reference

ROMFS virtual file system. More...

#include <sys/cdefs.h>
#include <arch/types.h>
#include <kos/limits.h>
#include <kos/fs.h>

Go to the source code of this file.

Macros

#define MAX_RD_FILES   16
 The maximum number of files that can be open at a time.

Functions

int fs_romdisk_mount (const char *mountpoint, const uint8 *img, int own_buffer)
 Mount a ROMFS image as a new filesystem.
int fs_romdisk_unmount (const char *mountpoint)
 Unmount a ROMFS image.

Detailed Description

ROMFS virtual file system.

This file contains support for the romdisk VFS. This VFS allows you to make Linux-style ROMFS images and either embed them into your binary or load them at runtime from some other source (such as a CD-ROM). These images are made with the genromfs program that is included in the utils portion of the tree.

You can choose to automount one ROMFS image by embedding it into your binary and using the appropriate KOS_INIT_FLAGS() setting. The embedded ROMFS will mount itself on /rom. You can also mount additional images that you load from some other source on whatever mountpoint you want.

Author:
Dan Potter

Macro Definition Documentation

#define MAX_RD_FILES   16

The maximum number of files that can be open at a time.


Function Documentation

int fs_romdisk_mount ( const char *  mountpoint,
const uint8 img,
int  own_buffer 
)

Mount a ROMFS image as a new filesystem.

This function will mount a ROMFS image that has been loaded into memory to the specified mountpoint.

Parameters:
mountpointThe directory to mount this romdisk on
imgThe ROMFS image
own_bufferIf 0, you are still responsible for img, and must free it if appropriate. If non-zero, img will be freed when it is unmounted
Return values:
0On success
-1On error
int fs_romdisk_unmount ( const char *  mountpoint)

Unmount a ROMFS image.

This function unmounts a ROMFS image that has been previously mounted with fs_romdisk_mount(). This function does not check for open files on the fs, so make sure that all files have been closed before calling it. If the VFS owns the buffer (own_buffer was non-zero when you called the mount function) then this function will also free the buffer.

Parameters:
mountpointThe ROMFS to unmount
Return values:
0On success
-1On error
Error Conditions:
ENOENT - no such ROMFS was mounted