From nobody Sun Feb 8 23:41:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1697468539; cv=none; d=zohomail.com; s=zohoarc; b=dQJ2whHrBWCirgZsfAGNjMIKiG/d9HzOG1HvMNyYke6+PW1cMJqGTAfBfBzcB+W6GD2WlGGQika3J3jIl8oQYzJ6h+fnq0QJji/BnWAfDi1qpX3rSJ4X42nYFAVLc/Tv/sdRjb9zwhXRWTIXMHPDMTpmYK4mLfgXkVx4Jzphcmw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697468539; 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=lThFpVahVT4H/FvFzukMgXGrkZ1ykRL718BGb1WImmQ=; b=VFjlUwahDeLwpoMdvfOI0rU3LyXDMKdndGVZCMVnmo+5fMpiAteWr/aut4wfZaqZjlJZD4rSZpkAkUyRqHNV2Fo9CBIbtQus/sy+DaaFSI+9e8AurCnHX5yyzAF76+BQnZvCUoID+SH+2dBapsraFlZ6xKELuLlIOei1udI+f9Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1697468539220212.80149843214406; Mon, 16 Oct 2023 08:02:19 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-26-w_USmfTcN46IfS1ciIQ-EA-1; Mon, 16 Oct 2023 11:02:12 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 3E03A81DA98; Mon, 16 Oct 2023 15:02:05 +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 28D9E40C6F79; Mon, 16 Oct 2023 15:02:05 +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 9ED14194658F; Mon, 16 Oct 2023 15:02:04 +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 5B14719465B9 for ; Mon, 16 Oct 2023 15:02:04 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4983440C6F7F; Mon, 16 Oct 2023 15:02:04 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE41E40C6F79 for ; Mon, 16 Oct 2023 15:02:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697468538; 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=lThFpVahVT4H/FvFzukMgXGrkZ1ykRL718BGb1WImmQ=; b=F34eF54V5ykq05VaUvQ69TfOZblcRwHC0cIJ1zvMwkrGP/mqzCu57CnqBRkdf66Iq/w1XQ P0PRRI2WeoZKp2Z9kdXjbO96KD5pNT+X+il/nPtCk30/LVsx9Ev7YVbTHbTpW46c0c0lAO C2BxPnzoXiHF1ABiolf5T4IrYb1I52Q= X-MC-Unique: w_USmfTcN46IfS1ciIQ-EA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/31] qemu: block: Add accessors for protocol/storage node names Date: Mon, 16 Oct 2023 17:01:31 +0200 Message-ID: <513be6789b73394f7770cc6dfec67faa876c5fb1.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.2 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: 1697468539962100005 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 Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_block.c | 48 +++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_block.h | 11 ++++++++++ 2 files changed, 59 insertions(+) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 07bc8ede76..0c9460f678 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -52,6 +52,54 @@ qemuBlockNodeNameValidate(const char *nn) } +/** + * qemuBlockStorageSourceSetStorageNodename: + * @src: virStorageSource to set the storage nodename + * @nodename: The node name to set (stolen) + * + * Sets @nodename as the storage node name of @src. Using NULL @nodename c= lears + * the nodename. @src takes ownership of @nodename. + */ +void +qemuBlockStorageSourceSetStorageNodename(virStorageSource *src, + char *nodename) +{ + g_free(src->nodestorage); + src->nodestorage =3D nodename; +} + + +/** + * qemuBlockStorageSourceGetEffectiveStorageNodename: + * @src: virStorageSource to get the effective nodename of + * + * Gets the nodename that exposes the storage corresponding to @src, witho= ut + * the format driver applied. This function always returns a name. + */ +const char * +qemuBlockStorageSourceGetEffectiveStorageNodename(virStorageSource *src) +{ + if (src->sliceStorage && + src->sliceStorage->nodename) + return src->sliceStorage->nodename; + + return src->nodestorage; +} + + +/** + * qemuBlockStorageSourceGetStorageNodename: + * @src: virStorageSource to get the effective nodename of + * + * Gets the nodename corresponding to the real backing storage format laye= r. + */ +const char * +qemuBlockStorageSourceGetStorageNodename(virStorageSource *src) +{ + return src->nodestorage; +} + + /** * qemuBlockStorageSourceSupportsConcurrentAccess: * @src: disk storage source diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index cf5eaf87f3..ecc5711dcd 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -26,6 +26,17 @@ #include "virjson.h" #include "viruri.h" +void +qemuBlockStorageSourceSetStorageNodename(virStorageSource *src, + char *nodename); + +const char * +qemuBlockStorageSourceGetEffectiveStorageNodename(virStorageSource *src); + +const char * +qemuBlockStorageSourceGetStorageNodename(virStorageSource *src); + + typedef struct qemuBlockNodeNameBackingChainData qemuBlockNodeNameBackingC= hainData; struct qemuBlockNodeNameBackingChainData { char *qemufilename; /* name of the image from qemu */ --=20 2.41.0