From nobody Mon Feb 9 14:24:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 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=1697468576; cv=none; d=zohomail.com; s=zohoarc; b=PhG34+SC+D0yOgaNoTX9ImHCuQZltNWieWWQ5R+PuflOkbWCKoBje3qwlbqPGzSF7UpZy29fDTCuL44FJxQ+nGJtfEEV6dqP8KBO+qUAm6raM1QrFw1pr/KzZJSQH4PgjKdzD2wkXj6Qaqn493IM7kAgvnJnHtG01+L72DXOWUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697468576; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=9ejFReBsIMdLGppc0GGaLId3ZWV8mcJuqQoEr8QV2HI=; b=P8CkP9+hZ74/eXBuqHGnQlALgSLaCevzE9evGyxYVUbAHlz9bQS2LPUBOyY/zPKbCZ0VBJuN7wJSlGRefcvBKeqSlAi3TwMKXvXFa8DaLjVDn7KpyYNVM2pRs9h/3kO+yojYNY+usnXcuxXE13ncbtMFku4cjzYlZFMjbpbR8OM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1697468576637990.0779588990569; Mon, 16 Oct 2023 08:02:56 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-199-MtQqLRTvOQ2jZ0gak_r_1w-1; Mon, 16 Oct 2023 11:02:48 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 82F91280D215; Mon, 16 Oct 2023 15:02:17 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B0BF25C8; Mon, 16 Oct 2023 15:02:17 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1D72D19465A8; Mon, 16 Oct 2023 15:02:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id F09B01946587 for ; Mon, 16 Oct 2023 15:02:15 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id DF5AF40C6F7F; Mon, 16 Oct 2023 15:02:15 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30B5940C6CA0 for ; Mon, 16 Oct 2023 15:02:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697468575; 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=9ejFReBsIMdLGppc0GGaLId3ZWV8mcJuqQoEr8QV2HI=; b=DUvs/JUpvnkPQbPPpHYbnggSRYxg/WbKj90zNm6ZvoFRDy+8IpW+j203Za/ykfmXH7A6vS wem+6uR8GXFiciZnuoV8Aje1wVxC5wGgqzrYWx6NMYxsQiG2gQufmfFuuad5h3GdHpNmGJ I5tZJKkeeDSejkwbPfX/q/Un7caYaqA= X-MC-Unique: MtQqLRTvOQ2jZ0gak_r_1w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 16/31] qemu: block: Add accessors for format layer node names Date: Mon, 16 Oct 2023 17:01:43 +0200 Message-ID: <365ec8761350814181051acc91842384110ceb14.1697468414.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697468580296100001 Content-Type: text/plain; charset="utf-8" Introduce a set of accessors, which return node names based on semantics. This will allow to us to modify how we setup the backing chain in cases when e.g. the format driver can be omitted, without breaking all the code. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 31 +++++++++++++++++++++++++++++++ src/qemu/qemu_block.h | 7 +++++++ 2 files changed, 38 insertions(+) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index a2414dc2e3..cba1fb1c1e 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -69,6 +69,23 @@ qemuBlockStorageSourceSetStorageNodename(virStorageSourc= e *src, } +/** + * qemuBlockStorageSourceSetFormatNodename: + * @src: virStorageSource to set the format nodename + * @nodename: The node name to set (stolen) + * + * Sets @nodename as the format node name of @src. Using NULL @nodename cl= ears + * the nodename. @src takes ownership of @nodename. + */ +void +qemuBlockStorageSourceSetFormatNodename(virStorageSource *src, + char *nodename) +{ + g_free(src->nodeformat); + src->nodeformat =3D nodename; +} + + /** * qemuBlockStorageSourceGetEffectiveStorageNodename: * @src: virStorageSource to get the effective nodename of @@ -100,6 +117,20 @@ qemuBlockStorageSourceGetStorageNodename(virStorageSou= rce *src) } +/** + * qemuBlockStorageSourceGetFormatNodename: + * @src: virStorageSource to get the effective nodename of + * + * Gets the nodename corresponding to the format layer. Useful when access= ing + * format specific features. Returns NULL if there is no format layer. + */ +const char * +qemuBlockStorageSourceGetFormatNodename(virStorageSource *src) +{ + return src->nodeformat; +} + + /** * qemuBlockStorageSourceSupportsConcurrentAccess: * @src: disk storage source diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index ecc5711dcd..6ed0aa85b2 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -30,12 +30,19 @@ void qemuBlockStorageSourceSetStorageNodename(virStorageSource *src, char *nodename); +void +qemuBlockStorageSourceSetFormatNodename(virStorageSource *src, + char *nodename); + const char * qemuBlockStorageSourceGetEffectiveStorageNodename(virStorageSource *src); const char * qemuBlockStorageSourceGetStorageNodename(virStorageSource *src); +const char * +qemuBlockStorageSourceGetFormatNodename(virStorageSource *src); + typedef struct qemuBlockNodeNameBackingChainData qemuBlockNodeNameBackingC= hainData; struct qemuBlockNodeNameBackingChainData { --=20 2.41.0