From nobody Sat Nov 29 10:19:12 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=1764264913; cv=none; d=zohomail.com; s=zohoarc; b=i5qNEGhAMdQGBaYT3zpPaZR/OEzyIM+Ya02ERm9M7MO+Q90qjN7W0gzNDg2vlogePmOxd4CyY06tYuMgol26bsHkGDsA+rtgjjp5Ca96NYSAcPAyFXof7iWEPFwxUxvAm/jx39yMmAHyd+FTQhqGJdQqxynlD9fjWr8XYnm1X2w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764264913; 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=Qrz6uqZ8id/hIeHHI1j4NbP6cH4LsPuTNTQJjCY5ro0=; b=cgtDFAt7Xq5bZSVp+4f2Prqh9oK5BtbHAzyNzr6rPoM4EEoQiNOXOSeDCtcYP7p09AHahIfQZh3Gdzy1yGWcyVd3RNTBBFKuJSWafL5usTUPlAT9t9eZKX870ozB1N6ZZ2+m+zx+KvdgCG81fdRZ1XWqcy2Ur0JyNFZ/ZtNY6y4= 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 1764264913385998.5188749341776; Thu, 27 Nov 2025 09:35:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vOfsg-0004TQ-IY; Thu, 27 Nov 2025 12:34:10 -0500 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 1vOfsb-0004Rm-Us for qemu-devel@nongnu.org; Thu, 27 Nov 2025 12:34:05 -0500 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 1vOfsX-0001Fs-Dx for qemu-devel@nongnu.org; Thu, 27 Nov 2025 12:34:04 -0500 Received: from mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net [IPv6:2a02:6b8:c24:fa2:0:640:41ee:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id B182B80C4E; Thu, 27 Nov 2025 20:33:55 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6bf:8080:834::1:7]) by mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id rXiJgL0F7Os0-9L2QmjXC; Thu, 27 Nov 2025 20:33:55 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1764264835; bh=Qrz6uqZ8id/hIeHHI1j4NbP6cH4LsPuTNTQJjCY5ro0=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=nxKYTMMec3gOgNU+9vpi5tzNSHhW3OF67BYo9APzFcWP2pbbaZ/ZITca0NLRUKceB SrzN19oQug15ay44xx2kyyoT5+/JhW44fC3rUxowr78QEcmrAu3dcBCtmfyQeUD4ir 01WGHT6AX3RNASGEcgvI5MENrtkMxGRVXfySDLTk= Authentication-Results: mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: dave@treblig.org, armbru@redhat.com Cc: pbonzini@redhat.com, marcandre.lureau@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru Subject: [PATCH 1/5] ui/vnc: don't use of error_printf_unless_qmp() Date: Thu, 27 Nov 2025 20:33:48 +0300 Message-ID: <20251127173352.283731-2-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20251127173352.283731-1-vsementsov@yandex-team.ru> References: <20251127173352.283731-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list 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: 1764264915425019200 Content-Type: text/plain; charset="utf-8" That's not a big deal to print these messages to log, if QMP monitor is active. And these two are the only users of this API. To simplify things, let's use more usual error_report() and info_report(), and drop error_printf_unless_qmp() in the following commit. Drop \n from messages, as vreport() adds one. Signed-off-by: Vladimir Sementsov-Ogievskiy --- ui/vnc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index e6bcf0e1cf..ffeed5788e 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3534,8 +3534,8 @@ int vnc_display_password(const char *id, const char *= password) return -EINVAL; } if (vd->auth =3D=3D VNC_AUTH_NONE) { - error_printf_unless_qmp("If you want use passwords please enable " - "password auth using '-vnc ${dpy},password= '.\n"); + error_report("If you want use passwords please enable " + "password auth using '-vnc ${dpy},password'."); return -EINVAL; } =20 @@ -3574,9 +3574,8 @@ static void vnc_display_print_local_addr(VncDisplay *= vd) qapi_free_SocketAddress(addr); return; } - error_printf_unless_qmp("VNC server running on %s:%s\n", - addr->u.inet.host, - addr->u.inet.port); + info_report("VNC server running on %s:%s", addr->u.inet.host, + addr->u.inet.port); qapi_free_SocketAddress(addr); } =20 --=20 2.48.1 From nobody Sat Nov 29 10:19:12 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=1764264901; cv=none; d=zohomail.com; s=zohoarc; b=GL0l3iCkpRYh5MwmJSGe9okHCpikbFVvhUy/uw5Y9KSgttBs760PwxIQqvnC1TgE7zGh/5eJjjvjdiQF5rDkchyHWru3W/EbZlmIP2fVGaBhzdu6r7kWfJtafB98SrX9dfGU+7nyZlcqIUipNBOkaYiVDwc4vRl/gbuVvfseZLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764264901; 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=21bOsdj8Db2Anq8WOkQGn/n5zY4kVb5bAQZaJlGVSSI=; b=n9NVoyzkLc4v+/IWFOqD4VUglwyJkqGOZg0alAQVGsvmDhoJqVILmAeS2D7aubqxp+TtEAhTY9q+CZA6U9bkE+0tEtckIxXTFLK3KNqHRZzaOb6l0T4o7qO1Y4ixXGwHv6H/uqiexX7yDjDcaeV/0D+QcOWp3n2n+ZfxT4sWRCU= 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 1764264901619554.0089222793036; Thu, 27 Nov 2025 09:35:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vOfsh-0004U0-KV; Thu, 27 Nov 2025 12:34:11 -0500 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 1vOfsb-0004Rq-UX for qemu-devel@nongnu.org; Thu, 27 Nov 2025 12:34:05 -0500 Received: from forwardcorp1b.mail.yandex.net ([2a02:6b8:c02:900:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vOfsX-0001GD-Dz for qemu-devel@nongnu.org; Thu, 27 Nov 2025 12:34:03 -0500 Received: from mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net [IPv6:2a02:6b8:c24:fa2:0:640:41ee:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 448DD80DEE; Thu, 27 Nov 2025 20:33:56 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6bf:8080:834::1:7]) by mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id rXiJgL0F7Os0-nKkrkL6N; Thu, 27 Nov 2025 20:33:55 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1764264835; bh=21bOsdj8Db2Anq8WOkQGn/n5zY4kVb5bAQZaJlGVSSI=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=1hVeVE77GNWGI2qNR8WR98AF8wtVXR3eUvkw0xQ4N39a0BGAJxRZWAhnJN5+09TEg d0Es3kHlrmDpr9xsxemX0op+U+hsF2iJO/+aIbuX0jCiqTqILNeMZOlVmIStlQroPe wSyIC+rBIa8nmwCKBu+Lp3DzD5T5To1aAf4tdtVs= Authentication-Results: mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: dave@treblig.org, armbru@redhat.com Cc: pbonzini@redhat.com, marcandre.lureau@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru Subject: [PATCH 2/5] monitor: remove unused error_printf_unless_qmp() function Date: Thu, 27 Nov 2025 20:33:49 +0300 Message-ID: <20251127173352.283731-3-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20251127173352.283731-1-vsementsov@yandex-team.ru> References: <20251127173352.283731-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=2a02:6b8:c02:900:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list 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: 1764264903327019200 Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/monitor/monitor.h | 3 --- monitor/monitor.c | 24 ------------------------ stubs/error-printf.c | 5 ----- 3 files changed, 32 deletions(-) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index c3740ec616..296690e1f1 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -59,7 +59,4 @@ void monitor_register_hmp(const char *name, bool info, void monitor_register_hmp_info_hrt(const char *name, HumanReadableText *(*handler)(Error **e= rrp)); =20 -int error_vprintf_unless_qmp(const char *fmt, va_list ap) G_GNUC_PRINTF(1,= 0); -int error_printf_unless_qmp(const char *fmt, ...) G_GNUC_PRINTF(1, 2); - #endif /* MONITOR_H */ diff --git a/monitor/monitor.c b/monitor/monitor.c index c5a5d30877..b5007c1851 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -281,30 +281,6 @@ int error_vprintf(const char *fmt, va_list ap) return vfprintf(stderr, fmt, ap); } =20 -int error_vprintf_unless_qmp(const char *fmt, va_list ap) -{ - Monitor *cur_mon =3D monitor_cur(); - - if (!cur_mon) { - return vfprintf(stderr, fmt, ap); - } - if (!monitor_cur_is_qmp()) { - return monitor_vprintf(cur_mon, fmt, ap); - } - return -1; -} - -int error_printf_unless_qmp(const char *fmt, ...) -{ - va_list ap; - int ret; - - va_start(ap, fmt); - ret =3D error_vprintf_unless_qmp(fmt, ap); - va_end(ap); - return ret; -} - static MonitorQAPIEventConf monitor_qapi_event_conf[QAPI_EVENT__MAX] =3D { /* Limit guest-triggerable events to 1 per second */ [QAPI_EVENT_RTC_CHANGE] =3D { 1000 * SCALE_MS }, diff --git a/stubs/error-printf.c b/stubs/error-printf.c index 0e326d8010..1afa0f62ca 100644 --- a/stubs/error-printf.c +++ b/stubs/error-printf.c @@ -16,8 +16,3 @@ int error_vprintf(const char *fmt, va_list ap) } return vfprintf(stderr, fmt, ap); } - -int error_vprintf_unless_qmp(const char *fmt, va_list ap) -{ - return error_vprintf(fmt, ap); -} --=20 2.48.1 From nobody Sat Nov 29 10:19:12 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=1764264905; cv=none; d=zohomail.com; s=zohoarc; b=mxCmra46SwEaJMflJmRVkIdrr7Z1bJZPKphSaOcqgiNORi1m7DAtD2R3T0g3MmE59fG/WH5bZfNx9b1VYSDCd3ylkKv3DfhDK4r9MVuQA1CwNi97O9wmn56gu0gZCYddxsTHo2K8LO+mOlXp8VPoBFjXGSbG4Sg/taGVs/mh+VI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764264905; 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=JHAhwuo2n4HbMnqt206gdLWBdiRPW678482/oYIg4wM=; b=jKpdPjXQo3anSTCYgJr8vWH1Vb/GsXXTB5nK3uj6x3NNAe4j3LU5EUXN31Qp/ZK+tfJHr4yhsxwkxTnRCf7D1oSZqD7PPeJAieZvQL51FRSS8Zs9LTa13GX3gp+rYeOz8K7V0tgKCc+eVceTY3dFDy5cjLQizttXEzEvWVaN694= 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 17642649059022.4977855870016583; Thu, 27 Nov 2025 09:35:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vOfsg-0004TU-Ur; Thu, 27 Nov 2025 12:34:10 -0500 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 1vOfsb-0004Rt-V7 for qemu-devel@nongnu.org; Thu, 27 Nov 2025 12:34:05 -0500 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 1vOfsX-0001GG-19 for qemu-devel@nongnu.org; Thu, 27 Nov 2025 12:34:04 -0500 Received: from mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net [IPv6:2a02:6b8:c24:fa2:0:640:41ee:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id D640080DF1; Thu, 27 Nov 2025 20:33:56 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6bf:8080:834::1:7]) by mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id rXiJgL0F7Os0-6LvukXpO; Thu, 27 Nov 2025 20:33:56 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1764264836; bh=JHAhwuo2n4HbMnqt206gdLWBdiRPW678482/oYIg4wM=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=oM+qDcYEa/PzVv3ijIB74FIStnKFhyKMSccO82PrNAJ+MIBjJSwoQ+g/vpOcJDnWk FFn86CJMpvWvxms/2he6EvNyEJIcrVFhgohMXEei+lbtpyXF44HVrVldU4AdkY7KNc /J36YMEd03bSMdLGRnYAvwzo3po4ESDljnKlRano= Authentication-Results: mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: dave@treblig.org, armbru@redhat.com Cc: pbonzini@redhat.com, marcandre.lureau@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru Subject: [PATCH 3/5] monitor: rework monitor_cur_is_qmp() into monitor_cur_is_hmp() Date: Thu, 27 Nov 2025 20:33:50 +0300 Message-ID: <20251127173352.283731-4-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20251127173352.283731-1-vsementsov@yandex-team.ru> References: <20251127173352.283731-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list 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: 1764264907995019200 Content-Type: text/plain; charset="utf-8" Condition in error_vprintf() becomes simpler. Also we are going to reuse monitor_cur_is_hmp() in the following commit. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/monitor/monitor.h | 2 +- monitor/monitor.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index 296690e1f1..b531108eeb 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -15,7 +15,7 @@ extern QemuOptsList qemu_mon_opts; =20 Monitor *monitor_cur(void); Monitor *monitor_set_cur(Coroutine *co, Monitor *mon); -bool monitor_cur_is_qmp(void); +bool monitor_cur_is_hmp(void); =20 void monitor_init_globals(void); void monitor_init_globals_core(void); diff --git a/monitor/monitor.c b/monitor/monitor.c index b5007c1851..8ca17e9326 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -109,11 +109,11 @@ Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) /** * Is the current monitor, if any, a QMP monitor? */ -bool monitor_cur_is_qmp(void) +bool monitor_cur_is_hmp(void) { Monitor *cur_mon =3D monitor_cur(); =20 - return cur_mon && monitor_is_qmp(cur_mon); + return cur_mon && !monitor_is_qmp(cur_mon); } =20 /** @@ -275,7 +275,7 @@ int error_vprintf(const char *fmt, va_list ap) { Monitor *cur_mon =3D monitor_cur(); =20 - if (cur_mon && !monitor_cur_is_qmp()) { + if (monitor_cur_is_hmp()) { return monitor_vprintf(cur_mon, fmt, ap); } return vfprintf(stderr, fmt, ap); --=20 2.48.1 From nobody Sat Nov 29 10:19:12 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=1764264896; cv=none; d=zohomail.com; s=zohoarc; b=Nf51CF5heO8Xgm2aLjj8fjbvL0ivKSEgVRiDwnfMJdvl/oZ8l91Qf4S23eevnHER41W42tpP9WG/np8P8aUDKOGCUH1ppUarrGz6v5yuErNf/lAv8sb1cTWs7somE0UyOe8RnQQJbfX83TwhuDkqB8aSaBSN0Jc7rhMQYv3GMO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764264896; 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=6vx3WhUktEBcatqeazVbFbGZoG58FOOHtw8XzeX1II8=; b=DA2a4lmydeETiFTRbwIpgnsQx8J4BPHa39sYx5OLjaDWXU3u89ycNiXBCfYM8sLVEjfauuZ9b1OdcjwgUfz0GQ9XG1j10aSXPlSDTk2chr6rTRZHG5sd9itQk6+Yhnr8w7bZMuRyZPvaNQIxb9eJ6rXcQT3oVGTQ/JhbciG8KH0= 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 1764264895705889.6441025362479; Thu, 27 Nov 2025 09:34:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vOfsh-0004Tb-2z; Thu, 27 Nov 2025 12:34:11 -0500 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 1vOfsb-0004Rl-TH for qemu-devel@nongnu.org; Thu, 27 Nov 2025 12:34:05 -0500 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 1vOfsW-0001GL-Po for qemu-devel@nongnu.org; Thu, 27 Nov 2025 12:34:04 -0500 Received: from mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net [IPv6:2a02:6b8:c24:fa2:0:640:41ee:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 7213680DF2; Thu, 27 Nov 2025 20:33:57 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6bf:8080:834::1:7]) by mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id rXiJgL0F7Os0-QM1lMLMF; Thu, 27 Nov 2025 20:33:57 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1764264837; bh=6vx3WhUktEBcatqeazVbFbGZoG58FOOHtw8XzeX1II8=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=ITvSI1GaRss+iwKWRSeTF0cgc/Ff62rOXTEzm04ExAGCGCdNwBVJinS5LSrP5McUX AymT//hriMWJ6/Y/GCmYRwg2UEY5luV1y2gIX4LjcM5t32YOcwS/ofSro31Nm9iadL 0tYkaAcDQpNWj/BLEI061IgFhW1iSvhxWcEvyL4Q= Authentication-Results: mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: dave@treblig.org, armbru@redhat.com Cc: pbonzini@redhat.com, marcandre.lureau@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru Subject: [PATCH 4/5] error: print error_report timestamp when QMP monitor is active Date: Thu, 27 Nov 2025 20:33:51 +0300 Message-ID: <20251127173352.283731-5-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20251127173352.283731-1-vsementsov@yandex-team.ru> References: <20251127173352.283731-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list 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: 1764264899821019200 Content-Type: text/plain; charset="utf-8" We skip printing timestamp when _any_ monitor is active. But then, in production (where QMP is usually used) we lack timestamps in logs. Let's go a bit further, and use same logic to detect HMP monitor in the whole util/error-report.c like in error_vprintf(). Signed-off-by: Vladimir Sementsov-Ogievskiy --- stubs/monitor-core.c | 5 +++++ tests/unit/test-util-sockets.c | 1 + util/error-report.c | 23 ++++++++++++++--------- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/stubs/monitor-core.c b/stubs/monitor-core.c index 1894cdfe1f..275cb0cbfa 100644 --- a/stubs/monitor-core.c +++ b/stubs/monitor-core.c @@ -7,6 +7,11 @@ Monitor *monitor_cur(void) return NULL; } =20 +bool monitor_cur_is_hmp(void) +{ + return false; +} + Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) { return NULL; diff --git a/tests/unit/test-util-sockets.c b/tests/unit/test-util-sockets.c index ee66d727c3..4b7f408902 100644 --- a/tests/unit/test-util-sockets.c +++ b/tests/unit/test-util-sockets.c @@ -74,6 +74,7 @@ int monitor_get_fd(Monitor *mon, const char *fdname, Erro= r **errp) Monitor *monitor_cur(void) { return cur_mon; } Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) { abort(); } int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) { abort(); } +bool monitor_cur_is_hmp(void) { return false; } =20 #ifndef _WIN32 static void test_socket_fd_pass_name_good(void) diff --git a/util/error-report.c b/util/error-report.c index 1b17c11de1..7ffbcf2123 100644 --- a/util/error-report.c +++ b/util/error-report.c @@ -144,7 +144,7 @@ static void print_loc(void) int i; const char *const *argp; =20 - if (!monitor_cur() && g_get_prgname()) { + if (!monitor_cur_is_hmp() && g_get_prgname()) { error_printf("%s:", g_get_prgname()); sep =3D " "; } @@ -188,15 +188,20 @@ static void vreport(report_type type, const char *fmt= , va_list ap) { gchar *timestr; =20 - if (message_with_timestamp && !monitor_cur()) { - timestr =3D real_time_iso8601(); - error_printf("%s ", timestr); - g_free(timestr); - } + if (!monitor_cur_is_hmp()) { + if (message_with_timestamp) { + timestr =3D real_time_iso8601(); + error_printf("%s ", timestr); + g_free(timestr); + } =20 - /* Only prepend guest name if -msg guest-name and -name guest=3D... ar= e set */ - if (error_with_guestname && error_guest_name && !monitor_cur()) { - error_printf("%s ", error_guest_name); + /* + * Only prepend guest name if -msg guest-name and -name guest=3D... + * are set. + */ + if (error_with_guestname && error_guest_name) { + error_printf("%s ", error_guest_name); + } } =20 print_loc(); --=20 2.48.1 From nobody Sat Nov 29 10:19:12 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=1764264913; cv=none; d=zohomail.com; s=zohoarc; b=QSgxZqh9hPyVz6Z6Lotxk8a+tK3i8RBuPgGGoAoOVgfXcJ82fkENAtCYgd+stIUXNhesa/pelKoeFHdTDCkJ0M84sB0jfN+YDItfdBFM4YS1sK0S5hXU7leKZ1swhjczF+gff69gD0XD/nfSNwhilU42yM4liTYe5Ph2xATdkJ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764264913; 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=ueby3IU3TcupzmFwaUbWLNrW2a/+cLbdDLEJHIRz1bE=; b=mPauygIHWOLysxj8KYFPmr6qu15bWsnmzfLjuG5xUHgRmaIWK2wfO1zO++WvsujMbOVm3N/kqe12+qEV81l+yvzc+dIGXG6k8rbK6E510wUEMAsX+xc1r5eElWAjZGEJL03wbrDh73hScOu3eMHGxTxj024iCHyG9skAW7wtHEE= 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 176426491337911.035968630314187; Thu, 27 Nov 2025 09:35:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vOfsh-0004TY-2E; Thu, 27 Nov 2025 12:34:11 -0500 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 1vOfsb-0004Rn-Uv for qemu-devel@nongnu.org; Thu, 27 Nov 2025 12:34:05 -0500 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 1vOfsX-0001Gr-Mx for qemu-devel@nongnu.org; Thu, 27 Nov 2025 12:34:05 -0500 Received: from mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net [IPv6:2a02:6b8:c24:fa2:0:640:41ee:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 1348180DF3; Thu, 27 Nov 2025 20:33:58 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6bf:8080:834::1:7]) by mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id rXiJgL0F7Os0-K9ftgLa0; Thu, 27 Nov 2025 20:33:57 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1764264837; bh=ueby3IU3TcupzmFwaUbWLNrW2a/+cLbdDLEJHIRz1bE=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=FDOK4f6ARNBodCvNTfwYB26PYi6GOxeE2kCnhvYI8wHRxFiOlrmhVpQjWnfyK7BQ7 P3CFPVmuAqpDEHpxubjuDgfLm1XoYSbxNPNeuJaV9xlL90JmotWKW98U8+zyWAVpXs 1rh6Tv47GH/C4f3EJSnYvVWFzhYTzF2Yu5X7mqJE= Authentication-Results: mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: dave@treblig.org, armbru@redhat.com Cc: pbonzini@redhat.com, marcandre.lureau@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru Subject: [PATCH 5/5] error-report: fix doc for vreport() Date: Thu, 27 Nov 2025 20:33:52 +0300 Message-ID: <20251127173352.283731-6-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20251127173352.283731-1-vsementsov@yandex-team.ru> References: <20251127173352.283731-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list 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: 1764264915415019200 Content-Type: text/plain; charset="utf-8" We actually don't print any errors to QMP monitor. Signed-off-by: Vladimir Sementsov-Ogievskiy --- util/error-report.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/error-report.c b/util/error-report.c index 7ffbcf2123..0f3b1c0354 100644 --- a/util/error-report.c +++ b/util/error-report.c @@ -177,7 +177,7 @@ real_time_iso8601(void) } =20 /* - * Print a message to current monitor if we have one, else to stderr. + * Print a message to current HMP monitor if we have one, else to stderr. * @report_type is the type of message: error, warning or informational. * Format arguments like vsprintf(). The resulting message should be * a single phrase, with no newline or trailing punctuation. --=20 2.48.1