LexLeo 0.0.0-dev+f8e5087-dirty
Technical documentation
Loading...
Searching...
No Matches
fs_stream_ctor.h File Reference

Private factory constructor callback for the fs_stream adapter. More...

Include dependency graph for fs_stream_ctor.h:

Go to the source code of this file.

Functions

stream_status_t fs_stream_ctor (const void *ud, const void *args, stream_t **out)
 Factory constructor callback for the fs_stream adapter.
 

Detailed Description

This constructor is stored in the adapter descriptor created by fs_stream_create_desc() and later invoked by the stream port factory when creating a file-backed stream instance.

Definition in file fs_stream_ctor.h.

Function Documentation

◆ fs_stream_ctor()

stream_status_t fs_stream_ctor ( const void *  ud,
const void *  args,
stream_t **  out 
)

This function implements the stream_ctor_fn_t contract expected by the stream port factory.

The opaque user-data pointer ud is expected to reference a fs_stream_ctor_ud_t structure containing the configuration and environment required to construct the stream instance.

The args parameter is the runtime argument blob supplied by the factory when creating a stream instance. It is expected to point to a const fs_stream_args_t * describing the file to open.

Parameters
[in]udOpaque user data stored in the adapter descriptor.

Expected type:

Parameters
[in]argsRuntime argument blob supplied by the factory.

Expected type:

Parameters
[out]outReceives the created stream handle.
Returns
  • STREAM_STATUS_OK on success
  • STREAM_STATUS_INVALID if one or more arguments are invalid
  • STREAM_STATUS_OOM on allocation failure
  • STREAM_STATUS_IO_ERROR if the underlying OSAL file operation fails
Postcondition
On success, *out receives a newly created stream instance owned by the caller.

On failure, *out is left unchanged.

Definition at line 233 of file fs_stream.c.