19#error "port/posix is host-only and must never be compiled or linked into target firmware."
32typedef enum : uint16_t {
65typedef enum : uint8_t {
72typedef enum : uint8_t {
81typedef enum : uint32_t {
88typedef enum : uint16_t {
94typedef enum : uint8_t {
101typedef enum : uint8_t {
152typedef int64_t (*fw_fs_posix_test_dir_read_fn_t)(
void* ctx,
190ra8_fs_posix_test_set_directory_reader(fw_fs_posix_test_dir_read_fn_t reader,
void* ctx);
322 const char* component,
379 const char* component,
522 void* directory_state,
523 uint32_t state_bytes);
544 void* directory_state,
589 uint32_t max_entries,
682 uint32_t state_bytes);
708 uint32_t* out_written);
Architecture-neutral filesystem namespace, stream, and transaction ports.
Root-confined hosted POSIX adapter for fw_if_fs.
ra8_err_t priv_fs_posix_stage_path(const char *destination, uint32_t id, char *out)
Build an 8.3-compatible sibling transaction path.
ra8_err_t priv_fs_posix_component_open(int parent_fd, const char *component, int *out_fd)
Open one validated directory component without following its pathname.
posix_root_alias_t
Classification of a verified filesystem-root directory alias.
@ k_posix_root_alias_tmp
Root tmp resolves to private/tmp.
@ k_posix_root_alias_none
Component is not an approved root alias.
@ k_posix_root_alias_var
Root var resolves to private/var.
ra8_err_t priv_fs_posix_seek(void *ctx, void *file_state, uint64_t offset)
Seek a POSIX descriptor to an unsigned absolute offset.
ra8_err_t priv_fs_posix_dir_open(void *ctx, const char *path, void *directory_state, uint32_t state_bytes)
Open a confined raw-directory cursor in caller storage.
ra8_err_t priv_fs_posix_close(void *ctx, void *file_state)
Close and consume one caller-owned POSIX file state.
ra8_err_t priv_fs_posix_sync(void *ctx, void *file_state)
Flush file contents and metadata through POSIX fsync.
ra8_err_t priv_fs_posix_write(void *ctx, void *file_state, const uint8_t *src, uint32_t len, uint32_t *out_written)
Complete POSIX short writes while reporting any accepted prefix.
ra8_err_t priv_fs_posix_dir_next(void *ctx, void *directory_state, fw_fs_dirent_value_t *out, bool *out_entry)
Copy the next visible raw-directory entry.
ra8_err_t priv_fs_posix_dir_close(void *ctx, void *directory_state)
Close one owned raw-directory descriptor.
ra8_err_t priv_fs_posix_close_fd(int *fd)
Close exactly once and invalidate the caller's descriptor.
ra8_err_t priv_fs_posix_bind_interfaces(fw_fs_t *out, fw_fs_posix_state_t *state, const fw_fs_caps_t *caps)
Bind the immutable POSIX operation tables to initialized state.
ra8_err_t priv_fs_posix_close_fd_preserve(int *fd, ra8_err_t primary)
Close one owned descriptor while preserving a primary status.
posix_numeric_limits_t
POSIX timestamp and transaction arithmetic constants.
@ k_posix_transaction_id_mask
Six hexadecimal digits.
@ k_posix_nanosecond_max
Largest valid subsecond.
@ k_posix_epoch_year_offset
struct tm year origin.
ra8_err_t priv_fs_posix_root_alias_classify(const char *component, const char *target, size_t target_bytes, posix_root_alias_t *out_alias)
Classify one exact filesystem-root alias component and target pair.
ra8_err_t priv_fs_posix_parent_open(fw_fs_posix_state_t *state, const char *path, int *out_parent_fd, char *out_leaf)
Resolve a canonical path's parent without following any symlink.
ra8_err_t priv_fs_posix_root_alias_open(int root_fd, posix_root_alias_t alias, int *out_fd)
Open a classified root alias through its canonical components.
ra8_err_t priv_fs_posix_size(void *ctx, void *file_state, uint64_t *out_size)
Report a POSIX descriptor's current file length.
ra8_err_t priv_fs_posix_directory_next(int fd, posix_directory_reader_t *reader, posix_directory_record_t *out, bool *out_end)
Read and validate the next raw hosted directory record.
posix_directory_limits_t
Raw directory buffer and retry bounds.
@ k_posix_directory_read_retries
Maximum interrupted reads.
@ k_posix_directory_buffer_bytes
Fixed local kernel buffer.
posix_limits_t
Local component and stage-search bounds.
@ k_posix_max_open_files
Truthful hosted descriptor capacity.
@ k_posix_file_mode
Owner-only created-file mode.
@ k_posix_stage_leaf_span
Stage leaf plus terminating NUL.
@ k_posix_directory_mode
Owner-only created-directory mode.
@ k_posix_stage_attempts
Collision-search attempt cap.
@ k_posix_component_cap
Component buffer including NUL.
ra8_err_t priv_fs_posix_copy_path(char *out, const char *path)
Copy one bounded portable path.
posix_linux_dirent_layout_t
Linux getdents64 wire-record offsets and alignment.
@ k_posix_linux_name_offset
Offset of d_name.
@ k_posix_linux_reclen_offset
Offset of d_reclen.
@ k_posix_linux_record_align
Kernel record alignment.
const fw_fs_stream_iface_t * priv_fs_posix_stream_iface(void)
Borrow the immutable POSIX byte-stream operation table.
posix_hex_limits_t
Hexadecimal stage-name encoding constants.
@ k_posix_hex_nibble_mask
Low-nibble mask.
@ k_posix_hex_last_digit
Highest valid index in a stage identifier.
@ k_posix_stage_hex_digits
Hex digits in a stage identifier.
@ k_posix_hex_nibble_bits
Bits represented by one hex digit.
ra8_err_t priv_fs_posix_errno(int value)
Map one captured errno value into ra8_err_t.
ra8_err_t priv_fs_posix_open(void *ctx, const char *path, fw_fs_open_mode_t mode, void *file_state, uint32_t state_bytes)
Open one confined regular file into caller workspace.
ra8_err_t priv_fs_posix_listdir(void *ctx, const char *path, uint32_t max_entries, fw_fs_list_fn_t callback, void *callback_ctx, uint32_t *out_count, bool *out_complete)
Enumerate a POSIX directory through bounded raw records.
posix_darwin_dirent_layout_t
Darwin getdirentries64 wire-record offsets and alignment.
@ k_posix_darwin_name_offset
Offset of d_name.
@ k_posix_darwin_record_align
Kernel record alignment.
@ k_posix_darwin_reclen_offset
Offset of d_reclen.
@ k_posix_darwin_namlen_offset
Offset of d_namlen.
fw_fs_timestamp_t priv_fs_posix_timestamp(time_t seconds, long nanoseconds)
Convert a POSIX UTC instant into the portable civil representation.
struct fw_fs_stream_iface fw_fs_stream_iface_t
@ k_fw_fs_path_cap
Largest portable path including its NUL.
fw_fs_open_mode_t
Open intent for fw_fs_open.
ra8_err_t(* fw_fs_list_fn_t)(void *ctx, const fw_fs_dirent_t *entry, bool *out_continue)
Bounded list callback.
fw_fs_transaction_policy_t
Destination policy for a staged transaction.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
#define RA8_TEST_HELPER
Mark a symbol as externally-linked but only callable from tests.
#define RA8_NODISCARD
Warn at any call site that discards the function's return value.
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Static properties and workspace requirements of one bound port.
Stable caller-owned value returned by fw_fs_dir_next.
Caller-owned POSIX adapter state.
One complete composition-root filesystem binding.
One portable timestamp and independent availability facts.
Caller-owned cursor and fixed storage for raw directory batches.
uint8_t buffer[k_posix_directory_buffer_bytes]
Kernel record bytes.
uint32_t valid_bytes
Bytes in buffer.
uint32_t cursor
Next record offset.
Validated view over one raw host directory record.
uint16_t name_bytes
Name length excluding the terminator.
const char * name
NUL-terminated name inside the read buffer.
uint16_t record_bytes
Complete aligned record length.
POSIX state placed in caller directory workspace.
posix_directory_reader_t reader
Bounded raw-record buffer and cursor.
int fd
Owned directory descriptor.
POSIX state placed in caller file workspace.
int fd
Owned descriptor, or -1 while closed.
POSIX state placed in caller transaction workspace.
bool writer_open
True while the stage descriptor is owned.
fw_fs_transaction_policy_t policy
Requested destination collision policy.
char stage[k_fw_fs_path_cap]
Private sibling stage path.
char destination[k_fw_fs_path_cap]
Final publication path.
bool stage_exists
True while the stage leaf needs cleanup.
posix_file_state_t file_state
Open descriptor state for the stage.