summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/spl.h4
-rw-r--r--include/test/spl.h30
2 files changed, 34 insertions, 0 deletions
diff --git a/include/spl.h b/include/spl.h
index 03a4a83eb2..ad1543ae16 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -673,6 +673,10 @@ static inline const char *spl_loader_name(const struct spl_image_loader *loader)
}
#endif
+#define SPL_LOAD_IMAGE_GET(_priority, _boot_device, _method) \
+ ll_entry_get(struct spl_image_loader, \
+ _boot_device ## _priority ## _method, spl_image_loader)
+
/* SPL FAT image functions */
/**
diff --git a/include/test/spl.h b/include/test/spl.h
index 7dba3f03d0..009c6b3546 100644
--- a/include/test/spl.h
+++ b/include/test/spl.h
@@ -80,6 +80,36 @@ int check_image_info(struct unit_test_state *uts, struct spl_image_info *info1,
struct spl_image_info *info2);
/**
+ * typedef write_image_t - Callback for writing an image
+ * @uts: Current unit test state
+ * @img: Image to write
+ * @size: Size of @img
+ *
+ * Write @img to a location which will be read by a &struct spl_image_loader.
+ *
+ * Return: 0 on success or 1 on failure
+ */
+typedef int write_image_t(struct unit_test_state *its, void *img, size_t size);
+
+/**
+ * do_spl_test_load() - Test loading with an SPL image loader
+ * @uts: Current unit test state
+ * @test_name: Name of the current test
+ * @type: Type of image to try loading
+ * @loader: The loader to test
+ * @write_image: Callback to write the image to the backing storage
+ *
+ * Test @loader, performing the common tasks of setting up the image and
+ * checking it was loaded correctly. The caller must supply a @write_image
+ * callback to write the image to a location which will be read by @loader.
+ *
+ * Return: 0 on success or 1 on failure
+ */
+int do_spl_test_load(struct unit_test_state *uts, const char *test_name,
+ enum spl_test_image type, struct spl_image_loader *loader,
+ write_image_t write_image);
+
+/**
* image_supported() - Determine whether an image type is supported
* @type: The image type to check
*