mirror of https://github.com/xemu-project/xemu.git
net: remove qemu_show_nic_models(), qemu_find_nic_model()
These old functions can be removed now too. Let net_param_nic() print the full set of network devices directly, and also make it note that a list more specific to this platform/config will be available by using '-nic model=help' instead. Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Reviewed-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
75942eea59
commit
481434f99e
|
@ -203,9 +203,6 @@ void qemu_set_vnet_hdr_len(NetClientState *nc, int len);
|
||||||
int qemu_set_vnet_le(NetClientState *nc, bool is_le);
|
int qemu_set_vnet_le(NetClientState *nc, bool is_le);
|
||||||
int qemu_set_vnet_be(NetClientState *nc, bool is_be);
|
int qemu_set_vnet_be(NetClientState *nc, bool is_be);
|
||||||
void qemu_macaddr_default_if_unset(MACAddr *macaddr);
|
void qemu_macaddr_default_if_unset(MACAddr *macaddr);
|
||||||
int qemu_show_nic_models(const char *arg, const char *const *models);
|
|
||||||
int qemu_find_nic_model(NICInfo *nd, const char * const *models,
|
|
||||||
const char *default_model);
|
|
||||||
/**
|
/**
|
||||||
* qemu_find_nic_info: Obtain NIC configuration information
|
* qemu_find_nic_info: Obtain NIC configuration information
|
||||||
* @typename: Name of device object type
|
* @typename: Name of device object type
|
||||||
|
|
39
net/net.c
39
net/net.c
|
@ -977,38 +977,6 @@ GPtrArray *qemu_get_nic_models(const char *device_type)
|
||||||
return nic_models;
|
return nic_models;
|
||||||
}
|
}
|
||||||
|
|
||||||
int qemu_show_nic_models(const char *arg, const char *const *models)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!arg || !is_help_option(arg)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Available NIC models:\n");
|
|
||||||
for (i = 0 ; models[i]; i++) {
|
|
||||||
printf("%s\n", models[i]);
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int qemu_find_nic_model(NICInfo *nd, const char * const *models,
|
|
||||||
const char *default_model)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!nd->model)
|
|
||||||
nd->model = g_strdup(default_model);
|
|
||||||
|
|
||||||
for (i = 0 ; models[i]; i++) {
|
|
||||||
if (strcmp(nd->model, models[i]) == 0)
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
error_report("Unsupported NIC model: %s", nd->model);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int net_init_nic(const Netdev *netdev, const char *name,
|
static int net_init_nic(const Netdev *netdev, const char *name,
|
||||||
NetClientState *peer, Error **errp)
|
NetClientState *peer, Error **errp)
|
||||||
{
|
{
|
||||||
|
@ -1791,9 +1759,14 @@ static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp)
|
||||||
}
|
}
|
||||||
if (is_help_option(type)) {
|
if (is_help_option(type)) {
|
||||||
GPtrArray *nic_models = qemu_get_nic_models(TYPE_DEVICE);
|
GPtrArray *nic_models = qemu_get_nic_models(TYPE_DEVICE);
|
||||||
|
int i;
|
||||||
show_netdevs();
|
show_netdevs();
|
||||||
printf("\n");
|
printf("\n");
|
||||||
qemu_show_nic_models(type, (const char **)nic_models->pdata);
|
printf("Available NIC models "
|
||||||
|
"(use -nic model=help for a filtered list):\n");
|
||||||
|
for (i = 0 ; nic_models->pdata[i]; i++) {
|
||||||
|
printf("%s\n", (char *)nic_models->pdata[i]);
|
||||||
|
}
|
||||||
g_ptr_array_free(nic_models, true);
|
g_ptr_array_free(nic_models, true);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue