From patchwork Wed May 27 10:02:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 477042 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 884E414012C for ; Wed, 27 May 2015 20:08:24 +1000 (AEST) Received: from localhost ([::1]:52882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxYG6-0004pN-Kg for incoming@patchwork.ozlabs.org; Wed, 27 May 2015 06:08:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56329) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxYBV-0004va-4o for qemu-devel@nongnu.org; Wed, 27 May 2015 06:03:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxYBO-0002Ak-Ri for qemu-devel@nongnu.org; Wed, 27 May 2015 06:03:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43377) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxYBO-0002Af-LK for qemu-devel@nongnu.org; Wed, 27 May 2015 06:03:30 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t4RA3SGM025964 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 27 May 2015 06:03:28 -0400 Received: from localhost (ovpn-112-78.ams2.redhat.com [10.36.112.78]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4RA3QfG012964; Wed, 27 May 2015 06:03:27 -0400 From: Stefan Hajnoczi To: Date: Wed, 27 May 2015 11:02:59 +0100 Message-Id: <1432720988-20200-9-git-send-email-stefanha@redhat.com> In-Reply-To: <1432720988-20200-1-git-send-email-stefanha@redhat.com> References: <1432720988-20200-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Markus Armbruster , Stefan Hajnoczi Subject: [Qemu-devel] [PULL 08/17] tap: Convert tap_set_sndbuf() to Error X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Markus Armbruster Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Message-id: 1431691143-1015-8-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi --- net/tap-aix.c | 3 +-- net/tap-bsd.c | 3 +-- net/tap-haiku.c | 3 +-- net/tap-linux.c | 6 ++---- net/tap-solaris.c | 3 +-- net/tap.c | 4 +++- net/tap_int.h | 2 +- 7 files changed, 10 insertions(+), 14 deletions(-) diff --git a/net/tap-aix.c b/net/tap-aix.c index 804d164..0a3d461 100644 --- a/net/tap-aix.c +++ b/net/tap-aix.c @@ -32,9 +32,8 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, return -1; } -int tap_set_sndbuf(int fd, const NetdevTapOptions *tap) +void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp) { - return 0; } int tap_probe_vnet_hdr(int fd) diff --git a/net/tap-bsd.c b/net/tap-bsd.c index bf91bd0..53cdd9f 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -176,9 +176,8 @@ error: } #endif /* __FreeBSD__ */ -int tap_set_sndbuf(int fd, const NetdevTapOptions *tap) +void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp) { - return 0; } int tap_probe_vnet_hdr(int fd) diff --git a/net/tap-haiku.c b/net/tap-haiku.c index e5ce436..0905b28 100644 --- a/net/tap-haiku.c +++ b/net/tap-haiku.c @@ -32,9 +32,8 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, return -1; } -int tap_set_sndbuf(int fd, const NetdevTapOptions *tap) +void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp) { - return 0; } int tap_probe_vnet_hdr(int fd) diff --git a/net/tap-linux.c b/net/tap-linux.c index 812bf2d..6fa2744 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -126,7 +126,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, */ #define TAP_DEFAULT_SNDBUF 0 -int tap_set_sndbuf(int fd, const NetdevTapOptions *tap) +void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp) { int sndbuf; @@ -139,10 +139,8 @@ int tap_set_sndbuf(int fd, const NetdevTapOptions *tap) } if (ioctl(fd, TUNSETSNDBUF, &sndbuf) == -1 && tap->has_sndbuf) { - error_report("TUNSETSNDBUF ioctl failed: %s", strerror(errno)); - return -1; + error_setg_errno(errp, errno, "TUNSETSNDBUF ioctl failed"); } - return 0; } int tap_probe_vnet_hdr(int fd) diff --git a/net/tap-solaris.c b/net/tap-solaris.c index 9c7278f..7839323 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -198,9 +198,8 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, return fd; } -int tap_set_sndbuf(int fd, const NetdevTapOptions *tap) +void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp) { - return 0; } int tap_probe_vnet_hdr(int fd) diff --git a/net/tap.c b/net/tap.c index 23c81fa..d54222d 100644 --- a/net/tap.c +++ b/net/tap.c @@ -610,7 +610,9 @@ static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, TAPState *s = net_tap_fd_init(peer, model, name, fd, vnet_hdr); int vhostfd; - if (tap_set_sndbuf(s->fd, tap) < 0) { + tap_set_sndbuf(s->fd, tap, &err); + if (err) { + error_report_err(err); return -1; } diff --git a/net/tap_int.h b/net/tap_int.h index 79afdf2..6df271f 100644 --- a/net/tap_int.h +++ b/net/tap_int.h @@ -34,7 +34,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, ssize_t tap_read_packet(int tapfd, uint8_t *buf, int maxlen); -int tap_set_sndbuf(int fd, const NetdevTapOptions *tap); +void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp); int tap_probe_vnet_hdr(int fd); int tap_probe_vnet_hdr_len(int fd, int len); int tap_probe_has_ufo(int fd);