|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
The mount: which store is behind the filesystem, and the vtable it answers through. More...
#include "protocore_config.h"Go to the source code of this file.
Classes | |
| struct | protocore_mnt_stat |
| What a stat and a directory entry both answer: the facts about one file, and no name. More... | |
| struct | protocore_mnt_backend |
| A storage backend. Each open call returns a small handle (>= 0) or -1. More... | |
| struct | MntArgs |
| The mount point a call names, and what registering one takes. More... | |
| struct | MntVars |
| struct | MntNs |
| The entries. More... | |
Macros | |
| #define | PROTOCORE_MNT_NONE 0xFFu |
| Mount the active backend (call once at setup; NULL unmounts). | |
Typedefs | |
| typedef PROTOCORE_BEGIN_DECLS enum PROTO_ENUM_PACKED | protocore_mnt_mode |
| Open modes. | |
| typedef struct protocore_mnt_backend | protocore_mnt_backend |
| A storage backend. Each open call returns a small handle (>= 0) or -1. | |
Enumerations | |
| enum | PROTO_ENUM_PACKED { PROTOCORE_MNT_READ = 0 , PROTOCORE_MNT_WRITE = 1 , PROTOCORE_MNT_APPEND = 2 , PROTOCORE_MNT_RDWR = 3 } |
| Open modes. More... | |
Functions | |
| void | protocore_mnt_point_add (uint8_t *work) |
| void | protocore_mnt_point_of (uint8_t *work) |
| void | protocore_mnt_root_of (uint8_t *work) |
| void | protocore_mnt_reset (uint8_t *work) |
| void | protocore_mnt_mount (uint8_t *work) |
| void | protocore_mnt_active (uint8_t *work) |
Variables | |
| MntVars | MntV |
| The operands and the outcome. | |
The mount: which store is behind the filesystem, and the vtable it answers through.
This file answers one question - what is mounted - and nothing else. The operations a caller performs live on the filesystem accessor (server/filesystem.h), which resolves a request path against its root and then dispatches here. Splitting it that way means a backend author implements storage and never touches path policy, and the .. guard cannot be bypassed by reaching a backend directly.
Two backends ship, each its own module, because a backend is a footprint and this is a seam:
Handles are small ints the backend assigns, and a directory cursor is one of them - so ::close releases either kind and there is no second lifetime to get wrong. Every entry point fails closed (-1 / false) when nothing is mounted.
Single-accessor like the other services: use it from one context (a worker / loop), not concurrently.
Definition in file mnt.h.
| #define PROTOCORE_MNT_NONE 0xFFu |
| typedef PROTOCORE_BEGIN_DECLS enum PROTO_ENUM_PACKED protocore_mnt_mode |
Open modes.
PROTOCORE_MNT_RDWR is the only one that admits a seek before a write. Under PROTOCORE_MNT_APPEND a write lands at end-of-file whatever the position says, which is what O_APPEND means on a real filesystem, so a caller that overwrites in place has to ask for RDWR and a backend that cannot offer it answers -1.
| typedef struct protocore_mnt_backend protocore_mnt_backend |
A storage backend. Each open call returns a small handle (>= 0) or -1.
Implement this to add a store; the built-in RAM disk publishes one through MntRamNs::backend (server/storage/mnt_ram).
Every call here is one node. mnt is blind - it does not know what a path means, so it cannot know what a subtree is, and nothing here takes one. A whole-tree operation is composed from these by the accessor (server/storage/filesystem.h), which is the seam that does know.
| enum PROTO_ENUM_PACKED |
Open modes.
PROTOCORE_MNT_RDWR is the only one that admits a seek before a write. Under PROTOCORE_MNT_APPEND a write lands at end-of-file whatever the position says, which is what O_APPEND means on a real filesystem, so a caller that overwrites in place has to ask for RDWR and a backend that cannot offer it answers -1.
| void protocore_mnt_point_add | ( | uint8_t * | work | ) |
| void protocore_mnt_point_of | ( | uint8_t * | work | ) |
| void protocore_mnt_root_of | ( | uint8_t * | work | ) |
| void protocore_mnt_reset | ( | uint8_t * | work | ) |
| void protocore_mnt_mount | ( | uint8_t * | work | ) |
| void protocore_mnt_active | ( | uint8_t * | work | ) |
|
extern |
The operands and the outcome.