ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
fw_if_fs_backend.h
Go to the documentation of this file.
1
17
18#pragma once
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#include <stdint.h>
25
26#include "fw_if_fs.h"
27
36 ra8_err_t (*stat)(void* ctx, const char* path, fw_fs_stat_t* out);
38 ra8_err_t (*listdir)(void* ctx,
39 const char* path,
40 uint32_t max_entries,
41 fw_fs_list_fn_t callback,
42 void* callback_ctx,
43 uint32_t* out_count,
44 bool* out_complete);
46 ra8_err_t (*dir_open)(void* ctx, const char* path, void* directory_state, uint32_t state_bytes);
48 ra8_err_t (*dir_next)(void* ctx,
49 void* directory_state,
51 bool* out_entry);
53 ra8_err_t (*dir_close)(void* ctx, void* directory_state);
55 ra8_err_t (*mkdir)(void* ctx, const char* path);
57 ra8_err_t (*unlink)(void* ctx, const char* path);
59 ra8_err_t (*rmdir)(void* ctx, const char* path);
61 ra8_err_t (*rename)(void* ctx, const char* old_path, const char* new_path, bool replace);
63 ra8_err_t (*space)(void* ctx, fw_fs_space_t* out);
64};
65
74 ra8_err_t (*open)(void* ctx,
75 const char* path,
77 void* file_state,
78 uint32_t state_bytes);
80 ra8_err_t (*read)(void* ctx, void* file_state, uint8_t* dst, uint32_t cap, uint32_t* out_read);
83 *write)(void* ctx, void* file_state, const uint8_t* src, uint32_t len, uint32_t* out_written);
85 ra8_err_t (*seek)(void* ctx, void* file_state, uint64_t absolute_offset);
87 ra8_err_t (*tell)(void* ctx, void* file_state, uint64_t* out_offset);
89 ra8_err_t (*size)(void* ctx, void* file_state, uint64_t* out_size);
91 ra8_err_t (*sync)(void* ctx, void* file_state);
93 ra8_err_t (*close)(void* ctx, void* file_state);
94};
95
105 ra8_err_t (*begin)(void* ctx,
106 void* transaction_state,
107 uint32_t state_bytes,
108 const char* destination,
111 ra8_err_t (*write)(void* ctx,
112 void* transaction_state,
113 const uint8_t* src,
114 uint32_t len,
115 uint32_t* out_written);
117 ra8_err_t (*seek)(void* ctx, void* transaction_state, uint64_t absolute_offset);
119 ra8_err_t (*validate)(void* ctx,
120 void* transaction_state,
121 fw_fs_validate_fn_t validator,
122 void* validator_ctx);
124 ra8_err_t (*commit)(void* ctx, void* transaction_state, bool* out_published);
126 ra8_err_t (*abort)(void* ctx, void* transaction_state);
127};
128
134[[nodiscard]] ra8_err_t fw_fs_bind(fw_fs_t* out,
135 const fw_fs_namespace_iface_t* namespace_iface,
136 const fw_fs_stream_iface_t* stream_iface,
137 const fw_fs_transaction_iface_t* transaction_iface,
138 void* ctx,
139 const fw_fs_caps_t* caps);
140
141#ifdef __cplusplus
142}
143#endif
Architecture-neutral filesystem namespace, stream, and transaction ports.
ra8_err_t fw_fs_bind(fw_fs_t *out, const fw_fs_namespace_iface_t *namespace_iface, const fw_fs_stream_iface_t *stream_iface, const fw_fs_transaction_iface_t *transaction_iface, void *ctx, const fw_fs_caps_t *caps)
Bind segregated vtables and one context into a complete facade.
Definition fw_if_fs.c:427
struct fw_fs_stream_iface fw_fs_stream_iface_t
struct fw_fs_transaction_iface fw_fs_transaction_iface_t
ra8_err_t(* fw_fs_validate_fn_t)(void *ctx, fw_fs_file_t *staged)
Validate staged bytes through a read-only generic file handle.
struct fw_fs_namespace_iface fw_fs_namespace_iface_t
fw_fs_open_mode_t
Open intent for fw_fs_open.
ra8_err_t(* fw_fs_list_fn_t)(void *ctx, const fw_fs_dirent_t *entry, bool *out_continue)
Bounded list callback.
fw_fs_transaction_policy_t
Destination policy for a staged transaction.
-proof
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Static properties and workspace requirements of one bound port.
Stable caller-owned value returned by fw_fs_dir_next.
Namespace backend operations.
ra8_err_t(* mkdir)(void *ctx, const char *path)
Create one directory leaf.
ra8_err_t(* listdir)(void *ctx, const char *path, uint32_t max_entries, fw_fs_list_fn_t callback, void *callback_ctx, uint32_t *out_count, bool *out_complete)
Enumerate at most the requested number of directory entries.
ra8_err_t(* rmdir)(void *ctx, const char *path)
Remove one empty directory leaf.
ra8_err_t(* rename)(void *ctx, const char *old_path, const char *new_path, bool replace)
Rename one leaf within the backend volume.
ra8_err_t(* dir_open)(void *ctx, const char *path, void *directory_state, uint32_t state_bytes)
Open a directory cursor in caller-supplied workspace.
ra8_err_t(* stat)(void *ctx, const char *path, fw_fs_stat_t *out)
Query one path without following a symbolic-link leaf.
ra8_err_t(* dir_next)(void *ctx, void *directory_state, fw_fs_dirent_value_t *out, bool *out_entry)
Copy the next visible entry or report clean end-of-directory.
ra8_err_t(* space)(void *ctx, fw_fs_space_t *out)
Query the volume capacity and available byte count.
ra8_err_t(* dir_close)(void *ctx, void *directory_state)
Close a directory cursor and consume its backend state.
ra8_err_t(* unlink)(void *ctx, const char *path)
Remove one regular-file leaf.
Portable volume usage snapshot.
Result of a portable metadata query.
Open-file backend operations over caller-supplied state.
ra8_err_t(* tell)(void *ctx, void *file_state, uint64_t *out_offset)
Report the current absolute stream position.
ra8_err_t(* close)(void *ctx, void *file_state)
Close the file and release its caller workspace.
ra8_err_t(* open)(void *ctx, const char *path, fw_fs_open_mode_t mode, void *file_state, uint32_t state_bytes)
Initialize caller workspace for one path and open mode.
ra8_err_t(* size)(void *ctx, void *file_state, uint64_t *out_size)
Report the current file length.
ra8_err_t(* read)(void *ctx, void *file_state, uint8_t *dst, uint32_t cap, uint32_t *out_read)
Read bytes at the current stream position.
ra8_err_t(* sync)(void *ctx, void *file_state)
Request backend file durability when supported.
ra8_err_t(* seek)(void *ctx, void *file_state, uint64_t absolute_offset)
Set the absolute stream position.
One complete composition-root filesystem binding.
Staged-publication backend operations over caller-supplied state.
ra8_err_t(* abort)(void *ctx, void *transaction_state)
Close and remove an unpublished private stage.
ra8_err_t(* validate)(void *ctx, void *transaction_state, fw_fs_validate_fn_t validator, void *validator_ctx)
Run a caller validator against the staged stream.
ra8_err_t(* begin)(void *ctx, void *transaction_state, uint32_t state_bytes, const char *destination, fw_fs_transaction_policy_t policy)
Create a private stage for the requested destination policy.
ra8_err_t(* seek)(void *ctx, void *transaction_state, uint64_t absolute_offset)
Set the absolute position within the staged stream.
ra8_err_t(* commit)(void *ctx, void *transaction_state, bool *out_published)
Publish the validated stage under the destination path.