mirror of https://github.com/xemu-project/xemu.git
like acpi_table_install(), acpi_table_add() should propagate Errors
Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1363821803-3380-8-git-send-email-lersek@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
e980f2bf0a
commit
23084327dc
|
@ -1106,8 +1106,13 @@ int qemu_uuid_parse(const char *str, uint8_t *uuid)
|
||||||
void do_acpitable_option(const QemuOpts *opts)
|
void do_acpitable_option(const QemuOpts *opts)
|
||||||
{
|
{
|
||||||
#ifdef TARGET_I386
|
#ifdef TARGET_I386
|
||||||
if (acpi_table_add(opts) < 0) {
|
Error *err = NULL;
|
||||||
fprintf(stderr, "Wrong acpi table provided\n");
|
|
||||||
|
acpi_table_add(opts, &err);
|
||||||
|
if (err) {
|
||||||
|
fprintf(stderr, "Wrong acpi table provided: %s\n",
|
||||||
|
error_get_pretty(err));
|
||||||
|
error_free(err);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -229,7 +229,7 @@ static void acpi_table_install(const char unsigned *blob, size_t bloblen,
|
||||||
ACPI_TABLE_PFX_SIZE, acpi_payload_size);
|
ACPI_TABLE_PFX_SIZE, acpi_payload_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
int acpi_table_add(const QemuOpts *opts)
|
void acpi_table_add(const QemuOpts *opts, Error **errp)
|
||||||
{
|
{
|
||||||
AcpiTableOptions *hdrs = NULL;
|
AcpiTableOptions *hdrs = NULL;
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
|
@ -306,12 +306,7 @@ out:
|
||||||
qapi_dealloc_visitor_cleanup(dv);
|
qapi_dealloc_visitor_cleanup(dv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err) {
|
error_propagate(errp, err);
|
||||||
fprintf(stderr, "%s\n", error_get_pretty(err));
|
|
||||||
error_free(err);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void acpi_notify_wakeup(Notifier *notifier, void *data)
|
static void acpi_notify_wakeup(Notifier *notifier, void *data)
|
||||||
|
|
|
@ -891,6 +891,7 @@ void pc_acpi_init(const char *default_dsdt)
|
||||||
{
|
{
|
||||||
char *filename = NULL, *arg = NULL;
|
char *filename = NULL, *arg = NULL;
|
||||||
QemuOpts *opts;
|
QemuOpts *opts;
|
||||||
|
Error *err = NULL;
|
||||||
|
|
||||||
if (acpi_tables != NULL) {
|
if (acpi_tables != NULL) {
|
||||||
/* manually set via -acpitable, leave it alone */
|
/* manually set via -acpitable, leave it alone */
|
||||||
|
@ -909,8 +910,11 @@ void pc_acpi_init(const char *default_dsdt)
|
||||||
opts = qemu_opts_parse(qemu_find_opts("acpi"), arg, 0);
|
opts = qemu_opts_parse(qemu_find_opts("acpi"), arg, 0);
|
||||||
g_assert(opts != NULL);
|
g_assert(opts != NULL);
|
||||||
|
|
||||||
if (acpi_table_add(opts) != 0) {
|
acpi_table_add(opts, &err);
|
||||||
fprintf(stderr, "WARNING: failed to load %s\n", filename);
|
if (err) {
|
||||||
|
fprintf(stderr, "WARNING: failed to load %s: %s\n", filename,
|
||||||
|
error_get_pretty(err));
|
||||||
|
error_free(err);
|
||||||
}
|
}
|
||||||
g_free(arg);
|
g_free(arg);
|
||||||
g_free(filename);
|
g_free(filename);
|
||||||
|
|
2
hw/pc.h
2
hw/pc.h
|
@ -113,7 +113,7 @@ extern char unsigned *acpi_tables;
|
||||||
extern size_t acpi_tables_len;
|
extern size_t acpi_tables_len;
|
||||||
|
|
||||||
void acpi_bios_init(void);
|
void acpi_bios_init(void);
|
||||||
int acpi_table_add(const QemuOpts *opts);
|
void acpi_table_add(const QemuOpts *opts, Error **errp);
|
||||||
|
|
||||||
/* acpi_piix.c */
|
/* acpi_piix.c */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue