From d17a84a056a412f10a85985dc2c43b6fbedd0abd Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 9 Mar 2011 13:11:35 +0000 Subject: [image] Move the register_and_{select|boot}_image() functions to imgmgmt.c These functions are used only as the "action" parameters to imgdownload() or imgfetch(), and so belong in imgmgmt.c rather than image.c Signed-off-by: Michael Brown --- src/usr/imgmgmt.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/usr') diff --git a/src/usr/imgmgmt.c b/src/usr/imgmgmt.c index 6eefdfa5f..f375db868 100644 --- a/src/usr/imgmgmt.c +++ b/src/usr/imgmgmt.c @@ -35,6 +35,45 @@ FILE_LICENCE ( GPL2_OR_LATER ); * */ +/** + * Register and select an image + * + * @v image Executable image + * @ret rc Return status code + */ +int register_and_select_image ( struct image *image ) { + int rc; + + if ( ( rc = register_image ( image ) ) != 0 ) + return rc; + + if ( ( rc = image_probe ( image ) ) != 0 ) + return rc; + + if ( ( rc = image_select ( image ) ) != 0 ) + return rc; + + return 0; +} + +/** + * Register and boot an image + * + * @v image Image + * @ret rc Return status code + */ +int register_and_boot_image ( struct image *image ) { + int rc; + + if ( ( rc = register_and_select_image ( image ) ) != 0 ) + return rc; + + if ( ( rc = image_exec ( image ) ) != 0 ) + return rc; + + return 0; +} + /** * Download an image * -- cgit v1.2.3-55-g7522