[PATCH v3 09/10] FIT: save filename during fit_open

Marco Felsch m.felsch at pengutronix.de
Wed Jul 3 09:58:37 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  | 2 ++
 include/image-fit.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/common/image-fit.c b/common/image-fit.c
index 9480d7963f2a..4839d8dd33a4 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -937,6 +937,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) {
@@ -952,6 +953,7 @@ void fit_close(struct fit_handle *handle)
 	if (handle->root)
 		of_delete_node(handle->root);
 
+	free(handle->filename);
 	free(handle->fit_alloc);
 	free(handle);
 }
diff --git a/include/image-fit.h b/include/image-fit.h
index f8321aa87e11..68f70f4365cb 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