summaryrefslogtreecommitdiff
path: root/qdev-monitor.c
AgeCommit message (Collapse)AuthorFilesLines
2013-11-05qdev-monitor: Inline qdev_init() for device_addAndreas Färber1-1/+6
For historic reasons, qdev_init() unparents the device on failure. Inline this to make the error paths clearer and consistent. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-11-05qdev-monitor: Avoid qdev as variable nameAndreas Färber1-16/+16
Prepares for bringing error cleanup code into canonical QOM form. Includes a whitespace removal after curly brace by Stefan. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-11-05qdev: Drop misleading qdev_free() functionStefan Hajnoczi1-1/+1
The qdev_free() function name is misleading since all the function does is unlink the device from its parent. The device is not necessarily freed. The device will be freed when its QObject refcount reaches zero. It is usual for the parent (bus) to hold the final reference but there are cases where something else holds a reference so "free" is a misleading name. Call object_unparent(obj) directly instead of having a qdev wrapper function. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-11-05qdev-monitor: Unref device when device_add failsStefan Hajnoczi1-0/+2
qdev_device_add() leaks the created device upon failure. I suspect this problem crept in because qdev_free() unparents the device but does not drop a reference - confusing name. Cc: qemu-stable@nongnu.org Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-11-05qdev-monitor: Fix crash when device_add is called with abstract driverIgor Mammedov1-0/+6
User is able to crash running QEMU when following monitor command is called: device_add intel-hda-generic Crash is caused by assertion in object_initialize_with_type() when type is abstract. Checking if type is abstract before instance is created in qdev_device_add() allows to prevent crash on incorrect user input. Cc: qemu-stable@nongnu.org Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-11-05qdev-monitor: Clean up qdev_device_add() variable namingAndreas Färber1-11/+11
Avoid confusion between object (obj) and object class (oc). Tidy DeviceClass variable while at it (k -> dc). Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-10-11qdev-monitor: Group "device_add help" and "info qdm" by categoryMarkus Armbruster1-14/+53
Output is a long, unsorted list. Not very helpful. Print one list per device category instead, with a header line identifying the category, plus a list of uncategorized devices. Print each list in case-insenitive alphabetical order. Devices with multiple categories are listed multiple times. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel.a@redhat.com> Message-id: 1381410021-1538-3-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-10-11Mostly revert "qemu-help: Sort devices by logical functionality"Markus Armbruster1-39/+9
This reverts most of commit 3d1237fb2ab4edb926c717767bb5e31d6053a7c5. The commit claims to sort the output of "-device help" "by functionality rather than alphabetical". Issues: * The output was unsorted before, not alphabetically sorted. Misleading, but harmless enough. * The commit doesn't just sort the output of "-device help" as it claims, it adds categories to each line of "-device help", and it prints devices once per category. In particular, devices without a category aren't shown anymore. Maybe such devices should not exist, but they do. Regression. * Categories are also added to the output of "info qdm". Silent change, not nice. Output remains unsorted, unlike "-device help". I'm going to reimplement the feature we actually want, without the warts. Reverting the flawed commit first should make it easier to review. However, I can't revert it completely, since DeviceClass member categories has been put to use. So leave that part in. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel.a@redhat.com> Message-id: 1381410021-1538-2-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-07-29qemu-help: Sort devices by logical functionalityMarcel Apfelbaum1-9/+39
Categorize devices that appear as output to "-device ?" command by logical functionality. Sort the devices by logical categories before showing them to user. The sort is done by functionality rather than alphabetical. Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com> Message-id: 1375107465-25767-3-git-send-email-marcel.a@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-27misc: Use g_assert_not_reached for code which is expected to be unreachableStefan Weil1-2/+2
The macro g_assert_not_reached is a better self documenting replacement for assert(0) or assert(false). Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-05-06qdev: Let qdev_prop_parse() pass through ErrorAndreas Färber1-1/+5
Move error reporting to callers. Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-04-17qbus: remove wrong error messagesAlexey Kardashevskiy1-4/+2
The existing code shows the "Bus '%s' is full" message even if name is specified and different from bus->name (i.e. match=0). The patch excludes unnecessary error message. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Message-id: 1366184940-13516-1-git-send-email-aik@ozlabs.ru Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-16qdev: Fix device_add bus assumptionsAndreas Färber1-8/+8
Drop an unreachable fallback bus assignment to SysBus. If no ,bus= is specified, only search busses recursively for bus type if the DeviceClass has a bus_type specified. Handle resulting NULL cases. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Andreas Färber <afaerber@suse.de> Message-id: 1366077021-28882-1-git-send-email-afaerber@suse.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-03-01hw: move qdev-monitor.o to toplevel directoryPaolo Bonzini1-0/+684
qdev-monitor.c is the only "core qdev" file that is not used in user-mode emulation, and it does not define anything that is used by hardware models. Remove it from the hw/ directory and remove hw/qdev-monitor.h from hw/qdev.h too; this requires some files to have some new explicitly includes. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>