diff mbox series

[05/29] Hide copyfile() implementation to add more input

Message ID 20211011112156.44192-6-sbabic@denx.de
State Changes Requested
Headers show
Series DELTA Update | expand

Commit Message

Stefano Babic Oct. 11, 2021, 11:21 a.m. UTC
Add copyfile implementation with a wrapper function to allow to change
internals without modifying the API.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 core/cpio_utils.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/core/cpio_utils.c b/core/cpio_utils.c
index 2e4aca3..e06bf5f 100644
--- a/core/cpio_utils.c
+++ b/core/cpio_utils.c
@@ -380,7 +380,7 @@  static int zstd_step(void* state, void* buffer, size_t size)
 
 #endif
 
-int copyfile(int fdin, void *out, unsigned int nbytes, unsigned long *offs, unsigned long long seek,
+static int __swupdate_copy(int fdin, void *out, unsigned int nbytes, unsigned long *offs, unsigned long long seek,
 	int skip_file, int __attribute__ ((__unused__)) compressed,
 	uint32_t *checksum, unsigned char *hash, bool encrypted, const char *imgivt, writeimage callback)
 {
@@ -633,6 +633,24 @@  copyfile_exit:
 	return ret;
 }
 
+int copyfile(int fdin, void *out, unsigned int nbytes, unsigned long *offs, unsigned long long seek,
+	int skip_file, int __attribute__ ((__unused__)) compressed,
+	uint32_t *checksum, unsigned char *hash, bool encrypted, const char *imgivt, writeimage callback)
+{
+	return __swupdate_copy(fdin,
+				out,
+				nbytes,
+				offs,
+				seek,
+				skip_file,
+				compressed,
+				checksum,
+				hash,
+				encrypted,
+				imgivt,
+				callback);
+}
+
 int copyimage(void *out, struct img_type *img, writeimage callback)
 {
 	return copyfile(img->fdin,