ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
mdl_config.c File Reference

Flat key=value site-descriptor parser over injected portable storage. More...

#include "mdl_config.h"
#include <string.h>
#include "mdl_politeness.h"
#include "ra8_attributes.h"
Include dependency graph for mdl_config.c:

Go to the source code of this file.

Data Structures

struct  internal_config_reader_t
 Buffered reader borrowing one initialized storage binding. More...

Enumerations

enum  mdl_parse_limits_t : uint16_t { k_line_max = 512 }
 Local parser limits. More...
enum  mdl_config_io_limit_t : uint32_t {
  k_config_file_max = 64U * 1024U ,
  k_config_read_calls = k_config_file_max + 1U ,
  k_config_dec_base = 10U
}
 Complete descriptor and backend-progress ceilings. More...
enum  mdl_kv_result_t : uint8_t {
  k_kv_unknown = 0 ,
  k_kv_applied = 1 ,
  k_kv_invalid = 2
}
 Result of applying one descriptor key. More...
enum  mdl_config_defaults_t : uint16_t {
  k_def_img_delay_min = 500 ,
  k_def_img_delay_max = 1200 ,
  k_def_chapter_delay_min = 1500 ,
  k_def_chapter_delay_max = 3000
}
 Default politeness bounds (ms) applied before the file is read. More...
enum  mdl_config_polite_floor_t : uint16_t {
  k_polite_img_min_ms = 2000 ,
  k_polite_img_max_ms = 4000 ,
  k_polite_chap_min_ms = 5000 ,
  k_polite_chap_max_ms = 10000
}
 --polite per-request delay floors (milliseconds). More...

Functions

static char * internal_config_trim (char *s)
 Trim leading/trailing ASCII whitespace in place; return start.
static bool internal_config_set_str (char *dst, size_t cap, const char *val)
 Copy one descriptor value without truncation.
static mdl_kv_result_t internal_config_apply_string (mdl_site_t *s, const char *key, const char *val)
 Apply a string-valued key and distinguish unknown from invalid.
static bool internal_config_parse_u32 (const char *val, uint32_t *out)
 Parse one complete unsigned 32-bit decimal field.
static mdl_kv_result_t internal_config_apply_u32 (mdl_site_t *s, const char *key, const char *val)
 Apply an unsigned-integer key (jitter delay or governor bound).
static bool internal_config_parse_order (const char *val, mdl_chapter_order_t *out)
 Parse the configured chapter-order spelling.
static bool internal_config_apply_pair (mdl_site_t *s, const char *key, const char *val)
 Apply one descriptor key/value pair.
static void internal_config_set_defaults (mdl_site_t *out)
 Apply the polite default descriptor before the file overrides it.
static ra8_err_t internal_config_next (internal_config_reader_t *reader, uint8_t *out_byte, bool *out_eof)
 Read one byte through a bounded buffered portable stream.
static ra8_err_t internal_config_read_line (internal_config_reader_t *reader, char *line, uint32_t capacity, bool *out_present)
 Read one complete bounded descriptor line.
static ra8_err_t internal_config_apply_line (mdl_site_t *site, char *line)
 Apply one already bounded descriptor record.
static ra8_err_t internal_config_parse (internal_config_reader_t *reader, mdl_site_t *out)
 Parse every descriptor record from an open portable stream.
static bool internal_config_valid (const mdl_site_t *site)
 Validate descriptor cross-field and selector invariants.
ra8_err_t mdl_config_load (mdl_storage_t *storage, const char *path, mdl_site_t *out)
 Load a site descriptor from a flat key=value file.
mdl_gov_cfg_t mdl_config_gov_cfg (const mdl_site_t *site)
 Build the politeness-governor tunables for a loaded site descriptor.
static uint32_t internal_config_max_u32 (uint32_t a, uint32_t b)
 Return the larger of two unsigned values.
void mdl_config_apply_polite (mdl_site_t *site)
 Raise a descriptor's per-request delay floors for --polite.

Detailed Description

Flat key=value site-descriptor parser over injected portable storage.

Validates bounded descriptor fields and converts policy values from storage-backed text without retaining external buffers.

Definition in file mdl_config.c.

Enumeration Type Documentation

◆ mdl_config_defaults_t

enum mdl_config_defaults_t : uint16_t

Default politeness bounds (ms) applied before the file is read.

Enumerator
k_def_img_delay_min 

Per-image spacing floor.

k_def_img_delay_max 

Per-image spacing ceiling.

k_def_chapter_delay_min 

