cpatch patching API
More...
|
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.
|
|
cpatch patching API
◆ CPATCH_MAGIC_NUMBER
#define CPATCH_MAGIC_NUMBER 0xBA854092 |
◆ 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_offset | Current patching progress |
◆ 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
-
input | Input file flash area |
patch | Patch file flash area |
output | Output stream flash context |
header | Patch header read by cpatch_patch_start |
progress_cb | Optional progress callback |
- Return values
-
0 | on success |
-EINVAL | on input or output validation errors |
-errno | other 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
-
input | Input file flash area |
patch | Patch file flash area |
header | Output storage for the patch header |
- Return values
-
0 | on success |
-EINVAL | on patch file or input data validation errors |
-errno | other error from flash_area_crc32 |