Skip to content
/ ramfs Public

A memory based file system for embedded use.

License

Notifications You must be signed in to change notification settings

jkent/ramfs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jan 16, 2025
4ab0a10 · Jan 16, 2025

History

12 Commits
Dec 8, 2023
Jan 16, 2025
Aug 5, 2024
Dec 7, 2023
Jan 16, 2025
Jan 16, 2025
Jan 16, 2025
Dec 7, 2023
Dec 7, 2023
Dec 7, 2023
Aug 5, 2024
Dec 7, 2023
Dec 8, 2023
Jan 16, 2025
Jan 16, 2025
Aug 6, 2024

Repository files navigation

About RamFS

RamFS is a memory based filesystem designed for embedded use. It can be easily used with a CMake project — including ESP-IDF.

Getting started with ESP-IDF

To use this component with ESP-IDF, within your projects directory run

idf.py add-dependency jkent/ramfs

Usage

Two interfaces are available: the bare API or when using IDF there is the VFS interface which builds on top of the bare API. You should use the VFS interface in IDF projects, as it uses the portable and familiar posix and stdio C functions with it. There is nothing preventing you from mix and matching both at the same time, however.

Shared initialization

Initialization is as simple as calling ramfs_init function and checking its return variable:

ramfs_fs_t *fs = ramfs_init();
assert(fs != NULL);

When done, and all file handles are closed, you can call ramfs_deinit:

ramfs_deinit(fs);

VFS interface

The VFS interface adds another step to the initialization: you define a ramfs_vfs_conf_t structure:

  • base_path - path to mount the ramfs
  • fs - a ramfs_fs_t instance
  • max_files - max number of files that can be open at a time
ramfs_vfs_conf_t ramfs_vfs_conf = {
    .base_path = "/ramfs",
    .fs = fs,
    .max_files = 5,
};
ramfs_vfs_register(&ramfs_vfs_conf);

Bare API

Filesystem functions:

Object functions:

Directory Functions: