|
@@ -17,6 +17,7 @@
|
17
|
17
|
*/
|
18
|
18
|
|
19
|
19
|
#include <stdlib.h>
|
|
20
|
+#include <stdarg.h>
|
20
|
21
|
#include <errno.h>
|
21
|
22
|
#include <gpxe/xfer.h>
|
22
|
23
|
#include <gpxe/open.h>
|
|
@@ -243,19 +244,21 @@ static struct xfer_interface_operations downloader_xfer_operations = {
|
243
|
244
|
* Instantiate a downloader
|
244
|
245
|
*
|
245
|
246
|
* @v job Job control interface
|
246
|
|
- * @v uri_string URI string
|
247
|
247
|
* @v image Image to fill with downloaded file
|
248
|
248
|
* @v register_image Image registration routine
|
|
249
|
+ * @v type Location type to pass to xfer_open()
|
|
250
|
+ * @v ... Remaining arguments to pass to xfer_open()
|
249
|
251
|
* @ret rc Return status code
|
250
|
252
|
*
|
251
|
253
|
* Instantiates a downloader object to download the specified URI into
|
252
|
254
|
* the specified image object. If the download is successful, the
|
253
|
255
|
* image registration routine @c register_image() will be called.
|
254
|
256
|
*/
|
255
|
|
-int create_downloader ( struct job_interface *job, const char *uri_string,
|
256
|
|
- struct image *image,
|
257
|
|
- int ( * register_image ) ( struct image *image ) ) {
|
|
257
|
+int create_downloader ( struct job_interface *job, struct image *image,
|
|
258
|
+ int ( * register_image ) ( struct image *image ),
|
|
259
|
+ int type, ... ) {
|
258
|
260
|
struct downloader *downloader;
|
|
261
|
+ va_list args;
|
259
|
262
|
int rc;
|
260
|
263
|
|
261
|
264
|
|
|
@@ -270,19 +273,21 @@ int create_downloader ( struct job_interface *job, const char *uri_string,
|
270
|
273
|
&downloader->refcnt );
|
271
|
274
|
downloader->image = image_get ( image );
|
272
|
275
|
downloader->register_image = register_image;
|
|
276
|
+ va_start ( args, type );
|
273
|
277
|
|
274
|
278
|
|
275
|
|
- if ( ( rc = xfer_open ( &downloader->xfer, LOCATION_URI,
|
276
|
|
- uri_string ) ) != 0 )
|
|
279
|
+ if ( ( rc = xfer_vopen ( &downloader->xfer, type, args ) ) != 0 )
|
277
|
280
|
goto err;
|
278
|
281
|
|
279
|
282
|
|
280
|
283
|
job_plug_plug ( &downloader->job, job );
|
281
|
284
|
ref_put ( &downloader->refcnt );
|
|
285
|
+ va_end ( args );
|
282
|
286
|
return 0;
|
283
|
287
|
|
284
|
288
|
err:
|
285
|
289
|
downloader_finished ( downloader, rc );
|
286
|
290
|
ref_put ( &downloader->refcnt );
|
|
291
|
+ va_end ( args );
|
287
|
292
|
return rc;
|
288
|
293
|
}
|