diff mbox

[v2,24/31] kvm tools: Add MACRO for user and tap mode for virtio net

Message ID 1309423279-3093-25-git-send-email-asias.hejun@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Asias He June 30, 2011, 8:41 a.m. UTC
This patch prepares the user and tap mode for virtio net.

Signed-off-by: Asias He <asias.hejun@gmail.com>
---
 tools/kvm/include/kvm/virtio-net.h |    4 ++++
 tools/kvm/virtio/net.c             |    3 +++
 2 files changed, 7 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/tools/kvm/include/kvm/virtio-net.h b/tools/kvm/include/kvm/virtio-net.h
index 00f3220..e93e8e4 100644
--- a/tools/kvm/include/kvm/virtio-net.h
+++ b/tools/kvm/include/kvm/virtio-net.h
@@ -8,8 +8,12 @@  struct virtio_net_parameters {
 	const char *host_ip;
 	char guest_mac[6];
 	const char *script;
+	int mode;
 };
 
 void virtio_net__init(const struct virtio_net_parameters *params);
 
+#define NET_MODE_USER	0
+#define NET_MODE_TAP	1
+
 #endif /* KVM__VIRTIO_NET_H */
diff --git a/tools/kvm/virtio/net.c b/tools/kvm/virtio/net.c
index 6916af6..68967f2 100644
--- a/tools/kvm/virtio/net.c
+++ b/tools/kvm/virtio/net.c
@@ -63,6 +63,9 @@  struct net_device {
 
 	int				tap_fd;
 	char				tap_name[IFNAMSIZ];
+
+	int				mode;
+
 };
 
 static struct net_device ndev = {