From patchwork Mon Nov 2 22:23:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 57155 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nA2MQlBx019288 for ; Mon, 2 Nov 2009 22:26:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932090AbZKBW0k (ORCPT ); Mon, 2 Nov 2009 17:26:40 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757212AbZKBW0k (ORCPT ); Mon, 2 Nov 2009 17:26:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37550 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757196AbZKBW0j (ORCPT ); Mon, 2 Nov 2009 17:26:39 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nA2MQ8Ho021706; Mon, 2 Nov 2009 17:26:08 -0500 Received: from redhat.com (vpn-6-135.tlv.redhat.com [10.35.6.135]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id nA2MQ3fx001812; Mon, 2 Nov 2009 17:26:05 -0500 Date: Tue, 3 Nov 2009 00:23:40 +0200 From: "Michael S. Tsirkin" To: avi@redhat.com, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: gregory.haskins@gmail.com Subject: [PATCHv4 2/6] qemu/net: routines to get tap fd Message-ID: <20091102222340.GC15153@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/net.c b/net.c index 6a7f1c2..8ac639b 100644 --- a/net.c +++ b/net.c @@ -1472,6 +1472,16 @@ static int tap_set_sndbuf(TAPState *s, QemuOpts *opts) } #endif /* TUNSETSNDBUF */ +int tap_get_fd(VLANClientState *vc) +{ + TAPState *s = vc->opaque; + + if (vc->receive != tap_receive) + return -1; + + return s->fd; +} + int tap_has_vnet_hdr(void *opaque) { VLANClientState *vc = opaque; diff --git a/net.h b/net.h index d1ba23b..7246d16 100644 --- a/net.h +++ b/net.h @@ -92,6 +92,7 @@ void do_set_link(Monitor *mon, const QDict *qdict); void do_info_usernet(Monitor *mon); +int tap_get_fd(VLANClientState *vc); int tap_has_vnet_hdr(void *opaque); void tap_using_vnet_hdr(void *opaque, int using_vnet_hdr);