Inter-chapter spacing floor.

k_def_chapter_delay_max 

Inter-chapter spacing ceiling.

Definition at line 46 of file mdl_config.c.

◆ mdl_config_io_limit_t

enum mdl_config_io_limit_t : uint32_t

Complete descriptor and backend-progress ceilings.

Enumerator
k_config_file_max 

Largest accepted descriptor file.

k_config_read_calls 

One-byte reads plus EOF.

k_config_dec_base 

Base-10 integer fields.

Definition at line 22 of file mdl_config.c.

◆ mdl_config_polite_floor_t

enum mdl_config_polite_floor_t : uint16_t

--polite per-request delay floors (milliseconds).

Enumerator
k_polite_img_min_ms 

Polite per-image floor.

k_polite_img_max_ms 

Polite per-image ceiling.

k_polite_chap_min_ms 

Polite inter-chapter floor.

k_polite_chap_max_ms 

Polite inter-chapter ceiling.

Definition at line 54 of file mdl_config.c.

◆ mdl_kv_result_t

enum mdl_kv_result_t : uint8_t

Result of applying one descriptor key.

Enumerator
k_kv_unknown 

Key is not owned by this helper.

k_kv_applied 

Key and value were accepted.

k_kv_invalid 

Key is known but value is invalid.

Definition at line 39 of file mdl_config.c.

◆ mdl_parse_limits_t

enum mdl_parse_limits_t : uint16_t

Local parser limits.

Enumerator
k_line_max 

Max config line bytes including NUL.

Definition at line 17 of file mdl_config.c.

Function Documentation

◆ internal_config_apply_line()

ra8_err_t internal_config_apply_line ( mdl_site_t * site,
char * line )
static

Apply one already bounded descriptor record.

Trims whitespace, ignores blank/comment/section records, and applies exactly one complete key/value pair for every active record.

Parameters
[in,out]siteDescriptor receiving the record.
[in,out]lineMutable NUL-terminated record text.
Returns
Record validation status.
Return values
k_ra8_okA blank/comment/section line was ignored or a pair applied.
k_ra8_err_invalid_stateThe record was malformed or unsupported.
Precondition
Both pointers are non-NULL and line is NUL-terminated.
line is writable because the separator is replaced in place.
Postcondition
Success preserves descriptor invariants for all applied fields.
Failure never stores a truncated field.
Note
Not thread-safe for a shared descriptor.
Since
0.1.0

Definition at line 454 of file mdl_config.c.

References internal_config_apply_pair(), internal_config_trim(), k_ra8_err_invalid_state, k_ra8_ok, RA8_INTERNAL, and strchr().

Referenced by internal_config_parse().

◆ internal_config_apply_pair()

bool internal_config_apply_pair ( mdl_site_t * s,
const char * key,
const char * val )
static

Apply one descriptor key/value pair.

Dispatches string, unsigned-integer, and chapter-order keys while rejecting unknown names and malformed values.

Parameters
[in,out]sSite descriptor being populated.
[in]keyNUL-terminated key spelling.
[in]valNUL-terminated value text.
Returns
Whether the key is known and its complete value is valid.
Return values
trueThe matching descriptor field was updated.
falseThe key is unknown or its value is invalid.
Precondition
s, key, and val are non-NULL.
Both string arguments are NUL-terminated.
Postcondition
On true, exactly the selected field is updated.
On false, no truncated string is stored.
Note
Not thread-safe: mutates caller-owned descriptor storage.
Since
0.1.0

Definition at line 285 of file mdl_config.c.

References mdl_site_t::chapter_order, internal_config_apply_string(), internal_config_apply_u32(), internal_config_parse_order(), k_kv_applied, k_kv_unknown, RA8_INTERNAL, and strcmp().

Referenced by internal_config_apply_line().

◆ internal_config_apply_string()

mdl_kv_result_t internal_config_apply_string ( mdl_site_t * s,
const char * key,
const char * val )
static

Apply a string-valued key and distinguish unknown from invalid.

Searches the fixed descriptor-field table and copies only complete, bounded values into the selected field.

Parameters
[in,out]sDescriptor receiving a recognized string field.
[in]keyNUL-terminated configuration key.
[in]valNUL-terminated configuration value.
Returns
Three-way key application result.
Return values
k_kv_appliedA recognized key was copied without truncation.
k_kv_invalidA recognized value exceeded its destination bound.
k_kv_unknownThe key is not a string-valued descriptor field.
Precondition
All pointers are non-NULL.
key and val are NUL-terminated.
Postcondition
Applied values are complete and NUL-terminated.
Unknown or invalid keys do not modify a descriptor field.
Note
Not thread-safe for concurrent writes to the same descriptor.
Since
0.1.0

