QOM and device refactorings

* Machine: Property name fixups for 2.1 ABI
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTzUcnAAoJEPou0S0+fgE/qsgQAKYa7irLYFu3zu5PBk5iOzhR
 lHAc7XChpE+0TNRUEH2SNcTynNNlS37vHKmzDLuEVhL3CtSKQsn+9KgVMLbrmXwb
 NRSCHYEZW0PwTd5W2+kLkfGafjlb63tasNSIeFNgj8E59mWFes/FXk8gQnykJnm1
 rpHys4vHsKR5Dcd3JfterpvDRH6kr8mjL1t4hUiTJzOfFzPV60OYAjt55atS9Vu8
 OnYYbcOdUaVHZ50W4CakwC/L69lHhKoiOLYryr7FwDbj58cy9GKflOinXkRZ3/rC
 x4ARj/fYRN93+iozhAbGUwwddAjNmIMd1Y+6bbnZvVf5Ooa0ShX/L32wZCotpEQM
 7UfS/QAPH/Bc6ngNQo3QwwEHO63mt1HfLgCjG8rLAb777GD60lxyuYmW/DXN4XJ+
 wdz7+c/Ze6+WmdAgnV1xxJolPx8tOsD7Qk8efJBBVs6eH/cmWy/V052RavVbtcTL
 FCxkb3EdqlVGpvClJYvXNG/fMges6zF9gCYskNLfC5FsBfSMXimVpTiPpfLD0ENL
 g5qCTgwsE4j+RsirT9ej0DsC7pT6YpVvNr8N7MIB+wP/fOf00ekszwusz9M1n10h
 LMns5yOjumThLZr3a7YZgjb8Yes6n7q/8s+FC/5Xcm6Bpnp8AHtlTMGKos8GOlOC
 NdEdjGlXz2IbrugEMXd7
 =IkO4
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-2.1' into staging

QOM and device refactorings

* Machine: Property name fixups for 2.1 ABI

# gpg: Signature made Mon 21 Jul 2014 18:00:23 BST using RSA key ID 3E7E013F
# gpg: Good signature from "Andreas Färber <afaerber@suse.de>"
# gpg:                 aka "Andreas Färber <afaerber@suse.com>"

* remotes/afaerber/tags/qom-devices-for-2.1:
  machine: Replace underscores in machine's property names

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2014-07-21 18:06:12 +01:00
commit 35858955e6
2 changed files with 15 additions and 5 deletions

View File

@ -239,11 +239,11 @@ static void machine_initfn(Object *obj)
{
object_property_add_str(obj, "accel",
machine_get_accel, machine_set_accel, NULL);
object_property_add_bool(obj, "kernel_irqchip",
object_property_add_bool(obj, "kernel-irqchip",
machine_get_kernel_irqchip,
machine_set_kernel_irqchip,
NULL);
object_property_add(obj, "kvm_shadow_mem", "int",
object_property_add(obj, "kvm-shadow-mem", "int",
machine_get_kvm_shadow_mem,
machine_set_kvm_shadow_mem,
NULL, NULL, NULL);
@ -257,11 +257,11 @@ static void machine_initfn(Object *obj)
machine_get_dtb, machine_set_dtb, NULL);
object_property_add_str(obj, "dumpdtb",
machine_get_dumpdtb, machine_set_dumpdtb, NULL);
object_property_add(obj, "phandle_start", "int",
object_property_add(obj, "phandle-start", "int",
machine_get_phandle_start,
machine_set_phandle_start,
NULL, NULL, NULL);
object_property_add_str(obj, "dt_compatible",
object_property_add_str(obj, "dt-compatible",
machine_get_dt_compatible,
machine_set_dt_compatible,
NULL);

12
vl.c
View File

@ -2823,15 +2823,25 @@ static int object_set_property(const char *name, const char *value, void *opaque
Object *obj = OBJECT(opaque);
StringInputVisitor *siv;
Error *local_err = NULL;
char *c, *qom_name;
if (strcmp(name, "qom-type") == 0 || strcmp(name, "id") == 0 ||
strcmp(name, "type") == 0) {
return 0;
}
qom_name = g_strdup(name);
c = qom_name;
while (*c++) {
if (*c == '_') {
*c = '-';
}
}
siv = string_input_visitor_new(value);
object_property_set(obj, string_input_get_visitor(siv), name, &local_err);
object_property_set(obj, string_input_get_visitor(siv), qom_name, &local_err);
string_input_visitor_cleanup(siv);
g_free(qom_name);
if (local_err) {
qerror_report_err(local_err);