|
|
9ae3a8 |
From c028066b7a4a68d52a33f6856bb8fe907def2b6b Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Date: Wed, 6 Nov 2013 14:41:10 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 34/81] Mostly revert "qemu-help: Sort devices by logical functionality"
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1383748882-22831-6-git-send-email-kwolf@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 55531
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 05/17] Mostly revert "qemu-help: Sort devices by logical functionality"
|
|
|
9ae3a8 |
Bugzilla: 1001216
|
|
|
9ae3a8 |
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
This reverts most of commit 3d1237fb2ab4edb926c717767bb5e31d6053a7c5.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
The commit claims to sort the output of "-device help" "by
|
|
|
9ae3a8 |
functionality rather than alphabetical". Issues:
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
* The output was unsorted before, not alphabetically sorted.
|
|
|
9ae3a8 |
Misleading, but harmless enough.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
* The commit doesn't just sort the output of "-device help" as it
|
|
|
9ae3a8 |
claims, it adds categories to each line of "-device help", and it
|
|
|
9ae3a8 |
prints devices once per category. In particular, devices without a
|
|
|
9ae3a8 |
category aren't shown anymore. Maybe such devices should not exist,
|
|
|
9ae3a8 |
but they do. Regression.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
* Categories are also added to the output of "info qdm". Silent
|
|
|
9ae3a8 |
change, not nice. Output remains unsorted, unlike "-device help".
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
I'm going to reimplement the feature we actually want, without the
|
|
|
9ae3a8 |
warts. Reverting the flawed commit first should make it easier to
|
|
|
9ae3a8 |
review. However, I can't revert it completely, since DeviceClass
|
|
|
9ae3a8 |
member categories has been put to use. So leave that part in.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
9ae3a8 |
Message-id: 1381410021-1538-2-git-send-email-armbru@redhat.com
|
|
|
9ae3a8 |
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
|
|
|
9ae3a8 |
(cherry picked from commit 1fc224b4b6d195fb7802d5ba1a0846a4e7a1e2af)
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
include/hw/qdev-core.h | 16 ----------------
|
|
|
9ae3a8 |
qdev-monitor.c | 48 +++++++++---------------------------------------
|
|
|
9ae3a8 |
2 files changed, 9 insertions(+), 55 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
include/hw/qdev-core.h | 16 ----------------
|
|
|
9ae3a8 |
qdev-monitor.c | 48 +++++++++---------------------------------------
|
|
|
9ae3a8 |
2 files changed, 9 insertions(+), 55 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
|
|
|
9ae3a8 |
index 18596e9..a8618db 100644
|
|
|
9ae3a8 |
--- a/include/hw/qdev-core.h
|
|
|
9ae3a8 |
+++ b/include/hw/qdev-core.h
|
|
|
9ae3a8 |
@@ -30,22 +30,6 @@ typedef enum DeviceCategory {
|
|
|
9ae3a8 |
DEVICE_CATEGORY_MAX
|
|
|
9ae3a8 |
} DeviceCategory;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static inline const char *qdev_category_get_name(DeviceCategory category)
|
|
|
9ae3a8 |
-{
|
|
|
9ae3a8 |
- static const char *category_names[DEVICE_CATEGORY_MAX] = {
|
|
|
9ae3a8 |
- [DEVICE_CATEGORY_BRIDGE] = "Controller/Bridge/Hub",
|
|
|
9ae3a8 |
- [DEVICE_CATEGORY_USB] = "USB",
|
|
|
9ae3a8 |
- [DEVICE_CATEGORY_STORAGE] = "Storage",
|
|
|
9ae3a8 |
- [DEVICE_CATEGORY_NETWORK] = "Network",
|
|
|
9ae3a8 |
- [DEVICE_CATEGORY_INPUT] = "Input",
|
|
|
9ae3a8 |
- [DEVICE_CATEGORY_DISPLAY] = "Display",
|
|
|
9ae3a8 |
- [DEVICE_CATEGORY_SOUND] = "Sound",
|
|
|
9ae3a8 |
- [DEVICE_CATEGORY_MISC] = "Misc",
|
|
|
9ae3a8 |
- };
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- return category_names[category];
|
|
|
9ae3a8 |
-};
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
typedef int (*qdev_initfn)(DeviceState *dev);
|
|
|
9ae3a8 |
typedef int (*qdev_event)(DeviceState *dev);
|
|
|
9ae3a8 |
typedef void (*qdev_resetfn)(DeviceState *dev);
|
|
|
9ae3a8 |
diff --git a/qdev-monitor.c b/qdev-monitor.c
|
|
|
9ae3a8 |
index 230a8df..e54dbc2 100644
|
|
|
9ae3a8 |
--- a/qdev-monitor.c
|
|
|
9ae3a8 |
+++ b/qdev-monitor.c
|
|
|
9ae3a8 |
@@ -75,27 +75,24 @@ static bool qdev_class_has_alias(DeviceClass *dc)
|
|
|
9ae3a8 |
return (qdev_class_get_alias(dc) != NULL);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static void qdev_print_class_devinfo(DeviceClass *dc)
|
|
|
9ae3a8 |
+static void qdev_print_devinfo(ObjectClass *klass, void *opaque)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- DeviceCategory category;
|
|
|
9ae3a8 |
+ DeviceClass *dc;
|
|
|
9ae3a8 |
+ bool *show_no_user = opaque;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ dc = (DeviceClass *)object_class_dynamic_cast(klass, TYPE_DEVICE);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- if (!dc) {
|
|
|
9ae3a8 |
+ if (!dc || (show_no_user && !*show_no_user && dc->no_user)) {
|
|
|
9ae3a8 |
return;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- error_printf("name \"%s\"", object_class_get_name(OBJECT_CLASS(dc)));
|
|
|
9ae3a8 |
+ error_printf("name \"%s\"", object_class_get_name(klass));
|
|
|
9ae3a8 |
if (dc->bus_type) {
|
|
|
9ae3a8 |
error_printf(", bus %s", dc->bus_type);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
if (qdev_class_has_alias(dc)) {
|
|
|
9ae3a8 |
error_printf(", alias \"%s\"", qdev_class_get_alias(dc));
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
- error_printf(", categories");
|
|
|
9ae3a8 |
- for (category = 0; category < DEVICE_CATEGORY_MAX; ++category) {
|
|
|
9ae3a8 |
- if (test_bit(category, dc->categories)) {
|
|
|
9ae3a8 |
- error_printf(" \"%s\"", qdev_category_get_name(category));
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
if (dc->desc) {
|
|
|
9ae3a8 |
error_printf(", desc \"%s\"", dc->desc);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -105,15 +102,6 @@ static void qdev_print_class_devinfo(DeviceClass *dc)
|
|
|
9ae3a8 |
error_printf("\n");
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static void qdev_print_devinfo(ObjectClass *klass, void *opaque)
|
|
|
9ae3a8 |
-{
|
|
|
9ae3a8 |
- DeviceClass *dc;
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- dc = (DeviceClass *)object_class_dynamic_cast(klass, TYPE_DEVICE);
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- qdev_print_class_devinfo(dc);
|
|
|
9ae3a8 |
-}
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
static int set_property(const char *name, const char *value, void *opaque)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
DeviceState *dev = opaque;
|
|
|
9ae3a8 |
@@ -151,21 +139,6 @@ static const char *find_typename_by_alias(const char *alias)
|
|
|
9ae3a8 |
return NULL;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static void qdev_print_category_devices(DeviceCategory category)
|
|
|
9ae3a8 |
-{
|
|
|
9ae3a8 |
- DeviceClass *dc;
|
|
|
9ae3a8 |
- GSList *list, *curr;
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- list = object_class_get_list(TYPE_DEVICE, false);
|
|
|
9ae3a8 |
- for (curr = list; curr; curr = g_slist_next(curr)) {
|
|
|
9ae3a8 |
- dc = (DeviceClass *)object_class_dynamic_cast(curr->data, TYPE_DEVICE);
|
|
|
9ae3a8 |
- if (!dc->no_user && test_bit(category, dc->categories)) {
|
|
|
9ae3a8 |
- qdev_print_class_devinfo(dc);
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
- g_slist_free(list);
|
|
|
9ae3a8 |
-}
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
int qdev_device_help(QemuOpts *opts)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
const char *driver;
|
|
|
9ae3a8 |
@@ -174,11 +147,8 @@ int qdev_device_help(QemuOpts *opts)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
driver = qemu_opt_get(opts, "driver");
|
|
|
9ae3a8 |
if (driver && is_help_option(driver)) {
|
|
|
9ae3a8 |
- DeviceCategory category;
|
|
|
9ae3a8 |
- for (category = 0; category < DEVICE_CATEGORY_MAX; ++category) {
|
|
|
9ae3a8 |
- qdev_print_category_devices(category);
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
+ bool show_no_user = false;
|
|
|
9ae3a8 |
+ object_class_foreach(qdev_print_devinfo, TYPE_DEVICE, false, &show_no_user);
|
|
|
9ae3a8 |
return 1;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|