< Config key spelling.

< Descriptor field it fills.

< Capacity of that field.

Definition at line 121 of file mdl_config.c.

References mdl_site_t::browse_url, mdl_site_t::chapter_number_selector, mdl_site_t::chapter_title_selector, mdl_site_t::chapter_url_contains, mdl_site_t::chapter_url_prefix, mdl_site_t::contact, mdl_site_t::host, internal_config_set_str(), k_kv_applied, k_kv_invalid, k_kv_unknown, mdl_site_t::kind, mdl_site_t::language, mdl_site_t::name, mdl_site_t::page_img_attr, mdl_site_t::page_img_url_contains, mdl_site_t::reading_direction, mdl_site_t::search_result_contains, mdl_site_t::search_url, mdl_site_t::series_artist_selector, mdl_site_t::series_author_selector, mdl_site_t::series_cover_selector, mdl_site_t::series_summary_selector, mdl_site_t::series_title_selector, and strcmp().

Referenced by internal_config_apply_pair().

◆ internal_config_apply_u32()

mdl_kv_result_t internal_config_apply_u32 ( mdl_site_t * s,
const char * key,
const char * val )
static

Apply an unsigned-integer key (jitter delay or governor bound).

Searches the fixed integer-field table and delegates complete, overflow-safe decimal conversion to internal_config_parse_u32.

Parameters
[in,out]sDescriptor receiving a recognized integer field.
[in]keyNUL-terminated configuration key.
[in]valNUL-terminated unsigned decimal value.
Returns
Three-way key application result.
Return values
k_kv_appliedA recognized key received a valid integer.
k_kv_invalidA recognized key carried an invalid integer.
k_kv_unknownThe key is not an integer-valued descriptor field.
Precondition
All pointers are non-NULL.
key and val are NUL-terminated.
Postcondition
Applied values exactly equal the parsed decimal text.
Unknown or invalid keys do not modify an integer field.
Note
Not thread-safe for concurrent writes to the same descriptor.
Since
0.1.0

< Config key spelling.

< Descriptor field it fills.

Definition at line 212 of file mdl_config.c.

References mdl_site_t::backoff_base_ms, mdl_site_t::backoff_max_ms, mdl_site_t::burst, mdl_site_t::chapter_delay_max, mdl_site_t::chapter_delay_min, mdl_site_t::img_delay_max, mdl_site_t::img_delay_min, internal_config_parse_u32(), k_kv_applied, k_kv_invalid, k_kv_unknown, mdl_site_t::max_inflight, mdl_site_t::rate_per_min, and strcmp().

Referenced by internal_config_apply_pair().

◆ internal_config_max_u32()

uint32_t internal_config_max_u32 ( uint32_t a,
uint32_t b )
static

Return the larger of two unsigned values.

Performs one comparison without arithmetic or overflow risk.

Parameters
[in]aFirst candidate.
[in]bSecond candidate.
Returns
The greater candidate, or their shared value when equal.
Return values
aa is greater than or equal to b.
bb is greater than a.
Precondition
Both arguments are valid uint32_t values.
No external state is required.
Postcondition
The result is greater than or equal to both inputs.
Neither input nor global state is modified.
Note
Thread-safe and side-effect free.
Since
0.1.0

Definition at line 620 of file mdl_config.c.

References RA8_INTERNAL.

Referenced by mdl_config_apply_polite().

◆ internal_config_next()

ra8_err_t internal_config_next ( internal_config_reader_t * reader,
uint8_t * out_byte,
bool * out_eof )
static

Read one byte through a bounded buffered portable stream.

Refills the storage binding's caller-owned scratch when exhausted; a successful zero-byte read is represented only through out_eof.

Parameters
[in,out]readerOpen descriptor reader.
[out]out_byteNext byte when one is available.
[out]out_eofWhether clean end-of-file was reached.
Returns
Canonical stream status.
Return values
k_ra8_okA byte or clean EOF was reported.
k_ra8_err_invalid_sizeThe bounded read-call ceiling was exhausted.
otherA backend read failure propagated unchanged.
Precondition
All pointers are non-NULL and reader owns an open file.
The storage scratch is exclusively borrowed for the parse.
Postcondition
Success initializes out_eof and initializes out_byte unless EOF.
No backend read is issued after clean EOF.
Note
Not thread-safe for a shared storage binding.
Since
0.1.0

