LexLeo 0.0.0-dev+f8e5087-dirty
Technical documentation
Loading...
Searching...
No Matches
osal_file_ops Struct Reference

Operations table for the low-level OSAL file abstraction. More...

#include <osal_file_ops.h>

Data Fields

osal_file_status_t(* open )(OSAL_FILE **out, const char *pathname, const char *mode, const osal_mem_ops_t *mem_ops)
 Open a file resource.
 
size_t(* read )(void *ptr, size_t size, size_t nmemb, OSAL_FILE *stream, osal_file_status_t *st)
 Read elements from an open OSAL_FILE.
 
size_t(* write )(const void *ptr, size_t size, size_t nmemb, OSAL_FILE *stream, osal_file_status_t *st)
 Write elements to an open OSAL_FILE.
 
osal_file_status_t(* flush )(OSAL_FILE *stream)
 Flush buffered output associated with an open OSAL_FILE.
 
osal_file_status_t(* close )(OSAL_FILE *stream)
 Close an open OSAL_FILE and release its associated resource.
 

Detailed Description

This API defines the low-level file operations exposed by the osal_file module.

It provides a portable file-oriented operations table for the active platform, while keeping higher-level adapter concerns outside of the OSAL.

Low-level file operations for the active OSAL backend.

This structure groups the primitive operations used to acquire, access, flush, and release OSAL_FILE resources through the OS abstraction layer.

These operations are intentionally file-oriented. They do not define a higher-level byte-stream port contract.

Definition at line 54 of file osal_file_ops.h.

Field Documentation

◆ close

osal_file_status_t(* osal_file_ops::close) (OSAL_FILE *stream)
Parameters
streamOpen OSAL_FILE handle to close.
Returns
OSAL_FILE_STATUS_OK on success, or an error status on failure.

Definition at line 167 of file osal_file_ops.h.

◆ flush

osal_file_status_t(* osal_file_ops::flush) (OSAL_FILE *stream)
Parameters
streamOpen OSAL_FILE handle.
Returns
OSAL_FILE_STATUS_OK on success, or an error status on failure.

Definition at line 156 of file osal_file_ops.h.

◆ open

osal_file_status_t(* osal_file_ops::open) (OSAL_FILE **out, const char *pathname, const char *mode, const osal_mem_ops_t *mem_ops)
Parameters
[out]outReceives the acquired OSAL_FILE handle on success.
pathnamePath of the file to open, expressed as a project-level UTF-8 path string. Platform-specific conversion is performed by the active OSAL backend.
modeFile access mode string. Only mode values supported by the portable osal_file contract are valid.
mem_opsMemory operations table used to allocate and release the OSAL file handle.
Returns
OSAL_FILE_STATUS_OK on success, or an error status on failure.
Note
On success, the acquired handle is owned by the caller and must be released through osal_file_ops_t::close.

Definition at line 81 of file osal_file_ops.h.

◆ read

size_t(* osal_file_ops::read) (void *ptr, size_t size, size_t nmemb, OSAL_FILE *stream, osal_file_status_t *st)
Parameters
ptrDestination buffer.
sizeSize in bytes of each element.
nmembNumber of elements to read.
streamOpen OSAL_FILE handle.
[out]stReceives the operation status.
Returns
The number of elements successfully read.
Note
A return value smaller than nmemb does not by itself distinguish between end-of-file and failure; callers must inspect st.

Definition at line 112 of file osal_file_ops.h.

◆ write

size_t(* osal_file_ops::write) (const void *ptr, size_t size, size_t nmemb, OSAL_FILE *stream, osal_file_status_t *st)
Parameters
ptrSource buffer.
sizeSize in bytes of each element.
nmembNumber of elements to write.
streamOpen OSAL_FILE handle.
[out]stReceives the operation status.
Returns
The number of elements successfully written.

Definition at line 140 of file osal_file_ops.h.