[image] Simplify image management commands and internal API
Remove the name, cmdline, and action parameters from imgdownload() and imgdownload_string(). These functions now simply download and return an image. Add the function imgacquire(), which will interpret a "name or URI string" parameter and return either an existing image or a newly downloaded image. Use imgacquire() to merge similar image-management commands that currently differ only by whether they take the name of an existing image or the URI of a new image to download. For example, "chain" and "imgexec" can now be merged. Extend imgstat and imgfree commands to take an optional list of images. Remove the arbitrary restriction on the length of image names. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
+6
-3
@@ -131,6 +131,7 @@ struct setting skip_san_boot_setting __setting ( SETTING_SANBOOT_EXTRA ) = {
|
||||
*/
|
||||
int uriboot ( struct uri *filename, struct uri *root_path, int drive,
|
||||
unsigned int flags ) {
|
||||
struct image *image;
|
||||
int rc;
|
||||
|
||||
/* Hook SAN device, if applicable */
|
||||
@@ -157,9 +158,10 @@ int uriboot ( struct uri *filename, struct uri *root_path, int drive,
|
||||
|
||||
/* Attempt filename boot if applicable */
|
||||
if ( filename ) {
|
||||
if ( ( rc = imgdownload ( filename, NULL, NULL,
|
||||
image_exec ) ) != 0 ) {
|
||||
printf ( "\nCould not chain image: %s\n",
|
||||
if ( ( rc = imgdownload ( filename, &image ) ) != 0 )
|
||||
goto err_download;
|
||||
if ( ( rc = image_exec ( image ) ) != 0 ) {
|
||||
printf ( "Could not boot image: %s\n",
|
||||
strerror ( rc ) );
|
||||
/* Fall through to (possibly) attempt a SAN boot
|
||||
* as a fallback. If no SAN boot is attempted,
|
||||
@@ -190,6 +192,7 @@ int uriboot ( struct uri *filename, struct uri *root_path, int drive,
|
||||
}
|
||||
}
|
||||
|
||||
err_download:
|
||||
err_san_describe:
|
||||
/* Unhook SAN device, if applicable */
|
||||
if ( ( drive >= 0 ) && ! ( flags & URIBOOT_NO_SAN_UNHOOK ) ) {
|
||||
|
||||
Reference in New Issue
Block a user