From nobody Mon Feb 9 02:11:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 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=1573821695; cv=none; d=zoho.com; s=zohoarc; b=IM6SiiMhqf4UpB/Z6qrOmozl5Y07d3yLdBvxhRCiv2hcsZHWDTGsymIWtoYk/PcgOBAj7ZlammGC8TKa/O0VmGxmB52E2P5QfC9r6l9i6jG6q/47ZejfYVMvumbA5wdYoG2GFJd/UYeFBWcKMXsRbjpoT2d9ktDloOyhoCWHIx8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573821695; 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=g5dSAbDArcFJI+BXDJmISi1mNtaVFYFkeL72lYQffGc=; b=Rw0CE3AMzqAm/YmyKHMEZHLT+gclqLVuvjRbQkxghFs9i29rozgNRUDOV5DKAizHhjD8lWICxFy0jQKUVlwLkbPib7zF3gSuFJX74dDL3eA588rqPGMqzIcZi62r9dQFM7m2mCd6SwhabxDrlP8o2Rf2Ob4FpFssKFLUYlhVjkw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1573821695491801.5678866661669; Fri, 15 Nov 2019 04:41:35 -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-375-aWbT7C1VPwe0McMl8PbzFA-1; Fri, 15 Nov 2019 07:41:32 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C86C7804F97; Fri, 15 Nov 2019 12:41:26 +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 9C40F5ED37; Fri, 15 Nov 2019 12:41:26 +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 58FAC4E56C; Fri, 15 Nov 2019 12:41:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAFCfAxF027037 for ; Fri, 15 Nov 2019 07:41:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7679B5ED32; Fri, 15 Nov 2019 12:41:10 +0000 (UTC) Received: from lindworm.usersys.redhat.com (unknown [10.43.2.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 01DA85E263 for ; Fri, 15 Nov 2019 12:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573821694; 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=g5dSAbDArcFJI+BXDJmISi1mNtaVFYFkeL72lYQffGc=; b=AAExR2F+nsks5aA9OqLgmE6sqg0th4RMY1ZFCa/3EtLO+7tUUBiwLMc6Y1S3ETw0K2WZlP C3AwRkF9lR39s6K3Qs38v9dK9I17j+oUQJ94PT1vaYG0TTN2StsxqYaYUyOSmfGQFqXOL+ +aCAU4DIuQrnof1nCb+kr7jsqDK9YVs= From: Pino Toscano To: libvir-list@redhat.com Date: Fri, 15 Nov 2019 13:40:48 +0100 Message-Id: <20191115124051.989-10-ptoscano@redhat.com> In-Reply-To: <20191115124051.989-1-ptoscano@redhat.com> References: <20191115124051.989-1-ptoscano@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 09/12] esx: split datastorePathToStorageVol helper 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.14 X-MC-Unique: aWbT7C1VPwe0McMl8PbzFA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Move the creation of a virStorageVolPtr object by lookup out of esxStorageVolLookupByPath in an own helper. This way it can be used also in other functions. Signed-off-by: Pino Toscano Reviewed-by: Cole Robinson --- src/esx/esx_storage_backend_vmfs.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backe= nd_vmfs.c index 1270c21e00..ab47a4c272 100644 --- a/src/esx/esx_storage_backend_vmfs.c +++ b/src/esx/esx_storage_backend_vmfs.c @@ -695,32 +695,40 @@ esxStorageVolLookupByName(virStoragePoolPtr pool, =20 =20 =20 +static virStorageVolPtr +datastorePathToStorageVol(virConnectPtr conn, const char *pool, + const char *path) +{ + esxPrivate *priv =3D conn->privateData; + g_autofree char *key =3D NULL; + + if (esxVI_LookupStorageVolumeKeyByDatastorePath(priv->primary, path, + &key) < 0) { + return NULL; + } + + return virGetStorageVol(conn, pool, path, key, + &esxStorageBackendVMFS, NULL); +} + + static virStorageVolPtr esxStorageVolLookupByPath(virConnectPtr conn, const char *path) { virStorageVolPtr volume =3D NULL; - esxPrivate *priv =3D conn->privateData; char *datastoreName =3D NULL; char *directoryAndFileName =3D NULL; - char *key =3D NULL; =20 if (esxUtil_ParseDatastorePath(path, &datastoreName, NULL, &directoryAndFileName) < 0) { goto cleanup; } =20 - if (esxVI_LookupStorageVolumeKeyByDatastorePath(priv->primary, path, - &key) < 0) { - goto cleanup; - } - - volume =3D virGetStorageVol(conn, datastoreName, directoryAndFileName,= key, - &esxStorageBackendVMFS, NULL); + volume =3D datastorePathToStorageVol(conn, datastoreName, directoryAnd= FileName); =20 cleanup: VIR_FREE(datastoreName); VIR_FREE(directoryAndFileName); - VIR_FREE(key); =20 return volume; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list