ProtoCore v0.0.2
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
vfs.h File Reference

Unified virtual filesystem wrapper (PC_ENABLE_VFS). More...

#include "protocore_config.h"
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Detailed Description

Unified virtual filesystem wrapper (PC_ENABLE_VFS).

One small file API the rest of the library and the application can target, backed by a pluggable store. Two backends ship:

  • RAM (built-in, host-testable, zero-heap): a fixed pool of PC_VFS_RAM_FILES files of up to PC_VFS_RAM_FILE_SIZE bytes each, all in BSS - deterministic, bounded, and the same on host and ESP32. Ideal as a scratch / test / RAM-disk store.
  • Arduino FS (ESP32 only): wraps a real fs::FS (LittleFS / SD / SPIFFS) for persistent storage. Mount it with pc_vfs_mount(pc_vfs_fs(&LittleFS)).

The point is a single seam: a feature (a config store, the audit-log sink, a template loader, an upload target) calls pc_vfs_* and works against whichever backend the application mounted - RAM in tests, flash or SD in production - without knowing which. Handles are small ints the backend assigns; the API fails closed (-1 / false) when nothing is mounted or a bound is hit.

Single-accessor like the other services: use it from one context (a worker / loop), not concurrently.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file vfs.h.