20#error "port/posix is host-only and must never be compiled or linked into target firmware."
299 const char* old_path,
300 const char* new_path);
389 void* transaction_state,
390 uint32_t state_bytes,
391 const char* destination,
415 void* transaction_state,
418 uint32_t* out_written);
461 void* transaction_state,
463 void* validator_ctx);
static ra8_err_t internal_intermediate_check(int parent_fd, const char *component, posix_root_alias_t *out_alias)
Validate one directory component without following a symbolic link.
static ra8_err_t internal_directory_open(fw_fs_posix_state_t *state, const char *path, int *out_fd)
Open a confined directory without following its final component.
static ra8_err_t internal_txn_commit(void *ctx, void *transaction_state, bool *out_published)
Atomically publish then durably sync the destination directory.
static ra8_err_t internal_component_copy(const char *start, uint16_t length, char *out)
Copy one bounded path component into a fixed local buffer.
static ra8_err_t internal_parent_open_step(int *current, const char *name)
Descend into one intermediate path component, retiring the old parent.
static ra8_err_t internal_txn_begin(void *ctx, void *transaction_state, uint32_t state_bytes, const char *destination, fw_fs_transaction_policy_t policy)
Begin a staged POSIX create-new or atomic-replacement transaction.
static ra8_err_t internal_stage_open(fw_fs_posix_state_t *state, posix_transaction_state_t *txn)
Create an exclusive sibling stage after bounded collision retries.
static ra8_err_t internal_rename(void *ctx, const char *old_path, const char *new_path, bool replace)
Rename within the selected root without following either leaf.
static fw_fs_node_type_t internal_node_type(mode_t mode)
Convert a POSIX mode into a portable node kind.
static ra8_err_t internal_space(void *ctx, fw_fs_space_t *out)
Query confined-root volume byte totals with fstatvfs.
static ra8_err_t internal_txn_validate(void *ctx, void *transaction_state, fw_fs_validate_fn_t validator, void *validator_ctx)
Durably sync, reopen read-only, and validate a POSIX stage.
static ra8_err_t internal_rename_validate_endpoints(fw_fs_posix_state_t *state, const char *old_path, const char *new_path)
Validate that a rename's source exists and neither endpoint is a symlink.
static ra8_err_t internal_next_component(const char **cursor, char *out_name, uint16_t *out_length)
Scan and copy the next slash-delimited component of a cursor.
static ra8_err_t internal_parent_sync(fw_fs_posix_state_t *state, const char *path)
Sync the destination's containing directory after publication.
static ra8_err_t internal_mkdir(void *ctx, const char *path)
Create one confined directory with no implicit parent creation.
static ra8_err_t internal_native_stat(fw_fs_posix_state_t *state, const char *path, struct stat *out, bool *out_exists)
Query native metadata without following the final component.
static ra8_err_t internal_txn_abort(void *ctx, void *transaction_state)
Close and remove a POSIX stage while preserving the destination.
static ra8_err_t internal_txn_seek(void *ctx, void *transaction_state, uint64_t offset)
Seek within the open POSIX stage for bounded header or table backfill.
static ra8_err_t internal_rmdir(void *ctx, const char *path)
Remove one confined empty real directory.
static ra8_err_t internal_txn_write(void *ctx, void *transaction_state, const uint8_t *src, uint32_t len, uint32_t *out_written)
Append bytes to an open POSIX transaction stage.
static ra8_err_t internal_rename_noreplace(int old_fd, const char *old_leaf, int new_fd, const char *new_leaf)
Perform a host atomic no-replace rename without a TOCTOU fallback.
static ra8_err_t internal_unlink(void *ctx, const char *path)
Remove one confined regular file while refusing directories and links.
static ra8_err_t internal_stat(void *ctx, const char *path, fw_fs_stat_t *out)
Produce portable metadata for one path below the confined root.
Shared errno/descriptor helpers for the POSIX filesystem port.
posix_root_alias_t
Classification of a verified filesystem-root directory alias.
fw_fs_node_type_t
Filesystem node kind reported by fw_fs_stat.
ra8_err_t(* fw_fs_validate_fn_t)(void *ctx, fw_fs_file_t *staged)
Validate staged bytes through a read-only generic file handle.
fw_fs_transaction_policy_t
Destination policy for a staged transaction.
Annotation-attribute framework macros for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Caller-owned POSIX adapter state.
Portable volume usage snapshot.
Result of a portable metadata query.
POSIX state placed in caller transaction workspace.