diff options
author | Mark McLoughlin <markmc@redhat.com> | 2009-10-06 12:17:16 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-10-06 14:36:13 -0500 |
commit | dc1c9fe8b759d4e70222d8f94838a6f6ef5c4ef1 (patch) | |
tree | 8fd31fed4bc434f8c726d09512f770f58b7796e7 /vl.c | |
parent | c59c7ea94796a4fce2fe79b8f9aa3628dc2e0b2a (diff) |
Final net cleanup after conversion to QemuOpts
Now that net_client_init() has no users, kill it off and rename
net_client_init_from_opts().
There is no further need for the old code in net_client_parse() either.
We use qemu_opts_parse() 'firstname' facitity for that. Instead, move
the special handling of the 'vmchannel' type there.
Simplify the vl.c code into merely call net_client_parse() for each
-net command line option and then calling net_init_clients() later
to iterate over the options and create the clients.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 28 |
1 files changed, 4 insertions, 24 deletions
@@ -2606,7 +2606,7 @@ static int usb_device_add(const char *devname, int is_hotplug) qemu_opt_set(opts, "type", "nic"); qemu_opt_set(opts, "model", "usb"); - idx = net_client_init_from_opts(NULL, opts); + idx = net_client_init(NULL, opts); if (idx == -1) { return -1; } @@ -4538,8 +4538,6 @@ int qemu_uuid_parse(const char *str, uint8_t *uuid) return 0; } -#define MAX_NET_CLIENTS 32 - #ifndef _WIN32 static void termsig_handler(int signal) @@ -4743,8 +4741,6 @@ int main(int argc, char **argv, char **envp) DisplayState *ds; DisplayChangeListener *dcl; int cyls, heads, secs, translation; - const char *net_clients[MAX_NET_CLIENTS]; - int nb_net_clients; QemuOpts *hda_opts = NULL, *opts; int optind; const char *r, *optarg; @@ -4847,7 +4843,6 @@ int main(int argc, char **argv, char **envp) node_cpumask[i] = 0; } - nb_net_clients = 0; nb_numa_nodes = 0; nb_nics = 0; @@ -5093,12 +5088,9 @@ int main(int argc, char **argv, char **envp) break; #endif case QEMU_OPTION_net: - if (nb_net_clients >= MAX_NET_CLIENTS) { - fprintf(stderr, "qemu: too many network clients\n"); + if (net_client_parse(optarg) == -1) { exit(1); } - net_clients[nb_net_clients] = optarg; - nb_net_clients++; break; #ifdef CONFIG_SLIRP case QEMU_OPTION_tftp: @@ -5661,25 +5653,13 @@ int main(int argc, char **argv, char **envp) socket_init(); #endif - /* init network clients */ - if (nb_net_clients == 0) { - /* if no clients, we use a default config */ - net_clients[nb_net_clients++] = "nic"; -#ifdef CONFIG_SLIRP - net_clients[nb_net_clients++] = "user"; -#endif - } - - for(i = 0;i < nb_net_clients; i++) { - if (net_client_parse(net_clients[i]) < 0) - exit(1); + if (net_init_clients() < 0) { + exit(1); } net_boot = (boot_devices_bitmap >> ('n' - 'a')) & 0xF; net_set_boot_mask(net_boot); - net_client_check(); - /* init the bluetooth world */ if (foreach_device_config(DEV_BT, bt_parse)) exit(1); |