From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NUNzk-0004aj-QK for qemu-devel@nongnu.org; Mon, 11 Jan 2010 12:24:00 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NUNzg-0004Xz-66 for qemu-devel@nongnu.org; Mon, 11 Jan 2010 12:24:00 -0500 Received: from [199.232.76.173] (port=34462 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NUNzg-0004Xv-10 for qemu-devel@nongnu.org; Mon, 11 Jan 2010 12:23:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50870) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NUNzf-0000aR-IT for qemu-devel@nongnu.org; Mon, 11 Jan 2010 12:23:55 -0500 Date: Mon, 11 Jan 2010 19:20:58 +0200 From: "Michael S. Tsirkin" Message-ID: <20100111172058.GI11936@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [Qemu-devel] [PATCH-RFC 08/13] net/tap: add interface to get device fd List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori , qemu-devel@nongnu.org Will be used by vhost to attach/detach to backend. Signed-off-by: Michael S. Tsirkin --- net/tap.c | 7 +++++++ net/tap.h | 2 ++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/net/tap.c b/net/tap.c index d3492de..7e9ca79 100644 --- a/net/tap.c +++ b/net/tap.c @@ -269,6 +269,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 = { diff --git a/net/tap.h b/net/tap.h index 538a562..a244b28 100644 --- 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 */ -- 1.6.6.rc1.43.gf55cc