summaryrefslogtreecommitdiffstats
path: root/src/usr/imgmgmt.c
diff options
context:
space:
mode:
authorMichael Brown2007-01-18 04:39:45 +0100
committerMichael Brown2007-01-18 04:39:45 +0100
commitdd6d94004f2cd33401978a91353f5c352caa1313 (patch)
tree386c513b5b16f564db93ae057c9e85545d873a4c /src/usr/imgmgmt.c
parentReplacement for fetch() which operates asynchronously and identifies (diff)
downloadipxe-dd6d94004f2cd33401978a91353f5c352caa1313.tar.gz
ipxe-dd6d94004f2cd33401978a91353f5c352caa1313.tar.xz
ipxe-dd6d94004f2cd33401978a91353f5c352caa1313.zip
HTTP/DNS now working fully asynchronously. HTTP/IP addresses and any
other protocol won't work at the moment.
Diffstat (limited to 'src/usr/imgmgmt.c')
-rw-r--r--src/usr/imgmgmt.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/usr/imgmgmt.c b/src/usr/imgmgmt.c
index abd48bb3..06ae872e 100644
--- a/src/usr/imgmgmt.c
+++ b/src/usr/imgmgmt.c
@@ -22,7 +22,7 @@
#include <vsprintf.h>
#include <gpxe/image.h>
#include <gpxe/umalloc.h>
-#include <usr/fetch.h>
+#include <gpxe/download.h>
#include <usr/imgmgmt.h>
/** @file
@@ -34,14 +34,15 @@
/**
* Fetch an image
*
- * @v filename Filename for image
+ * @v uri_string URI as a string (e.g. "http://www.nowhere.com/vmlinuz")
* @v name Name for image, or NULL
* @ret new_image Newly created image
* @ret rc Return status code
*/
-int imgfetch ( const char *filename, const char *name,
+int imgfetch ( const char *uri_string, const char *name,
struct image **new_image ) {
struct image *image;
+ struct async async;
int rc;
/* Allocate new image */
@@ -54,8 +55,10 @@ int imgfetch ( const char *filename, const char *name,
if ( name )
strncpy ( image->name, name, ( sizeof ( image->name ) - 1 ) );
- /* Fetch the file */
- if ( ( rc = fetch ( filename, &image->data, &image->len ) ) != 0 )
+ /* Download the file */
+ if ( ( rc = async_block ( &async, start_download ( uri_string, &async,
+ &image->data,
+ &image->len ))) !=0)
goto err;
/* Register the image */