Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
cpatch patching APIs

cpatch patching API More...

Data Structures

struct  cpatch_array_validation
 Expected values for various memory regions. More...
 
struct  cpatch_header
 CPatch file header. More...
 

Macros

#define CPATCH_MAGIC_NUMBER   0xBA854092
 Magic number that signifies a CPatch file.
 

Typedefs

typedef void(* cpatch_progress_cb_t) (size_t output_offset)
 Patching output progress callback.
 

Functions

int cpatch_patch_start (const struct flash_area *input, const struct flash_area *patch, struct cpatch_header *header)
 Validate patch file and input data region.
 
int cpatch_patch_apply (const struct flash_area *input, const struct flash_area *patch, struct stream_flash_ctx *output, struct cpatch_header *header, cpatch_progress_cb_t progress_cb)
 Create an output file by applying a patch file to an input file.
 

Detailed Description

cpatch patching API

Macro Definition Documentation

◆ CPATCH_MAGIC_NUMBER

#define CPATCH_MAGIC_NUMBER   0xBA854092

#include <infuse/cpatch/patch.h>

Magic number that signifies a CPatch file.

Typedef Documentation

◆ cpatch_progress_cb_t

typedef void(* cpatch_progress_cb_t) (size_t output_offset)

#include <infuse/cpatch/patch.h>

Patching output progress callback.

Note
The frequency and offsets of the callback progress depend on the patch file contents.
Parameters
output_offsetCurrent patching progress

Function Documentation

◆ cpatch_patch_apply()

int cpatch_patch_apply ( const struct flash_area * input,
const struct flash_area * patch,
struct stream_flash_ctx * output,
struct cpatch_header * header,
cpatch_progress_cb_t progress_cb )

#include <infuse/cpatch/patch.h>

Create an output file by applying a patch file to an input file.

Note
If STREAM_FLASH_ERASE is not enabled, the output flash area must be manually erased prior to calling this function.
Parameters
inputInput file flash area
patchPatch file flash area
outputOutput stream flash context
headerPatch header read by cpatch_patch_start
progress_cbOptional progress callback
Return values
0on success
-EINVALon input or output validation errors
-errnoother negative error on flash read or write failures

◆ cpatch_patch_start()

int cpatch_patch_start ( const struct flash_area * input,
const struct flash_area * patch,
struct cpatch_header * header )

#include <infuse/cpatch/patch.h>

Validate patch file and input data region.

Ensures that the patch file is internally consistent, and that it can be applied to the flash area input. Returns the patch header so that the caller can prepare the output region before starting the application process.

Parameters
inputInput file flash area
patchPatch file flash area
headerOutput storage for the patch header
Return values
0on success
-EINVALon patch file or input data validation errors
-errnoother error from flash_area_crc32