mvadkert / rpms / qemu

Forked from rpms/qemu 6 years ago
Clone
2e83913
Will be used by vhost to attach/detach to backend.
2e83913
2e83913
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2e83913
---
2e83913
 net/tap.c |    7 +++++++
2e83913
 net/tap.h |    2 ++
2e83913
 2 files changed, 9 insertions(+), 0 deletions(-)
2e83913
2e83913
diff --git a/net/tap.c b/net/tap.c
2e83913
index d3492de..7e9ca79 100644
2e83913
--- a/net/tap.c
2e83913
+++ b/net/tap.c
2e83913
@@ -269,6 +269,13 @@ static void tap_poll(VLANClientState *nc, bool enable)
2e83913
     tap_write_poll(s, enable);
2e83913
 }
2e83913
 
2e83913
+int tap_get_fd(VLANClientState *nc)
2e83913
+{
2e83913
+    TAPState *s = DO_UPCAST(TAPState, nc, nc);
2e83913
+    assert(nc->info->type == NET_CLIENT_TYPE_TAP);
2e83913
+    return s->fd;
2e83913
+}
2e83913
+
2e83913
 /* fd support */
2e83913
 
2e83913
 static NetClientInfo net_tap_info = {
2e83913
diff --git a/net/tap.h b/net/tap.h
2e83913
index 538a562..a244b28 100644
2e83913
--- a/net/tap.h
2e83913
+++ b/net/tap.h
2e83913
@@ -48,4 +48,6 @@ int tap_probe_vnet_hdr(int fd);
2e83913
 int tap_probe_has_ufo(int fd);
2e83913
 void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo);
2e83913
 
2e83913
+int tap_get_fd(VLANClientState *vc);
2e83913
+
2e83913
 #endif /* QEMU_NET_TAP_H */
2e83913
-- 
2e83913
1.6.6.144.g5c3af