[PATCH v2 10/11] FIT: save filename during fit_open

Marco Felsch m.felsch at pengutronix.de
Thu Jun 13 05:58:17 PDT 2024


This is in preparation of buffering fit_open() calls to not load the
same fit twice if it is still open.

Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
 common/image-fit.c  | 4 ++++
 include/image-fit.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/common/image-fit.c b/common/image-fit.c
index e93946a0615e..c5c88ebe4c1e 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -951,6 +951,7 @@ struct fit_handle *fit_open(const char *filename, bool verbose,
 	}
 
 	handle->fit = handle->fit_alloc;
+	handle->filename = xstrdup(filename);
 
 	ret = fit_do_open(handle);
 	if (ret) {
@@ -966,6 +967,9 @@ void fit_close(struct fit_handle *handle)
 	if (handle->root)
 		of_delete_node(handle->root);
 
+	if (handle->filename)
+		free(handle->filename);
+
 	free(handle->fit_alloc);
 	free(handle);
 }
diff --git a/include/image-fit.h b/include/image-fit.h
index 7e0cd38fea53..10fa3716a094 100644
--- a/include/image-fit.h
+++ b/include/image-fit.h
@@ -13,6 +13,7 @@ struct fit_handle {
 	const void *fit;
 	void *fit_alloc;
 	size_t size;
+	char *filename;
 
 	bool verbose;
 	enum bootm_verify verify;
-- 
2.39.2




More information about the barebox mailing list