From nobody Mon Feb 9 03:48:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584987184; cv=none; d=zohomail.com; s=zohoarc; b=W16RF3esI5wN/JFs4GjKDOlnOIcz7vog8oxOrPBktN+7ooB931o5eZEWpCF1GvzHlP7VCGPQ1iLgBMfiMQ3GhUKRcgtcOTes1E1E0UTzt7Bn8OpldzGL7YzGQt6UBtDaMZUkSefdJxC/CrnxkkVEXMTqitpkHCo2rQdGvgnObb8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584987184; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JfSgW+yA7XcjaiZfHk3J4UxI1VdsUo+E92Lbe7msNSE=; b=VGUZ0KHHXlcd76yKXGk5NuWq7o0UqmHsIznQ4vvCqt1C2A/5Wp37c9USvJdC3DaO4SRN1thNVzTrTNBmsv79ag7hueHAOZCSAsFarHijyFSCYVdjJjZFNAclZCZnXZ/0HrwxChEmY0hSKqHT1FseH09bLt3yMa1hkvkaVkf/2ow= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1584987184168968.6604644356471; Mon, 23 Mar 2020 11:13:04 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-163-PT75Zh-_MwukdLW15PTxxw-1; Mon, 23 Mar 2020 14:12:42 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9ED6F801E7E; Mon, 23 Mar 2020 18:12:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7974B7E323; Mon, 23 Mar 2020 18:12:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 247B81803C33; Mon, 23 Mar 2020 18:12:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02NICHQo009512 for ; Mon, 23 Mar 2020 14:12:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8DB428D574; Mon, 23 Mar 2020 18:12:17 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13C229B93A for ; Mon, 23 Mar 2020 18:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584987183; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=JfSgW+yA7XcjaiZfHk3J4UxI1VdsUo+E92Lbe7msNSE=; b=MYeCYBKu8f5OPk2gPPlu5jibtpGhLML8GsevKC9e9QU2b6ByHwIxyNzkcGdAW3zzsV9cT1 qAE9SdWOLa7mGeImfiHF2sKQFaXm9I0wPaHR+7zFdQLF8i1ZCCq+sPiRvipaGFQnUqU3Fu 7/dfbnUdWFoN9hSiVq452fvVhQhBMDE= X-MC-Unique: PT75Zh-_MwukdLW15PTxxw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 10/14] storage: Implement backing store support for "fat:" prefix Date: Mon, 23 Mar 2020 19:12:00 +0100 Message-Id: <6a6532aae473585aef71907d54c65e51f8fc8063.1584986997.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" qemublocktest showed that we don't add the "fat:" prefix for directory storage when formatting the backing store string. While it's unlikely to be used it's simple enough to actually implement the support rather than trying to forbid it. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 7 ++++++- src/util/virstoragefile.c | 9 +++++++++ .../xml2json/dir-fat-cache-srconly.json | 2 +- .../xml2json/dir-fat-floppy-srconly.json | 2 +- .../xml2json/dir-fat-readonly-srconly.json | 2 +- tests/virstoragetest.c | 1 + 6 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index b7c3ba7530..a44cfeb99c 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -2045,8 +2045,13 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr s= rc, g_autofree char *backingJSON =3D NULL; if (!src->sliceStorage) { - if (virStorageSourceIsLocalStorage(src)) + if (virStorageSourceIsLocalStorage(src)) { + if (src->type =3D=3D VIR_STORAGE_TYPE_DIR && + src->format =3D=3D VIR_STORAGE_FILE_FAT) + return g_strdup_printf("fat:%s", src->path); + return g_strdup(src->path); + } /* generate simplified URIs for the easy cases */ if (actualType =3D=3D VIR_STORAGE_TYPE_NETWORK && diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index ca39391379..fa04ff74e1 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -3922,6 +3922,7 @@ virStorageSourceNewFromBackingAbsolute(const char *pa= th, virStorageSourcePtr *src) { const char *json; + const char *dirpath; int rc =3D 0; g_autoptr(virStorageSource) def =3D NULL; @@ -3935,6 +3936,14 @@ virStorageSourceNewFromBackingAbsolute(const char *p= ath, def->path =3D g_strdup(path); } else { + if ((dirpath =3D STRSKIP(path, "fat:"))) { + def->type =3D VIR_STORAGE_TYPE_DIR; + def->format =3D VIR_STORAGE_FILE_FAT; + def->path =3D g_strdup(dirpath); + *src =3D g_steal_pointer(&def); + return 0; + } + def->type =3D VIR_STORAGE_TYPE_NETWORK; VIR_DEBUG("parsing backing store string: '%s'", path); diff --git a/tests/qemublocktestdata/xml2json/dir-fat-cache-srconly.json b/= tests/qemublocktestdata/xml2json/dir-fat-cache-srconly.json index 8bc58fa033..80f866f08b 100644 --- a/tests/qemublocktestdata/xml2json/dir-fat-cache-srconly.json +++ b/tests/qemublocktestdata/xml2json/dir-fat-cache-srconly.json @@ -6,5 +6,5 @@ "floppy": false } backing store string: - /var/somefiles + fat:/var/somefiles ) diff --git a/tests/qemublocktestdata/xml2json/dir-fat-floppy-srconly.json b= /tests/qemublocktestdata/xml2json/dir-fat-floppy-srconly.json index 043b796435..6c86f1da06 100644 --- a/tests/qemublocktestdata/xml2json/dir-fat-floppy-srconly.json +++ b/tests/qemublocktestdata/xml2json/dir-fat-floppy-srconly.json @@ -6,5 +6,5 @@ "floppy": true } backing store string: - /var/somefiles + fat:/var/somefiles ) diff --git a/tests/qemublocktestdata/xml2json/dir-fat-readonly-srconly.json= b/tests/qemublocktestdata/xml2json/dir-fat-readonly-srconly.json index 8bc58fa033..80f866f08b 100644 --- a/tests/qemublocktestdata/xml2json/dir-fat-readonly-srconly.json +++ b/tests/qemublocktestdata/xml2json/dir-fat-readonly-srconly.json @@ -6,5 +6,5 @@ "floppy": false } backing store string: - /var/somefiles + fat:/var/somefiles ) diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 547118951e..209d0c37d3 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -1226,6 +1226,7 @@ mymain(void) TEST_BACKING_PARSE_FULL(bck, xml, 0) TEST_BACKING_PARSE("path", "\n"); + TEST_BACKING_PARSE("fat:/somedir", "\n"); TEST_BACKING_PARSE("://", NULL); TEST_BACKING_PARSE("http://example.com", "\n" --=20 2.24.1