Skip to contentSkip to conversation

qemu-help: add category headlines

PATCH In review Marcel Apfelbaum 4 participants 7 messages Aug 22, 2013 – Aug 28, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-help: add category headlines

This patch follows Markus Armbruster suggestion:

A possibly better way to group help by category: instead of adding categories to each line, add category headlines, like this:

    Controller/Bridge/Hub devices:
    name "NAME", bus "BUS"...
    ...
    USB devices:
    name "NAME", bus "BUS"...
    ...
    Storage devices:
    ...

This way, showing devices with multiple categories once per category actually makes sense.

Note that the "categories to each line" is kept for 2 reasons:
1. Preparation for multifunction devices
2. Ability to grep by category

---
 qdev-monitor.c | 2 ++
 1 file changed, 2 insertions(+)
qdev-monitor.c +2 -0
index 410cdcb..a7329b0 100644
@@ -156,6 +156,8 @@ static void qdev_print_category_devices(DeviceCategory category)
     DeviceClass *dc;
     GSList *list, *curr;
 
+    error_printf("%s devices:\n", qdev_category_get_name(category));
+
     list = object_class_get_list(TYPE_DEVICE, false);
     for (curr = list; curr; curr = g_slist_next(curr)) {
         dc = (DeviceClass *)object_class_dynamic_cast(curr->data, TYPE_DEVICE);
Signature · 1 line
1.8.3.1
#1 lore raw

Am 22.08.2013 14:48, schrieb Marcel Apfelbaum:

Quoted 31 lines

This patch follows Markus Armbruster suggestion:

A possibly better way to group help by category: instead of adding categories to each line, add category headlines, like this:

    Controller/Bridge/Hub devices:
    name "NAME", bus "BUS"...
    ...
    USB devices:
    name "NAME", bus "BUS"...
    ...
    Storage devices:
    ...

This way, showing devices with multiple categories once per category actually makes sense.

Note that the "categories to each line" is kept for 2 reasons:
1. Preparation for multifunction devices
2. Ability to grep by category

---
 qdev-monitor.c | 2 ++
 1 file changed, 2 insertions(+)
qdev-monitor.c +0 -0
index 410cdcb..a7329b0 100644

qdev-monitor.c static void qdev_print_category_devices(DeviceCategory category) · line 159

Quoted 4 lines
qdev-monitor.c +1 -0
@@ -156,6 +156,8 @@ static void qdev_print_category_devices(DeviceCategory category)
     DeviceClass *dc;
     GSList *list, *curr;
 
+    error_printf("%s devices:\n", qdev_category_get_name(category));

Why is that an error? Shouldn't it go to stdout?

Andreas

Quoted 5 lines
qdev-monitor.c +1 -0
+
     list = object_class_get_list(TYPE_DEVICE, false);
     for (curr = list; curr; curr = g_slist_next(curr)) {
         dc = (DeviceClass *)object_class_dynamic_cast(curr->data, TYPE_DEVICE);
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#2 lore raw
Quoted 35 lines · Andreas Färber

Am 22.08.2013 14:48, schrieb Marcel Apfelbaum:

Quoted 34 lines

This patch follows Markus Armbruster suggestion:

A possibly better way to group help by category: instead of adding categories to each line, add category headlines, like this:

    Controller/Bridge/Hub devices:
    name "NAME", bus "BUS"...
    ...
    USB devices:
    name "NAME", bus "BUS"...
    ...
    Storage devices:
    ...

This way, showing devices with multiple categories once per category actually makes sense.

Note that the "categories to each line" is kept for 2 reasons:
1. Preparation for multifunction devices
2. Ability to grep by category

---
 qdev-monitor.c | 2 ++
 1 file changed, 2 insertions(+)
qdev-monitor.c +0 -0
index 410cdcb..a7329b0 100644
@@ -156,6 +156,8 @@ static void qdev_print_category_devices(DeviceCategory category)
     DeviceClass *dc;
     GSList *list, *curr;
 
Quoted 3 lines

qdev-monitor.c static void qdev_print_category_devices(DeviceCategory category) · line 159

Quoted 1 line
qdev-monitor.c +1 -0
+    error_printf("%s devices:\n", qdev_category_get_name(category));

Why is that an error? Shouldn't it go to stdout?

Output of -device help has always gone to stderr, and that has always annoyed me. Just not enough to fix it.

[...]

#3 lore raw
Quoted 11 lines · Markus Armbruster
Quoted 8 lines

qdev-monitor.c static void qdev_print_category_devices(DeviceCategory category) · line 159

Quoted 6 lines

+++ b/qdev-monitor.c

qdev-monitor.c +1 -0
@@ -156,6 +156,8 @@ static void qdev_print_category_devices(DeviceCategory category)
     DeviceClass *dc;
     GSList *list, *curr;
 
+    error_printf("%s devices:\n", qdev_category_get_name(category));

Why is that an error? Shouldn't it go to stdout?

Output of -device help has always gone to stderr, and that has always annoyed me. Just not enough to fix it.

Back when libvirt scraped -help output, changing it to use stdout would be an incompatible change. But now that libvirt uses QMP, I would also welcome a change to use stdout (but also fall in the category of "not enough of a bother for ME to fix it).

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#4 lore raw
Quoted 11 lines · Eric Blake
Quoted 9 lines · Markus Armbruster
Quoted 8 lines

qdev-monitor.c static void qdev_print_category_devices(DeviceCategory category) · line 159

Quoted 6 lines

+++ b/qdev-monitor.c

qdev-monitor.c +1 -0
@@ -156,6 +156,8 @@ static void qdev_print_category_devices(DeviceCategory category)
     DeviceClass *dc;
     GSList *list, *curr;
 
+    error_printf("%s devices:\n", qdev_category_get_name(category));

Why is that an error? Shouldn't it go to stdout?

Quoted 7 lines
Quoted 2 lines

Output of -device help has always gone to stderr, and that has always annoyed me. Just not enough to fix it.

Back when libvirt scraped -help output, changing it to use stdout would be an incompatible change. But now that libvirt uses QMP, I would also welcome a change to use stdout (but also fall in the category of "not enough of a bother for ME to fix it).

It really bothers me. I need to use the help (being new to qemu ...) and I am always forgetting "2>&1".

Anyone can think of a reason for not sending the help to stdout? Marcel

Quoted 1 line
#5 lore raw
Quoted 16 lines · Marcel Apfelbaum
Quoted 15 lines · Eric Blake
Quoted 12 lines · Markus Armbruster
Quoted 9 lines

qdev-monitor.c static void · line 160

Quoted 7 lines

+++ b/qdev-monitor.c

qdev-monitor.c +1 -0
@@ -156,6 +156,8 @@ static void
 qdev_print_category_devices(DeviceCategory category)
     DeviceClass *dc;
     GSList *list, *curr;
 
+    error_printf("%s devices:\n", qdev_category_get_name(category));

Why is that an error? Shouldn't it go to stdout?

Output of -device help has always gone to stderr, and that has always annoyed me. Just not enough to fix it.

Quoted 8 lines
Quoted 4 lines

Back when libvirt scraped -help output, changing it to use stdout would be an incompatible change. But now that libvirt uses QMP, I would also welcome a change to use stdout (but also fall in the category of "not enough of a bother for ME to fix it).

It really bothers me. I need to use the help (being new to qemu ...) and I am always forgetting "2>&1".

Anyone can think of a reason for not sending the help to stdout?

Post a patch and find out ;)

#6 lore raw
In reply to Marcel Apfelbaum
Quoted 14 lines · Marcel Apfelbaum

This patch follows Markus Armbruster suggestion:

A possibly better way to group help by category: instead of adding categories to each line, add category headlines, like this:

    Controller/Bridge/Hub devices:
    name "NAME", bus "BUS"...
    ...
    USB devices:
    name "NAME", bus "BUS"...
    ...
    Storage devices:
    ...
Quoted 6 lines

This way, showing devices with multiple categories once per category actually makes sense.

Note that the "categories to each line" is kept for 2 reasons:
1. Preparation for multifunction devices
2. Ability to grep by category

ping
Marcel

Quoted 19 lines
---
 qdev-monitor.c | 2 ++
 1 file changed, 2 insertions(+)
qdev-monitor.c +2 -0
index 410cdcb..a7329b0 100644
@@ -156,6 +156,8 @@ static void qdev_print_category_devices(DeviceCategory category)
     DeviceClass *dc;
     GSList *list, *curr;
 
+    error_printf("%s devices:\n", qdev_category_get_name(category));
+
     list = object_class_get_list(TYPE_DEVICE, false);
     for (curr = list; curr; curr = g_slist_next(curr)) {
         dc = (DeviceClass *)object_class_dynamic_cast(curr->data, TYPE_DEVICE);