Instantiate a downloader.
- Parameters
-
job | Job control interface |
image | Image to fill with downloaded file |
- Return values
-
Instantiates a downloader object to download the content of the specified image from its URI.
Definition at line 258 of file downloader.c.
struct arbelprm_rc_send_wqe rc
userptr_t data
Raw file image.
struct image * image
Image to contain downloaded file.
#define ref_init(refcnt, free)
Initialise a reference counter.
int xfer_open_uri(struct interface *intf, struct uri *uri)
Open URI.
static struct image * image_get(struct image *image)
Increment reference count on an image.
static struct interface_descriptor downloader_xfer_desc
Downloader data transfer interface descriptor.
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
struct interface job
Job control interface.
#define ENOMEM
Not enough space.
static void downloader_finished(struct downloader *downloader, int rc)
Terminate download.
void * zalloc(size_t size)
Allocate cleared memory.
struct uri * uri
URI of image.
struct interface xfer
Data transfer interface.
static void xferbuf_umalloc_init(struct xfer_buffer *xferbuf, userptr_t *data)
Initialise umalloc()-based data transfer buffer.
struct refcnt refcnt
Reference count for this object.
struct xfer_buffer buffer
Data transfer buffer.
static struct interface_descriptor downloader_job_desc
Downloader job control interface descriptor.
static void downloader_free(struct refcnt *refcnt)
Free downloader object.
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
#define ref_put(refcnt)
Drop reference to object.
References downloader::buffer, image::data, downloader_finished(), downloader_free(), downloader_job_desc, downloader_xfer_desc, ENOMEM, downloader::image, image_get(), intf_init(), intf_plug_plug(), downloader::job, rc, ref_init, ref_put, downloader::refcnt, image::uri, downloader::xfer, xfer_open_uri(), xferbuf_umalloc_init(), and zalloc().
Referenced by imgdownload().