From nobody Sat Nov 23 12:38:27 2024 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=1732119148; cv=none; d=zohomail.com; s=zohoarc; b=fEYCumF4g8AA/zKSInf/b6wIhORy+Sha6QzYgzYdfSWJVnPncgysdh/PRpmJN9dUVHbD05TIzM4TX3sCUU0m2HkFSkTS7R8FhLqNje7nmCDqgRmLR6AaruE5Xpl5lkECfDYW88Xr1J5dISaFeQDiNB2VqGSY2Lw6gSeiC5O4YNA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732119148; 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:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=vIJcmnXfziu6HcIbz+hQYFqGjgf2Fw4Pc6Aswf4oCkc=; b=gi+3jYasdkASCy6v7qv08k4RLAmfaljK5uUFHwsnR8IyU38D3BE9Sj/rZfabnWd7mbKhDtzi3jxrQcM3+NCGE9ITHMEmFkveBX7sJaNGZe56MCsE+wiF20mIFHX9sG5HyjwC5z9I43LOyFzMibGklz3uXfefVoU6IpKW6I8vrTU= 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 1732119148581713.0038734055374; Wed, 20 Nov 2024 08:12:28 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7A3301553; Wed, 20 Nov 2024 11:12:27 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 07F4A1591; Wed, 20 Nov 2024 11:09:57 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id D41601528; Wed, 20 Nov 2024 11:09:52 -0500 (EST) Received: from relay.virtuozzo.com (relay.virtuozzo.com [130.117.225.111]) (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 BD36614C1 for ; Wed, 20 Nov 2024 11:09:39 -0500 (EST) Received: from [130.117.225.1] (helo=vz9-barybin-2.ch-qa.vzint.dev) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1tDn0Z-0005yc-37; Wed, 20 Nov 2024 16:52:48 +0100 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,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; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=RbEQjpuT/nc0q5i/HWURggbkQGkUeN1fGhXqTWcVdPA=; b=nYNNiBt8wWDR 87KZOJ00ZFajAsILSqqs4Bhp+RbT2XQCje3+43ATtAIb46WqlpaA7g+LRi5rbcPfrZ8EWboRTshDg XhJNu5jXSztsQTJOKQkxZgs26VTACI6aeYWsuvDaqC+iumBvUSfNaWPk9mRCfDUQJHAr3WTkG8Yec 6OOSROMxq0PIAD1trHjgR4dQU6t5DsFWloPYN4Zeq5S71VP3EnP1Zfg68d//PPcI89NPEQLiQ7Fm5 DG9EFGQ97FxOLMkntZJzgNtUW73InUXT4nAXtYD7JKLFIiAChmF2FrOcpms9n64ldHaVSxRU268k2 wO0YUBF6xeScySyjy7F8Fw==; To: devel@lists.libvirt.org Subject: [PATCH 05/15] storage file: add getDataFile function to FileTypeInfo Date: Wed, 20 Nov 2024 18:48:40 +0300 Message-ID: <20241120155229.1259-6-nikolai.barybin@virtuozzo.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241120155229.1259-1-nikolai.barybin@virtuozzo.com> References: <20241120155229.1259-1-nikolai.barybin@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: CMAUUCC6247MTDXKVXIV7ADXV5KG2DMH X-Message-ID-Hash: CMAUUCC6247MTDXKVXIV7ADXV5KG2DMH X-MailFrom: nikolai.barybin@virtuozzo.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 CC: den@openvz.org, Nikolai Barybin 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: Nikolai Barybin via Devel Reply-To: Nikolai Barybin X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1732119150497116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolai Barybin Reviewed-by: Peter Krempa --- src/storage_file/storage_file_probe.c | 34 ++++++++++++++------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/storage_file/storage_file_probe.c b/src/storage_file/stora= ge_file_probe.c index 243927d50a..ad14350edc 100644 --- a/src/storage_file/storage_file_probe.c +++ b/src/storage_file/storage_file_probe.c @@ -93,6 +93,7 @@ struct FileTypeInfo { 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); }; @@ -238,18 +239,18 @@ static struct FileEncryptionInfo const qcow2Encryptio= nInfo[] =3D { =20 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 }, + -1, 0, {0}, 0, 0, 0, NULL, NULL, NULL, NUL= L, NULL }, [VIR_STORAGE_FILE_RAW] =3D { 0, NULL, LV_LITTLE_ENDIAN, -1, 0, {0}, 0, 0, 0, luksEncryptionInfo, - NULL, 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= }, + -1, 0, {0}, 0, 0, 0, NULL, NULL, NULL, 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 + 32+16+16+4+4+4+4+4, 8, 1, NULL, NULL, NULL, NULL, NULL }, [VIR_STORAGE_FILE_CLOOP] =3D { /* #!/bin/sh @@ -258,7 +259,7 @@ static struct FileTypeInfo const fileTypeInfo[] =3D { */ /* Untested */ 0, NULL, LV_LITTLE_ENDIAN, -1, 0, {0}, - -1, 0, 0, NULL, NULL, NULL, NULL + -1, 0, 0, NULL, NULL, NULL, NULL, NULL }, [VIR_STORAGE_FILE_DMG] =3D { /* XXX QEMU says there's no magic for dmg, @@ -266,45 +267,45 @@ 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 + -1, 0, 0, NULL, NULL, NULL, NULL, NULL }, [VIR_STORAGE_FILE_ISO] =3D { 32769, "CD001", LV_LITTLE_ENDIAN, -2, 0, {0}, - -1, 0, 0, NULL, NULL, NULL, NULL + -1, 0, 0, NULL, NULL, NULL, 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 + 8 + 4 + 4 + 8 + 4 + 4 + 2 + 2 + 4, 8, 1, NULL, NULL, NULL, NULL, N= ULL }, /* 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}, + 64 + 5 * 4 + 256 + 7 * 4, 8, 1, NULL, NULL, NULL, NULL, NULL}, =20 /* 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= }, + -1, 0, {0}, 0, 0, 0, NULL, NULL, NULL, NULL= , NULL }, [VIR_STORAGE_FILE_VHD] =3D { 0, NULL, LV_LITTLE_ENDIAN, - -1, 0, {0}, 0, 0, 0, NULL, NULL, NULL, NULL= }, + -1, 0, {0}, 0, 0, 0, NULL, NULL, NULL, 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 }, + PLOOP_SIZE_MULTIPLIER, NULL, NULL, NULL, = NULL, NULL }, =20 /* 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, cowGetBackingStore, NULL + 4+4+1024+4, 8, 1, NULL, NULL, cowGetBackingStore, NULL, NULL }, [VIR_STORAGE_FILE_QCOW] =3D { 0, "QFI", LV_BIG_ENDIAN, 4, 4, {1}, QCOWX_HDR_IMAGE_SIZE, 8, 1, qcow1EncryptionInfo, - NULL, qcowXGetBackingStore, NULL + NULL, qcowXGetBackingStore, NULL, NULL }, [VIR_STORAGE_FILE_QCOW2] =3D { 0, "QFI", @@ -313,18 +314,19 @@ static struct FileTypeInfo const fileTypeInfo[] =3D { qcow2EncryptionInfo, qcow2GetClusterSize, qcowXGetBackingStore, + NULL, qcow2GetFeatures }, [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, qedGetBackingStore, NULL + QED_HDR_IMAGE_SIZE, 8, 1, NULL, NULL, qedGetBackingStore, NULL, NU= LL }, [VIR_STORAGE_FILE_VMDK] =3D { 0, "KDMV", LV_LITTLE_ENDIAN, 4, 4, {1, 2, 3}, - 4+4+4, 8, 512, NULL, NULL, vmdk4GetBackingStore, NULL + 4+4+4, 8, 512, NULL, NULL, vmdk4GetBackingStore, NULL, NULL }, }; G_STATIC_ASSERT(G_N_ELEMENTS(fileTypeInfo) =3D=3D VIR_STORAGE_FILE_LAST); --=20 2.43.5