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

Module-private bounded host-storage composition for mkfontimg. More...

#include <stdint.h>
#include "ra8_attributes.h"
#include "ra8_fs.h"
Include dependency graph for mkfontimg_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mkfontimg_disk_t
 Descriptor-backed block-device state bound into ra8_fs. More...
struct  mkfontimg_host_t
 Caller-owned sibling-temporary and block-backend binding. More...

Enumerations

enum  mkfontimg_host_limit_t : uint32_t {
  k_mkfontimg_host_path_cap = 4096U ,
  k_mkfontimg_host_name_cap = 256U
}
 Fixed private storage bounds for the hosted adapter. More...

Functions

void priv_mkfontimg_diag (const char *text)
 Write one complete best-effort diagnostic fragment to standard error.
void priv_mkfontimg_diag_u64 (uint64_t value)
 Write one unsigned decimal value to standard error without stdio.
bool priv_mkfontimg_host_begin (const char *final_path, uint64_t block_count, uint32_t block_size, mkfontimg_host_t *host)
 Create, size, and bind one private sibling-temporary image.
bool priv_mkfontimg_host_seed (mkfontimg_host_t *host, const uint8_t *bytes, uint32_t length)
 Seed exact bytes at the beginning of the temporary image.
bool priv_mkfontimg_host_copy (const mkfontimg_host_t *host, ra8_fs_mount_t *mount, const char *input_path, const char *card_name, uint64_t minimum_bytes, uint64_t maximum_bytes, uint64_t *out_bytes)
 Stream one stable host input into a card file and verify it by reread.
bool priv_mkfontimg_host_commit (mkfontimg_host_t *host)
 Sync and atomically publish a complete temporary image.
void priv_mkfontimg_host_abort (mkfontimg_host_t *host)
 Close and unlink an unpublished temporary image.

Detailed Description

Module-private bounded host-storage composition for mkfontimg.

Keeps POSIX descriptors and atomic-publication state at the standalone tool's composition edge. The filesystem itself sees only ra8_fs_backend_t callbacks, and font bytes cross into it through bounded ra8_fs_write calls. All state is caller-owned and allocation-free.

Since
0.1.0

Definition in file mkfontimg_internal.h.

Enumeration Type Documentation

◆ mkfontimg_host_limit_t

enum mkfontimg_host_limit_t : uint32_t

Fixed private storage bounds for the hosted adapter.

Enumerator
k_mkfontimg_host_path_cap 

Hosted path capacity.

k_mkfontimg_host_name_cap 

Hosted leaf capacity.

Definition at line 24 of file mkfontimg_internal.h.

Function Documentation

◆ priv_mkfontimg_diag()

void priv_mkfontimg_diag ( const char * text)

Write one complete best-effort diagnostic fragment to standard error.

Retries interrupted and short raw-descriptor writes without stdio.

Parameters
[in]textNUL-terminated diagnostic fragment.
Precondition
text is non-null and NUL-terminated.
The standard-error descriptor may accept or reject output.
Postcondition
The complete fragment was attempted.
No image or filesystem state changed.
Note
Fragments can interleave with diagnostics from another process.
Since
0.1.0

Definition at line 67 of file mkfontimg_host.c.

References RA8_PRIV, and strlen().

Referenced by internal_run_blank(), internal_run_font(), main(), and priv_mkfontimg_diag_u64().

◆ priv_mkfontimg_diag_u64()

void priv_mkfontimg_diag_u64 ( uint64_t value)

Write one unsigned decimal value to standard error without stdio.

Converts through fixed local buffers and delegates one bounded string.

Parameters
[in]valueUnsigned value to render in base ten.
Precondition
The fixed digit buffer covers every uint64_t value.
The standard-error descriptor may accept or reject output.
Postcondition
The complete decimal spelling was attempted.
No image or filesystem state changed.
Note
Fragments can interleave with diagnostics from another process.
Since
0.1.0

Definition at line 83 of file mkfontimg_host.c.

References k_host_decimal_base, k_host_decimal_digits, priv_mkfontimg_diag(), and RA8_PRIV.

Referenced by internal_run_font().

◆ priv_mkfontimg_host_abort()

void priv_mkfontimg_host_abort ( mkfontimg_host_t * host)

Close and unlink an unpublished temporary image.

Idempotently releases every partially acquired host resource.

Parameters
[in,out]hostPublication state returned by the begin operation.
Precondition
host is non-null and may be only partially initialized.
No mounted filesystem still uses host->image_fd.
Postcondition
Every owned descriptor is closed.
Any owned sibling temporary is removed; the final file is unchanged.
Note
Not thread-safe through the same state object.
Since
0.1.0

Definition at line 815 of file mkfontimg_host.c.

References mkfontimg_host_t::directory_fd, mkfontimg_host_t::image_fd, RA8_PRIV, mkfontimg_host_t::temp_exists, and mkfontimg_host_t::temp_name.

Referenced by internal_finish_image(), internal_mount_image(), internal_run_font(), and priv_mkfontimg_host_begin().

◆ priv_mkfontimg_host_begin()

◆ priv_mkfontimg_host_commit()

bool priv_mkfontimg_host_commit ( mkfontimg_host_t * host)
nodiscard

◆ priv_mkfontimg_host_copy()

bool priv_mkfontimg_host_copy ( const mkfontimg_host_t * host,
ra8_fs_mount_t * mount,
const char * input_path,
const char * card_name,
uint64_t minimum_bytes,
uint64_t maximum_bytes,
uint64_t * out_bytes )
nodiscard

Stream one stable host input into a card file and verify it by reread.

Definition at line 756 of file mkfontimg_host.c.

References mkfontimg_host_t::disk, internal_mkfontimg_verify(), internal_mkfontimg_write(), mkfontimg_disk_t::io_failed, RA8_PRIV, and host_input_identity_t::size.

Referenced by internal_run_font().

◆ priv_mkfontimg_host_seed()

bool priv_mkfontimg_host_seed ( mkfontimg_host_t * host,
const uint8_t * bytes,
uint32_t length )
nodiscard

Seed exact bytes at the beginning of the temporary image.

Definition at line 461 of file mkfontimg_host.c.

References mkfontimg_disk_t::block_count, mkfontimg_disk_t::block_size, mkfontimg_host_t::disk, mkfontimg_host_t::image_fd, internal_pwrite_exact(), and mkfontimg_disk_t::io_failed.

Referenced by internal_mount_image().