From nobody Tue Dec 16 03:19:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1743676905; cv=none; d=zohomail.com; s=zohoarc; b=GLfffBdYQZHrEe7krGkbN54XUSp3hqztWttp0KxegAV7OkWk1yzamCOtbtvjMfD/1jw3J2otjEtGjGczRpyblUUN0TpRjZuenBJlXzCpVYdF175GPc1zkuGsG7Y8v4ISQ+EK2I75AQdF3ppcGnupOKsa+Ehyp8lmGJZy+bfyj9k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1743676905; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=jJqKXgO17kzAjctDWbeb1ryZWxrf0Jfu6u16AFyHyg8=; b=bP4aObCjLD7eMHTzae3VIb8z2yChxhROY6CfbcNNn2206PXoYxexRoL0LdHz93/p/1yV6R67Md0qPc96omXNlbBykOl88arLt+1J1MF7qbO5F+TuHlaq5p9+4ltJgzcCtOAC/gWW5IcolfchuDHVJ1+t8pMK/G4Dgp9YZDR8fd0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1743676905255547.0725325842225; Thu, 3 Apr 2025 03:41:45 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B2C2811DD; Thu, 3 Apr 2025 06:41:44 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id E57F21471; Thu, 3 Apr 2025 06:37:17 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 29C581419; Thu, 3 Apr 2025 06:37:09 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id AAAE31622 for ; Thu, 3 Apr 2025 06:36:54 -0400 (EDT) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-330-SFwVO8cfM1-We9fQ5C2Jpw-1; Thu, 03 Apr 2025 06:36:51 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C7B4C1956089 for ; Thu, 3 Apr 2025 10:36:49 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.3.236]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1E0391955BC2 for ; Thu, 3 Apr 2025 10:36:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743676614; h=from:from: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; bh=T85nJ7FeK+2L8sBPBp0an+KHo87jZulGOCmaPmib6S0=; b=Y1kBw0JzYkGRcGH160zKAlzWBO3OtJm4MVvw5tWPjVL8XT6HSA5BnZKmnEHAwUVqnJnjZA 66bqQOQt/BbeuWCENuL7Hi8y5XaFMU0YWz2YSqe+v3VWNRWV0q59FNd33qIXbb+XL1ClJ/ 4oivAoZFHKYhgea0emGZU47KSD0oBCM= X-MC-Unique: SFwVO8cfM1-We9fQ5C2Jpw-1 X-Mimecast-MFC-AGG-ID: SFwVO8cfM1-We9fQ5C2Jpw_1743676609 To: devel@lists.libvirt.org Subject: [PATCH 1/3] ch: Use CH_DOMAIN_PRIVATE() more Date: Thu, 3 Apr 2025 12:36:43 +0200 Message-ID: <9422d50b24a5e4b040bb6ddffe2356c258582286.1743676591.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: iNxFbNQkgiTCeXOyw5_mmmDiy1GM6Yj8i_W5ct_K43M_1743676609 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: SWJBP7K5AH3WGI4RTNYFCJ7RL6LFIE3C X-Message-ID-Hash: SWJBP7K5AH3WGI4RTNYFCJ7RL6LFIE3C X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1743676905789019000 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik There are two instances where vm->privateData is typecasted only so that it can be dereferenced further. Well, that's exactly what CH_DOMAIN_PRIVATE() macro is for. Use that instead. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/ch/ch_events.c | 2 +- src/ch/ch_process.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ch/ch_events.c b/src/ch/ch_events.c index f1dc5c6f4c..9cb873d8cd 100644 --- a/src/ch/ch_events.c +++ b/src/ch/ch_events.c @@ -54,7 +54,7 @@ static int virCHEventStopProcess(virDomainObj *vm, virDomainShutoffReason reason) { - virCHDriver *driver =3D ((virCHDomainObjPrivate *)vm->privateData)->d= river; + virCHDriver *driver =3D CH_DOMAIN_PRIVATE(vm)->driver; =20 virObjectLock(vm); if (virDomainObjBeginJob(vm, VIR_JOB_DESTROY)) diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c index e8d482da97..6a59bf756a 100644 --- a/src/ch/ch_process.c +++ b/src/ch/ch_process.c @@ -430,8 +430,8 @@ virCHProcessSetupVcpus(virDomainObj *vm) size_t i; =20 if ((vm->def->cputune.period || vm->def->cputune.quota) && - !virCgroupHasController(((virCHDomainObjPrivate *) vm->privateData= )-> - cgroup, VIR_CGROUP_CONTROLLER_CPU)) { + !virCgroupHasController(CH_DOMAIN_PRIVATE(vm)->cgroup, + VIR_CGROUP_CONTROLLER_CPU)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("cgroup cpu is required for scheduler tuning")); return -1; --=20 2.49.0 From nobody Tue Dec 16 03:19:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1743676868; cv=none; d=zohomail.com; s=zohoarc; b=Q8+HOiZ5Fu4UQquHmN79XqVg7meZiOExJ8Vj07czK/JnEb3/lD1GV4+zEqwgpjyEeHZp260z3ge+5zTPoeMKrcxXdT9idk+UJiVh8HSel0iOaPxIodbpYbGSLia4ZRe2j+3TyQ3lOgKS8U8SbaAv3veqhKo20NLu5uboChRkCnY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1743676868; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=fqwpWsKKRyMzgwAqUAwFTOtm+rcSrZJL98dqltzxEGY=; b=keBIYrpa4bkJz8fu5eFdtfoCS7UT3P5UfPiCgF/MhasvvmhJZueO4s7m+kedYrSco0O7+pfhi86uZP3ONCkbSQCmdM3vQJ5SREhvRZK4/UKcD3y5Y0P/mNvIbHZBM4f25leSKyREPk3yOZYmVAjE2YVty0yX7g9nbYA0Zq+7SsM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1743676868659863.9594741838231; Thu, 3 Apr 2025 03:41:08 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id A7B1916F0; Thu, 3 Apr 2025 06:41:07 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 5ECF41490; Thu, 3 Apr 2025 06:37:13 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B3784A5B; Thu, 3 Apr 2025 06:37:07 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 49EC9A5B for ; Thu, 3 Apr 2025 06:36:53 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-341-27jnw4ydNLmc8ovFO3AhPw-1; Thu, 03 Apr 2025 06:36:51 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E69231800259 for ; Thu, 3 Apr 2025 10:36:50 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.3.236]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3C9811955BC2 for ; Thu, 3 Apr 2025 10:36:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743676612; h=from:from: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; bh=2DXyLTuc6WOawk5MMbXmEu2BSjyw7dxUArtNVN/FEFo=; b=N0OgOMWZ+4AI7C/S/EJgc1/xlV6cef1Nru489qicdwoe9+TsA4AcaVDuIR5EiUXk5IP4wV bkXBxNWepKPH/Y4L6icATLYD0j3KFWqjQt1yxaEtcTvkkspivYGxy7/3A/L3+SiEgsv1hJ NZTjelyiiOa6NI742mn1v3j4oYX/S48= X-MC-Unique: 27jnw4ydNLmc8ovFO3AhPw-1 X-Mimecast-MFC-AGG-ID: 27jnw4ydNLmc8ovFO3AhPw_1743676611 To: devel@lists.libvirt.org Subject: [PATCH 2/3] ch: Drop pid from monitor Date: Thu, 3 Apr 2025 12:36:44 +0200 Message-ID: <0cc946b5b89d4782a7855e48f17d073bf34125e7.1743676591.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: lO2avjMuj2YZ8tHLhVDfuxvIPIh_Rzo89h3vpECwhEY_1743676611 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 6W3Z354VEYXPPLJIZABZ3OABLTAV335Z X-Message-ID-Hash: 6W3Z354VEYXPPLJIZABZ3OABLTAV335Z X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1743676871499019100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik The domain object already has a member that allows storing hypervisor's PID (vm->pid). There's no need to duplicate it in _virCHMonitor struct. Switch CH code to use the former. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/ch/ch_events.c | 2 +- src/ch/ch_monitor.c | 10 ++-------- src/ch/ch_monitor.h | 2 -- src/ch/ch_process.c | 3 +-- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/ch/ch_events.c b/src/ch/ch_events.c index 9cb873d8cd..3d4e3c41e1 100644 --- a/src/ch/ch_events.c +++ b/src/ch/ch_events.c @@ -297,7 +297,7 @@ int virCHStartEventHandler(virCHMonitor *mon) { g_autofree char *name =3D NULL; - name =3D g_strdup_printf("ch-evt-%d", mon->pid); + name =3D g_strdup_printf("ch-evt-%d", mon->vm->pid); =20 virObjectRef(mon); if (virThreadCreateFull(&mon->event_handler_thread, diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index 91899e873b..1c2c1f2858 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -672,14 +672,14 @@ virCHMonitorNew(virDomainObj *vm, virCHDriverConfig *= cfg, int logfile) return NULL; } =20 - if ((rv =3D virPidFileReadPath(priv->pidfile, &mon->pid)) < 0) { + if ((rv =3D virPidFileReadPath(priv->pidfile, &vm->pid)) < 0) { virReportSystemError(-rv, _("Domain %1$s didn't show up"), vm->def->name); return NULL; } VIR_DEBUG("CH vm=3D%p name=3D%s running with pid=3D%lld", - vm, vm->def->name, (long long)mon->pid); + vm, vm->def->name, (long long)vm->pid); =20 /* open the reader end of fifo before start Event Handler */ while ((event_monitor_fd =3D open(mon->eventmonitorpath, O_RDONLY)) < = 0) { @@ -727,12 +727,6 @@ void virCHMonitorClose(virCHMonitor *mon) if (!mon) return; =20 - if (mon->pid > 0) { - /* try cleaning up the Cloud-Hypervisor process */ - virProcessAbort(mon->pid); - mon->pid =3D 0; - } - if (mon->handle) curl_easy_cleanup(mon->handle); =20 diff --git a/src/ch/ch_monitor.h b/src/ch/ch_monitor.h index 185de0dbfd..ffac9e938e 100644 --- a/src/ch/ch_monitor.h +++ b/src/ch/ch_monitor.h @@ -108,8 +108,6 @@ struct _virCHMonitor { size_t buf_fill_sz; } event_buffer; =20 - pid_t pid; - virDomainObj *vm; =20 size_t nthreads; diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c index 6a59bf756a..a008b52752 100644 --- a/src/ch/ch_process.c +++ b/src/ch/ch_process.c @@ -957,7 +957,6 @@ virCHProcessStart(virCHDriver *driver, } } =20 - vm->pid =3D priv->monitor->pid; vm->def->id =3D vm->pid; priv->machineName =3D virCHDomainGetMachineName(vm); =20 @@ -1024,6 +1023,7 @@ virCHProcessStop(virCHDriver *driver, virErrorPreserveLast(&orig_err); =20 if (priv->monitor) { + virProcessAbort(vm->pid); g_clear_pointer(&priv->monitor, virCHMonitorClose); } =20 @@ -1117,7 +1117,6 @@ virCHProcessStartRestore(virCHDriver *driver, virDoma= inObj *vm, const char *from } } =20 - vm->pid =3D priv->monitor->pid; vm->def->id =3D vm->pid; priv->machineName =3D virCHDomainGetMachineName(vm); =20 --=20 2.49.0 From nobody Tue Dec 16 03:19:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1743676889; cv=none; d=zohomail.com; s=zohoarc; b=mTE2bbV6eZ0T992R6ECJ66K2NH1iLc0EZUZlZctMv2QyrFodIdx5H7hP0zn9aufV9AAXNBZ5OaqWn2hw//2sWUNBpykXHsdWdstW1m4UT7Tt8p/8fQ6C/kpI7j/6pt0LDHnNYJ1g7N11cuZZzCTw/707fISmyFL7tBW7QO9wZIQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1743676889; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=f28xi2wyhaQe1LH0VUfjjUJS/HwlKRxDpn1YfI7H4/k=; b=mari0TZTcEMdMp10XOaEooWZXyPyG6315SI19UMFqJcLduUJDwjgpBVG7BSGaHgHcP3F/hhWsCqjNRvsdbNMgu8W/40lSrMxx+4aIRYPwJPdFvQBU/P0KzYcshIi3b17SqlR+ab9q8CXhqu0frA2j438os+QiXAPwxp3vfTfs78= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1743676889279358.92361462427914; Thu, 3 Apr 2025 03:41:29 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id A4B171668; Thu, 3 Apr 2025 06:41:28 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 29E091573; Thu, 3 Apr 2025 06:37:15 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 77C521597; Thu, 3 Apr 2025 06:37:08 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 5DFDA13FB for ; Thu, 3 Apr 2025 06:36:54 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-563-YPp5l2EsO62VosjQLmsuBA-1; Thu, 03 Apr 2025 06:36:52 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 20B7F1809CA5 for ; Thu, 3 Apr 2025 10:36:52 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.3.236]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 697B71955BC2 for ; Thu, 3 Apr 2025 10:36:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743676614; h=from:from: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; bh=VKOoz9LoXwnvbHf5u2LMsQ6QBl7wcFILEPFq55Gh3Pg=; b=PvYpi7J5B2oDYAufJhACfNTfNVn9L9/jHliu4Subv6R/zglPucag4x/lYwGLrBUgR7X00e F/pvXEOeiQGgTH9lopKwophHMGelCEqTuA6VRj58hyB7YMo813AWhXTfxwQORFFbGqD5N/ 10yiFsJ+UFwVJM8cfs4wm6E+bSePohc= X-MC-Unique: YPp5l2EsO62VosjQLmsuBA-1 X-Mimecast-MFC-AGG-ID: YPp5l2EsO62VosjQLmsuBA_1743676612 To: devel@lists.libvirt.org Subject: [PATCH 3/3] ch: Fix printf format strings wrt size_t argument Date: Thu, 3 Apr 2025 12:36:45 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: m4h1sLNfKuwxqr9LJEmiACNoTNz2w227IDPPOzFHaXI_1743676612 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: DYU2MYK7QXAGAZGCCTP6RZ22AQWY2RUW X-Message-ID-Hash: DYU2MYK7QXAGAZGCCTP6RZ22AQWY2RUW X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1743676889819019000 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik In a few places, when a size_t typed argument is passed to a printf-like function the corresponding specifier is %ld instead of %zu. Fix those places. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/ch/ch_monitor.c | 4 ++-- src/ch/ch_process.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index 1c2c1f2858..78b6551d6c 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -156,7 +156,7 @@ virCHMonitorBuildPayloadJson(virJSONValue *content, vir= DomainDef *vmdef) buf =3D g_base64_decode(vmdef->sec->data.sev_snp.host_data, &l= en); if (len !=3D host_data_len) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Invalid host_data provided. Expected '%1= $ld' bytes"), + _("Invalid host_data provided. Expected '%1= $zu' bytes"), host_data_len); return -1; } @@ -1139,7 +1139,7 @@ virCHMonitorBuildRestoreJson(virDomainDef *vmdef, g_autoptr(virJSONValue) nets =3D virJSONValueNewArray(); for (i =3D 0; i < vmdef->nnets; i++) { g_autoptr(virJSONValue) net_json =3D virJSONValueNewObject(); - g_autofree char *id =3D g_strdup_printf("%s_%ld", CH_NET_ID_PR= EFIX, i); + g_autofree char *id =3D g_strdup_printf("%s_%zu", CH_NET_ID_PR= EFIX, i); if (virJSONValueObjectAppendString(net_json, "id", id) < 0) return -1; if (virJSONValueObjectAppendNumberInt(net_json, "num_fds", vmd= ef->nets[i]->driver.virtio.queues)) diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c index a008b52752..95c808cb41 100644 --- a/src/ch/ch_process.c +++ b/src/ch/ch_process.c @@ -701,7 +701,7 @@ chProcessAddNetworkDevices(virCHDriver *driver, VIR_DEBUG("payload sent with net-add request to CH =3D %s", payloa= d); =20 virBufferAsprintf(&buf, "%s", virBufferCurrentContent(&http_header= s)); - virBufferAsprintf(&buf, "Content-Length: %ld\r\n\r\n", strlen(payl= oad)); + virBufferAsprintf(&buf, "Content-Length: %zu\r\n\r\n", strlen(payl= oad)); virBufferAsprintf(&buf, "%s", payload); payload_len =3D virBufferUse(&buf); payload =3D virBufferContentAndReset(&buf); @@ -1130,7 +1130,7 @@ virCHProcessStartRestore(virCHDriver *driver, virDoma= inObj *vm, const char *from virBufferAddLit(&http_headers, "Host: localhost\r\n"); virBufferAddLit(&http_headers, "Content-Type: application/json\r\n"); virBufferAsprintf(&buf, "%s", virBufferCurrentContent(&http_headers)); - virBufferAsprintf(&buf, "Content-Length: %ld\r\n\r\n", strlen(payload)= ); + virBufferAsprintf(&buf, "Content-Length: %zu\r\n\r\n", strlen(payload)= ); virBufferAsprintf(&buf, "%s", payload); payload_len =3D virBufferUse(&buf); payload =3D virBufferContentAndReset(&buf); --=20 2.49.0