diff options
author | Peter Maydell | 2020-10-15 17:35:06 +0200 |
---|---|---|
committer | Peter Maydell | 2020-10-15 17:35:06 +0200 |
commit | e545512b5e26f1e69fcd4c88df3c12853946dcdb (patch) | |
tree | e88d9444b6f85b1454a3d0a35a818b8c28711374 | |
parent | Merge remote-tracking branch 'remotes/kraxel/tags/ui-20201014-pull-request' i... (diff) | |
parent | can-host-socketcan: Fix crash when 'if' option is not set (diff) | |
download | qemu-e545512b5e26f1e69fcd4c88df3c12853946dcdb.tar.gz qemu-e545512b5e26f1e69fcd4c88df3c12853946dcdb.tar.xz qemu-e545512b5e26f1e69fcd4c88df3c12853946dcdb.zip |
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging
machine + QOM queue, 2020-10-14
* Register some properties as class properties (Eduardo Habkost)
* authz-list-file: Fix crash when filename is not set (Eduardo Habkost)
* can-host-socketcan: Fix crash when 'if' option is not set (Eduardo Habkost)
# gpg: Signature made Wed 14 Oct 2020 15:33:17 BST
# gpg: using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6
# gpg: issuer "ehabkost@redhat.com"
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full]
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6
* remotes/ehabkost/tags/machine-next-pull-request:
can-host-socketcan: Fix crash when 'if' option is not set
authz-list-file: Fix crash when filename is not set
vhost-user: Register "chardev" as class property
vga-pci: Register "big-endian-framebuffer" as class property
i386: Register most CPU properties as class properties
input-barrier: Register properties as class properties
input-linux: Register properties as class properties
rng: Register "opened" as class property
rng-random: register "filename" as class property
rng-egd: Register "chardev" as class property
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | authz/listfile.c | 5 | ||||
-rw-r--r-- | backends/rng-egd.c | 9 | ||||
-rw-r--r-- | backends/rng-random.c | 8 | ||||
-rw-r--r-- | backends/rng.c | 8 | ||||
-rw-r--r-- | backends/vhost-user.c | 6 | ||||
-rw-r--r-- | hw/display/vga-pci.c | 12 | ||||
-rw-r--r-- | net/can/can_socketcan.c | 5 | ||||
-rw-r--r-- | target/i386/cpu.c | 66 | ||||
-rw-r--r-- | ui/input-barrier.c | 44 | ||||
-rw-r--r-- | ui/input-linux.c | 27 |
10 files changed, 97 insertions, 93 deletions
diff --git a/authz/listfile.c b/authz/listfile.c index cd6163aa40..aaf930453d 100644 --- a/authz/listfile.c +++ b/authz/listfile.c @@ -122,6 +122,11 @@ qauthz_list_file_complete(UserCreatable *uc, Error **errp) QAuthZListFile *fauthz = QAUTHZ_LIST_FILE(uc); gchar *dir = NULL, *file = NULL; + if (!fauthz->filename) { + error_setg(errp, "filename not provided"); + return; + } + fauthz->list = qauthz_list_file_load(fauthz, errp); if (!fauthz->refresh) { diff --git a/backends/rng-egd.c b/backends/rng-egd.c index 20198ff26e..4de142b9dc 100644 --- a/backends/rng-egd.c +++ b/backends/rng-egd.c @@ -135,12 +135,6 @@ static char *rng_egd_get_chardev(Object *obj, Error **errp) return NULL; } -static void rng_egd_init(Object *obj) -{ - object_property_add_str(obj, "chardev", - rng_egd_get_chardev, rng_egd_set_chardev); -} - static void rng_egd_finalize(Object *obj) { RngEgd *s = RNG_EGD(obj); @@ -155,6 +149,8 @@ static void rng_egd_class_init(ObjectClass *klass, void *data) rbc->request_entropy = rng_egd_request_entropy; rbc->opened = rng_egd_opened; + object_class_property_add_str(klass, "chardev", + rng_egd_get_chardev, rng_egd_set_chardev); } static const TypeInfo rng_egd_info = { @@ -162,7 +158,6 @@ static const TypeInfo rng_egd_info = { .parent = TYPE_RNG_BACKEND, .instance_size = sizeof(RngEgd), .class_init = rng_egd_class_init, - .instance_init = rng_egd_init, .instance_finalize = rng_egd_finalize, }; diff --git a/backends/rng-random.c b/backends/rng-random.c index 245b12ab24..7add272edd 100644 --- a/backends/rng-random.c +++ b/backends/rng-random.c @@ -108,10 +108,6 @@ static void rng_random_init(Object *obj) { RngRandom *s = RNG_RANDOM(obj); - object_property_add_str(obj, "filename", - rng_random_get_filename, - rng_random_set_filename); - s->filename = g_strdup("/dev/urandom"); s->fd = -1; } @@ -134,6 +130,10 @@ static void rng_random_class_init(ObjectClass *klass, void *data) rbc->request_entropy = rng_random_request_entropy; rbc->opened = rng_random_opened; + object_class_property_add_str(klass, "filename", + rng_random_get_filename, + rng_random_set_filename); + } static const TypeInfo rng_random_info = { diff --git a/backends/rng.c b/backends/rng.c index 484f04e891..3757b04485 100644 --- a/backends/rng.c +++ b/backends/rng.c @@ -105,10 +105,6 @@ static void rng_backend_init(Object *obj) RngBackend *s = RNG_BACKEND(obj); QSIMPLEQ_INIT(&s->requests); - - object_property_add_bool(obj, "opened", - rng_backend_prop_get_opened, - rng_backend_prop_set_opened); } static void rng_backend_finalize(Object *obj) @@ -123,6 +119,10 @@ static void rng_backend_class_init(ObjectClass *oc, void *data) UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc); ucc->complete = rng_backend_complete; + + object_class_property_add_bool(oc, "opened", + rng_backend_prop_get_opened, + rng_backend_prop_set_opened); } static const TypeInfo rng_backend_info = { diff --git a/backends/vhost-user.c b/backends/vhost-user.c index ae8362d721..b366610e16 100644 --- a/backends/vhost-user.c +++ b/backends/vhost-user.c @@ -175,9 +175,9 @@ static char *get_chardev(Object *obj, Error **errp) return NULL; } -static void vhost_user_backend_init(Object *obj) +static void vhost_user_backend_class_init(ObjectClass *oc, void *data) { - object_property_add_str(obj, "chardev", get_chardev, set_chardev); + object_class_property_add_str(oc, "chardev", get_chardev, set_chardev); } static void vhost_user_backend_finalize(Object *obj) @@ -195,7 +195,7 @@ static const TypeInfo vhost_user_backend_info = { .name = TYPE_VHOST_USER_BACKEND, .parent = TYPE_OBJECT, .instance_size = sizeof(VhostUserBackend), - .instance_init = vhost_user_backend_init, + .class_init = vhost_user_backend_class_init, .instance_finalize = vhost_user_backend_finalize, }; diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c index e5d9af5868..48d29630ab 100644 --- a/hw/display/vga-pci.c +++ b/hw/display/vga-pci.c @@ -267,13 +267,6 @@ static void pci_std_vga_realize(PCIDevice *dev, Error **errp) } } -static void pci_std_vga_init(Object *obj) -{ - /* Expose framebuffer byteorder via QOM */ - object_property_add_bool(obj, "big-endian-framebuffer", - vga_get_big_endian_fb, vga_set_big_endian_fb); -} - static void pci_secondary_vga_realize(PCIDevice *dev, Error **errp) { PCIVGAState *d = PCI_VGA(dev); @@ -386,6 +379,10 @@ static void vga_class_init(ObjectClass *klass, void *data) k->class_id = PCI_CLASS_DISPLAY_VGA; device_class_set_props(dc, vga_pci_properties); dc->hotpluggable = false; + + /* Expose framebuffer byteorder via QOM */ + object_class_property_add_bool(klass, "big-endian-framebuffer", + vga_get_big_endian_fb, vga_set_big_endian_fb); } static void secondary_class_init(ObjectClass *klass, void *data) @@ -403,7 +400,6 @@ static void secondary_class_init(ObjectClass *klass, void *data) static const TypeInfo vga_info = { .name = "VGA", .parent = TYPE_PCI_VGA, - .instance_init = pci_std_vga_init, .class_init = vga_class_init, }; diff --git a/net/can/can_socketcan.c b/net/can/can_socketcan.c index 92b1f79385..4b68f60c6b 100644 --- a/net/can/can_socketcan.c +++ b/net/can/can_socketcan.c @@ -194,6 +194,11 @@ static void can_host_socketcan_connect(CanHostState *ch, Error **errp) struct sockaddr_can addr; struct ifreq ifr; + if (!c->ifname) { + error_setg(errp, "'if' property not set"); + return; + } + /* open socket */ s = qemu_socket(PF_CAN, SOCK_RAW, CAN_RAW); if (s < 0) { diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 9eafbe3690..5d713c8528 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6925,44 +6925,12 @@ static void x86_cpu_initfn(Object *obj) env->nr_dies = 1; cpu_set_cpustate_pointers(cpu); - object_property_add(obj, "family", "int", - x86_cpuid_version_get_family, - x86_cpuid_version_set_family, NULL, NULL); - object_property_add(obj, "model", "int", - x86_cpuid_version_get_model, - x86_cpuid_version_set_model, NULL, NULL); - object_property_add(obj, "stepping", "int", - x86_cpuid_version_get_stepping, - x86_cpuid_version_set_stepping, NULL, NULL); - object_property_add_str(obj, "vendor", - x86_cpuid_get_vendor, - x86_cpuid_set_vendor); - object_property_add_str(obj, "model-id", - x86_cpuid_get_model_id, - x86_cpuid_set_model_id); - object_property_add(obj, "tsc-frequency", "int", - x86_cpuid_get_tsc_freq, - x86_cpuid_set_tsc_freq, NULL, NULL); object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo", x86_cpu_get_feature_words, NULL, NULL, (void *)env->features); object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo", x86_cpu_get_feature_words, NULL, NULL, (void *)cpu->filtered_features); - /* - * The "unavailable-features" property has the same semantics as - * CpuDefinitionInfo.unavailable-features on the "query-cpu-definitions" - * QMP command: they list the features that would have prevented the - * CPU from running if the "enforce" flag was set. - */ - object_property_add(obj, "unavailable-features", "strList", - x86_cpu_get_unavailable_features, - NULL, NULL, NULL); - -#if !defined(CONFIG_USER_ONLY) - object_property_add(obj, "crash-information", "GuestPanicInformation", - x86_cpu_get_crash_info_qom, NULL, NULL, NULL); -#endif for (w = 0; w < FEATURE_WORDS; w++) { int bitnr; @@ -7312,6 +7280,40 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->disas_set_info = x86_disas_set_info; dc->user_creatable = true; + + object_class_property_add(oc, "family", "int", + x86_cpuid_version_get_family, + x86_cpuid_version_set_family, NULL, NULL); + object_class_property_add(oc, "model", "int", + x86_cpuid_version_get_model, + x86_cpuid_version_set_model, NULL, NULL); + object_class_property_add(oc, "stepping", "int", + x86_cpuid_version_get_stepping, + x86_cpuid_version_set_stepping, NULL, NULL); + object_class_property_add_str(oc, "vendor", + x86_cpuid_get_vendor, + x86_cpuid_set_vendor); + object_class_property_add_str(oc, "model-id", + x86_cpuid_get_model_id, + x86_cpuid_set_model_id); + object_class_property_add(oc, "tsc-frequency", "int", + x86_cpuid_get_tsc_freq, + x86_cpuid_set_tsc_freq, NULL, NULL); + /* + * The "unavailable-features" property has the same semantics as + * CpuDefinitionInfo.unavailable-features on the "query-cpu-definitions" + * QMP command: they list the features that would have prevented the + * CPU from running if the "enforce" flag was set. + */ + object_class_property_add(oc, "unavailable-features", "strList", + x86_cpu_get_unavailable_features, + NULL, NULL, NULL); + +#if !defined(CONFIG_USER_ONLY) + object_class_property_add(oc, "crash-information", "GuestPanicInformation", + x86_cpu_get_crash_info_qom, NULL, NULL, NULL); +#endif + } static const TypeInfo x86_cpu_type_info = { diff --git a/ui/input-barrier.c b/ui/input-barrier.c index a047919fde..81b8d04ec8 100644 --- a/ui/input-barrier.c +++ b/ui/input-barrier.c @@ -689,28 +689,6 @@ static void input_barrier_instance_init(Object *obj) ib->y_origin = 0; ib->width = 1920; ib->height = 1080; - - object_property_add_str(obj, "name", - input_barrier_get_name, - input_barrier_set_name); - object_property_add_str(obj, "server", - input_barrier_get_server, - input_barrier_set_server); - object_property_add_str(obj, "port", - input_barrier_get_port, - input_barrier_set_port); - object_property_add_str(obj, "x-origin", - input_barrier_get_x_origin, - input_barrier_set_x_origin); - object_property_add_str(obj, "y-origin", - input_barrier_get_y_origin, - input_barrier_set_y_origin); - object_property_add_str(obj, "width", - input_barrier_get_width, - input_barrier_set_width); - object_property_add_str(obj, "height", - input_barrier_get_height, - input_barrier_set_height); } static void input_barrier_class_init(ObjectClass *oc, void *data) @@ -718,6 +696,28 @@ static void input_barrier_class_init(ObjectClass *oc, void *data) UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc); ucc->complete = input_barrier_complete; + + object_class_property_add_str(oc, "name", + input_barrier_get_name, + input_barrier_set_name); + object_class_property_add_str(oc, "server", + input_barrier_get_server, + input_barrier_set_server); + object_class_property_add_str(oc, "port", + input_barrier_get_port, + input_barrier_set_port); + object_class_property_add_str(oc, "x-origin", + input_barrier_get_x_origin, + input_barrier_set_x_origin); + object_class_property_add_str(oc, "y-origin", + input_barrier_get_y_origin, + input_barrier_set_y_origin); + object_class_property_add_str(oc, "width", + input_barrier_get_width, + input_barrier_set_width); + object_class_property_add_str(oc, "height", + input_barrier_get_height, + input_barrier_set_height); } static const TypeInfo input_barrier_info = { diff --git a/ui/input-linux.c b/ui/input-linux.c index 34cc531190..05c0c98819 100644 --- a/ui/input-linux.c +++ b/ui/input-linux.c @@ -490,19 +490,6 @@ static void input_linux_set_grab_toggle(Object *obj, int value, static void input_linux_instance_init(Object *obj) { - object_property_add_str(obj, "evdev", - input_linux_get_evdev, - input_linux_set_evdev); - object_property_add_bool(obj, "grab_all", - input_linux_get_grab_all, - input_linux_set_grab_all); - object_property_add_bool(obj, "repeat", - input_linux_get_repeat, - input_linux_set_repeat); - object_property_add_enum(obj, "grab-toggle", "GrabToggleKeys", - &GrabToggleKeys_lookup, - input_linux_get_grab_toggle, - input_linux_set_grab_toggle); } static void input_linux_class_init(ObjectClass *oc, void *data) @@ -510,6 +497,20 @@ static void input_linux_class_init(ObjectClass *oc, void *data) UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc); ucc->complete = input_linux_complete; + + object_class_property_add_str(oc, "evdev", + input_linux_get_evdev, + input_linux_set_evdev); + object_class_property_add_bool(oc, "grab_all", + input_linux_get_grab_all, + input_linux_set_grab_all); + object_class_property_add_bool(oc, "repeat", + input_linux_get_repeat, + input_linux_set_repeat); + object_class_property_add_enum(oc, "grab-toggle", "GrabToggleKeys", + &GrabToggleKeys_lookup, + input_linux_get_grab_toggle, + input_linux_set_grab_toggle); } static const TypeInfo input_linux_info = { |