|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Module-private seams shared by the two mkbookimg translation units. More...
#include <fcntl.h>#include <stddef.h>#include <stdint.h>#include "ra8_attributes.h"#include "ra8_fs.h"Go to the source code of this file.
Data Structures | |
| struct | mkbookimg_disk_t |
| Host descriptor-backed block device bound into ra8_fs. More... | |
Macros | |
| #define | O_CLOEXEC (0) |
| No-op close-on-exec fallback for hosts lacking the flag. | |
| #define | O_DIRECTORY (0) |
| No-op directory-open fallback for hosts lacking the flag. | |
| #define | O_NOFOLLOW (0) |
| No-op no-follow fallback for hosts lacking the flag. | |
Enumerations | |
| enum | mkbookimg_limit_t : uint32_t { k_block_size = 512U , k_img_sectors = 131072U , k_max_books = 32U , k_stream_chunk_bytes = 16U * 1024U , k_host_path_cap = 4096U , k_host_name_cap = 256U , k_temp_create_attempts = 128U , k_decimal_u64_digits = 20U , k_decimal_base = 10U , k_output_create_mode = 0666U } |
| Fixed image geometry and bounded host-I/O capacities. More... | |
Functions | |
| void | priv_mkbookimg_diag (const char *text) |
| Write a complete diagnostic fragment to the standard-error descriptor. | |
| void | priv_mkbookimg_diag_u64 (uint64_t value) |
| Emit an unsigned decimal value without a formatting runtime. | |
| bool | priv_mkbookimg_pread_exact (int fd, uint64_t offset, uint8_t *bytes, size_t length) |
| Read exactly one bounded positioned byte range. | |
| bool | priv_mkbookimg_build_image (const ra8_fs_backend_t *backend, char **argv, int book_count, const mkbookimg_disk_t *disk) |
| Format, populate, and unmount the destination image. | |
Module-private seams shared by the two mkbookimg translation units.
The image builder is split across two translation units to keep each under the maintainability line cap:
This header carries the fixed image geometry (mkbookimg_limit_t), the descriptor-backed device state (mkbookimg_disk_t), the open-flag fallbacks both units need, and the RA8_PRIV declarations of every helper shared across them. Nothing here is a reusable surface: the tool links ra8_fs and publishes no library of its own.
[Ring 7 / Tooling] {World: NS}
Definition in file mkbookimg_internal.h.
| #define O_CLOEXEC (0) |
No-op close-on-exec fallback for hosts lacking the flag.
Definition at line 39 of file mkbookimg_internal.h.
| #define O_DIRECTORY (0) |
No-op directory-open fallback for hosts lacking the flag.
Definition at line 44 of file mkbookimg_internal.h.
| #define O_NOFOLLOW (0) |
No-op no-follow fallback for hosts lacking the flag.
Definition at line 49 of file mkbookimg_internal.h.
| enum mkbookimg_limit_t : uint32_t |
Fixed image geometry and bounded host-I/O capacities.
Definition at line 53 of file mkbookimg_internal.h.
| bool priv_mkbookimg_build_image | ( | const ra8_fs_backend_t * | backend, |
| char ** | argv, | ||
| int | book_count, | ||
| const mkbookimg_disk_t * | disk ) |
Format, populate, and unmount the destination image.
Formats a fresh FAT32 volume, writes every input book, and unmounts before reporting the combined outcome.
| [in] | backend | Block-device backend bound to disk. |
| [in] | argv | Output path followed by book paths. |
| [in] | book_count | Number of book paths in argv. |
| [in,out] | disk | Block-device state; inspected for a deferred I/O fault. |
| true | The destination image is complete and consistent. |
| false | Formatting, a book write, unmount, or block I/O failed. |
backend is bound to disk and disk names an open image file. book_count is in 1..k_max_books, already validated by the caller. Definition at line 435 of file mkbookimg_books.c.
References internal_format_mount(), internal_write_books(), mkbookimg_disk_t::io_failed, k_ra8_ok, and ra8_fs_unmount().
Referenced by main().
| void priv_mkbookimg_diag | ( | const char * | text | ) |
Write a complete diagnostic fragment to the standard-error descriptor.
Retries interrupted and short writes without involving stdio streams.
| [in] | text | NUL-terminated fragment. |
text is non-NULL and NUL-terminated. Definition at line 41 of file mkbookimg.c.
References strlen().
Referenced by internal_format_mount(), internal_print_success(), internal_write_books(), main(), and priv_mkbookimg_diag_u64().
| void priv_mkbookimg_diag_u64 | ( | uint64_t | value | ) |
Emit an unsigned decimal value without a formatting runtime.
Converts into fixed local buffers and forwards one bounded string.
| [in] | value | Value to emit. |
Definition at line 58 of file mkbookimg.c.
References k_decimal_base, k_decimal_u64_digits, and priv_mkbookimg_diag().
Referenced by internal_print_success(), and internal_write_books().
| bool priv_mkbookimg_pread_exact | ( | int | fd, |
| uint64_t | offset, | ||
| uint8_t * | bytes, | ||
| size_t | length ) |
Read exactly one bounded positioned byte range.
Retries interrupted calls and rejects EOF before the requested end.
| [in] | fd | Open regular-file descriptor. |
| [in] | offset | Absolute starting byte offset. |
| [out] | bytes | Destination spanning length bytes. |
| [in] | length | Exact byte count. |
| true | The destination contains the complete requested range. |
| false | EOF, overflow, or an unrecoverable read error occurred. |
bytes spans length writable bytes. bytes may hold a strict prefix. Definition at line 75 of file mkbookimg.c.
Referenced by internal_disk_read(), internal_stream_book(), and internal_verify_book().