The osal_file module provides the default low-level file operations service for the project.
It exposes a portable file API through osal_file_ops_t, while delegating the actual system calls to the active platform implementation.
The module is designed to:
osal_file_status_t,OSAL_FILE handles through injected memory services,The osal_file module is an OSAL service module.
It is not a high-level stream abstraction and does not define buffering, formatting, logging, or business-oriented I/O behavior.
Instead, it provides a minimal portable file service by:
open, read, write, flush, close),OSAL_FILE handles,Typical responsibilities:
The entry point of the module is:
It returns the default callable operations table for the active platform.
The returned table provides:
open()read()write()flush()close()Opened files are represented through:
This handle hides backend-specific runtime state such as native descriptors, native streams, or adapter-private metadata.
Callers manipulate the resource only through osal_file_ops_t.
Creation and destruction of wrapper handles rely on injected allocation services:
const osal_mem_ops_t *This keeps memory policy external to the module and allows testing through fake providers.
Public operations report outcomes through:
osal_file_status_tTypical results include:
This avoids leaking backend-native error models directly into callers.
The portable modes supported by the public contract are:
"rb""wb""ab"Their backend translation is implementation-specific and remains private to the module.
This module belongs to the OSAL layer and is commonly consumed by higher-level adapters needing filesystem access.
See: