From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ys8u5-0007Qg-N1 for qemu-devel@nongnu.org; Tue, 12 May 2015 08:03:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ys8u1-0003z7-6Y for qemu-devel@nongnu.org; Tue, 12 May 2015 08:03:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39711) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ys8u0-0003yv-WF for qemu-devel@nongnu.org; Tue, 12 May 2015 08:03:13 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 9D4CAB6A24 for ; Tue, 12 May 2015 12:03:12 +0000 (UTC) From: Markus Armbruster Date: Tue, 12 May 2015 14:02:59 +0200 Message-Id: <1431432187-10993-8-git-send-email-armbru@redhat.com> In-Reply-To: <1431432187-10993-1-git-send-email-armbru@redhat.com> References: <1431432187-10993-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH 07/15] tap: Convert tap_set_sndbuf() to Error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: stefanha@redhat.com Signed-off-by: Markus Armbruster --- 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); -- 1.9.3