From nobody Fri Nov 14 21:05:54 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1760118218; cv=none; d=zohomail.com; s=zohoarc; b=F89hW64RhOUu3eG5g2IdBnwtn7FRSX9aUGcej1nAYg/hCwr7gLWuZlU6fV7tmI1HSN+fz5ORf0GI1kigeM13wOPWLYu8+h4pf3GNOCAR0gN9+wRiNFg3YGv85g7QbDE+t3d6Mz05UsAhHJm+EOc6QISVK3sMOQ/3iTegcub+kEU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760118218; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nnKwp9UVQ4ods/yG1iyoepfjor+lRBQrWYh08dJIpQ8=; b=nj32tWPrQZ92+8ciUAPSW2BdpUFIUYJpiwGeeg7aw4NYD5bRle2+sxxNJqiNlD8/M9BNcZSzCgG6MR+T89dSWBXgdEduMBAYeoQE08AbZgr/WksSMPBDJOVxMjLwKegZxvDRDJ3iCOrpgp4ssCEFdVhHJK9IZWQBLJ4Ww6oE6qk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1760118218069715.3813202806143; Fri, 10 Oct 2025 10:43:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v7H6f-0008Hu-8U; Fri, 10 Oct 2025 13:40:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v7H6Z-0008GD-T6 for qemu-devel@nongnu.org; Fri, 10 Oct 2025 13:40:35 -0400 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v7H6H-0007SI-Lz for qemu-devel@nongnu.org; Fri, 10 Oct 2025 13:40:35 -0400 Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:9297:0:640:61e7:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 5DEBE807DC; Fri, 10 Oct 2025 20:40:09 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6bf:8080:a89::1:23]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id xdPFQ30FtmI0-jXC9gl68; Fri, 10 Oct 2025 20:40:08 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1760118008; bh=nnKwp9UVQ4ods/yG1iyoepfjor+lRBQrWYh08dJIpQ8=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=e7uP+jHW6EqRddxTE0n8B9i1218oYYb27bGdfwh5K++yeG67OiLERVrzc7zMTY6IQ 4koimPa8liE3bKIANDSqEKpVqEMgeEDFKkhKzSBycee4W0ikz1/QbOfw43R5oycEyV Z0dkujkCH6pT2r8I4LAPAZzxo7wb+qBhawwDWmog= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: mst@redhat.com, jasowang@redhat.com Cc: peterx@redhat.com, farosas@suse.de, sw@weilnetz.de, eblake@redhat.com, armbru@redhat.com, thuth@redhat.com, philmd@linaro.org, berrange@redhat.com, qemu-devel@nongnu.org, michael.roth@amd.com, steven.sistare@oracle.com, leiyang@redhat.com, davydov-max@yandex-team.ru, yc-core@yandex-team.ru, vsementsov@yandex-team.ru, raphael.s.norwitz@gmail.com Subject: [PATCH v7 08/19] net/tap: tap_set_sndbuf(): add return value Date: Fri, 10 Oct 2025 20:39:46 +0300 Message-ID: <20251010173957.166759-9-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20251010173957.166759-1-vsementsov@yandex-team.ru> References: <20251010173957.166759-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.136; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1760118223172158500 Content-Type: text/plain; charset="utf-8" Follow common recommendations in include/qapi/error.h of having a return value together with errp. This allows to avoid error propagation. Signed-off-by: Vladimir Sementsov-Ogievskiy Tested-by: Lei Yang Reviewed-by: Maksim Davydov --- net/tap-bsd.c | 3 ++- net/tap-linux.c | 5 ++++- net/tap-solaris.c | 3 ++- net/tap-stub.c | 3 ++- net/tap.c | 5 +---- net/tap_int.h | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/net/tap-bsd.c b/net/tap-bsd.c index bbf84d1828..9bd282b69c 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -206,8 +206,9 @@ error: } #endif /* __FreeBSD__ */ =20 -void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp) +bool tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp) { + return true; } =20 int tap_probe_vnet_hdr(int fd, Error **errp) diff --git a/net/tap-linux.c b/net/tap-linux.c index 2a90b58467..db68693bbf 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -145,7 +145,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_h= dr, */ #define TAP_DEFAULT_SNDBUF 0 =20 -void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp) +bool tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp) { int sndbuf; =20 @@ -159,7 +159,10 @@ void tap_set_sndbuf(int fd, const NetdevTapOptions *ta= p, Error **errp) =20 if (ioctl(fd, TUNSETSNDBUF, &sndbuf) =3D=3D -1 && tap->has_sndbuf) { error_setg_errno(errp, errno, "TUNSETSNDBUF ioctl failed"); + return false; } + + return true; } =20 int tap_probe_vnet_hdr(int fd, Error **errp) diff --git a/net/tap-solaris.c b/net/tap-solaris.c index 75397e6c54..e5ba89d926 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -208,8 +208,9 @@ int tap_open(char *ifname, int ifname_size, int *vnet_h= dr, return fd; } =20 -void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp) +bool tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp) { + return true; } =20 int tap_probe_vnet_hdr(int fd, Error **errp) diff --git a/net/tap-stub.c b/net/tap-stub.c index f7a5e0c163..86d7d38e0f 100644 --- a/net/tap-stub.c +++ b/net/tap-stub.c @@ -33,8 +33,9 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, return -1; } =20 -void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp) +bool tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp) { + return true; } =20 int tap_probe_vnet_hdr(int fd, Error **errp) diff --git a/net/tap.c b/net/tap.c index 7cb694e683..25dedd8492 100644 --- a/net/tap.c +++ b/net/tap.c @@ -702,15 +702,12 @@ static void net_init_tap_one(const NetdevTapOptions *= tap, NetClientState *peer, const char *downscript, const char *vhostfdna= me, int vnet_hdr, int fd, Error **errp) { - Error *err =3D NULL; TAPState *s =3D net_tap_new(peer, model, name); int vhostfd; =20 net_tap_set_fd(s, fd, vnet_hdr); =20 - tap_set_sndbuf(s->fd, tap, &err); - if (err) { - error_propagate(errp, err); + if (!tap_set_sndbuf(s->fd, tap, errp)) { goto failed; } =20 diff --git a/net/tap_int.h b/net/tap_int.h index b76a05044b..7963dd6aae 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, =20 ssize_t tap_read_packet(int tapfd, uint8_t *buf, int maxlen); =20 -void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp); +bool tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp); int tap_probe_vnet_hdr(int fd, Error **errp); int tap_probe_has_ufo(int fd); int tap_probe_has_uso(int fd); --=20 2.48.1