Nexus Embedded Platform 0.1.0
Statically assembled reusable embedded mechanisms
Loading...
Searching...
No Matches
file_flash.h File Reference

Native persistent file Flash model with fault injection. More...

Go to the source code of this file.

Data Structures

struct  nx_file_flash_t

Functions

nx_storage_status_t nx_file_flash_open (nx_file_flash_t *flash, const char *path, size_t size, size_t erase_size, size_t program_size)
 Open an exclusively locked persistent host Flash model.
void nx_file_flash_close (nx_file_flash_t *flash)
 Close the host file after all store users have quiesced.
void nx_file_flash_fail_after (nx_file_flash_t *flash, int64_t events)
 Set an explicit model interruption boundary.

Detailed Description

Native persistent file Flash model with fault injection.

Author
Nexus Team
Version
1.0.0
Date
2026-10-09

Definition in file file_flash.h.

Function Documentation

◆ nx_file_flash_close()

void nx_file_flash_close ( nx_file_flash_t * flash)

Close the host file after all store users have quiesced.

Parameters
[in,out]flashOpen serialized model
Note
No future port calls are permitted until explicit reopen.

◆ nx_file_flash_fail_after()

void nx_file_flash_fail_after ( nx_file_flash_t * flash,
int64_t events )

Set an explicit model interruption boundary.

Parameters
[in,out]flashSerialized open model
[in]eventsProgrammed/erased bytes and sync attempts permitted; negative disables
Note
Zero simulates power-off until explicitly cleared.

◆ nx_file_flash_open()

nx_storage_status_t nx_file_flash_open ( nx_file_flash_t * flash,
const char * path,
size_t size,
size_t erase_size,
size_t program_size )

Open an exclusively locked persistent host Flash model.

Parameters
[out]flashUnused caller-owned storage
[in]pathRegular-file path; symlink traversal rejected
[in]sizeExact persistent byte size
[in]erase_sizeUniform erase block bytes
[in]program_sizeAligned program bytes, 1..256
Returns
OK or INVALID/IO; failed open retains no file descriptor
Note
Task-only POSIX model. Does not qualify MCU Flash or actual power loss; existing file size mismatch is rejected without truncation.