Update '-machine help' to report 'aliases' from the TYPE_ALIASED
interface, in preference to the traditional 'alias' from the
TYPE_MACHINE class. It is assumed that only one of the two fields
will be set at any time give a given class. Shortly existing
machines will be converted to the new approach and the old field
removed. '-machine help' output will remain unchanged across
this transition.

Signed-off-by: Daniel P. Berrangé <[email protected]>
---
 system/vl.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/system/vl.c b/system/vl.c
index e7b759d5442..8ddf306002f 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -1583,7 +1583,16 @@ static void machine_help_func(const QDict *qdict)
     machines = g_slist_sort_with_data(machines, machine_class_cmp, NULL);
     for (el = machines; el; el = el->next) {
         MachineClass *mc = el->data;
-        if (mc->alias) {
+        AliasedClass *alc = ALIASED_CLASS(mc);
+        if (alc->aliases) {
+            size_t i;
+            for (i = 0; alc->aliases[i] != NULL; i++) {
+                printf("%-*.20s %s (alias of %s)\n",
+                       (int)(strlen(alc->aliases[i]) -
+                             strlen(TYPE_MACHINE_SUFFIX)),
+                       alc->aliases[i], mc->desc, mc->name);
+            }
+        } else if (mc->alias) {
             printf("%-20s %s (alias of %s)\n", mc->alias, mc->desc, mc->name);
         }
         printf("%-20s %s%s%s%s\n", mc->name, mc->desc,
-- 
2.56.1


Reply via email to