swupdate: fix build errors in ubivol rdiff handler patch

This patch includes code that only gets compiled for platforms that use a NAND
as the internal storage. Recent changes in swupdate's "copyfile" API caused
this code to stop building.

Using the normal rdiff handler code as reference, update our custom handler to
fix the build errors. While at it, include another change to prevent a warning.

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
This commit is contained in:
Gabriel Valcazar 2024-12-04 11:23:05 +01:00
parent 655ab0cc36
commit 51655b11dd
1 changed files with 5 additions and 16 deletions

View File

@ -16,8 +16,8 @@ Signed-off-by: David Escalona <david.escalona@digi.com>
configs/all_handlers_defconfig | 1 +
handlers/Kconfig | 13 +
handlers/Makefile | 1 +
handlers/ubivol_rdiff_handler.c | 606 ++++++++++++++++++++++++++++++++
5 files changed, 625 insertions(+)
handlers/ubivol_rdiff_handler.c | 595 ++++++++++++++++++++++++++++++++
5 files changed, 614 insertions(+)
create mode 100644 handlers/ubivol_rdiff_handler.c
diff --git a/Makefile.flags b/Makefile.flags
@ -87,7 +87,7 @@ new file mode 100644
index 0000000..3b6073d
--- /dev/null
+++ b/handlers/ubivol_rdiff_handler.c
@@ -0,0 +1,606 @@
@@ -0,0 +1,595 @@
+/*
+ * Author: Christian Storm
+ * Copyright (C) 2018, Siemens AG
@ -252,7 +252,7 @@ index 0000000..3b6073d
+ case RS_RUNNING: strresult = (char*)"RUNNING"; break;
+ default: break;
+ }
+ TRACE("%s avail_in=%ld avail_out=%ld result=%s",
+ TRACE("%s avail_in=%zu avail_out=%zu result=%s",
+ msg, buffers->avail_in, buffers->avail_out, strresult);
+}
+
@ -657,18 +657,7 @@ index 0000000..3b6073d
+ rs_trace_to(rdiff_log);
+
+ rdiff_state.job = rs_patch_begin(base_file_read_cb, rdiff_state.base_file);
+ ret = copyfile(img->fdin,
+ &rdiff_state,
+ img->size,
+ (unsigned long *)&img->offset,
+ img->seek,
+ 0, /* no skip */
+ img->compressed,
+ &img->checksum,
+ img->sha256,
+ img->is_encrypted,
+ img->ivt_ascii,
+ apply_rdiff_chunk_cb);
+ ret = copyimage(&rdiff_state, img, apply_rdiff_chunk_cb);
+ if (ret != 0) {
+ ERROR("Error %d running rdiff job, aborting.", ret);
+ goto cleanup;