aboutsummaryrefslogtreecommitdiff
path: root/bootdevice.c
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2014-12-03 17:11:39 +0000
committerroot <root@ceth6.(none)>2014-12-22 14:39:20 +0800
commit703008e81a6ace40f227aae16d630014e5016af1 (patch)
treec515ae6d62765dd51094e9063e125bb8bdc3bac9 /bootdevice.c
parent9816833d3b8ec9adfb63b6a53f1b56f5304f4c40 (diff)
bootdevice: add Error **errp argument for validate_bootdevices()
It will be useful for checking when we change traditional boot order dynamically and propagate error message to the monitor. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'bootdevice.c')
-rw-r--r--bootdevice.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/bootdevice.c b/bootdevice.c
index aae4cac27f..184348ecd2 100644
--- a/bootdevice.c
+++ b/bootdevice.c
@@ -55,7 +55,7 @@ int qemu_boot_set(const char *boot_order)
return boot_set_handler(boot_set_opaque, boot_order);
}
-void validate_bootdevices(const char *devices)
+void validate_bootdevices(const char *devices, Error **errp)
{
/* We just do some generic consistency checks */
const char *p;
@@ -72,12 +72,12 @@ void validate_bootdevices(const char *devices)
* features.
*/
if (*p < 'a' || *p > 'p') {
- fprintf(stderr, "Invalid boot device '%c'\n", *p);
- exit(1);
+ error_setg(errp, "Invalid boot device '%c'", *p);
+ return;
}
if (bitmap & (1 << (*p - 'a'))) {
- fprintf(stderr, "Boot device '%c' was given twice\n", *p);
- exit(1);
+ error_setg(errp, "Boot device '%c' was given twice", *p);
+ return;
}
bitmap |= 1 << (*p - 'a');
}