mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
net: introduce qemu_set_info_str() function
Embed the setting of info_str in a function. Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
f3eedcddba
commit
53b85d9574
11 changed files with 41 additions and 47 deletions
17
net/net.c
17
net/net.c
|
@ -141,13 +141,20 @@ char *qemu_mac_strdup_printf(const uint8_t *macaddr)
|
|||
macaddr[3], macaddr[4], macaddr[5]);
|
||||
}
|
||||
|
||||
void qemu_set_info_str(NetClientState *nc, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(nc->info_str, sizeof(nc->info_str), fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void qemu_format_nic_info_str(NetClientState *nc, uint8_t macaddr[6])
|
||||
{
|
||||
snprintf(nc->info_str, sizeof(nc->info_str),
|
||||
"model=%s,macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
nc->model,
|
||||
macaddr[0], macaddr[1], macaddr[2],
|
||||
macaddr[3], macaddr[4], macaddr[5]);
|
||||
qemu_set_info_str(nc, "model=%s,macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
nc->model, macaddr[0], macaddr[1], macaddr[2],
|
||||
macaddr[3], macaddr[4], macaddr[5]);
|
||||
}
|
||||
|
||||
static int mac_table[256] = {0};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue