summaryrefslogtreecommitdiffstats
path: root/src/hci/commands/image_cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hci/commands/image_cmd.c')
-rw-r--r--src/hci/commands/image_cmd.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/hci/commands/image_cmd.c b/src/hci/commands/image_cmd.c
index dc30b3f2..a9e831bf 100644
--- a/src/hci/commands/image_cmd.c
+++ b/src/hci/commands/image_cmd.c
@@ -40,6 +40,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
struct imgsingle_options {
/** Image name */
char *name;
+ /** Download timeout */
+ unsigned long timeout;
/** Replace image */
int replace;
/** Free image after execution */
@@ -49,13 +51,17 @@ struct imgsingle_options {
/** "img{single}" option list */
static union {
/* "imgexec" takes all three options */
- struct option_descriptor imgexec[3];
- /* Other "img{single}" commands take only --name and --autofree */
- struct option_descriptor imgsingle[2];
+ struct option_descriptor imgexec[4];
+ /* Other "img{single}" commands take only --name, --timeout,
+ * and --autofree
+ */
+ struct option_descriptor imgsingle[3];
} opts = {
.imgexec = {
OPTION_DESC ( "name", 'n', required_argument,
struct imgsingle_options, name, parse_string ),
+ OPTION_DESC ( "timeout", 't', required_argument,
+ struct imgsingle_options, timeout, parse_timeout),
OPTION_DESC ( "autofree", 'a', no_argument,
struct imgsingle_options, autofree, parse_flag ),
OPTION_DESC ( "replace", 'r', no_argument,
@@ -68,7 +74,8 @@ struct imgsingle_descriptor {
/** Command descriptor */
struct command_descriptor *cmd;
/** Function to use to acquire the image */
- int ( * acquire ) ( const char *name, struct image **image );
+ int ( * acquire ) ( const char *name, unsigned long timeout,
+ struct image **image );
/** Pre-action to take upon image, or NULL */
void ( * preaction ) ( struct image *image );
/** Action to take upon image, or NULL */
@@ -114,7 +121,8 @@ static int imgsingle_exec ( int argc, char **argv,
/* Acquire the image */
if ( name_uri ) {
- if ( ( rc = desc->acquire ( name_uri, &image ) ) != 0 )
+ if ( ( rc = desc->acquire ( name_uri, opts.timeout,
+ &image ) ) != 0 )
goto err_acquire;
} else {
image = image_find_selected();