From nobody Mon Sep 8 21:40:31 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=1750167902; cv=none; d=zohomail.com; s=zohoarc; b=JQ6gdfmH3IWhMv4iE97MYgKqmdh2vZBZWFZgNsPEij9mZ3NCy2jmvlxqWx8QlVPt4bJUtQ+LysDLHHwdkBflFROphkFCk+zrmojt0pspSvkDJBgViq8A7A3l68FCuRTTjmRfMqQoMIyuMqKqtF/dv+6pGBASkUsC4M6TJeFdqSc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750167902; 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=Rvd6LsYConXbox3LBlZwjjzp16wdHv+ch48ns+os68k=; b=ZncRdz4dFZgK5s5U0L21l8Vprst8zeScJi820CixbO+fR1S9jLeUR2dMOWxBZ7CRAKOZgGJ0k6EtVdP9ujka9IlQevohwe9gxxXdyAqbZNgb5N46BYqBegJd9LNtOfJNbHWUdjzW4PEcuQHCUfSJIx+nm9Po1j260V4w17v8iKk= 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 1750167902909663.8339583454103; Tue, 17 Jun 2025 06:45:02 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C265ED46; Tue, 17 Jun 2025 09:45:01 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id B69D3E7B; Tue, 17 Jun 2025 09:44:11 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 51F66B99; Tue, 17 Jun 2025 09:44: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 97753B64 for ; Tue, 17 Jun 2025 09:44:06 -0400 (EDT) Received: from mx-prod-mc-02.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-225-ar3ent0mPAmRESKzpaXqPw-1; Tue, 17 Jun 2025 09:44:04 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 77C7F19560AA for ; Tue, 17 Jun 2025 13:44:03 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.10]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B0F7E180045B for ; Tue, 17 Jun 2025 13:44:02 +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=1750167846; 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=EEAqbZ1IVoH3dClP7JZCEWRe/s3zZPT2Yl2/z6AbmOs=; b=DpdCJSPNex3/j5mtqCDMKpQh12SISiu4ujFjxekt8X4i3HA7hdYwLYy6bijjOR1c1fxD9i usSuFpAIxV3TIEVXhYXiZeo42jYTF6HXZMX8m3jzRd1M/53JPhuaXdzvmdNC+gAMEHogw4 jaJI2cRjamoea2I3MtuONfMP9fQ80o8= X-MC-Unique: ar3ent0mPAmRESKzpaXqPw-1 X-Mimecast-MFC-AGG-ID: ar3ent0mPAmRESKzpaXqPw_1750167843 To: devel@lists.libvirt.org Subject: [PATCH 1/6] storage_file_probe: Use named initializer for 'struct FileTypeInfo' Date: Tue, 17 Jun 2025 15:43:54 +0200 Message-ID: <800d808d6740810974d9f8d8b5fa5dac71d9f88c.1750167757.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: KzJXyBwZT12ZLccQzuILHEBBKy4RogaNqTgdUYz4_kM_1750167843 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: DAV63OX4NI2OJXDQYLONX2NYYFKLUE4D X-Message-ID-Hash: DAV63OX4NI2OJXDQYLONX2NYYFKLUE4D X-MailFrom: pkrempa@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: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1750167905014116600 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/storage_file/storage_file_probe.c | 174 ++++++++++++++++++-------- 1 file changed, 119 insertions(+), 55 deletions(-) diff --git a/src/storage_file/storage_file_probe.c b/src/storage_file/stora= ge_file_probe.c index 26f8d63e9a..82cea28b20 100644 --- a/src/storage_file/storage_file_probe.c +++ b/src/storage_file/storage_file_probe.c @@ -242,92 +242,156 @@ static struct FileEncryptionInfo const qcow2Encrypti= onInfo[] =3D { }; static struct FileTypeInfo const fileTypeInfo[] =3D { - [VIR_STORAGE_FILE_NONE] =3D { 0, NULL, LV_LITTLE_ENDIAN, - -1, 0, {0}, 0, 0, 0, NULL, NULL }, - [VIR_STORAGE_FILE_RAW] =3D { 0, NULL, LV_LITTLE_ENDIAN, - -1, 0, {0}, 0, 0, 0, - luksEncryptionInfo, - NULL }, - [VIR_STORAGE_FILE_DIR] =3D { 0, NULL, LV_LITTLE_ENDIAN, - -1, 0, {0}, 0, 0, 0, NULL, NULL }, + [VIR_STORAGE_FILE_NONE] =3D { + .endian =3D LV_LITTLE_ENDIAN, + .versionOffset =3D -1, + }, + [VIR_STORAGE_FILE_RAW] =3D { + .endian =3D LV_LITTLE_ENDIAN, + .versionOffset =3D -1, + .cryptInfo =3D luksEncryptionInfo, + }, + [VIR_STORAGE_FILE_DIR] =3D { + .endian =3D LV_LITTLE_ENDIAN, + .versionOffset =3D -1, + .cryptInfo =3D luksEncryptionInfo, + }, [VIR_STORAGE_FILE_BOCHS] =3D { /*"Bochs Virtual HD Image", */ /* Untested */ - 0, NULL, - LV_LITTLE_ENDIAN, 64, 4, {0x20000}, - 32+16+16+4+4+4+4+4, 8, 1, NULL, NULL + .endian =3D LV_LITTLE_ENDIAN, + .versionOffset =3D 64, + .versionSize =3D 4, + .versionNumbers =3D {0x20000}, + .sizeOffset =3D 32 + 16 + 16 + 4 + 4 + 4 + 4 + 4, + .sizeBytes =3D 8, + .sizeMultiplier =3D 1, }, + [VIR_STORAGE_FILE_CLOOP] =3D { /* #!/bin/sh #V2.0 Format modprobe cloop file=3D$0 && mount -r -t iso9660 /dev/cloop $1 */ /* Untested */ - 0, NULL, - LV_LITTLE_ENDIAN, -1, 0, {0}, - -1, 0, 0, NULL, NULL + .endian =3D LV_LITTLE_ENDIAN, + .versionOffset =3D -1, + .sizeOffset =3D -1, }, [VIR_STORAGE_FILE_DMG] =3D { /* XXX QEMU says there's no magic for dmg, * /usr/share/misc/magic lists double magic (both offsets * would have to match) but then disables that check. */ - 0, NULL, - 0, -1, 0, {0}, - -1, 0, 0, NULL, NULL + .endian =3D LV_LITTLE_ENDIAN, + .versionOffset =3D -1, + .sizeOffset =3D -1, }, [VIR_STORAGE_FILE_ISO] =3D { - 32769, "CD001", - LV_LITTLE_ENDIAN, -2, 0, {0}, - -1, 0, 0, NULL, NULL + .magicOffset =3D 32769, + .magic =3D "CD001", + .endian =3D LV_LITTLE_ENDIAN, + .versionOffset =3D -2, + .sizeOffset =3D -1, }, [VIR_STORAGE_FILE_VPC] =3D { - 0, "conectix", - LV_BIG_ENDIAN, 12, 4, {0x10000}, - 8 + 4 + 4 + 8 + 4 + 4 + 2 + 2 + 4, 8, 1, NULL, NULL + .magicOffset =3D 0, + .magic =3D "conectix", + .endian =3D LV_BIG_ENDIAN, + .versionOffset =3D 12, + .versionSize =3D 4, + .versionNumbers =3D {0x10000}, + .sizeOffset =3D 8 + 4 + 4 + 8 + 4 + 4 + 2 + 2 + 4, + .sizeBytes =3D 8, + .sizeMultiplier =3D 1, }, - /* TODO: add getBackingStore function */ [VIR_STORAGE_FILE_VDI] =3D { - 64, "\x7f\x10\xda\xbe", - LV_LITTLE_ENDIAN, 68, 4, {0x00010001}, - 64 + 5 * 4 + 256 + 7 * 4, 8, 1, NULL, NULL }, - + .magicOffset =3D 64, + .magic =3D "\x7f\x10\xda\xbe", + .endian =3D LV_LITTLE_ENDIAN, + .versionOffset =3D 68, + .versionSize =3D 4, + .versionNumbers =3D {0x00010001}, + .sizeOffset =3D 64 + 5 * 4 + 256 + 7 * 4, + .sizeBytes =3D 8, + .sizeMultiplier =3D 1, + }, /* Not direct file formats, but used for various drivers */ - [VIR_STORAGE_FILE_FAT] =3D { 0, NULL, LV_LITTLE_ENDIAN, - -1, 0, {0}, 0, 0, 0, NULL, NULL }, - [VIR_STORAGE_FILE_VHD] =3D { 0, NULL, LV_LITTLE_ENDIAN, - -1, 0, {0}, 0, 0, 0, NULL, NULL }, - [VIR_STORAGE_FILE_PLOOP] =3D { 0, "WithouFreSpacExt", LV_LITTLE_ENDIAN, - -2, 0, {0}, PLOOP_IMAGE_SIZE_OFFSET, 8, - PLOOP_SIZE_MULTIPLIER, NULL, NULL }, - + [VIR_STORAGE_FILE_FAT] =3D { + .endian =3D LV_LITTLE_ENDIAN, + .versionOffset =3D -1, + }, + [VIR_STORAGE_FILE_VHD] =3D { + .endian =3D LV_LITTLE_ENDIAN, + .versionOffset =3D -1, + }, + [VIR_STORAGE_FILE_PLOOP] =3D { + .magicOffset =3D 0, + .magic =3D "WithouFreSpacExt", + .endian =3D LV_LITTLE_ENDIAN, + .versionOffset =3D -2, + .sizeOffset =3D PLOOP_IMAGE_SIZE_OFFSET, + .sizeBytes =3D 8, + .sizeMultiplier =3D PLOOP_SIZE_MULTIPLIER, + }, /* All formats with a backing store probe below here */ [VIR_STORAGE_FILE_COW] =3D { - 0, "OOOM", - LV_BIG_ENDIAN, 4, 4, {2}, - 4+4+1024+4, 8, 1, NULL, cowGetImageSpecific + .magicOffset =3D 0, + .magic =3D "OOOM", + .endian =3D LV_BIG_ENDIAN, + .versionOffset =3D 4, + .versionSize =3D 4, + .versionNumbers =3D {2}, + .sizeOffset =3D 4 + 4 + 1024 + 4, + .sizeBytes =3D 8, + .sizeMultiplier =3D 1, + .getImageSpecific =3D cowGetImageSpecific, }, [VIR_STORAGE_FILE_QCOW] =3D { - 0, "QFI", - LV_BIG_ENDIAN, 4, 4, {1}, - QCOWX_HDR_IMAGE_SIZE, 8, 1, - qcow1EncryptionInfo, - qcowGetImageSpecific + .magicOffset =3D 0, + .magic =3D "QFI", + .endian =3D LV_BIG_ENDIAN, + .versionOffset =3D 4, + .versionSize =3D 4, + .versionNumbers =3D {1}, + .sizeOffset =3D QCOWX_HDR_IMAGE_SIZE, + .sizeBytes =3D 8, + .sizeMultiplier =3D 1, + .cryptInfo =3D qcow1EncryptionInfo, + .getImageSpecific =3D qcowGetImageSpecific, }, [VIR_STORAGE_FILE_QCOW2] =3D { - 0, "QFI", - LV_BIG_ENDIAN, 4, 4, {2, 3}, - QCOWX_HDR_IMAGE_SIZE, 8, 1, - qcow2EncryptionInfo, - qcow2GetImageSpecific + .magicOffset =3D 0, + .magic =3D "QFI", + .endian =3D LV_BIG_ENDIAN, + .versionOffset =3D 4, + .versionSize =3D 4, + .versionNumbers =3D {2, 3}, + .sizeOffset =3D QCOWX_HDR_IMAGE_SIZE, + .sizeBytes =3D 8, + .sizeMultiplier =3D 1, + .cryptInfo =3D qcow2EncryptionInfo, + .getImageSpecific =3D qcow2GetImageSpecific, }, [VIR_STORAGE_FILE_QED] =3D { /* https://wiki.qemu.org/Features/QED */ - 0, "QED", - LV_LITTLE_ENDIAN, -2, 0, {0}, - QED_HDR_IMAGE_SIZE, 8, 1, NULL, qedGetImageSpecific + .magicOffset =3D 0, + .magic =3D "QED", + .endian =3D LV_LITTLE_ENDIAN, + .versionOffset =3D -2, + .sizeOffset =3D QED_HDR_IMAGE_SIZE, + .sizeBytes =3D 8, + .sizeMultiplier =3D 1, + .getImageSpecific =3D qedGetImageSpecific, }, [VIR_STORAGE_FILE_VMDK] =3D { - 0, "KDMV", - LV_LITTLE_ENDIAN, 4, 4, {1, 2, 3}, - 4+4+4, 8, 512, NULL, vmdk4GetImageSpecific + .magicOffset =3D 0, + .magic =3D "KDMV", + .endian =3D LV_LITTLE_ENDIAN, + .versionOffset =3D 4, + .versionSize =3D 4, + .versionNumbers =3D {1, 2, 3}, + .sizeOffset =3D 4 + 4 + 4, + .sizeBytes =3D 8, + .sizeMultiplier =3D 512, + .getImageSpecific =3D vmdk4GetImageSpecific, }, }; G_STATIC_ASSERT(G_N_ELEMENTS(fileTypeInfo) =3D=3D VIR_STORAGE_FILE_LAST); --=20 2.49.0 From nobody Mon Sep 8 21:40:31 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=1750167921; cv=none; d=zohomail.com; s=zohoarc; b=H01GJduQRt/Ix1eg+SzKtN7HzCsyHTQEoWVi2v2XQN2fg84QBk8CidC4KaLlgPr4txaYrJjE5Vf13k0/mWhbzdoZB48UhCWQCGH3oCmbdIY9OhSgTGUcrC7ptx16h396PYV7R6/32dWF5U9M/XTl6iJRuhSyrpVZP4N7foUdpmI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750167921; 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=ehcFFQSsB0EBDNANliW/m+OTHqq1yL8h7vCme567AGk=; b=fhycootopMCAFq60dBKs2vHb7wHhCCGWXQjN8oMPG6mChqGcvFRjSbyUNuhb6/viYcM8sqJ1JT64ZcFH8Y4JZ9Y1iAfGA/UqediG/bUBQDBe4YH/REvDyCeeDLSJ2gXymMMMW7+9tfN5kSRe3/T/xp9bnREZuXQtrGwDAh+mB1w= 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 1750167921759579.5942214445022; Tue, 17 Jun 2025 06:45:21 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id AD3FBCEE; Tue, 17 Jun 2025 09:45:20 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 5D99E1171; Tue, 17 Jun 2025 09:44:14 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 086CFBA1; Tue, 17 Jun 2025 09:44:08 -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 855AEB48 for ; Tue, 17 Jun 2025 09:44:07 -0400 (EDT) Received: from mx-prod-mc-04.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-512-CLSfn1lGOxu5cRFMFcCODQ-1; Tue, 17 Jun 2025 09:44:05 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CA9CF19560AE for ; Tue, 17 Jun 2025 13:44:04 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.10]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0529A180045B for ; Tue, 17 Jun 2025 13:44:03 +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=1750167847; 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=v6gwjQx0+dUdR+SUECxPjWeP7QZlrAvPqgnUuYFaYTE=; b=dOQeD5IJkeh2OpXUj4rQBM+1YfKXswIkGsNyVF43ZjPQoSYzlubvBplAZ0k43FgSjd6GY7 MiVjWQj5b9LaqkvR5ZwmOKMlX8SoJ/CEKw4SUgDdiGaLD8g3F6VLlVBPxmER2IAu5soCVc PEFxldLIp/stjm33GogvBtfC2fhOEcc= X-MC-Unique: CLSfn1lGOxu5cRFMFcCODQ-1 X-Mimecast-MFC-AGG-ID: CLSfn1lGOxu5cRFMFcCODQ_1750167845 To: devel@lists.libvirt.org Subject: [PATCH 2/6] virQEMUCapsFindBinary: Refactor local variables Date: Tue, 17 Jun 2025 15:43:55 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: YJZyGVZxF8_wj6CNpqZV098UVw4BQQazgdpgqiGVQvA_1750167845 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: GEVDSNYPEG22V2ZYSZJ2HWNT65FVY5IE X-Message-ID-Hash: GEVDSNYPEG22V2ZYSZJ2HWNT65FVY5IE X-MailFrom: pkrempa@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: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1750167923107116600 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 4251ad2d92..2ba5462bb2 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -972,14 +972,9 @@ static char * virQEMUCapsFindBinary(const char *format, const char *archstr) { - char *ret =3D NULL; - char *binary =3D NULL; + g_autofree char *binary =3D g_strdup_printf(format, archstr); - binary =3D g_strdup_printf(format, archstr); - - ret =3D virFindFileInPath(binary); - VIR_FREE(binary); - return ret; + return virFindFileInPath(binary); } char * --=20 2.49.0 From nobody Mon Sep 8 21:40:31 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=1750167940; cv=none; d=zohomail.com; s=zohoarc; b=MC6+abTxAmM2vZ9FWYlIvjibAJ07CMUNoRaWxL2i4HPa/ZTHnLuTtPebqxoVwq9BKWTXmRZuKrpEf5Yk8gCMObOqirwMdm/v/3DAED9cvYn3gxJZb78mpmcOF3ZKcXS0mUm7o6dDfZ+r25FTxmePzIQBeC/GpVCCntEnGtH0AyU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750167940; 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=IRFkX4M/+8/c80BhQ5Rum2N3YYKUxR3KSXkKw7l0yW8=; b=d9f5iUgPMO0uqR+sC7WuOxjNlWIol9XU06+dFABgbMpWb9okjxt+wYFmdBymsVHLdjAG7TxXD3Gmwb/dS0Td2ZElMVNBijgo+lXlqcfUWbGiGwpb4RmecP5PVWiFi8XrigB930T3msG6EvlX0D5wrtMdSRkVJrTRfyBP5l8SiCE= 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 1750167940903343.75942059599015; Tue, 17 Jun 2025 06:45:40 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C1B64B64; Tue, 17 Jun 2025 09:45:39 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 1C32ED47; Tue, 17 Jun 2025 09:44:18 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 324181171; Tue, 17 Jun 2025 09:44:14 -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 00AD5C4F for ; Tue, 17 Jun 2025 09:44:08 -0400 (EDT) Received: from mx-prod-mc-04.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-451-ivrQCaGOPSej2S_reL-8qw-1; Tue, 17 Jun 2025 09:44:06 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 25EE21955F42 for ; Tue, 17 Jun 2025 13:44:06 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.10]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 58B97180035C for ; Tue, 17 Jun 2025 13:44:05 +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=1750167848; 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=IoI35iqgwnORnngx4OO2X/ZZbT8v3VQRoLS2Sv+DBcc=; b=DfgtIMUgo6dZs6oCSZmkJx3AQ9qtnjGKK66AbQIomXaaEgYMZ+qLowYRqCfG7mQbAhzHCN yBpqZ3ABFpZHgukJc7YviGXPEeFdLhO1XWFTVrrxxyCCrtjlnOkmXqQv8UiMz9NkNSxCjV kFZTj8V2FqlNvuaLnspxuKtNSeAk11I= X-MC-Unique: ivrQCaGOPSej2S_reL-8qw-1 X-Mimecast-MFC-AGG-ID: ivrQCaGOPSej2S_reL-8qw_1750167846 To: devel@lists.libvirt.org Subject: [PATCH 3/6] virshPrintJobProgress: Don't rewrite migration status line on non-terminals Date: Tue, 17 Jun 2025 15:43:56 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: CJouAZX_tSnHLhEPFDVdM0_gyLH7z6KpOUeBCUhN1Po_1750167846 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: AVRGQFPIJTJREX44VXHFQREUOLZE3SY4 X-Message-ID-Hash: AVRGQFPIJTJREX44VXHFQREUOLZE3SY4 X-MailFrom: pkrempa@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: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1750167941341116600 Content-Type: text/plain; charset="utf-8" From: Peter Krempa On non-terminals print each progress report on a new line. Fix based on suggestion in the issue report. Closes: https://gitlab.com/libvirt/libvirt/-/issues/756 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- tools/virsh-domain.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 8d615b6e7a..7253596f4a 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2091,10 +2091,13 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd) static void -virshPrintJobProgress(const char *label, unsigned long long remaining, +virshPrintJobProgress(const char *label, + unsigned long long remaining, unsigned long long total) { double progress =3D 100.00; + const char *term_start =3D "\r"; + const char *term_end =3D ""; /* if remaining =3D=3D 0 migration has completed */ if (remaining !=3D 0) { @@ -2106,10 +2109,16 @@ virshPrintJobProgress(const char *label, unsigned l= ong long remaining, } } + if (!isatty(STDERR_FILENO)) { + term_start =3D ""; + term_end =3D "\n"; + } + /* see comments in vshError about why we must flush */ fflush(stdout); /* avoid auto-round-off of double by keeping only 2 decimals */ - fprintf(stderr, "\r%s: [%5.2f %%]", label, (int)(progress*100)/100.0); + fprintf(stderr, "%s%s: [%5.2f %%]%s", + term_start, label, (int)(progress*100)/100.0, term_end); fflush(stderr); } --=20 2.49.0 From nobody Mon Sep 8 21:40:31 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=1750167985; cv=none; d=zohomail.com; s=zohoarc; b=eVMttu6qu+zvYtwGMKl7MltjSjyDKQPUTIHbADEHspx4zsKbvrH5e4J6y1fYyDHdH+YFElTKngVEUY7nfehmqIsRX7oazv4apDHuyz2fE7aLr03KmfCBNHbbSmzewxPRP/z04G0bJurAbano9wmsrepCuJVXKwy9doD1OcVQJ/I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750167985; 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=9qsbb/OegeF7ujDnUnlNPU4bbO+ViGXfQjxjL6Y4UMk=; b=Sx7nEv52V2uRyMw80mNeMZQzEX4Pl4vEnMeKuru9S2PkI0xf0q4K68JVUONBQEW8XVhZkzz6shu7jthMxyAhV5KoersbkYeeqqAzkjGSI4l1xbYNuyS1j+al83cnzVYLeGWx0TC/IgEyT+Jc6uwfauQWxk7rSnP0DtMy2Vg7jxI= 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 1750167985311633.2487937932793; Tue, 17 Jun 2025 06:46:25 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 60918E75; Tue, 17 Jun 2025 09:46:24 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id C597410F6; Tue, 17 Jun 2025 09:44:30 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 085D6B98; Tue, 17 Jun 2025 09:44:25 -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 E58C5BDB for ; Tue, 17 Jun 2025 09:44:11 -0400 (EDT) Received: from mx-prod-mc-04.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-104-TG30z4dNPgmuKrJ2Cy8HWQ-1; Tue, 17 Jun 2025 09:44:08 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6C29719560BF for ; Tue, 17 Jun 2025 13:44:07 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.10]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9AA04180035C for ; Tue, 17 Jun 2025 13:44:06 +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=1750167851; 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=8+vSS/Q0v9bFCC4AkEtXIHTxVOFt+7OdHWGnMghDa9Y=; b=V7v9RI4SgA1H2nWXJ9iSJap0dYDmAerJYe6Lrjx1adi5r6yqrgDeXiUhkL9elxZigwJvHI l0VU17Qis/WJlBNBnq9sGSHz7/Wt7O0iEnUTEsGmnzWjBXsW4Criz+OsUn8Rdln6nmnzJF Uz6vXRVo2hR3swcZfhtYFBwK3EMntHo= X-MC-Unique: TG30z4dNPgmuKrJ2Cy8HWQ-1 X-Mimecast-MFC-AGG-ID: TG30z4dNPgmuKrJ2Cy8HWQ_1750167847 To: devel@lists.libvirt.org Subject: [PATCH 4/6] storage: parthelper: Use if/else instead of ternary operator Date: Tue, 17 Jun 2025 15:43:57 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: OAL_XzHT7wZkhgtjR-H3JKUTomw7aUvix54XPf_oTrU_1750167847 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: SMW7PSRDYG4QRUH4CN7WAQEFJH7NXSJG X-Message-ID-Hash: SMW7PSRDYG4QRUH4CN7WAQEFJH7NXSJG X-MailFrom: pkrempa@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: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1750167986161116600 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/storage/parthelper.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c index 1169ebfb64..94aac34f7c 100644 --- a/src/storage/parthelper.c +++ b/src/storage/parthelper.c @@ -95,8 +95,11 @@ int main(int argc, char **argv) if (virFileResolveLink(path, &canonical_path) !=3D 0) return 2; - partsep =3D *canonical_path && - g_ascii_isdigit(canonical_path[strlen(canonical_path)-1]) ? "p= " : ""; + if (*canonical_path && + g_ascii_isdigit(canonical_path[strlen(canonical_path)-1])) + partsep =3D "p"; + else + partsep =3D ""; } if ((dev =3D ped_device_get(path)) =3D=3D NULL) { --=20 2.49.0 From nobody Mon Sep 8 21:40:31 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=1750167968; cv=none; d=zohomail.com; s=zohoarc; b=j/r3VKqBZ09b4y9gSz97URZWiVGotK1ZagvLcmIouUWkdnGWcGrsuB2EFWLN6Tr307oPv7woP6H0tbBxVmxxVoomF3vFkcMmzbTAv8wpihps1Ysy7v9z9OnRSxhuYAIgZ1qS26HIcb+FSQo/FFdjdP92M3lpx4r6bzow/RQZl3o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750167968; 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=X15toOm88aOIVzWCwasY/Zu5jBEDlxepk8PF6IWDP5k=; b=FrO4RinHMCHaoF8YIZPncoArFrVFgjeeZJ28iNna5j8RcQgoDYAPczVilYGpTn3oNlGHgbORZc3dqUqShqWr/7urZM08Oor5Y1bHcxkbVp0xnK1flWms+Kry1MbPr5x3RChq9P3coD8vMY0jmjBDvW5Sr/vgimONuGx+ZDvG9CI= 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 1750167968775309.91702914222094; Tue, 17 Jun 2025 06:46:08 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id BD40FC2F; Tue, 17 Jun 2025 09:46:07 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 4B380DDF; Tue, 17 Jun 2025 09:44:26 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2740BBD7; Tue, 17 Jun 2025 09:44:21 -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 99528E73 for ; Tue, 17 Jun 2025 09:44:11 -0400 (EDT) Received: from mx-prod-mc-02.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-164-IwiJ52EHPNWnzNdkSOiaYA-1; Tue, 17 Jun 2025 09:44:09 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C0D1F1956089 for ; Tue, 17 Jun 2025 13:44:08 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.10]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0254C1800288 for ; Tue, 17 Jun 2025 13:44:07 +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=1750167851; 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=sblHfjOaOQLZ/JJyzW1tDWixl0hzyPNnZsfokEgznwI=; b=Stxqj6AxQ+sbH4hSEjKxtxTHvTIFCeE4huQz2yrp1utynq4jW/IeAeEUh6fPdsdfoxtbgw zIGJ93GfY5BooW2h+BTuLRJ6OFWhV4Kr2CqSVS3cNQkS1aQhxKELxfYYiuLHTJCDYnLbyc uW/BIlwYnAsNhFw1cNl0ByoLFFGvpcI= X-MC-Unique: IwiJ52EHPNWnzNdkSOiaYA-1 X-Mimecast-MFC-AGG-ID: IwiJ52EHPNWnzNdkSOiaYA_1750167848 To: devel@lists.libvirt.org Subject: [PATCH 5/6] storage: disk: Properly handle partition numbers separated by 'p' Date: Tue, 17 Jun 2025 15:43:58 +0200 Message-ID: <4ead169268cd492679f24908ce852ba0f7b726f3.1750167757.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: sUKteGc9KO8QDWtuzjacfs-guCQBjEQxhWD_xT55NvY_1750167848 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NYJSIPDATQOPB53MRGIR6DMFLK3QMXCV X-Message-ID-Hash: NYJSIPDATQOPB53MRGIR6DMFLK3QMXCV X-MailFrom: pkrempa@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: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1750167969716116600 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The 'p' separator for partitions is now common also for NVMe devices. Fix the algorithm to extract the partition number to always consider it. The fix is based on suggestion in the issue mentioned below. Closes: https://gitlab.com/libvirt/libvirt/-/issues/239 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/storage/storage_backend_disk.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backe= nd_disk.c index 996395de4a..871226ee22 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -805,7 +805,6 @@ virStorageBackendDiskDeleteVol(virStoragePoolObj *pool, virStoragePoolDef *def =3D virStoragePoolObjGetDef(pool); char *src_path =3D def->source.devices[0].path; g_autofree char *srcname =3D g_path_get_basename(src_path); - bool isDevMapperDevice; g_autofree char *devpath =3D NULL; g_autoptr(virCommand) cmd =3D NULL; @@ -822,8 +821,7 @@ virStorageBackendDiskDeleteVol(virStoragePoolObj *pool, * (parthelper.c) that is used to generate the target.path name * for use by libvirt. Changes to either, need to be reflected * in both places */ - isDevMapperDevice =3D virIsDevMapperDevice(vol->target.path); - if (isDevMapperDevice) { + if (virIsDevMapperDevice(vol->target.path)) { dev_name =3D g_path_get_basename(vol->target.path); } else { if (virFileResolveLink(vol->target.path, &devpath) < 0) { @@ -846,9 +844,8 @@ virStorageBackendDiskDeleteVol(virStoragePoolObj *pool, part_num =3D dev_name + strlen(srcname); - /* For device mapper and we have a partition character 'p' as the - * current character, let's move beyond that before checking part_num = */ - if (isDevMapperDevice && *part_num =3D=3D 'p') + /* Check if partition character 'p' is present and move beyond it */ + if (*part_num =3D=3D 'p' && g_ascii_isdigit(*(part_num + 1))) part_num++; if (*part_num =3D=3D 0) { --=20 2.49.0 From nobody Mon Sep 8 21:40:31 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=1750168003; cv=none; d=zohomail.com; s=zohoarc; b=KX9hsbn42eUf9Venwmba68ensSQNkU/Fw25a1T3R3R2OMGpYK49JpeECBfSYhAzRo/rEhzQSJqf3A9dtlTuo1x/RT6HDDygVVRcuW7XuNtSdm1a1T3XkkeuzVT7a5BkRjWBGJfb0FgWKrjs/viaXJHRJFr/yoDj2noT5xN9G9EA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750168003; 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=eoTqTE4GfYhOJk5SFvavLs3BKeuElUjoCSdfXiJ5niY=; b=F7eCQ/1ZtMOR9DIDVDpYwT6Mz3ZLJGXuFSy75ZeZqhGBBVrysLK5mliHyzTvEaVv/hfeERI8y29u3e0cM2Clog00mgEI/0XWmcbLdMRodpYWTgl7/5s3Ne1iBKexWNB7Xpn28FROfXbp1QDRxTTtgxG109vpiekcq4BeZt+s/0I= 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 1750168003789481.356896476031; Tue, 17 Jun 2025 06:46:43 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id D29A8C50; Tue, 17 Jun 2025 09:46:42 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id EA2F7E73; Tue, 17 Jun 2025 09:44:32 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 455E1CA7; Tue, 17 Jun 2025 09:44:26 -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 CB078D33 for ; Tue, 17 Jun 2025 09:44:12 -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-101-ImyCyIadM4GVAo8S8RmpZQ-1; Tue, 17 Jun 2025 09:44:10 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 35562180028F for ; Tue, 17 Jun 2025 13:44:10 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.10]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 575F5180035C for ; Tue, 17 Jun 2025 13:44:09 +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=1750167852; 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=SBuLvGprVPWLXu0nYZXG0IXtjZtNnz6pYLIuSZ5MAFA=; b=B7VC20p2pMA8pOWdpJMhRsrs7mgOhEBpigJc78z+J7orD+OrtkPbWpR+EqryMVW092JTkB dpFUbUXqFPsR9kUxyjS0OOkldzL5MtRf6pbxMubZFzq5NjSimUJVByJKsbbaYHrtSpVirN WMwvCJ/Gnd1Os6fP9UOYP4ZRkBnMkMQ= X-MC-Unique: ImyCyIadM4GVAo8S8RmpZQ-1 X-Mimecast-MFC-AGG-ID: ImyCyIadM4GVAo8S8RmpZQ_1750167850 To: devel@lists.libvirt.org Subject: [PATCH 6/6] tlscert: Don't force 'keyEncipherment' for ECDSA and ECDH Date: Tue, 17 Jun 2025 15:43:59 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: A2OXJAAyrMxI8CYlklrn4nexSCjsEvVS6MVuEI-G7Mo_1750167850 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: IZM7UVK3W6WDGHBKTAQOYLDHA6ECO3UH X-Message-ID-Hash: IZM7UVK3W6WDGHBKTAQOYLDHA6ECO3UH X-MailFrom: pkrempa@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: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1750168004335116600 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Per RFC8813 [1] which amends RFC5580 [2] ECDSA, ECDH, and ECMQV algorithms must not have 'keyEncipherment' present, but our code did check it. Add exemption for known algorithms which don't use it. [1] https://datatracker.ietf.org/doc/rfc8813/ [2] https://datatracker.ietf.org/doc/rfc5480 Closes: https://gitlab.com/libvirt/libvirt/-/issues/691 Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/rpc/virnettlscert.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/rpc/virnettlscert.c b/src/rpc/virnettlscert.c index 1befbe06bc..f197995633 100644 --- a/src/rpc/virnettlscert.c +++ b/src/rpc/virnettlscert.c @@ -163,14 +163,31 @@ static int virNetTLSCertCheckKeyUsage(gnutls_x509_crt= _t cert, } } if (!(usage & GNUTLS_KEY_KEY_ENCIPHERMENT)) { - if (critical) { - virReportError(VIR_ERR_SYSTEM_ERROR, - _("Certificate %1$s usage does not permit k= ey encipherment"), - certFile); - return -1; - } else { - VIR_WARN("Certificate %s usage does not permit key enciphe= rment", - certFile); + int alg =3D gnutls_x509_crt_get_pk_algorithm(cert, NULL); + + /* Per RFC8813 [1] which amends RFC5580 [2] ECDSA, ECDH, and E= CMQV + * algorithms must not have 'keyEncipherment' present. + * + * [1] https://datatracker.ietf.org/doc/rfc8813/ + * [2] https://datatracker.ietf.org/doc/rfc5480 + */ + + switch (alg) { + case GNUTLS_PK_ECDSA: + case GNUTLS_PK_ECDH_X25519: + case GNUTLS_PK_ECDH_X448: + break; + + default: + if (critical) { + virReportError(VIR_ERR_SYSTEM_ERROR, + _("Certificate %1$s usage does not perm= it key encipherment"), + certFile); + return -1; + } else { + VIR_WARN("Certificate %s usage does not permit key enc= ipherment", + certFile); + } } } } --=20 2.49.0