summaryrefslogtreecommitdiffstats
path: root/discover/boot.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-09-23 17:31:43 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-09-23 17:31:43 +0800
commit748bd3f1bd8ffff60653f7a54f51cc5f63696c68 (patch)
treeada2a9a540c27184361c7bbbf0eefc30a8b97a66 /discover/boot.c
parent209b10507b8f95f9f549ecb81158034038334c36 (diff)
downloadtalos-petitboot-748bd3f1bd8ffff60653f7a54f51cc5f63696c68.tar.gz
talos-petitboot-748bd3f1bd8ffff60653f7a54f51cc5f63696c68.zip
discover/boot: Allow printf formatting in update_status
It'd be nice to include arbitrary format strings here, so do a taloc_vasprintf in update_status. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/boot.c')
-rw-r--r--discover/boot.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/discover/boot.c b/discover/boot.c
index 583d141..6095cd8 100644
--- a/discover/boot.c
+++ b/discover/boot.c
@@ -121,17 +121,23 @@ static int kexec_reboot(struct boot_task *task)
return result;
}
-static void update_status(boot_status_fn fn, void *arg, int type,
- char *message)
+static void __attribute__((format(__printf__, 4, 5))) update_status(
+ boot_status_fn fn, void *arg, int type, char *fmt, ...)
{
struct boot_status status;
+ va_list ap;
+
+ va_start(ap, fmt);
+ status.message = talloc_vasprintf(NULL, fmt, ap);
+ va_end(ap);
status.type = type;
- status.message = message;
status.progress = -1;
status.detail = NULL;
fn(arg, &status);
+
+ talloc_free(status.message);
}
static void boot_hook_update_param(void *ctx, struct boot_task *task,
OpenPOWER on IntegriCloud