35#ifndef PROTOCORE_MNT_H
36#define PROTOCORE_MNT_H
50 PROTOCORE_MNT_READ = 0,
51 PROTOCORE_MNT_WRITE = 1,
52 PROTOCORE_MNT_APPEND = 2,
53 PROTOCORE_MNT_RDWR = 3,
88 int (*
open)(
const char *path,
int mode);
89 int (*
read)(
int handle,
void *buf,
size_t n);
90 int (*
write)(
int handle,
const void *buf,
size_t n);
92 embed_bool (*
seek)(
int handle, uint64_t off);
93 long (*
size)(
const char *path);
94 embed_bool (*
exists)(
const char *path);
95 embed_bool (*
remove)(
const char *path);
96 embed_bool (*
rename)(
const char *from,
const char *to);
97 embed_bool (*
mkdir)(
const char *path);
98 embed_bool (*
rmdir)(
const char *path);
113 embed_bool (*
sync)(
int handle);
122#define PROTOCORE_MNT_NONE 0xFFu
166 void (*
const reset)(
const uint8_t *work);
167 void (*
const mount)(
const uint8_t *work);
168 void (*
const active)(
const uint8_t *work);
184static const MntNs Mnt __attribute__((unused)) = {
EMBED_BEGIN_DECLS EMBED_ENUM_BYTE(protocore_mnt_mode, PROTOCORE_MNT_READ=0, PROTOCORE_MNT_WRITE=1, PROTOCORE_MNT_APPEND=2, PROTOCORE_MNT_RDWR=3,)
Open modes.
void protocore_mnt_active(const uint8_t *work)
void protocore_mnt_point_add(const uint8_t *work)
MntVars MntV
The operands and the outcome.
void protocore_mnt_mount(const uint8_t *work)
void protocore_mnt_reset(const uint8_t *work)
void protocore_mnt_root_of(const uint8_t *work)
void protocore_mnt_point_of(const uint8_t *work)
The mount point a call names, and what registering one takes.
const protocore_mnt_backend * backend
the filesystem behind the point
uint8_t id
the point a lookup names
const char * root
the path prefix it answers for
void(*const reset)(const uint8_t *work)
void(*const mount)(const uint8_t *work)
void(*const point_add)(const uint8_t *work)
void(*const point_of)(const uint8_t *work)
void(*const active)(const uint8_t *work)
void(*const root_of)(const uint8_t *work)
const protocore_mnt_backend * backend
A storage backend. Each open call returns a small handle (>= 0) or -1.
embed_bool(* readdir)(int handle, protocore_mnt_stat *out, char *name, size_t name_cap)
Next entry: facts into out, name into name (NUL-terminated). False at end.
embed_bool(* remove)(const char *path)
delete a file; true on success.
long(* size)(const char *path)
file size, or -1 if absent.
int(* open)(const char *path, int mode)
-> handle (>=0) or -1.
embed_bool(* mkdir)(const char *path)
create a directory; true on success.
embed_bool(* exists)(const char *path)
true if the path exists.
int(* write)(int handle, const void *buf, size_t n)
bytes written, or -1.
void(* close)(int handle)
release a file OR directory handle.
embed_bool(* rmdir)(const char *path)
remove an empty directory; true on success.
embed_bool(* sync)(int handle)
Push everything written to handle past the backend's own buffering, and report whether it got there....
int(* opendir)(const char *path)
-> directory handle (>=0) or -1.
embed_bool(* stat)(const char *path, protocore_mnt_stat *out)
fill out for path; false if absent.
embed_bool(* rename)(const char *from, const char *to)
rename; true on success.
int(* read)(int handle, void *buf, size_t n)
bytes read, or -1.
embed_bool(* seek)(int handle, uint64_t off)
absolute seek; false if unsupported.
What a stat and a directory entry both answer: the facts about one file, and no name.
uint64_t size
0 for a directory
uint32_t mtime
unix epoch seconds, 0 if the backend keeps no timestamp