SUIT storage backend driver struct. More...

Detailed Description

SUIT storage backend driver struct.

Definition at line 115 of file storage.h.

#include <storage.h>

Data Fields

int(* init )(suit_storage_t *storage)
 One-time initialization function. More...
 
int(* start )(suit_storage_t *storage, const suit_manifest_t *manifest, size_t len)
 Start a new payload write sequence. More...
 
int(* write )(suit_storage_t *storage, const suit_manifest_t *manifest, const uint8_t *buf, size_t offset, size_t len)
 Write a new chunk of the payload to the storage backend. More...
 
int(* finish )(suit_storage_t *storage, const suit_manifest_t *manifest)
 Signal that the payload write stage done to the storage backend. More...
 
int(* read )(suit_storage_t *storage, uint8_t *buf, size_t offset, size_t len)
 Read a chunk of previously written data back. More...
 
int(* read_ptr )(suit_storage_t *storage, const uint8_t **buf, size_t *len)
 retrieve a direct read pointer for this storage backend More...
 
int(* install )(suit_storage_t *storage, const suit_manifest_t *manifest)
 Install the payload or mark the payload as valid. More...
 
int(* erase )(suit_storage_t *storage)
 Erase the previously loaded payload. More...
 
bool(* has_location )(const suit_storage_t *storage, const char *location)
 Check if this storage backend services a location. More...
 
bool(* match_offset )(const suit_storage_t *storage, size_t offset)
 Checks if the supplied offset is true or false for the current location. More...
 
int(* set_active_location )(suit_storage_t *storage, const char *location)
 Set the active location of the storage handler. More...
 
int(* get_seq_no )(const suit_storage_t *storage, uint32_t *seq_no)
 Retrieve the sequence number from the storage backend. More...
 
int(* set_seq_no )(suit_storage_t *storage, uint32_t seq_no)
 Set a new sequence number in the storage backend. More...
 
char separator
 Component ID separator used by this storage driver.
 

Field Documentation

◆ erase

int(* suit_storage_driver::erase) (suit_storage_t *storage)

Erase the previously loaded payload.

Parameters
[in]storageStorage context
Returns
SUIT_OK on successfully erasing the data
suit_error_t on error

Definition at line 211 of file storage.h.

◆ finish

int(* suit_storage_driver::finish) (suit_storage_t *storage, const suit_manifest_t *manifest)

Signal that the payload write stage done to the storage backend.

Parameters
[in]storageStorage context
[in]manifestThe suit manifest context
Returns
SUIT_OK on successfully finalizing the write
suit_error_t on error

Definition at line 161 of file storage.h.

◆ get_seq_no

int(* suit_storage_driver::get_seq_no) (const suit_storage_t *storage, uint32_t *seq_no)

Retrieve the sequence number from the storage backend.

Note
The sequence number must be global to the storage context, it must not depend on the location
Parameters
[in]storageStorage context
[out]seq_noRetrieved sequence number
Returns
SUIT_OK on success
suit_error_t if the sequence number can't be retrieved

Definition at line 271 of file storage.h.

◆ has_location

bool(* suit_storage_driver::has_location) (const suit_storage_t *storage, const char *location)

Check if this storage backend services a location.

Parameters
[in]storageStorage context
[in]locationLocation to check
Returns
True if this storage driver must be used for the supplied location

Definition at line 222 of file storage.h.

◆ init

int(* suit_storage_driver::init) (suit_storage_t *storage)

One-time initialization function.

Called at boot.

Parameters
[in]storageStorage context

Definition at line 122 of file storage.h.

◆ install

int(* suit_storage_driver::install) (suit_storage_t *storage, const suit_manifest_t *manifest)

Install the payload or mark the payload as valid.

Parameters
[in]storageStorage context
[in]manifestThe suit manifest context
Returns
SUIT_OK on successfully installing the payload
suit_error_t on error

Definition at line 201 of file storage.h.

◆ match_offset

bool(* suit_storage_driver::match_offset) (const suit_storage_t *storage, size_t offset)

Checks if the supplied offset is true or false for the current location.

Note
Optional to implement, should not be implemented if the backend doesn't support the image_offset
Parameters
[in]storageStorage context
[in]offsetOffset to check
Returns
True if the location matches the offset,
False otherwise

Definition at line 237 of file storage.h.

◆ read

int(* suit_storage_driver::read) (suit_storage_t *storage, uint8_t *buf, size_t offset, size_t len)

Read a chunk of previously written data back.

Parameters
[in]storageStorage context
[out]bufBuffer to write the read data in
[in]offsetOffset to read from
[in]lenNumber of bytes to read
Returns
SUIT_OK on successfully reading the chunk
suit_error_t on error

Definition at line 174 of file storage.h.

◆ read_ptr

int(* suit_storage_driver::read_ptr) (suit_storage_t *storage, const uint8_t **buf, size_t *len)

retrieve a direct read pointer for this storage backend

Note
Optional to implement
Parameters
[in]storageStorage context
[out]bufPointer to the location data
[out]lenFull length of the location data
Returns
SUIT_OK on successfully providing the region
suit_error_t on error

Definition at line 189 of file storage.h.

◆ set_active_location

int(* suit_storage_driver::set_active_location) (suit_storage_t *storage, const char *location)

Set the active location of the storage handler.

A storage backend can handle multiple locations, e.g. a VFS backend targeting multiple files on a filesystem, setting the location selects the target location for writes or reads.

Note
Must be idempotent
Parameters
[in]storageStorage backend context
[in]locationThe location supplied as string with components separated by the suit_storage_driver_t::separator
Returns
SUIT_OK on success
SUIT_ERR_STORAGE_UNAVAILABLE if the location is not available.

Definition at line 257 of file storage.h.

◆ set_seq_no

int(* suit_storage_driver::set_seq_no) (suit_storage_t *storage, uint32_t seq_no)

Set a new sequence number in the storage backend.

Parameters
[in]storageStorage context
[in]seq_noSequence number to store
Returns
SUIT_OK on success
suit_error_t if the sequence number can't be stored.

Definition at line 282 of file storage.h.

◆ start

int(* suit_storage_driver::start) (suit_storage_t *storage, const suit_manifest_t *manifest, size_t len)

Start a new payload write sequence.

Parameters
[in]storageStorage context
[in]manifestThe suit manifest context
[in]lenTotal size of the payload in bytes
Returns
SUIT_OK on successfully starting the write
suit_error_t on error

Definition at line 134 of file storage.h.

◆ write

int(* suit_storage_driver::write) (suit_storage_t *storage, const suit_manifest_t *manifest, const uint8_t *buf, size_t offset, size_t len)

Write a new chunk of the payload to the storage backend.

Parameters
[in]storageStorage context
[in]manifestThe suit manifest context
[in]bufBuffer to read the payload chunk from
[in]offsetOffset to write at
[in]lenLength of the payload chunk
Returns
SUIT_OK on successfully writing the chunk
suit_error_t on error

Definition at line 149 of file storage.h.


The documentation for this struct was generated from the following file: