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 ");
+ 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;
+}