ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_fs_check.h
Go to the documentation of this file.
1
56
57#pragma once
58
59#ifdef __cplusplus
60extern "C" {
61#endif
62
63#include <stdint.h>
64
65#include "ra8_err.h"
66#include "ra8_fs.h"
67
68/* =============================================================================
69 * Sentinels
70 * =============================================================================
71 */
72
77typedef enum : uint32_t {
79 0xFFFFFFFFU,
81
82/* =============================================================================
83 * Fault categories
84 * =============================================================================
85 */
86
112
129typedef struct {
131 uint32_t cluster;
132 uint64_t lba;
133 uint32_t entry_off;
135
136/* =============================================================================
137 * Report
138 * =============================================================================
139 */
140
188
189/* =============================================================================
190 * Public API
191 * =============================================================================
192 */
193
242[[nodiscard]] ra8_err_t ra8_fs_check(ra8_fs_mount_t* handle,
243 uint8_t* bitmap,
244 uint32_t bitmap_bytes,
245 ra8_fs_check_report_t* report);
246
247#ifdef __cplusplus
248}
249#endif
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Minimal FAT12/FAT16/FAT32 filesystem adapter (read + write).
ra8_fs_check_const_t
Sentinels the check reports for values it could not determine.
@ k_ra8_fs_check_unknown
A count the check could not determine (no bitmap supplied).
ra8_err_t ra8_fs_check(ra8_fs_mount_t *handle, uint8_t *bitmap, uint32_t bitmap_bytes, ra8_fs_check_report_t *report)
Scan a mounted volume for consistency, read-only, and report findings.
ra8_fs_check_fault_kind_t
The category of a single consistency finding.
@ k_ra8_fs_check_fault_bad_set_checksum
exFAT entry-set SetChecksum mismatch.
@ k_ra8_fs_check_fault_bad_fat_value
FAT entry is out of range / reserved.
@ k_ra8_fs_check_fault_bad_name_hash
exFAT Stream NameHash mismatch.
@ k_ra8_fs_check_fault_bad_dir_entry
A directory entry's first cluster is invalid.
@ k_ra8_fs_check_fault_bad_chain
A chain runs into free space or off-volume.
@ k_ra8_fs_check_fault_lost_cluster
A cluster is allocated but referenced by none.
@ k_ra8_fs_check_fault_none
No fault (a clean scan).
@ k_ra8_fs_check_fault_bitmap_ref_unset
exFAT: referenced, but its bitmap bit is 0.
@ k_ra8_fs_check_fault_scan_truncated
The directory worklist hit its static bound.
@ k_ra8_fs_check_fault_free_count_bad
FAT32 FSInfo free count disagrees.
@ k_ra8_fs_check_fault_crosslink
A cluster is reached by more than one chain.
ra8_fs_type_t
FAT variant detected from the BPB cluster-count rule.
Where and what the first consistency finding was.
ra8_fs_check_fault_kind_t kind
Category of the first finding.
uint32_t cluster
Cluster the finding concerns (0 if n/a).
uint64_t lba
Volume-relative sector of the entry (0 if n/a).
uint32_t entry_off
Byte offset of the entry in that sector (0 n/a).
The structured result of one ra8_fs_check run.
ra8_fs_check_fault_t first_fault
Kind + location of the first finding.
uint32_t clusters_used
Clusters that read as allocated.
uint32_t chains_crosslinked
Clusters reached by more than one chain.
uint32_t entries_bad
Bad dir entry / SetChecksum / NameHash findings.
uint32_t clusters_total
Data-region cluster count.
uint32_t bitmap_mismatches
exFAT clusters referenced with the bitmap bit clear.
uint32_t clusters_lost
Allocated but referenced by nothing; k_ra8_fs_check_unknown when referenced_scan is false.
uint32_t faults_total
Every finding, across all categories (0 == clean).
uint32_t clusters_bad
FAT defective-marker clusters (informational).
bool referenced_scan
true when a bitmap enabled the reference analysis.
uint32_t clusters_free
Clusters that read as free.
uint32_t files_visited
Files walked.
ra8_fs_type_t type
The volume variant that was checked.
uint32_t dirs_visited
Directories walked.
Cached parse of one mounted FAT volume.