]> git.proxmox.com Git - qemu.git/commitdiff
tap: add interface to get device fd
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 17 Mar 2010 11:07:50 +0000 (13:07 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Thu, 1 Apr 2010 18:56:43 +0000 (13:56 -0500)
Will be used by vhost to attach/detach to backend.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net/tap.c
net/tap.h

index 672b0ee0b49c226d41f9dc44ce6e8ac8706b41a9..c19740b5842373cc5864e0c2fb8197c1edfe8d55 100644 (file)
--- a/net/tap.c
+++ b/net/tap.c
@@ -270,6 +270,13 @@ static void tap_poll(VLANClientState *nc, bool enable)
     tap_write_poll(s, enable);
 }
 
+int tap_get_fd(VLANClientState *nc)
+{
+    TAPState *s = DO_UPCAST(TAPState, nc, nc);
+    assert(nc->info->type == NET_CLIENT_TYPE_TAP);
+    return s->fd;
+}
+
 /* fd support */
 
 static NetClientInfo net_tap_info = {
index 538a5627206ba34dc244035442023835893342ab..a244b28f822afbf0dfa652d9bdce9ef4ebeb9935 100644 (file)
--- a/net/tap.h
+++ b/net/tap.h
@@ -48,4 +48,6 @@ int tap_probe_vnet_hdr(int fd);
 int tap_probe_has_ufo(int fd);
 void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo);
 
+int tap_get_fd(VLANClientState *vc);
+
 #endif /* QEMU_NET_TAP_H */