qemu-riscv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 02/46] net: report list of available models according to p


From: Thomas Huth
Subject: Re: [PATCH v3 02/46] net: report list of available models according to platform
Date: Fri, 26 Jan 2024 15:33:30 +0100
User-agent: Mozilla Thunderbird

On 08/01/2024 21.26, David Woodhouse wrote:
From: David Woodhouse <dwmw@amazon.co.uk>

By noting the models for which a configuration was requested, we can give
the user an accurate list of which NIC models were actually available on
the platform/configuration that was otherwise chosen.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
---
  net/net.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 94 insertions(+)

diff --git a/net/net.c b/net/net.c
index aeb7f573fc..962904eaef 100644
--- a/net/net.c
+++ b/net/net.c
@@ -75,6 +75,8 @@ typedef QSIMPLEQ_HEAD(, NetdevQueueEntry) NetdevQueue;
static NetdevQueue nd_queue = QSIMPLEQ_HEAD_INITIALIZER(nd_queue); +static GHashTable *nic_model_help;
+
  /***********************************************************/
  /* network device redirectors */
@@ -1087,12 +1089,94 @@ static int net_init_nic(const Netdev *netdev, const char *name,
      return idx;
  }
+static gboolean add_nic_result(gpointer key, gpointer value, gpointer user_data)
+{
+    GPtrArray *results = user_data;
+    GPtrArray *alias_list = value;
+    const char *model = key;
+    char *result;
+
+    if (!alias_list) {
+        result = g_strdup(model);
+    } else {
+        GString *result_str = g_string_new(model);
+        int i;
+
+        g_string_append(result_str, " (aka ");

It's an abbreviation, so I'd rather use "a.k.a." instead of "aka".

Apart from that, the patch looks reasonable to me.

 Thomas

+        for (i = 0; i < alias_list->len; i++) {
+            if (i) {
+                g_string_append(result_str, ", ");
+            }
+            g_string_append(result_str, alias_list->pdata[i]);
+        }
+        g_string_append(result_str, ")");
+        result = result_str->str;
+        g_string_free(result_str, false);
+        g_ptr_array_unref(alias_list);
+    }
+    g_ptr_array_add(results, result);
+    return true;
+}
...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]