From nobody Sat Feb 7 13:45:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1609936029; cv=none; d=zohomail.com; s=zohoarc; b=Q/Tc6LMKxRX1IK4VOIv2l4bWpGwvCEBsQziYoGCHHmlEy3RyWY9sjcNoJmY7tuuCVhtj/rFt2Nag3c+u1Jj2sU3bvOAp+4clMFMrMydjdvsyFylglbwiS9GOmd/cu/QxpNxf8G6lj5rk4iQCADhq+vW4MxGJpXkCengpwCYM5T8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609936029; 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=ZB/duAl5/B3QE9zHlv7KE9EBKlrJnlFBamV+pdJulXw=; b=ELsJkmomBfl14eiwGSIlwB1c08umOdn9yIIPbTu+ZBmSpSzevI3oWOhVVB8fzt1DIdxPIIdG9+TAthA+mIYy3mL3ZSmImz7RvmTVcBdFpe6sTBpQwrGlTO8eZTTIqVdkoM1bXcZo2yZRgCgs3/pT3SHyVuVzmgefaMGnG22wqRg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1609936029278498.48700118305067; Wed, 6 Jan 2021 04:27:09 -0800 (PST) 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-237-OQ0is1peOAOZCxfZMM37Wg-1; Wed, 06 Jan 2021 07:26:23 -0500 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 A8DC9190A7A0; Wed, 6 Jan 2021 12:26:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 87FFD60875; Wed, 6 Jan 2021 12:26:17 +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 530D44E590; Wed, 6 Jan 2021 12:26:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 106CQBYZ019076 for ; Wed, 6 Jan 2021 07:26:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id 067F460BE5; Wed, 6 Jan 2021 12:26:11 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.194.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 76E8B60BE2 for ; Wed, 6 Jan 2021 12:26:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609936028; 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=ZB/duAl5/B3QE9zHlv7KE9EBKlrJnlFBamV+pdJulXw=; b=N2qfBQZfxvFDPc38c7uBv1RgfavhYxHRrIQ4S34DMqqeQVwu6p9x43mN634U8zDjJBRQg+ 8nvmsFfLoEUj6IPHM61hdHIo9774MIJzuO822x+WOfKY+Dl57BqTEbE8lazgKpjimDjZgk ecG05FqLzouORRVU74acTfsILqWhLtc= X-MC-Unique: OQ0is1peOAOZCxfZMM37Wg-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH v2 7/9] virfile: refactor virFileNBDDeviceAssociate Date: Wed, 6 Jan 2021 13:25:58 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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" The only reason why virstoragefile.h needs to be included in virfile.h is that virFileNBDDeviceAssociate() takes virStorageFileFormat argument. The function doesn't need the enum value as it converts the value to string and uses only that. Change the argument to string which will allow us to remove that include. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/lxc/lxc_controller.c | 4 ++-- src/util/virfile.c | 8 ++------ src/util/virfile.h | 3 +-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 67e5e63d00..8f166a436a 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -509,7 +509,7 @@ static int virLXCControllerSetupNBDDeviceFS(virDomainFS= DefPtr fs) } =20 if (virFileNBDDeviceAssociate(fs->src->path, - fs->format, + virStorageFileFormatTypeToString(fs->for= mat), fs->readonly, &dev) < 0) return -1; @@ -541,7 +541,7 @@ static int virLXCControllerSetupNBDDeviceDisk(virDomain= DiskDefPtr disk) } =20 if (virFileNBDDeviceAssociate(src, - format, + virStorageFileFormatTypeToString(format), disk->src->readonly, &dev) < 0) return -1; diff --git a/src/util/virfile.c b/src/util/virfile.c index f7283fa72f..3f4c6d1d0a 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -879,14 +879,13 @@ virFileNBDLoadDriver(void) } =20 int virFileNBDDeviceAssociate(const char *file, - virStorageFileFormat fmt, + const char *fmtstr, bool readonly, char **dev) { g_autofree char *nbddev =3D NULL; g_autofree char *qemunbd =3D NULL; g_autoptr(virCommand) cmd =3D NULL; - const char *fmtstr =3D NULL; =20 if (!virFileNBDLoadDriver()) return -1; @@ -900,9 +899,6 @@ int virFileNBDDeviceAssociate(const char *file, return -1; } =20 - if (fmt > 0) - fmtstr =3D virStorageFileFormatTypeToString(fmt); - cmd =3D virCommandNew(qemunbd); =20 /* Explicitly not trying to cope with old qemu-nbd which @@ -945,7 +941,7 @@ int virFileLoopDeviceAssociate(const char *file, } =20 int virFileNBDDeviceAssociate(const char *file, - virStorageFileFormat fmt G_GNUC_UNUSED, + const char *fmtstr G_GNUC_UNUSED, bool readonly G_GNUC_UNUSED, char **dev G_GNUC_UNUSED) { diff --git a/src/util/virfile.h b/src/util/virfile.h index 0f197be73d..28dfe86445 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -28,7 +28,6 @@ =20 #include "internal.h" #include "virbitmap.h" -#include "virstoragefile.h" #include "virenum.h" =20 typedef enum { @@ -144,7 +143,7 @@ int virFileLoopDeviceAssociate(const char *file, char **dev); =20 int virFileNBDDeviceAssociate(const char *file, - virStorageFileFormat fmt, + const char *fmtstr, bool readonly, char **dev); =20 --=20 2.29.2