diff options
author | Michael Brown | 2012-03-24 02:16:37 +0100 |
---|---|---|
committer | Michael Brown | 2012-03-25 00:12:04 +0100 |
commit | 1c127a696215bd75917c3ba836c2db11636b3ffb (patch) | |
tree | bd883060a15bfae71aef090481f9ea67d4fb43bc /src/usr/autoboot.c | |
parent | [build] Fix compilation under Cygwin (diff) | |
download | ipxe-1c127a696215bd75917c3ba836c2db11636b3ffb.tar.gz ipxe-1c127a696215bd75917c3ba836c2db11636b3ffb.tar.xz ipxe-1c127a696215bd75917c3ba836c2db11636b3ffb.zip |
[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>
Diffstat (limited to 'src/usr/autoboot.c')
-rw-r--r-- | src/usr/autoboot.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c index 5bfadec0..da82f5e8 100644 --- a/src/usr/autoboot.c +++ b/src/usr/autoboot.c @@ -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 ) ) { |