@@ -656,7 +656,7 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
void hmp_info_mac_table(Monitor *mon, const QDict *qdict)
{
MacTableInfoList *table_list, *table_entry;
- StringList *str_entry;
+ strList *str_entry;
table_list = qmp_query_mac_table(NULL);
table_entry = table_list;
@@ -698,7 +698,7 @@ void hmp_info_mac_table(Monitor *mon, const QDict *qdict)
str_entry = table_entry->value->unicast;
monitor_printf(mon, " \\ unicast:\n");
while (str_entry) {
- monitor_printf(mon, " %s\n", str_entry->value->str);
+ monitor_printf(mon, " %s\n", str_entry->value);
str_entry = str_entry->next;
}
}
@@ -707,7 +707,7 @@ void hmp_info_mac_table(Monitor *mon, const QDict *qdict)
str_entry = table_entry->value->multicast;
monitor_printf(mon, " \\ multicast:\n");
while (str_entry) {
- monitor_printf(mon, " %s\n", str_entry->value->str);
+ monitor_printf(mon, " %s\n", str_entry->value);
str_entry = str_entry->next;
}
}
@@ -197,8 +197,8 @@ static MacTableInfo *virtio_net_query_mactable(NetClientState *nc)
{
VirtIONet *n = qemu_get_nic_opaque(nc);
MacTableInfo *info;
- StringList *str_list = NULL;
- StringList *entry;
+ strList *str_list = NULL;
+ strList *entry;
char str[12];
int i;
@@ -234,7 +234,7 @@ static MacTableInfo *virtio_net_query_mactable(NetClientState *nc)
n->mac_table.macs[i * ETH_ALEN + 4],
n->mac_table.macs[i * ETH_ALEN + 5]);
entry->value = g_malloc0(sizeof(String *));
- entry->value->str = g_strdup(str);
+ entry->value = g_strdup(str);
entry->next = str_list;
str_list = entry;
}
@@ -253,7 +253,7 @@ static MacTableInfo *virtio_net_query_mactable(NetClientState *nc)
n->mac_table.macs[i * ETH_ALEN + 4],
n->mac_table.macs[i * ETH_ALEN + 5]);
entry->value = g_malloc0(sizeof(String *));
- entry->value->str = g_strdup(str);
+ entry->value = g_strdup(str);
entry->next = str_list;
str_list = entry;
}
@@ -50,6 +50,7 @@ void visit_type_int64(Visitor *v, int64_t *obj, const char *name, Error **errp);
void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp);
void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp);
void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp);
+void visit_type_strList(Visitor *m, strList ** obj, const char *name, Error **errp);
void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp);
#endif
@@ -3537,8 +3537,8 @@
'*nobcast': 'bool',
'*multi_overflow': 'bool',
'*uni_overflow': 'bool',
- '*unicast': ['String'],
- '*multicast': ['String'] }}
+ '*unicast': ['str'],
+ '*multicast': ['str'] }}
##
# @query-mac-table:
@@ -257,6 +257,28 @@ void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp)
}
}
+void visit_type_strList(Visitor *m, strList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ strList *native_i = (strList *)i;
+ visit_type_str(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp)
{
if (!error_is_set(errp)) {
@@ -276,6 +276,14 @@ fdecl.write(mcgen('''
#include <stdbool.h>
#include <stdint.h>
+#ifndef QGA_QAPI_TYPES_H
+typedef struct strList
+{
+ char *value;
+ struct strList *next;
+} strList;
+#endif
+
''',
guard=guardname(h_file)))