diff options
author | Michael Brown | 2011-03-07 01:37:50 +0100 |
---|---|---|
committer | Michael Brown | 2011-03-07 01:37:50 +0100 |
commit | 34b6ecb2f1d7940a0065cbabd6f9dcd439b4c841 (patch) | |
tree | ea583bf6fde26b2ed12ee3c6b117055e555555d9 /src/usr | |
parent | [spi] Reset device on each access (diff) | |
download | ipxe-34b6ecb2f1d7940a0065cbabd6f9dcd439b4c841.tar.gz ipxe-34b6ecb2f1d7940a0065cbabd6f9dcd439b4c841.tar.xz ipxe-34b6ecb2f1d7940a0065cbabd6f9dcd439b4c841.zip |
[image] Simplify image management
Refactor the {load,exec} image operations as {probe,exec}. This makes
the probe mechanism cleaner, eliminates some forward declarations,
avoids holding magic state in image->priv, eliminates the possibility
of screwing up between the "load" and "exec" stages, and makes the
documentation simpler since the concept of "loading" (as distinct from
"executing") no longer needs to be explained.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/usr')
-rw-r--r-- | src/usr/autoboot.c | 2 | ||||
-rw-r--r-- | src/usr/imgmgmt.c | 52 |
2 files changed, 4 insertions, 50 deletions
diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c index 9a31279f..7b851b3b 100644 --- a/src/usr/autoboot.c +++ b/src/usr/autoboot.c @@ -184,7 +184,7 @@ int uriboot ( struct uri *filename, struct uri *root_path ) { /* Attempt filename boot if applicable */ if ( filename ) { if ( ( rc = imgdownload ( image, filename, - register_and_autoexec_image ) ) !=0){ + register_and_boot_image ) ) != 0 ) { printf ( "\nCould not chain image: %s\n", strerror ( rc ) ); /* Fall through to (possibly) attempt a SAN boot diff --git a/src/usr/imgmgmt.c b/src/usr/imgmgmt.c index 6b150353..6eefdfa5 100644 --- a/src/usr/imgmgmt.c +++ b/src/usr/imgmgmt.c @@ -100,62 +100,16 @@ int imgfetch ( struct image *image, const char *uri_string, } /** - * Load an image - * - * @v image Image - * @ret rc Return status code - */ -int imgload ( struct image *image ) { - int rc; - - /* Try to load image */ - if ( ( rc = image_autoload ( image ) ) != 0 ) - return rc; - - return 0; -} - -/** - * Execute an image - * - * @v image Image - * @ret rc Return status code - */ -int imgexec ( struct image *image ) { - return image_exec ( image ); -} - -/** - * Identify the only loaded image - * - * @ret image Image, or NULL if 0 or >1 images are loaded - */ -struct image * imgautoselect ( void ) { - struct image *image; - struct image *selected_image = NULL; - int flagged_images = 0; - - for_each_image ( image ) { - if ( image->flags & IMAGE_LOADED ) { - selected_image = image; - flagged_images++; - } - } - - return ( ( flagged_images == 1 ) ? selected_image : NULL ); -} - -/** * Display status of an image * * @v image Executable/loadable image */ void imgstat ( struct image *image ) { - printf ( "%s: %zd bytes", image->name, image->len ); + printf ( "%s : %zd bytes", image->name, image->len ); if ( image->type ) printf ( " [%s]", image->type->name ); - if ( image->flags & IMAGE_LOADED ) - printf ( " [LOADED]" ); + if ( image->flags & IMAGE_SELECTED ) + printf ( " [SELECTED]" ); if ( image->cmdline ) printf ( " \"%s\"", image->cmdline ); printf ( "\n" ); |