diff options
author | Michael Brown <mcb30@ipxe.org> | 2015-08-21 16:15:24 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2015-08-21 16:25:11 +0100 |
commit | abfe94a90ad72f4be2055f3ad21f09ab081cc250 (patch) | |
tree | a206b2952cd7e7064fd3c621ca4d784a3335a7ad /src/tests | |
parent | f58ebbdfb5f48089bb3df088654d5bf735dab2c2 (diff) | |
download | ipxe-abfe94a90ad72f4be2055f3ad21f09ab081cc250.zip ipxe-abfe94a90ad72f4be2055f3ad21f09ab081cc250.tar.gz ipxe-abfe94a90ad72f4be2055f3ad21f09ab081cc250.tar.bz2 |
[image] Detect image type when image is first registered
The current usage pattern of image_probe() is a legacy from the time
before commit 34b6ecb ("[image] Simplify image management") when
loading an image to its executable location in memory was a separate
action from actually executing the image.
Call image_probe() as soon as an image is registered. This allows
"imgstat" to display image type information for all images and allows
image-consuming code to assume that image->type is already set
correctly.
Ignore failures if image_probe() does not recognise the image, since
we do expect to handle unrecognised images (initrds, modules, etc).
Unrecognised images will be left with a NULL image->type, which
image-consuming code can easily check.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/pixbuf_test.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/tests/pixbuf_test.c b/src/tests/pixbuf_test.c index 28c502b..aaa516b 100644 --- a/src/tests/pixbuf_test.c +++ b/src/tests/pixbuf_test.c @@ -57,8 +57,8 @@ void pixbuf_okx ( struct pixel_buffer_test *test, const char *file, /* Correct image data pointer */ test->image->data = virt_to_user ( ( void * ) test->image->data ); - /* Check that image is detected as PNM */ - okx ( image_probe ( test->image ) == 0, file, line ); + /* Check that image is detected as correct type */ + okx ( register_image ( test->image ) == 0, file, line ); okx ( test->image->type == test->type, file, line ); /* Check that a pixel buffer can be created from the image */ @@ -77,4 +77,7 @@ void pixbuf_okx ( struct pixel_buffer_test *test, const char *file, pixbuf_put ( pixbuf ); } + + /* Unregister image */ + unregister_image ( test->image ); } |