peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame qemu-tap-add-interface-to-get-device-fd.patch

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