From nobody Tue Sep 9 09:52:22 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=1748508759; cv=none; d=zohomail.com; s=zohoarc; b=WNaiJ8Deln0biKsEcRWi37PCkBGPssXCEpD8dFknIvQU+Hx/swSNQHYIMaYhSWw+E+M51ouZeC9rkKbUwnAER8WS63f9BooGvvjY2s5zFKzJmyCO6LQEOjOfmLLO4q/V4GcTbmJc2+vnP2RBmyOUwxNlKq4Iri5plFKX92tBCYY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748508759; 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=AaTnUOIdYVSxXYvvyR23Hci/YV36+CLZ0NDoHf4iqOQ=; b=SUPyhjSlpyzmNFRV6bfWwlb/2HpKK4T3cxBO8z0i/7lqUxBtBC/yv11UQDLETvwvGzcbwEJu/uGV57JBnj0TF2G1q1VpOWDZTRkRl3Pt5gjjRLqIYa7xRcIOArvoUH6cdAd9RTjIRhwT91gFwJ//CJva1PfRmXeQBmnGigm5OGM= 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 1748508759877914.6499960949357; Thu, 29 May 2025 01:52:39 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E7253139F; Thu, 29 May 2025 04:52:38 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 6BE5E1439; Thu, 29 May 2025 04:44:13 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E9E6C15CC; Thu, 29 May 2025 04:43:56 -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 0229A15CC for ; Thu, 29 May 2025 04:43:33 -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-678-6CB6d5q0P0W5_dHUoRWPpA-1; Thu, 29 May 2025 04:43:32 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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 313411800360 for ; Thu, 29 May 2025 08:43:31 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.44.22.3]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 68FEC19560AF for ; Thu, 29 May 2025 08:43:30 +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=1748508213; 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=JgUfPv79y/X7UcdCRPGzqwe7n55FN7dpmDQtFrEHc3k=; b=O4rxbeSY4cpmjiMtWzxM9Rut4tYpL1cVE2rY70J9gwY5bGfY0cn/2A9/POwXOUaGdK44rg vJJ6UUzA9mazIhrYB8m2HEkwpSNzgaMGEAy9dv5uY/LgPSjyncRgTx7XKNKDPUvVAsq3D1 LDOEFEdvSaxFe4uET5nd8L5W7MvrQds= X-MC-Unique: 6CB6d5q0P0W5_dHUoRWPpA-1 X-Mimecast-MFC-AGG-ID: 6CB6d5q0P0W5_dHUoRWPpA_1748508211 To: devel@lists.libvirt.org Subject: [PATCH 15/15] storage_file_probe: Remove unused image probing callbacks Date: Thu, 29 May 2025 10:43:09 +0200 Message-ID: <8bb2f8b6de610ec8c6a1df88b78c3148f1e89f66.1748507931.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: mhxTCf0PCVSdasFnAlyNHGutSVFGPXCuwp4iK9RoSuc_1748508211 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: C6VC3PRKEUNYT42TTT3VFOVC3FUFEIOR X-Message-ID-Hash: C6VC3PRKEUNYT42TTT3VFOVC3FUFEIOR 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: 1748508761179116600 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Remove the old now-unused infrastructure. Signed-off-by: Peter Krempa --- src/storage_file/storage_file_probe.c | 66 +++++++-------------------- 1 file changed, 16 insertions(+), 50 deletions(-) diff --git a/src/storage_file/storage_file_probe.c b/src/storage_file/stora= ge_file_probe.c index 9fcc052ea3..26f8d63e9a 100644 --- a/src/storage_file/storage_file_probe.c +++ b/src/storage_file/storage_file_probe.c @@ -89,13 +89,6 @@ struct FileTypeInfo { * or NULL if there is no COW base image, to RES; * return BACKING_STORE_* */ const struct FileEncryptionInfo *cryptInfo; /* Encryption info */ - unsigned long long (*getClusterSize)(const char *buf, - size_t buf_size); - int (*getBackingStore)(char **res, int *format, - const char *buf, size_t buf_size); - int (*getDataFile)(char **res, virBitmap *features, char *buf, size_t = buf_size); - int (*getFeatures)(virBitmap **features, int format, - char *buf, ssize_t len); int (*getImageSpecific)(virStorageSource *meta, const char *buf, size_t buf_size); @@ -250,18 +243,18 @@ static struct FileEncryptionInfo const qcow2Encryptio= nInfo[] =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, NULL, NUL= L, NULL, NULL }, + -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, NULL, NULL, NULL, NULL }, + NULL }, [VIR_STORAGE_FILE_DIR] =3D { 0, NULL, LV_LITTLE_ENDIAN, - -1, 0, {0}, 0, 0, 0, NULL, NULL, NULL, NULL= , NULL, NULL }, + -1, 0, {0}, 0, 0, 0, NULL, NULL }, [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, NULL, NULL, NULL, NULL + 32+16+16+4+4+4+4+4, 8, 1, NULL, NULL }, [VIR_STORAGE_FILE_CLOOP] =3D { /* #!/bin/sh @@ -270,7 +263,7 @@ static struct FileTypeInfo const fileTypeInfo[] =3D { */ /* Untested */ 0, NULL, LV_LITTLE_ENDIAN, -1, 0, {0}, - -1, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL + -1, 0, 0, NULL, NULL }, [VIR_STORAGE_FILE_DMG] =3D { /* XXX QEMU says there's no magic for dmg, @@ -278,67 +271,63 @@ static struct FileTypeInfo const fileTypeInfo[] =3D { * would have to match) but then disables that check. */ 0, NULL, 0, -1, 0, {0}, - -1, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL + -1, 0, 0, NULL, NULL }, [VIR_STORAGE_FILE_ISO] =3D { 32769, "CD001", LV_LITTLE_ENDIAN, -2, 0, {0}, - -1, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL + -1, 0, 0, NULL, NULL }, [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, NULL, NULL, N= ULL, NULL + 8 + 4 + 4 + 8 + 4 + 4 + 2 + 2 + 4, 8, 1, NULL, NULL }, /* 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, NULL, NULL, NULL, NULL= }, + 64 + 5 * 4 + 256 + 7 * 4, 8, 1, NULL, NULL }, /* 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, NULL, NULL= , NULL, NULL }, + -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, NULL, NULL= , NULL, NULL }, + -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, NULL, = NULL, NULL, NULL }, + PLOOP_SIZE_MULTIPLIER, NULL, NULL }, /* 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, NULL, NULL, NULL, NULL, cowGetImageSpecific + 4+4+1024+4, 8, 1, NULL, cowGetImageSpecific }, [VIR_STORAGE_FILE_QCOW] =3D { 0, "QFI", LV_BIG_ENDIAN, 4, 4, {1}, QCOWX_HDR_IMAGE_SIZE, 8, 1, qcow1EncryptionInfo, - NULL, NULL, NULL, NULL, qcowGetImageSpecific + qcowGetImageSpecific }, [VIR_STORAGE_FILE_QCOW2] =3D { 0, "QFI", LV_BIG_ENDIAN, 4, 4, {2, 3}, QCOWX_HDR_IMAGE_SIZE, 8, 1, qcow2EncryptionInfo, - NULL, - NULL, - NULL, - NULL, 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, NULL, NULL, NULL, NULL, qedGetImag= eSpecific + QED_HDR_IMAGE_SIZE, 8, 1, NULL, qedGetImageSpecific }, [VIR_STORAGE_FILE_VMDK] =3D { 0, "KDMV", LV_LITTLE_ENDIAN, 4, 4, {1, 2, 3}, - 4+4+4, 8, 512, NULL, NULL, NULL, NULL, NULL, vmdk4GetImageSpecific + 4+4+4, 8, 512, NULL, vmdk4GetImageSpecific }, }; G_STATIC_ASSERT(G_N_ELEMENTS(fileTypeInfo) =3D=3D VIR_STORAGE_FILE_LAST); @@ -911,7 +900,6 @@ virStorageFileProbeGetMetadata(virStorageSource *meta, char *buf, size_t len) { - int format; size_t i; VIR_DEBUG("path=3D%s, buf=3D%p, len=3D%zu, meta->format=3D%d", @@ -973,32 +961,10 @@ virStorageFileProbeGetMetadata(virStorageSource *meta, meta->capacity *=3D fileTypeInfo[meta->format].sizeMultiplier; } - VIR_FREE(meta->backingStoreRaw); - g_clear_pointer(&meta->features, virBitmapFree); - VIR_FREE(meta->dataFileRaw); - if (fileTypeInfo[meta->format].getImageSpecific && fileTypeInfo[meta->format].getImageSpecific(meta, buf, len) < 0) return -1; - if (fileTypeInfo[meta->format].getClusterSize !=3D NULL) - meta->clusterSize =3D fileTypeInfo[meta->format].getClusterSize(bu= f, len); - - if (fileTypeInfo[meta->format].getBackingStore !=3D NULL) { - fileTypeInfo[meta->format].getBackingStore(&meta->backingStoreRaw, - &format, buf, len); - meta->backingStoreRawFormat =3D format; - } - - if (fileTypeInfo[meta->format].getFeatures !=3D NULL && - fileTypeInfo[meta->format].getFeatures(&meta->features, meta->form= at, buf, len) < 0) - return -1; - - if (fileTypeInfo[meta->format].getDataFile !=3D NULL) { - fileTypeInfo[meta->format].getDataFile(&meta->dataFileRaw, meta->f= eatures, - buf, len); - } - return 0; } --=20 2.49.0