[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/62] vl: introduce object_parse_property_opt
From: |
Paolo Bonzini |
Subject: |
[PULL 18/62] vl: introduce object_parse_property_opt |
Date: |
Mon, 16 Dec 2019 17:28:02 +0100 |
We will reuse the parsing loop of machine_set_property soon for "-accel",
but we do not want the "_" -> "-" conversion since "-accel" can just
standardize on dashes. We will also add a bunch of legacy option handling
to keep the QOM machine object clean. Extract the loop into a separate
function, and keep the legacy handling in machine_set_property.
Signed-off-by: Paolo Bonzini <address@hidden>
---
vl.c | 35 ++++++++++++++++++++---------------
1 file changed, 20 insertions(+), 15 deletions(-)
diff --git a/vl.c b/vl.c
index 14c78bc..2f6b0dd 100644
--- a/vl.c
+++ b/vl.c
@@ -2615,27 +2615,17 @@ static MachineClass *select_machine(void)
return machine_class;
}
-static int machine_set_property(void *opaque,
- const char *name, const char *value,
- Error **errp)
+static int object_parse_property_opt(Object *obj,
+ const char *name, const char *value,
+ const char *skip, Error **errp)
{
- Object *obj = OBJECT(opaque);
Error *local_err = NULL;
- char *p, *qom_name;
- if (strcmp(name, "type") == 0) {
+ if (g_str_equal(name, skip)) {
return 0;
}
- qom_name = g_strdup(name);
- for (p = qom_name; *p; p++) {
- if (*p == '_') {
- *p = '-';
- }
- }
-
- object_property_parse(obj, value, qom_name, &local_err);
- g_free(qom_name);
+ object_property_parse(obj, value, name, &local_err);
if (local_err) {
error_propagate(errp, local_err);
@@ -2645,6 +2635,21 @@ static int machine_set_property(void *opaque,
return 0;
}
+static int machine_set_property(void *opaque,
+ const char *name, const char *value,
+ Error **errp)
+{
+ g_autofree char *qom_name = g_strdup(name);
+ char *p;
+
+ for (p = qom_name; *p; p++) {
+ if (*p == '_') {
+ *p = '-';
+ }
+ }
+
+ return object_parse_property_opt(opaque, name, value, "type", errp);
+}
/*
* Initial object creation happens before all other
--
1.8.3.1
- [PULL 09/62] migration-test: Move -incomming handling to common commandline, (continued)
- [PULL 09/62] migration-test: Move -incomming handling to common commandline, Paolo Bonzini, 2019/12/16
- [PULL 08/62] migration-test: Move -serial handling to common commandline, Paolo Bonzini, 2019/12/16
- [PULL 10/62] migration-test: Rename cmd_src/dst to arch_source/arch_target, Paolo Bonzini, 2019/12/16
- [PULL 12/62] memory: do not look at current_machine->accel, Paolo Bonzini, 2019/12/16
- [PULL 11/62] migration-test: Use a struct for test_migrate_start parameters, Paolo Bonzini, 2019/12/16
- [PULL 13/62] vl: move icount configuration earlier, Paolo Bonzini, 2019/12/16
- [PULL 15/62] vl: extract accelerator option processing to a separate function, Paolo Bonzini, 2019/12/16
- [PULL 14/62] tcg: move qemu_tcg_configure to accel/tcg/tcg-all.c, Paolo Bonzini, 2019/12/16
- [PULL 17/62] accel: compile accel/accel.c just once, Paolo Bonzini, 2019/12/16
- [PULL 16/62] vl: merge -accel processing into configure_accelerators, Paolo Bonzini, 2019/12/16
- [PULL 18/62] vl: introduce object_parse_property_opt,
Paolo Bonzini <=
- [PULL 20/62] vl: warn for unavailable accelerators, clarify messages, Paolo Bonzini, 2019/12/16
- [PULL 21/62] qom: introduce object_register_sugar_prop, Paolo Bonzini, 2019/12/16
- [PULL 22/62] qom: add object_new_with_class, Paolo Bonzini, 2019/12/16
- [PULL 24/62] tcg: convert "-accel threads" to a QOM property, Paolo Bonzini, 2019/12/16
- [PULL 23/62] accel: pass object to accel_init_machine, Paolo Bonzini, 2019/12/16
- [PULL 19/62] vl: configure accelerators from -accel options, Paolo Bonzini, 2019/12/16
- [PULL 25/62] tcg: add "-accel tcg,tb-size" and deprecate "-tb-size", Paolo Bonzini, 2019/12/16
- [PULL 26/62] xen: convert "-machine igd-passthru" to an accelerator property, Paolo Bonzini, 2019/12/16
- [PULL 27/62] kvm: convert "-machine kvm_shadow_mem" to an accelerator property, Paolo Bonzini, 2019/12/16
- [PULL 30/62] Makefile: remove unused variables, Paolo Bonzini, 2019/12/16