From nobody Wed May 8 04:57:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1641298754642331.8724170344083; Tue, 4 Jan 2022 04:19:14 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-20-TCZJuLPeNG2gkYV0mmaR9Q-1; Tue, 04 Jan 2022 07:19:12 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E22A82F24; Tue, 4 Jan 2022 12:19:07 +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 C214174EB2; Tue, 4 Jan 2022 12:19:07 +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 91D934CA9B; Tue, 4 Jan 2022 12:19:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 204CI6kp012261 for ; Tue, 4 Jan 2022 07:18:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id D38FC141DC29; Tue, 4 Jan 2022 12:18:06 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast09.extmail.prod.ext.rdu2.redhat.com [10.11.55.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF37A140EBFE for ; Tue, 4 Jan 2022 12:18:06 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B1B0528EC104 for ; Tue, 4 Jan 2022 12:18:06 +0000 (UTC) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-203-BHjA-cj-MjWaTjZDVtt5lw-1; Tue, 04 Jan 2022 07:18:04 -0500 Received: by mail-pj1-f53.google.com with SMTP id r16-20020a17090a0ad000b001b276aa3aabso27551828pje.0 for ; Tue, 04 Jan 2022 04:18:04 -0800 (PST) Received: from anisinha-lenovo.ba.nuagenetworks.net ([115.96.106.16]) by smtp.googlemail.com with ESMTPSA id 36sm28450416pgq.94.2022.01.04.04.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 04:18:02 -0800 (PST) X-MC-Unique: TCZJuLPeNG2gkYV0mmaR9Q-1 X-MC-Unique: BHjA-cj-MjWaTjZDVtt5lw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=STNRnAMGo93nb/m6hCPsDJVtaJB5Dl8khibsbwzj5WI=; b=l+Ckv2cFbxh/z0I7e7StbwrqqXem2xyRkAGjMRFHS9JA/m83iA35Lo5DRxISckZ8n5 4V1kjnoegU6zkObCIjr5jvBmrSDBME2TrqWo/+XbWVWdH3OrlXOdzbLL894Fe6lb68PS yZF01VfvZcoZgxHBz7x5s7ewkssAxJfEWPLoI5HBGM6icztyQEqWfKw4fK6wW948e8cO Oi4Dww1B1thJpeLCfc5rmH0tn8rHV13w9UZO0XZLzklT/nmVsOIPifFTsRlXvR6Nu4+U APeab5siXPyBBlkEdrN+stSw1SqJw78mmERLRxnqBVXzerQqTV1ig5fp1kqPlEvgcq5O byEg== X-Gm-Message-State: AOAM530Xj5jkeb1+H68lyKb/CTZy/dVZJ+hQJ6dkKys4mhOLKZYEkkny kXZMePOovPzCwNM8Qh6cRpjgIB9zM7MT5+u0 X-Google-Smtp-Source: ABdhPJzkHV1JoO6hQPhKGtu7iBqqDhIFRb3J+aTcZWyS3lNRn8AM2znwKu2ylhVGWOpLRhdHgqkZBA== X-Received: by 2002:a17:902:c94b:b0:149:22af:ed1c with SMTP id i11-20020a170902c94b00b0014922afed1cmr48062113pla.78.1641298682965; Tue, 04 Jan 2022 04:18:02 -0800 (PST) From: Ani Sinha To: libvir-list@redhat.com Subject: [PATCH] qemu: agent: remove all code around disabled DEBUG_IO/DEBUG_RAW_IO definitions Date: Tue, 4 Jan 2022 17:47:43 +0530 Message-Id: <20220104121743.46949-1-ani@anisinha.ca> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-loop: libvir-list@redhat.com Cc: Ani Sinha 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.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1641298755419100001 Content-Type: text/plain; charset="utf-8" DEBUG_IO and DEBUG_RAW_IO are disabled and hence the code #defined under th= em are useless. Remove them. Also remove similar useless code from qemu_monitor_json. See also 4aae00bf1287f ("qemu: monitor: Remove disabled debug infrastructur= e") Signed-off-by: Ani Sinha Reviewed-by: Peter Krempa --- src/qemu/qemu_agent.c | 51 ------------------------------------ src/qemu/qemu_monitor_json.c | 4 --- 2 files changed, 55 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index cb3bf97415..f33cd47078 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -48,9 +48,6 @@ VIR_LOG_INIT("qemu.qemu_agent"); =20 #define LINE_ENDING "\n" =20 -#define DEBUG_IO 0 -#define DEBUG_RAW_IO 0 - /* We read from QEMU until seeing a \r\n pair to indicate a * completed reply or event. To avoid memory denial-of-service * though, we must have a size limit on amount of data we @@ -137,25 +134,6 @@ static int qemuAgentOnceInit(void) VIR_ONCE_GLOBAL_INIT(qemuAgent); =20 =20 -#if DEBUG_RAW_IO -static char * -qemuAgentEscapeNonPrintable(const char *text) -{ - size_t i; - g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; - for (i =3D 0; text[i] !=3D '\0'; i++) { - if (text[i] =3D=3D '\\') - virBufferAddLit(&buf, "\\\\"); - else if (g_ascii_isprint(text[i]) || text[i] =3D=3D '\n' || - (text[i] =3D=3D '\r' && text[i+1] =3D=3D '\n')) - virBufferAddChar(&buf, text[i]); - else - virBufferAsprintf(&buf, "\\x%02x", text[i]); - } - return virBufferContentAndReset(&buf); -} -#endif - =20 static void qemuAgentDispose(void *obj) { @@ -300,14 +278,6 @@ static int qemuAgentIOProcessData(qemuAgent *agent, { int used =3D 0; size_t i =3D 0; -#if DEBUG_IO -# if DEBUG_RAW_IO - g_autofree char *str1 =3D qemuAgentEscapeNonPrintable(data); - VIR_ERROR(_("[%s]"), str1); -# else - VIR_DEBUG("Data %zu bytes [%s]", len, data); -# endif -#endif =20 while (used < len) { char *nl =3D strstr(data + used, LINE_ENDING); @@ -344,17 +314,6 @@ qemuAgentIOProcess(qemuAgent *agent) if (agent->msg && agent->msg->txOffset =3D=3D agent->msg->txLength) msg =3D agent->msg; =20 -#if DEBUG_IO -# if DEBUG_RAW_IO - g_autofree char *str1 =3D qemuAgentEscapeNonPrintable(msg ? msg->txBuf= fer : ""); - g_autofree char *str2 =3D qemuAgentEscapeNonPrintable(agent->buffer); - VIR_ERROR(_("Process %zu %p %p [[[%s]]][[[%s]]]"), - agent->bufferOffset, agent->msg, msg, str1, str2); -# else - VIR_DEBUG("Process %zu", agent->bufferOffset); -# endif -#endif - len =3D qemuAgentIOProcessData(agent, agent->buffer, agent->bufferOffset, msg); @@ -369,9 +328,6 @@ qemuAgentIOProcess(qemuAgent *agent) VIR_FREE(agent->buffer); agent->bufferOffset =3D agent->bufferLength =3D 0; } -#if DEBUG_IO - VIR_DEBUG("Process done %zu used %d", agent->bufferOffset, len); -#endif if (msg && msg->finished) virCondBroadcast(&agent->notify); return len; @@ -455,10 +411,6 @@ qemuAgentIORead(qemuAgent *agent) agent->buffer[agent->bufferOffset] =3D '\0'; } =20 -#if DEBUG_IO - VIR_DEBUG("Now read %zu bytes of data", agent->bufferOffset); -#endif - return ret; } =20 @@ -527,9 +479,6 @@ qemuAgentIO(GSocket *socket G_GNUC_UNUSED, virObjectRef(agent); /* lock access to the agent and protect fd */ virObjectLock(agent); -#if DEBUG_IO - VIR_DEBUG("Agent %p I/O on watch %d socket %p cond %d", agent, agent->= socket, cond); -#endif =20 if (agent->fd =3D=3D -1 || !agent->watch) { virObjectUnlock(agent); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index e45b43eb5a..0f1999f413 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -280,10 +280,6 @@ int qemuMonitorJSONIOProcess(qemuMonitor *mon, } } =20 -#if DEBUG_IO - VIR_DEBUG("Total used %d bytes out of %zd available in buffer", used, = len); -#endif - return used; } =20 --=20 2.25.1