Definition at line 358 of file mdl_config.c.

References internal_config_reader_t::available, internal_config_reader_t::eof, internal_config_reader_t::file, fw_fs_read(), mdl_storage_t::io_buffer, mdl_storage_t::io_buffer_bytes, k_config_read_calls, k_ra8_err_invalid_size, k_ra8_ok, internal_config_reader_t::position, internal_config_reader_t::read_calls, and internal_config_reader_t::storage.

Referenced by internal_config_read_line().

◆ internal_config_parse()

ra8_err_t internal_config_parse ( internal_config_reader_t * reader,
mdl_site_t * out )
static

Parse every descriptor record from an open portable stream.

Reuses one fixed stack line and stops only at clean EOF or the first bounded reader or record-validation failure.

Parameters
[in,out]readerOpen descriptor reader.
[in,out]outDescriptor receiving parsed overrides.
Returns
Complete parsing status.
Return values
k_ra8_okEvery record was valid and EOF was clean.
k_ra8_err_invalid_stateA line or key/value was invalid.
otherA bounded stream failure propagated unchanged.
Precondition
Both pointers are non-NULL and the reader is positioned at byte zero.
The descriptor contains defaults and is exclusively owned.
Postcondition
Success applies every active record exactly once.
Failure leaves a rejected partially populated descriptor.
Note
Not thread-safe for shared storage or descriptor state.
Since
0.1.0

Definition at line 488 of file mdl_config.c.

References internal_config_apply_line(), internal_config_read_line(), k_line_max, k_ra8_ok, and RA8_INTERNAL.

Referenced by mdl_config_load().

◆ internal_config_parse_order()

bool internal_config_parse_order ( const char * val,
mdl_chapter_order_t * out )
static

Parse the configured chapter-order spelling.

Accepts only reverse, asc, or doc; there is no silent default.

Parameters
[in]valNUL-terminated order spelling.
[out]outParsed order destination.
Returns
Whether val is one supported spelling.
Return values
trueout received the corresponding enum value.
falseval is unsupported and out is unchanged.
Precondition
val and out are non-NULL.
val is NUL-terminated.
Postcondition
On true, out is a valid mdl_chapter_order_t value.
val is unchanged.
Note
Thread-safe: reads only caller storage.
Since
0.1.0

Definition at line 251 of file mdl_config.c.

References k_mdl_order_asc, k_mdl_order_doc, k_mdl_order_reverse, RA8_INTERNAL, and strcmp().

Referenced by internal_config_apply_pair().

◆ internal_config_parse_u32()

bool internal_config_parse_u32 ( const char * val,
uint32_t * out )
static

Parse one complete unsigned 32-bit decimal field.

Rejects signs, empty text, overflow, and trailing characters.

Parameters
[in]valNUL-terminated decimal text.
[out]outParsed integer destination.
Returns
Whether one complete in-range integer was parsed.
Return values
trueout received the parsed value.
falseThe text was empty, signed, malformed, or out of range.
Precondition
val and out are non-NULL.
val is NUL-terminated.
Postcondition
On true, out contains the exact parsed value.
On false, out is unchanged.
Note
Thread-safe across disjoint input and output storage.
Since
0.1.0

Definition at line 173 of file mdl_config.c.

References k_config_dec_base, and RA8_INTERNAL.

Referenced by internal_config_apply_u32().

◆ internal_config_read_line()

ra8_err_t internal_config_read_line ( internal_config_reader_t * reader,
char * line,
uint32_t capacity,
bool * out_present )
static

Read one complete bounded descriptor line.

Accepts a final line without newline and rejects the first non-newline byte that would leave no room for the required terminator.

Parameters
[in,out]readerOpen descriptor reader.
[out]lineDestination for one NUL-terminated line without newline.
[in]capacityWritable bytes at line.
[out]out_presentWhether a line, including an empty one, was read.
Returns
Canonical read or line-validation status.
Return values
k_ra8_okA line or clean EOF was reported.
k_ra8_err_invalid_stateA line exceeded the fixed parser bound.
otherA stream error propagated unchanged.
Precondition
All pointers are non-NULL and capacity is nonzero.
reader owns an open read-only file.
Postcondition
line is always NUL-terminated on success.
Clean EOF before any byte sets out_present false.
Note
Not thread-safe for a shared reader.
Since
0.1.0

Definition at line 406 of file mdl_config.c.

References internal_config_next(), k_ra8_err_invalid_state, k_ra8_ok, and RA8_INTERNAL.

