From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: [PATCH 12/20] tap: add interface to get device fd Date: Thu, 4 Feb 2010 17:28:30 +0200 Message-ID: <20100204152830.GM8461@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:27989 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932478Ab0BDPbl (ORCPT ); Thu, 4 Feb 2010 10:31:41 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o14FVfVm003023 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 4 Feb 2010 10:31:41 -0500 Received: from redhat.com (vpn2-9-138.ams2.redhat.com [10.36.9.138]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id o14FVdKr005601 for ; Thu, 4 Feb 2010 10:31:40 -0500 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: 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.144.g5c3af