From patchwork Wed Mar 17 11:07:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 47930 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 32C76B7D42 for ; Wed, 17 Mar 2010 22:13:54 +1100 (EST) Received: from localhost ([127.0.0.1]:60600 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NrrCB-0002xC-8O for incoming@patchwork.ozlabs.org; Wed, 17 Mar 2010 07:13:51 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nrr9k-0002UZ-4J for qemu-devel@nongnu.org; Wed, 17 Mar 2010 07:11:20 -0400 Received: from [199.232.76.173] (port=34141 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nrr9j-0002UF-6S for qemu-devel@nongnu.org; Wed, 17 Mar 2010 07:11:19 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nrr9i-0001QF-1E for qemu-devel@nongnu.org; Wed, 17 Mar 2010 07:11:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14521) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nrr9h-0001Q9-Lo for qemu-devel@nongnu.org; Wed, 17 Mar 2010 07:11:17 -0400 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 o2HBBGuS027436 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 17 Mar 2010 07:11:16 -0400 Received: from redhat.com (vpn2-9-55.ams2.redhat.com [10.36.9.55]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id o2HBBDOj013853; Wed, 17 Mar 2010 07:11:14 -0400 Date: Wed, 17 Mar 2010 13:07:50 +0200 From: "Michael S. Tsirkin" To: Anthony Liguori , qemu-devel@nongnu.org Message-ID: <9dbe0adf87df1ccad0cfbaefca6a529ca5775828.1268823114.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mutt-Fcc: =sent User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: amit.shah@redhat.com, kraxel@redhat.com, quintela@redhat.com Subject: [Qemu-devel] [PATCHv6 01/11] tap: add interface to get device fd X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@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 7a7320c..fc59fd4 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 */