diff options
| author | Michael Brown | 2007-06-09 18:42:46 +0200 |
|---|---|---|
| committer | Michael Brown | 2007-06-09 18:42:46 +0200 |
| commit | 7c8cc3ef6cfdacdb6dcf1f556070069f8446e64b (patch) | |
| tree | 9014b799af187b81962f20efd4d9d8914f385971 /src | |
| parent | Add reference counting to register/unregister procedure. (diff) | |
| download | ipxe-7c8cc3ef6cfdacdb6dcf1f556070069f8446e64b.tar.gz ipxe-7c8cc3ef6cfdacdb6dcf1f556070069f8446e64b.tar.xz ipxe-7c8cc3ef6cfdacdb6dcf1f556070069f8446e64b.zip | |
Use standard xfer_open() argument list for downloader instantiator
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/downloader.c | 17 | ||||
| -rw-r--r-- | src/include/gpxe/downloader.h | 6 |
2 files changed, 14 insertions, 9 deletions
diff --git a/src/core/downloader.c b/src/core/downloader.c index 15ef962d3..eec0c578c 100644 --- a/src/core/downloader.c +++ b/src/core/downloader.c @@ -17,6 +17,7 @@ */ #include <stdlib.h> +#include <stdarg.h> #include <errno.h> #include <gpxe/xfer.h> #include <gpxe/open.h> @@ -243,19 +244,21 @@ static struct xfer_interface_operations downloader_xfer_operations = { * Instantiate a downloader * * @v job Job control interface - * @v uri_string URI string * @v image Image to fill with downloaded file * @v register_image Image registration routine + * @v type Location type to pass to xfer_open() + * @v ... Remaining arguments to pass to xfer_open() * @ret rc Return status code * * Instantiates a downloader object to download the specified URI into * the specified image object. If the download is successful, the * image registration routine @c register_image() will be called. */ -int create_downloader ( struct job_interface *job, const char *uri_string, - struct image *image, - int ( * register_image ) ( struct image *image ) ) { +int create_downloader ( struct job_interface *job, struct image *image, + int ( * register_image ) ( struct image *image ), + int type, ... ) { struct downloader *downloader; + va_list args; int rc; /* Allocate and initialise structure */ @@ -270,19 +273,21 @@ int create_downloader ( struct job_interface *job, const char *uri_string, &downloader->refcnt ); downloader->image = image_get ( image ); downloader->register_image = register_image; + va_start ( args, type ); /* Instantiate child objects and attach to our interfaces */ - if ( ( rc = xfer_open ( &downloader->xfer, LOCATION_URI, - uri_string ) ) != 0 ) + if ( ( rc = xfer_vopen ( &downloader->xfer, type, args ) ) != 0 ) goto err; /* Attach parent interface, mortalise self, and return */ job_plug_plug ( &downloader->job, job ); ref_put ( &downloader->refcnt ); + va_end ( args ); return 0; err: downloader_finished ( downloader, rc ); ref_put ( &downloader->refcnt ); + va_end ( args ); return rc; } diff --git a/src/include/gpxe/downloader.h b/src/include/gpxe/downloader.h index 956bbce0a..33aa76921 100644 --- a/src/include/gpxe/downloader.h +++ b/src/include/gpxe/downloader.h @@ -10,8 +10,8 @@ struct job_interface; struct image; -extern int create_downloader ( struct job_interface *job, - const char *uri_string, struct image *image, - int ( * register_image ) ( struct image * ) ); +extern int create_downloader ( struct job_interface *job, struct image *image, + int ( * register_image ) ( struct image *image ), + int type, ... ); #endif /* _GPXE_DOWNLOADER_H */ |
