From nobody Mon Feb 9 16:35:00 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=1617285322; cv=none; d=zohomail.com; s=zohoarc; b=iGS4HfLB6mWMaNhXCDPPUZDN3LN7UHYWZYwAL+2bkmMNRgwxoODQuXLMzO8p2Rmut4n+hxvXILg64zfcX1CT3qmtB+Xstr0KAxPGluUhaUntzSDrpVR6X1VuWW/xraIZOyl8CQV/G1z2rY+XquhhNl2nrmPeTJ/OihUx7mYMZw8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617285322; 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=tfxbis/NJ+LYJZ7VoIpjCFq7bScOpXIQVJZd1wTuuRQ=; b=HfzOpsLSsT+xOlgbePx/fC5AAt6M2FIN/wR1Et2hiQF+sFioyez1wfoYJM3lxEMnC4Iw0h9kykjqxg6dYLIPwh0RI5GKBJANDbFeYCmEjknS3usFNNM3jEn9e4E5886xNlUFD+9ouv20jaqT4Odakx387jcV+GW9SE56ipipCZg= 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 16172853229771023.5211941537154; Thu, 1 Apr 2021 06:55:22 -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-133-BxR8rfTDPyKOpU_tGZbQPQ-1; Thu, 01 Apr 2021 09:55:19 -0400 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 0F26A873071; Thu, 1 Apr 2021 13:54:31 +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 D7DC35D9DE; Thu, 1 Apr 2021 13:54:30 +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 9416A4A701; Thu, 1 Apr 2021 13:54:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 131Dqqfx023045 for ; Thu, 1 Apr 2021 09:52:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4DABF5C237; Thu, 1 Apr 2021 13:52:52 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id A75365C1A1 for ; Thu, 1 Apr 2021 13:52:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617285322; 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=tfxbis/NJ+LYJZ7VoIpjCFq7bScOpXIQVJZd1wTuuRQ=; b=XhUsYV55J7SHTPbf9jPZBszgplNEOcOuyhZo2Tr990sB595H2YvgHc3JbH/watm+//mJ6Y kw49Ig6NVmcsU6AouJRvX4owfhiQT9oI95d3E9mpvAc5AiChONLLllWGiH+RQASDV1P99A 0FbpkGoPpb2HRtkcDzwmYo58hfR9r9s= X-MC-Unique: BxR8rfTDPyKOpU_tGZbQPQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 03/39] Remove virStorageSourceGetUniqueIdentifier file backend API Date: Thu, 1 Apr 2021 15:52:02 +0200 Message-Id: <72420e07e8cbe45aa42a087958e14ec45fa772f3.1617285119.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.14 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 API isn't used any more. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 1 - src/storage_file/storage_file_backend.h | 4 -- src/storage_file/storage_file_backend_fs.c | 24 ------- .../storage_file_backend_gluster.c | 71 ------------------- src/storage_file/storage_source.c | 37 +--------- 5 files changed, 1 insertion(+), 136 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index cb9fe7c80a..62ccda467f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1713,7 +1713,6 @@ virStorageSourceGetMetadata; virStorageSourceGetMetadataFromBuf; virStorageSourceGetMetadataFromFD; virStorageSourceGetRelativeBackingPath; -virStorageSourceGetUniqueIdentifier; virStorageSourceInit; virStorageSourceInitAs; virStorageSourceNewFromBacking; diff --git a/src/storage_file/storage_file_backend.h b/src/storage_file/sto= rage_file_backend.h index ecf5883a55..8ad579a8db 100644 --- a/src/storage_file/storage_file_backend.h +++ b/src/storage_file/storage_file_backend.h @@ -60,9 +60,6 @@ typedef ssize_t size_t len, char **buf); -typedef const char * -(*virStorageFileBackendGetUniqueIdentifier)(virStorageSourcePtr src); - typedef int (*virStorageFileBackendAccess)(virStorageSourcePtr src, int mode); @@ -88,7 +85,6 @@ struct _virStorageFileBackend { virStorageFileBackendInit backendInit; virStorageFileBackendDeinit backendDeinit; virStorageFileBackendRead storageFileRead; - virStorageFileBackendGetUniqueIdentifier storageFileGetUniqueIdentifie= r; /* The following group of callbacks is expected to set errno * and return -1 on error. No libvirt error shall be reported */ diff --git a/src/storage_file/storage_file_backend_fs.c b/src/storage_file/= storage_file_backend_fs.c index 7b114fdeb0..f34ffd5fc8 100644 --- a/src/storage_file/storage_file_backend_fs.c +++ b/src/storage_file/storage_file_backend_fs.c @@ -147,24 +147,6 @@ virStorageFileBackendFileRead(virStorageSourcePtr src, } -static const char * -virStorageFileBackendFileGetUniqueIdentifier(virStorageSourcePtr src) -{ - virStorageDriverDataPtr drv =3D src->drv; - virStorageFileBackendFsPrivPtr priv =3D drv->priv; - - if (!priv->canonpath) { - if (!(priv->canonpath =3D virFileCanonicalizePath(src->path))) { - virReportSystemError(errno, _("can't canonicalize path '%s'"), - src->path); - return NULL; - } - } - - return priv->canonpath; -} - - static int virStorageFileBackendFileAccess(virStorageSourcePtr src, int mode) @@ -197,8 +179,6 @@ virStorageFileBackend virStorageFileBackendFile =3D { .storageFileRead =3D virStorageFileBackendFileRead, .storageFileAccess =3D virStorageFileBackendFileAccess, .storageFileChown =3D virStorageFileBackendFileChown, - - .storageFileGetUniqueIdentifier =3D virStorageFileBackendFileGetUnique= Identifier, }; @@ -212,8 +192,6 @@ virStorageFileBackend virStorageFileBackendBlock =3D { .storageFileRead =3D virStorageFileBackendFileRead, .storageFileAccess =3D virStorageFileBackendFileAccess, .storageFileChown =3D virStorageFileBackendFileChown, - - .storageFileGetUniqueIdentifier =3D virStorageFileBackendFileGetUnique= Identifier, }; @@ -225,8 +203,6 @@ virStorageFileBackend virStorageFileBackendDir =3D { .storageFileAccess =3D virStorageFileBackendFileAccess, .storageFileChown =3D virStorageFileBackendFileChown, - - .storageFileGetUniqueIdentifier =3D virStorageFileBackendFileGetUnique= Identifier, }; diff --git a/src/storage_file/storage_file_backend_gluster.c b/src/storage_= file/storage_file_backend_gluster.c index 06ba99bfe3..252eb523af 100644 --- a/src/storage_file/storage_file_backend_gluster.c +++ b/src/storage_file/storage_file_backend_gluster.c @@ -255,75 +255,6 @@ virStorageFileBackendGlusterAccess(virStorageSourcePtr= src, return glfs_access(priv->vol, src->path, mode); } -static int -virStorageFileBackendGlusterReadlinkCallback(const char *path, - char **linkpath, - void *data) -{ - virStorageFileBackendGlusterPrivPtr priv =3D data; - size_t bufsiz =3D 0; - ssize_t ret; - struct stat st; - g_autofree char *buf =3D NULL; - - *linkpath =3D NULL; - - if (glfs_stat(priv->vol, path, &st) < 0) { - virReportSystemError(errno, - _("failed to stat gluster path '%s'"), - path); - return -1; - } - - if (!S_ISLNK(st.st_mode)) - return 1; - - realloc: - VIR_EXPAND_N(buf, bufsiz, 256); - - if ((ret =3D glfs_readlink(priv->vol, path, buf, bufsiz)) < 0) { - virReportSystemError(errno, - _("failed to read link of gluster file '%s'"), - path); - return -1; - } - - if (ret =3D=3D bufsiz) - goto realloc; - - buf[ret] =3D '\0'; - - *linkpath =3D g_steal_pointer(&buf); - - return 0; -} - - -static const char * -virStorageFileBackendGlusterGetUniqueIdentifier(virStorageSourcePtr src) -{ - virStorageDriverDataPtr drv =3D src->drv; - virStorageFileBackendGlusterPrivPtr priv =3D drv->priv; - g_autofree char *filePath =3D NULL; - - if (priv->canonpath) - return priv->canonpath; - - if (!(filePath =3D virStorageFileCanonicalizePath(src->path, - virStorageFileBackendG= lusterReadlinkCallback, - priv))) - return NULL; - - priv->canonpath =3D g_strdup_printf("gluster://%s:%u/%s/%s", - src->hosts->name, - src->hosts->port, - src->volume, - filePath); - - return priv->canonpath; -} - - static int virStorageFileBackendGlusterChown(const virStorageSource *src, uid_t uid, @@ -349,8 +280,6 @@ virStorageFileBackend virStorageFileBackendGluster =3D { .storageFileRead =3D virStorageFileBackendGlusterRead, .storageFileAccess =3D virStorageFileBackendGlusterAccess, .storageFileChown =3D virStorageFileBackendGlusterChown, - - .storageFileGetUniqueIdentifier =3D virStorageFileBackendGlusterGetUni= queIdentifier, }; diff --git a/src/storage_file/storage_source.c b/src/storage_file/storage_s= ource.c index 19b06b02b8..746a3446d8 100644 --- a/src/storage_file/storage_source.c +++ b/src/storage_file/storage_source.c @@ -843,8 +843,7 @@ virStorageSourceSupportsBackingChainTraversal(const vir= StorageSource *src) if ((rv =3D virStorageSourceGetBackendForSupportCheck(src, &backend)) = < 1) return rv; - return backend->storageFileGetUniqueIdentifier && - backend->storageFileRead && + return backend->storageFileRead && backend->storageFileAccess ? 1 : 0; } @@ -1142,40 +1141,6 @@ virStorageSourceRead(virStorageSourcePtr src, } -/* - * virStorageSourceGetUniqueIdentifier: Get a unique string describing the= volume - * - * @src: file structure pointing to the file - * - * Returns a string uniquely describing a single volume (canonical path). - * The string shall not be freed and is valid until the storage file is - * deinitialized. Returns NULL on error and sets a libvirt error code */ -const char * -virStorageSourceGetUniqueIdentifier(virStorageSourcePtr src) -{ - virStorageDriverDataPtr drv =3D NULL; - - if (!virStorageSourceIsInitialized(src)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("storage file backend not initialized")); - return NULL; - } - - drv =3D src->drv; - - if (!drv->backend->storageFileGetUniqueIdentifier) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unique storage file identifier not implemented f= or " - "storage type %s (protocol: %s)'"), - virStorageTypeToString(src->type), - virStorageNetProtocolTypeToString(src->protocol)); - return NULL; - } - - return drv->backend->storageFileGetUniqueIdentifier(src); -} - - /** * virStorageSourceAccess: Check accessibility of a storage file * --=20 2.29.2