[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCHv2 4/8] net: Export valid host network devices list
From: |
Hani Benhabiles |
Subject: |
[Qemu-devel] [PATCHv2 4/8] net: Export valid host network devices list |
Date: |
Tue, 27 May 2014 23:39:33 +0100 |
Signed-off-by: Hani Benhabiles <address@hidden>
---
include/net/net.h | 1 +
net/net.c | 34 ++++++++++++++++++++--------------
2 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/include/net/net.h b/include/net/net.h
index 8166345..8b189da 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -177,6 +177,7 @@ struct NICInfo {
extern int nb_nics;
extern NICInfo nd_table[MAX_NICS];
extern int default_net;
+extern const char *host_net_devices[];
/* from net.c */
extern const char *legacy_tftp_prefix;
diff --git a/net/net.c b/net/net.c
index 0ff2e40..6344160 100644
--- a/net/net.c
+++ b/net/net.c
@@ -49,6 +49,22 @@
static QTAILQ_HEAD(, NetClientState) net_clients;
+const char *host_net_devices[] = {
+ "tap",
+ "socket",
+ "dump",
+#ifdef CONFIG_NET_BRIDGE
+ "bridge",
+#endif
+#ifdef CONFIG_SLIRP
+ "user",
+#endif
+#ifdef CONFIG_VDE
+ "vde",
+#endif
+ NULL,
+};
+
int default_net = 1;
/***********************************************************/
@@ -897,21 +913,11 @@ int net_client_init(QemuOpts *opts, int is_netdev, Error
**errp)
static int net_host_check_device(const char *device)
{
int i;
- const char *valid_param_list[] = { "tap", "socket", "dump"
-#ifdef CONFIG_NET_BRIDGE
- , "bridge"
-#endif
-#ifdef CONFIG_SLIRP
- ,"user"
-#endif
-#ifdef CONFIG_VDE
- ,"vde"
-#endif
- };
- for (i = 0; i < ARRAY_SIZE(valid_param_list); i++) {
- if (!strncmp(valid_param_list[i], device,
- strlen(valid_param_list[i])))
+ for (i = 0; host_net_devices[i]; i++) {
+ if (!strncmp(host_net_devices[i], device,
+ strlen(host_net_devices[i]))) {
return 1;
+ }
}
return 0;
--
1.8.3.2
- [Qemu-devel] [PATCHv2 0/8] monitor: Command completion for various commands, Hani Benhabiles, 2014/05/27
- [Qemu-devel] [PATCHv2 1/8] monitor: Add ringbuf_write and ringbuf_read argument completion., Hani Benhabiles, 2014/05/27
- [Qemu-devel] [PATCHv2 2/8] monitor: Add watchdog_action argument completion., Hani Benhabiles, 2014/05/27
- [Qemu-devel] [PATCHv2 3/8] monitor: Add migrate_set_capability completion., Hani Benhabiles, 2014/05/27
- [Qemu-devel] [PATCHv2 4/8] net: Export valid host network devices list,
Hani Benhabiles <=
- [Qemu-devel] [PATCHv2 5/8] monitor: Add host_net_add device argument completion., Hani Benhabiles, 2014/05/27
- [Qemu-devel] [PATCHv2 6/8] readline: Make completion strings always unique., Hani Benhabiles, 2014/05/27
- [Qemu-devel] [PATCHv2 7/8] monitor: Add host_net_remove arguments completion., Hani Benhabiles, 2014/05/27
- [Qemu-devel] [PATCHv2 8/8] monitor: Add delvm and loadvm argument completion., Hani Benhabiles, 2014/05/27