Referenced by internal_config_parse().

◆ internal_config_set_defaults()

void internal_config_set_defaults ( mdl_site_t * out)
static

Apply the polite default descriptor before the file overrides it.

Clears the complete descriptor, installs bounded textual defaults, and copies the single governor baseline into numeric fields.

Parameters
[out]outDescriptor receiving deterministic defaults.
Precondition
out is non-NULL.
out addresses writable storage for one complete descriptor.
Postcondition
Every fixed string field is NUL-terminated.
Governor fields equal mdl_gov_cfg_default.
Note
Not thread-safe for concurrent access to out.
Since
0.1.0

Definition at line 313 of file mdl_config.c.

References mdl_gov_cfg_t::backoff_base_ms, mdl_site_t::backoff_base_ms, mdl_gov_cfg_t::backoff_max_ms, mdl_site_t::backoff_max_ms, mdl_gov_cfg_t::burst, mdl_site_t::burst, mdl_site_t::chapter_delay_max, mdl_site_t::chapter_delay_min, mdl_site_t::chapter_order, mdl_site_t::chapter_url_contains, mdl_site_t::img_delay_max, mdl_site_t::img_delay_min, internal_config_set_str(), k_def_chapter_delay_max, k_def_chapter_delay_min, k_def_img_delay_max, k_def_img_delay_min, k_mdl_order_asc, mdl_site_t::kind, mdl_site_t::language, mdl_gov_cfg_t::max_inflight, mdl_site_t::max_inflight, mdl_gov_cfg_default(), mdl_site_t::name, mdl_site_t::page_img_attr, RA8_INTERNAL, mdl_gov_cfg_t::rate_per_min, mdl_site_t::rate_per_min, and mdl_site_t::reading_direction.

Referenced by mdl_config_load().

◆ internal_config_set_str()

bool internal_config_set_str ( char * dst,
size_t cap,
const char * val )
static

Copy one descriptor value without truncation.

Measures the complete source before copying it into fixed storage.

Parameters
[out]dstDestination character array.
[in]capDestination capacity including NUL.
[in]valNUL-terminated source value.
Returns
Whether the complete value fit and was copied.
Return values
truedst contains an exact copy of val.
falseval did not fit and dst is unchanged.
Precondition
dst and val are non-NULL.
cap is greater than zero and describes writable dst storage.
Postcondition
On true, dst is NUL-terminated.
val is unchanged.
Note
Not thread-safe when source and destination storage are shared.
Since
0.1.0

Definition at line 92 of file mdl_config.c.

References memcpy(), RA8_INTERNAL, and strlen().

Referenced by internal_config_apply_string(), and internal_config_set_defaults().

◆ internal_config_trim()

char * internal_config_trim ( char * s)
static

Trim leading/trailing ASCII whitespace in place; return start.

Definition at line 62 of file mdl_config.c.

References RA8_INTERNAL, and strlen().

Referenced by internal_config_apply_line().

◆ internal_config_valid()

bool internal_config_valid ( const mdl_site_t * site)
static

Validate descriptor cross-field and selector invariants.

Checks selector grammar, required static metadata, delay ordering, governor bounds, and reading direction after parsing completes.

Parameters
[in]siteFully populated site descriptor.
Returns
Whether every descriptor invariant is satisfied.
Return values
trueThe descriptor is safe for fetch/search use.
falseA required value, selector, or cross-field bound is invalid.
Precondition
site is non-NULL.
Every fixed string field in site is NUL-terminated.
Postcondition
site is unchanged.
No filesystem or network state is accessed.
Note
Thread-safe: reads only caller storage.
Since
0.1.0

Definition at line 520 of file mdl_config.c.

References mdl_site_t::backoff_base_ms, mdl_site_t::backoff_max_ms, mdl_site_t::burst, mdl_site_t::chapter_delay_max, mdl_site_t::chapter_delay_min, mdl_site_t::chapter_number_selector, mdl_site_t::chapter_title_selector, mdl_site_t::host, mdl_site_t::img_delay_max, mdl_site_t::img_delay_min, mdl_site_t::language, mdl_site_t::max_inflight, RA8_INTERNAL, mdl_site_t::reading_direction, mdl_site_t::series_artist_selector, mdl_site_t::series_author_selector, mdl_site_t::series_cover_selector, mdl_site_t::series_summary_selector, mdl_site_t::series_title_selector, strcmp(), strlen(), and strncmp().

Referenced by mdl_config_load().

◆ mdl_config_apply_polite()

