From nobody Sun Feb 8 15:25:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1596473854; cv=none; d=zohomail.com; s=zohoarc; b=lqED+mEXlK7g4ryXAX6mEFK6fMtLgYm8sKylXreBTGDqwd0Vp93PS3d5BjpymJHbAT1QjvMqIw3LrJlw3hnLUtJGO5pHYSs+xc70JvslW3spPKw4r3ie8vbqpULTyTPaplLx9q8MQfjur08J70HG9Xdzp/go+XB25i+XL78HL6w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596473854; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SElWkzHmp/owBmaC+b98RKKSvwybzMKthTzyyd6xcgw=; b=CpLcOzBcm29CXyFwazNVrKeipJUDVrUlQ03xjGotkqK9au/pChxt/dZ8DH2DNtLCOcX9+zuk16PWSKnr/1txBCHOteIQVfWt6QnYZWH8P83kRUqbiZdc05h09ZCQZ52xrL0fCZ5t3LjMsp5nGCiT4JB6t7o5yGXjuCQ0cl+j8vQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1596473854305640.4078451873366; Mon, 3 Aug 2020 09:57:34 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-182-0QtymlRRPICK4amfzWnacQ-1; Mon, 03 Aug 2020 12:57:27 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7557280183C; Mon, 3 Aug 2020 16:57:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F1DB10023A5; Mon, 3 Aug 2020 16:57:20 +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 1CE041800B71; Mon, 3 Aug 2020 16:57:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 073GvGOX007722 for ; Mon, 3 Aug 2020 12:57:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4200A7176F; Mon, 3 Aug 2020 16:57:16 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5572371778 for ; Mon, 3 Aug 2020 16:57:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596473852; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=SElWkzHmp/owBmaC+b98RKKSvwybzMKthTzyyd6xcgw=; b=iiAJrNAigIqc8VvKVlaskfkY0XW4nBi2nRjXbk79mTsRqX2uJ9IBHnfV5De0KSK9qCBJcf Wj1eD07151nG7g65hNoZwhI6wiHOgDW77ISuUwqfgvZqett6W1VjJVTuwMFwWL1EY4rk1s sMGZ0m5ducySXgMpGV8ftP6IiIyGMCc= X-MC-Unique: 0QtymlRRPICK4amfzWnacQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 07/19] Move debug statements after declarations Date: Mon, 3 Aug 2020 18:56:44 +0200 Message-Id: <91e7e19e2401810cf7c91744e350461cef94c369.1596473604.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Many of our functions start with a DEBUG statement. Move the statements after declarations to appease our coding style. Signed-off-by: J=C3=A1n Tomko --- src/lxc/lxc_container.c | 4 +++- src/nwfilter/nwfilter_ebiptables_driver.c | 8 ++++++-- src/qemu/qemu_domain.c | 6 ++++-- src/qemu/qemu_monitor.c | 9 ++++++--- src/remote/remote_daemon_dispatch.c | 6 +++--- src/remote/remote_daemon_stream.c | 13 ++++++++----- src/remote/remote_driver.c | 21 ++++++++++++--------- src/rpc/virnetclient.c | 4 +++- src/storage/storage_backend_disk.c | 2 +- src/storage/storage_file_fs.c | 3 ++- src/util/virdbus.c | 2 +- src/util/virfirewall.c | 3 ++- src/util/virnetdevip.c | 4 +++- src/util/virobject.c | 5 +++-- src/util/virprocess.c | 3 ++- src/util/virstoragefile.c | 8 ++++---- 16 files changed, 63 insertions(+), 38 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 6e98f133a9..ede419c275 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -291,8 +291,10 @@ static int lxcContainerSetupFDs(int *ttyfd, */ for (j =3D i + 1; j < npassFDs; j++) { if (passFDs[j] =3D=3D wantfd) { - VIR_DEBUG("Clash %zu", j); int newfd =3D dup(passFDs[j]); + + VIR_DEBUG("Clash %zu", j); + if (newfd < 0) { virReportSystemError(errno, _("Cannot move fd %d out of the w= ay"), diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfil= ter_ebiptables_driver.c index 6aefbe226b..e73aa82eb4 100644 --- a/src/nwfilter/nwfilter_ebiptables_driver.c +++ b/src/nwfilter/nwfilter_ebiptables_driver.c @@ -2655,8 +2655,10 @@ ebtablesRemoveSubChainsQuery(virFirewallPtr fw, const char *chainprefixes =3D opaque; =20 for (i =3D 0; lines[i] !=3D NULL; i++) { - VIR_DEBUG("Considering '%s'", lines[i]); char *tmp =3D strstr(lines[i], "-j "); + + VIR_DEBUG("Considering '%s'", lines[i]); + if (!tmp) continue; tmp =3D tmp + 3; @@ -2757,8 +2759,10 @@ ebtablesRenameTmpSubAndRootChainsQuery(virFirewallPt= r fw, char newchain[MAX_CHAINNAME_LENGTH]; =20 for (i =3D 0; lines[i] !=3D NULL; i++) { - VIR_DEBUG("Considering '%s'", lines[i]); char *tmp =3D strstr(lines[i], "-j "); + + VIR_DEBUG("Considering '%s'", lines[i]); + if (!tmp) continue; tmp =3D tmp + 3; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e5d6430a89..56999c2c46 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6222,12 +6222,14 @@ int qemuDomainLogContextWrite(qemuDomainLogContextP= tr ctxt, ssize_t qemuDomainLogContextRead(qemuDomainLogContextPtr ctxt, char **msg) { + char *buf; + size_t buflen; + VIR_DEBUG("Context read %p manager=3D%p inode=3D%llu pos=3D%llu", ctxt, ctxt->manager, (unsigned long long)ctxt->inode, (unsigned long long)ctxt->pos); - char *buf; - size_t buflen; + if (ctxt->manager) { buf =3D virLogManagerDomainReadLogFile(ctxt->manager, ctxt->path, diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 637361d24d..718ac50c08 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2838,8 +2838,9 @@ qemuMonitorAddDeviceWithFd(qemuMonitorPtr mon, int fd, const char *fdname) { + int ret; + VIR_DEBUG("device=3D%s fd=3D%d fdname=3D%s", devicestr, fd, NULLSTR(fd= name)); - int ret; =20 QEMU_CHECK_MONITOR(mon); =20 @@ -3458,9 +3459,10 @@ qemuMonitorOpenGraphics(qemuMonitorPtr mon, const char *fdname, bool skipauth) { + int ret; + VIR_DEBUG("protocol=3D%s fd=3D%d fdname=3D%s skipauth=3D%d", protocol, fd, NULLSTR(fdname), skipauth); - int ret; =20 QEMU_CHECK_MONITOR(mon); =20 @@ -4168,8 +4170,9 @@ int qemuMonitorGetMemoryDeviceInfo(qemuMonitorPtr mon, virHashTablePtr *info) { + int ret; + VIR_DEBUG("info=3D%p", info); - int ret; =20 *info =3D NULL; =20 diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index c91b5d3293..404712e7c8 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1621,10 +1621,10 @@ static void remoteRelayConnectionClosedEvent(virConnectPtr conn G_GNUC_UNUSED, in= t reason, void *opaque) { virNetServerClientPtr client =3D opaque; - - VIR_DEBUG("Relaying connection closed event, reason %d", reason); - remote_connect_event_connection_closed_msg msg =3D { reason }; + + VIR_DEBUG("Relaying connection closed event, reason %d", reason); + remoteDispatchObjectEventSend(client, remoteProgram, REMOTE_PROC_CONNECT_EVENT_CONNECTION_CLO= SED, (xdrproc_t)xdr_remote_connect_event_conn= ection_closed_msg, diff --git a/src/remote/remote_daemon_stream.c b/src/remote/remote_daemon_s= tream.c index 73e4d7befb..9a62189cd6 100644 --- a/src/remote/remote_daemon_stream.c +++ b/src/remote/remote_daemon_stream.c @@ -434,9 +434,10 @@ int daemonAddClientStream(virNetServerClientPtr client, daemonClientStream *stream, bool transmit) { + daemonClientPrivatePtr priv =3D virNetServerClientGetPrivateData(clien= t); + VIR_DEBUG("client=3D%p, proc=3D%d, serial=3D%u, st=3D%p, transmit=3D%d= ", client, stream->procedure, stream->serial, stream->st, trans= mit); - daemonClientPrivatePtr priv =3D virNetServerClientGetPrivateData(clien= t); =20 if (stream->filterID !=3D -1) { VIR_WARN("Filter already added to client %p", client); @@ -484,12 +485,13 @@ int daemonRemoveClientStream(virNetServerClientPtr client, daemonClientStream *stream) { - VIR_DEBUG("client=3D%p, proc=3D%d, serial=3D%u, st=3D%p", - client, stream->procedure, stream->serial, stream->st); daemonClientPrivatePtr priv =3D virNetServerClientGetPrivateData(clien= t); daemonClientStream *curr =3D priv->streams; daemonClientStream *prev =3D NULL; =20 + VIR_DEBUG("client=3D%p, proc=3D%d, serial=3D%u, st=3D%p", + client, stream->procedure, stream->serial, stream->st); + if (stream->filterID !=3D -1) { virNetServerClientRemoveFilter(client, stream->filterID); @@ -648,11 +650,12 @@ daemonStreamHandleAbort(virNetServerClientPtr client, daemonClientStream *stream, virNetMessagePtr msg) { - VIR_DEBUG("client=3D%p, stream=3D%p, proc=3D%d, serial=3D%u", - client, stream, msg->header.proc, msg->header.serial); int ret; bool raise_error =3D false; =20 + VIR_DEBUG("client=3D%p, stream=3D%p, proc=3D%d, serial=3D%u", + client, stream, msg->header.proc, msg->header.serial); + stream->closed =3D true; virStreamEventRemoveCallback(stream->st); ret =3D virStreamAbort(stream->st); diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 2402f73475..8654046b8d 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -5691,10 +5691,11 @@ remoteStreamSend(virStreamPtr st, const char *data, size_t nbytes) { + struct private_data *priv =3D st->conn->privateData; + virNetClientStreamPtr privst =3D st->privateData; + int rv; + VIR_DEBUG("st=3D%p data=3D%p nbytes=3D%zu", st, data, nbytes); - struct private_data *priv =3D st->conn->privateData; - virNetClientStreamPtr privst =3D st->privateData; - int rv; =20 remoteDriverLock(priv); priv->localUses++; @@ -5719,11 +5720,12 @@ remoteStreamRecvFlags(virStreamPtr st, size_t nbytes, unsigned int flags) { + struct private_data *priv =3D st->conn->privateData; + virNetClientStreamPtr privst =3D st->privateData; + int rv; + VIR_DEBUG("st=3D%p data=3D%p nbytes=3D%zu flags=3D0x%x", st, data, nbytes, flags); - struct private_data *priv =3D st->conn->privateData; - virNetClientStreamPtr privst =3D st->privateData; - int rv; =20 virCheckFlags(VIR_STREAM_RECV_STOP_AT_HOLE, -1); =20 @@ -5760,11 +5762,12 @@ remoteStreamSendHole(virStreamPtr st, long long length, unsigned int flags) { + struct private_data *priv =3D st->conn->privateData; + virNetClientStreamPtr privst =3D st->privateData; + int rv; + VIR_DEBUG("st=3D%p length=3D%lld flags=3D0x%x", st, length, flags); - struct private_data *priv =3D st->conn->privateData; - virNetClientStreamPtr privst =3D st->privateData; - int rv; =20 remoteDriverLock(priv); priv->localUses++; diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index 441f1502a6..42703664fe 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -1556,8 +1556,10 @@ static void virNetClientIOEventLoopPassTheBuck(virNetClientPtr client, virNetClientCallPtr thiscall) { - VIR_DEBUG("Giving up the buck %p", thiscall); virNetClientCallPtr tmp =3D client->waitDispatch; + + VIR_DEBUG("Giving up the buck %p", thiscall); + /* See if someone else is still waiting * and if so, then pass the buck ! */ while (tmp) { diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backe= nd_disk.c index eae23ec24a..a6d4e41220 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -673,10 +673,10 @@ virStorageBackendDiskPartBoundaries(virStoragePoolObj= Ptr pool, virStoragePoolSourceDevicePtr dev =3D &def->source.devices[0]; unsigned long long cylinderSize =3D (unsigned long long)dev->geometry.= heads * dev->geometry.sectors * SECTOR_SIZE; + int partType =3D virStorageBackendDiskPartTypeToCreate(pool); =20 VIR_DEBUG("find free area: allocation %llu, cyl size %llu", allocation, cylinderSize); - int partType =3D virStorageBackendDiskPartTypeToCreate(pool); =20 /* how many extra bytes we have since we allocate aligned to the cylinder boundary */ diff --git a/src/storage/storage_file_fs.c b/src/storage/storage_file_fs.c index 8aafd58992..8d9023bead 100644 --- a/src/storage/storage_file_fs.c +++ b/src/storage/storage_file_fs.c @@ -51,11 +51,12 @@ struct _virStorageFileBackendFsPriv { static void virStorageFileBackendFileDeinit(virStorageSourcePtr src) { + virStorageFileBackendFsPrivPtr priv =3D src->drv->priv; + VIR_DEBUG("deinitializing FS storage file %p (%s:%s)", src, virStorageTypeToString(virStorageSourceGetActualType(src)), src->path); =20 - virStorageFileBackendFsPrivPtr priv =3D src->drv->priv; =20 VIR_FREE(priv->canonpath); VIR_FREE(priv); diff --git a/src/util/virdbus.c b/src/util/virdbus.c index f512031b42..fbfc09c949 100644 --- a/src/util/virdbus.c +++ b/src/util/virdbus.c @@ -862,8 +862,8 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter, dbustype *x =3D (dbustype *)&v.member; \ vargtype *y; \ if (arrayref) { \ - VIR_DEBUG("Use arrayref"); \ vargtype **xptrptr =3D arrayptr; \ + VIR_DEBUG("Use arrayref"); \ if (VIR_EXPAND_N(*xptrptr, *narrayptr, 1) < 0) \ goto cleanup; \ y =3D (*xptrptr + (*narrayptr - 1)); \ diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index 12905165d4..22e717bce4 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -830,10 +830,11 @@ virFirewallApply(virFirewallPtr firewall) VIR_DEBUG("Applying groups for %p", firewall); for (i =3D 0; i < firewall->ngroups; i++) { if (virFirewallApplyGroup(firewall, i) < 0) { - VIR_DEBUG("Rolling back groups up to %zu for %p", i, firewall); size_t first =3D i; virErrorPtr saved_error; =20 + VIR_DEBUG("Rolling back groups up to %zu for %p", i, firewall); + virErrorPreserveLast(&saved_error); =20 /* diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c index 409f062c5c..8c66baa884 100644 --- a/src/util/virnetdevip.c +++ b/src/util/virnetdevip.c @@ -296,8 +296,10 @@ virNetDevIPRouteAdd(const char *ifname, =20 /* If we have no valid network address, then use the default one */ if (!addr || !VIR_SOCKET_ADDR_VALID(addr)) { - VIR_DEBUG("computing default address"); int family =3D VIR_SOCKET_ADDR_FAMILY(gateway); + + VIR_DEBUG("computing default address"); + if (family =3D=3D AF_INET) { if (virSocketAddrParseIPv4(&defaultAddr, VIR_SOCKET_ADDR_IPV4_= ALL) < 0) return -1; diff --git a/src/util/virobject.c b/src/util/virobject.c index 3f0bcc38ea..a6305354c3 100644 --- a/src/util/virobject.c +++ b/src/util/virobject.c @@ -315,11 +315,12 @@ virObjectRWLockableNew(virClassPtr klass) =20 static void vir_object_finalize(GObject *gobj) { - PROBE(OBJECT_DISPOSE, "obj=3D%p", gobj); virObjectPtr obj =3D VIR_OBJECT(gobj); virObjectPrivate *priv =3D vir_object_get_instance_private(obj); - virClassPtr klass =3D priv->klass; + + PROBE(OBJECT_DISPOSE, "obj=3D%p", gobj); + while (klass) { if (klass->dispose) klass->dispose(obj); diff --git a/src/util/virprocess.c b/src/util/virprocess.c index a9afa2e665..6f03627c42 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -444,11 +444,12 @@ int virProcessKillPainfully(pid_t pid, bool force) int virProcessSetAffinity(pid_t pid, virBitmapPtr map) { size_t i; - VIR_DEBUG("Set process affinity on %lld", (long long)pid); int numcpus =3D 1024; size_t masklen; cpu_set_t *mask; =20 + VIR_DEBUG("Set process affinity on %lld", (long long)pid); + /* Not only may the statically allocated cpu_set_t be too small, * but there is no way to ask the kernel what size is large enough. * So you have no option but to pick a size, try, catch EINVAL, diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index f529f0faf3..51037c691f 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -5335,14 +5335,14 @@ virStorageFileGetMetadata(virStorageSourcePtr src, uid_t uid, gid_t gid, bool report_broken) { + virHashTablePtr cycle =3D NULL; + virStorageType actualType =3D virStorageSourceGetActualType(src); + int ret =3D -1; + VIR_DEBUG("path=3D%s format=3D%d uid=3D%u gid=3D%u report_broken=3D%d", src->path, src->format, (unsigned int)uid, (unsigned int)gid, report_broken); =20 - virHashTablePtr cycle =3D NULL; - virStorageType actualType =3D virStorageSourceGetActualType(src); - int ret =3D -1; - if (!(cycle =3D virHashCreate(5, NULL))) return -1; =20 --=20 2.26.2