From nobody Fri May 16 08:38:23 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1496318933107307.4860342407991; Thu, 1 Jun 2017 05:08:53 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF2DC448D6B; Thu, 1 Jun 2017 12:08:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C93EE7ED88; Thu, 1 Jun 2017 12:08:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 736556B5ED; Thu, 1 Jun 2017 12:08:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v51C8gdW022629 for ; Thu, 1 Jun 2017 08:08:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6630753C32; Thu, 1 Jun 2017 12:08:42 +0000 (UTC) Received: from caroline.brq.redhat.com (dhcp129-198.brq.redhat.com [10.34.129.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id E15775279C for ; Thu, 1 Jun 2017 12:08:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EF2DC448D6B Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com EF2DC448D6B From: Martin Kletzander To: libvir-list@redhat.com Date: Thu, 1 Jun 2017 14:08:32 +0200 Message-Id: <43d414ff05bc75123cb67b89f47c4ef498acc500.1496318548.git.mkletzan@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] Make virNetClientStreamEventRemoveCallback's errors optional X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 01 Jun 2017 12:08:50 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" There will be new place for this function to be called, but we need not to report error from there. Since the virNetClientStream structure is private, there is no way to check for st->cb from outside this file, so we need to make the error reporting optional. The function name is already long enough to have yet another Quiet suffix like some other functions do, plus it is only called from two places, so just add bool for that. Signed-off-by: Martin Kletzander --- src/remote/remote_driver.c | 2 +- src/rpc/virnetclientstream.c | 10 +++++++--- src/rpc/virnetclientstream.h | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index d27e96ffc2b7..968fdfba191c 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -5838,7 +5838,7 @@ remoteStreamEventRemoveCallback(virStreamPtr st) remoteDriverLock(priv); - ret =3D virNetClientStreamEventRemoveCallback(privst); + ret =3D virNetClientStreamEventRemoveCallback(privst, false); remoteDriverUnlock(priv); return ret; diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c index a9bf271dc5ba..1f8456f59455 100644 --- a/src/rpc/virnetclientstream.c +++ b/src/rpc/virnetclientstream.c @@ -712,14 +712,18 @@ int virNetClientStreamEventUpdateCallback(virNetClien= tStreamPtr st, return ret; } -int virNetClientStreamEventRemoveCallback(virNetClientStreamPtr st) +int virNetClientStreamEventRemoveCallback(virNetClientStreamPtr st, bool q= uiet) { int ret =3D -1; virObjectLock(st); if (!st->cb) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("no stream callback registered")); + if (quiet) { + ret =3D 0; + } else { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("no stream callback registered")); + } goto cleanup; } diff --git a/src/rpc/virnetclientstream.h b/src/rpc/virnetclientstream.h index c4e01bf1cab0..4f114849e4e9 100644 --- a/src/rpc/virnetclientstream.h +++ b/src/rpc/virnetclientstream.h @@ -79,7 +79,8 @@ int virNetClientStreamEventAddCallback(virNetClientStream= Ptr st, int virNetClientStreamEventUpdateCallback(virNetClientStreamPtr st, int events); -int virNetClientStreamEventRemoveCallback(virNetClientStreamPtr st); +int virNetClientStreamEventRemoveCallback(virNetClientStreamPtr st, + bool quiet); bool virNetClientStreamEOF(virNetClientStreamPtr st) ATTRIBUTE_NONNULL(1); --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list