124 if ( ! progress->
total ) {
An object interface operation.
static struct xfer_buffer * downloader_buffer(struct downloader *downloader)
Get underlying data transfer buffer.
struct arbelprm_rc_send_wqe rc
void intf_close(struct interface *intf, int rc)
Close an object interface.
int xferbuf_deliver(struct xfer_buffer *xferbuf, struct io_buffer *iobuf, struct xfer_metadata *meta)
Add received data to data transfer buffer.
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
userptr_t data
Raw file image.
int image_set_uri(struct image *image, struct uri *uri)
Set image URI.
struct image * image
Image to contain downloaded file.
#define ref_init(refcnt, free)
Initialise a reference counter.
uint32_t type
Operating system type.
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.
int xfer_vredirect(struct interface *intf, int type, va_list args)
Send redirection event.
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
size_t pos
Current offset within data.
#define va_copy(dest, src)
#define LOG_ERR
Error: error conditions.
struct interface job
Job control interface.
Access to external ("user") memory.
Data transfer interfaces.
#define ENOMEM
Not enough space.
#define iob_disown(iobuf)
Disown an I/O buffer.
static void downloader_finished(struct downloader *downloader, int rc)
Terminate download.
#define container_of(ptr, type, field)
Get containing structure.
unsigned long total
Total operation size.
unsigned long completed
Amount of operation completed so far.
int create_downloader(struct interface *job, struct image *image)
Instantiate a downloader.
An object interface descriptor.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
void * zalloc(size_t size)
Allocate cleared memory.
size_t len
Length of raw file image.
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
struct uri * uri
URI of image.
int xfer_deliver(struct interface *intf, struct io_buffer *iobuf, struct xfer_metadata *meta)
Deliver datagram.
static void image_put(struct image *image)
Decrement reference count on an image.
Data transfer interface opening.
struct interface xfer
Data transfer interface.
int xfer_vreopen(struct interface *intf, int type, va_list args)
Reopen location.
static void xferbuf_umalloc_init(struct xfer_buffer *xferbuf, userptr_t *data)
Initialise umalloc()-based data transfer buffer.
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
static int downloader_progress(struct downloader *downloader, struct job_progress *progress)
Report progress of download job.
static struct interface_operation downloader_xfer_operations[]
Downloader data transfer interface operations.
struct refcnt refcnt
Reference count for this object.
__builtin_va_list va_list
struct xfer_buffer buffer
Data transfer buffer.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static int downloader_deliver(struct downloader *downloader, struct io_buffer *iobuf, struct xfer_metadata *meta)
Handle received data.
#define syslog(priority, fmt,...)
Write message to system log.
A Uniform Resource Identifier.
static struct interface_operation downloader_job_op[]
Downloader job control interface operations.
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 LOG_NOTICE
Notice: normal but significant conditions.
static int downloader_vredirect(struct downloader *downloader, int type, va_list args)
Redirect data transfer interface.
#define ref_put(refcnt)
Drop reference to object.