void mdl_config_apply_polite ( mdl_site_t * site)

Raise a descriptor's per-request delay floors for --polite.

The --polite opt-in lifts the per-image and inter-chapter jitter floors to cautious minimums (never lowering a site that is already slower). Shared by the series and discovery paths so both interpret --polite the same way.

Parameters
[in,out]siteDescriptor whose delay floors are raised in place.
Returns
Nothing.
Precondition
site is non-NULL and was populated by mdl_config_load.
The caller applies this only when --polite was requested.
Postcondition
Each delay floor is at least its polite minimum.
A floor already above its polite minimum is left unchanged.
Note
Not thread-safe: mutates site in place.
Since
0.1.0

Definition at line 625 of file mdl_config.c.

References mdl_site_t::chapter_delay_max, mdl_site_t::chapter_delay_min, mdl_site_t::img_delay_max, mdl_site_t::img_delay_min, internal_config_max_u32(), k_polite_chap_max_ms, k_polite_chap_min_ms, k_polite_img_max_ms, and k_polite_img_min_ms.

Referenced by mdl_app_run_discover(), and mdl_app_run_series().

◆ mdl_config_gov_cfg()

mdl_gov_cfg_t mdl_config_gov_cfg ( const mdl_site_t * site)

Build the politeness-governor tunables for a loaded site descriptor.

Overlays the descriptor's governor fields (rate/burst/backoff/in-flight) onto the conservative mdl_gov_cfg_default baseline, so every run mode – series download, discovery, library update – derives its governor identically from one place rather than re-copying the same six assignments.

Parameters
[in]siteLoaded descriptor (never NULL).
Returns
The governor configuration for site.
Return values
(byvalue) Defaults with the descriptor's governor fields applied.
Precondition
site is non-NULL and was populated by mdl_config_load.
The caller passes the result to a governor init function.
Postcondition
burst >= 1 and max_inflight >= 1 (the init function clamps).
site is unchanged.
Note
Thread-safe: depends only on its argument.
See also
mdl_governor_init
Since
0.1.0

Definition at line 594 of file mdl_config.c.

References mdl_gov_cfg_t::backoff_base_ms, mdl_site_t::backoff_base_ms, mdl_gov_cfg_t::backoff_max_ms, mdl_site_t::backoff_max_ms, mdl_gov_cfg_t::burst, mdl_site_t::burst, mdl_gov_cfg_t::max_inflight, mdl_site_t::max_inflight, mdl_gov_cfg_default(), mdl_gov_cfg_t::rate_per_min, and mdl_site_t::rate_per_min.

Referenced by internal_run_prepared(), and mdl_app_run_discover().

◆ mdl_config_load()

ra8_err_t mdl_config_load ( mdl_storage_t * storage,
const char * path,
mdl_site_t * out )
nodiscard

Load a site descriptor from a flat key=value file.

Parameters
[in,out]storageInitialized portable filesystem binding and exclusive file/I/O workspace.
[in]pathCanonical path beneath the bound filesystem root.
[out]outDescriptor to fill; defaults are applied first, then the file overrides recognised keys.
Return values
k_ra8_okLoaded and every key/value passed validation.
k_ra8_err_invalid_argInvalid binding, pointer, or path.
k_ra8_err_invalid_sizeDescriptor or backend progress bound exceeded.
k_ra8_err_invalid_stateA line, key, value, or required field was invalid.
otherOpen, size, read, or close error propagated by the filesystem.
Precondition
storage was initialized by mdl_storage_init and is exclusively owned.
path is canonical under the injected binding (for example /sites/a.conf).
Postcondition
The portable file handle is consumed on every successful open path, including parse and close failures.
Success publishes a complete validated descriptor in out.
Note
Not thread-safe for a shared storage binding.
Since
0.1.0

Definition at line 557 of file mdl_config.c.

References internal_config_reader_t::file, mdl_storage_t::file_workspace, mdl_storage_t::file_workspace_bytes, mdl_storage_t::fs, fw_fs_close(), fw_fs_file_size(), fw_fs_open(), internal_config_parse(), internal_config_set_defaults(), internal_config_valid(), mdl_storage_t::io_buffer, mdl_storage_t::io_buffer_bytes, k_config_file_max, k_fw_fs_open_read, k_ra8_err_invalid_arg, k_ra8_err_invalid_size, k_ra8_err_invalid_state, k_ra8_ok, and fw_fs_t::streams.

Referenced by mdl_app_run_discover(), and mdl_app_run_series().