mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Remove virStorageSourceGetUniqueIdentifier file backend API
The API isn't used any more. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
a43c8763bf
commit
218ddd60e7
@ -1719,7 +1719,6 @@ virStorageSourceGetMetadata;
|
|||||||
virStorageSourceGetMetadataFromBuf;
|
virStorageSourceGetMetadataFromBuf;
|
||||||
virStorageSourceGetMetadataFromFD;
|
virStorageSourceGetMetadataFromFD;
|
||||||
virStorageSourceGetRelativeBackingPath;
|
virStorageSourceGetRelativeBackingPath;
|
||||||
virStorageSourceGetUniqueIdentifier;
|
|
||||||
virStorageSourceInit;
|
virStorageSourceInit;
|
||||||
virStorageSourceInitAs;
|
virStorageSourceInitAs;
|
||||||
virStorageSourceNewFromBacking;
|
virStorageSourceNewFromBacking;
|
||||||
|
@ -60,9 +60,6 @@ typedef ssize_t
|
|||||||
size_t len,
|
size_t len,
|
||||||
char **buf);
|
char **buf);
|
||||||
|
|
||||||
typedef const char *
|
|
||||||
(*virStorageFileBackendGetUniqueIdentifier)(virStorageSourcePtr src);
|
|
||||||
|
|
||||||
typedef int
|
typedef int
|
||||||
(*virStorageFileBackendAccess)(virStorageSourcePtr src,
|
(*virStorageFileBackendAccess)(virStorageSourcePtr src,
|
||||||
int mode);
|
int mode);
|
||||||
@ -88,7 +85,6 @@ struct _virStorageFileBackend {
|
|||||||
virStorageFileBackendInit backendInit;
|
virStorageFileBackendInit backendInit;
|
||||||
virStorageFileBackendDeinit backendDeinit;
|
virStorageFileBackendDeinit backendDeinit;
|
||||||
virStorageFileBackendRead storageFileRead;
|
virStorageFileBackendRead storageFileRead;
|
||||||
virStorageFileBackendGetUniqueIdentifier storageFileGetUniqueIdentifier;
|
|
||||||
|
|
||||||
/* The following group of callbacks is expected to set errno
|
/* The following group of callbacks is expected to set errno
|
||||||
* and return -1 on error. No libvirt error shall be reported */
|
* and return -1 on error. No libvirt error shall be reported */
|
||||||
|
@ -147,24 +147,6 @@ virStorageFileBackendFileRead(virStorageSourcePtr src,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
virStorageFileBackendFileGetUniqueIdentifier(virStorageSourcePtr src)
|
|
||||||
{
|
|
||||||
virStorageDriverDataPtr drv = src->drv;
|
|
||||||
virStorageFileBackendFsPrivPtr priv = drv->priv;
|
|
||||||
|
|
||||||
if (!priv->canonpath) {
|
|
||||||
if (!(priv->canonpath = virFileCanonicalizePath(src->path))) {
|
|
||||||
virReportSystemError(errno, _("can't canonicalize path '%s'"),
|
|
||||||
src->path);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return priv->canonpath;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virStorageFileBackendFileAccess(virStorageSourcePtr src,
|
virStorageFileBackendFileAccess(virStorageSourcePtr src,
|
||||||
int mode)
|
int mode)
|
||||||
@ -197,8 +179,6 @@ virStorageFileBackend virStorageFileBackendFile = {
|
|||||||
.storageFileRead = virStorageFileBackendFileRead,
|
.storageFileRead = virStorageFileBackendFileRead,
|
||||||
.storageFileAccess = virStorageFileBackendFileAccess,
|
.storageFileAccess = virStorageFileBackendFileAccess,
|
||||||
.storageFileChown = virStorageFileBackendFileChown,
|
.storageFileChown = virStorageFileBackendFileChown,
|
||||||
|
|
||||||
.storageFileGetUniqueIdentifier = virStorageFileBackendFileGetUniqueIdentifier,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -212,8 +192,6 @@ virStorageFileBackend virStorageFileBackendBlock = {
|
|||||||
.storageFileRead = virStorageFileBackendFileRead,
|
.storageFileRead = virStorageFileBackendFileRead,
|
||||||
.storageFileAccess = virStorageFileBackendFileAccess,
|
.storageFileAccess = virStorageFileBackendFileAccess,
|
||||||
.storageFileChown = virStorageFileBackendFileChown,
|
.storageFileChown = virStorageFileBackendFileChown,
|
||||||
|
|
||||||
.storageFileGetUniqueIdentifier = virStorageFileBackendFileGetUniqueIdentifier,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -225,8 +203,6 @@ virStorageFileBackend virStorageFileBackendDir = {
|
|||||||
|
|
||||||
.storageFileAccess = virStorageFileBackendFileAccess,
|
.storageFileAccess = virStorageFileBackendFileAccess,
|
||||||
.storageFileChown = virStorageFileBackendFileChown,
|
.storageFileChown = virStorageFileBackendFileChown,
|
||||||
|
|
||||||
.storageFileGetUniqueIdentifier = virStorageFileBackendFileGetUniqueIdentifier,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -255,75 +255,6 @@ virStorageFileBackendGlusterAccess(virStorageSourcePtr src,
|
|||||||
return glfs_access(priv->vol, src->path, mode);
|
return glfs_access(priv->vol, src->path, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
virStorageFileBackendGlusterReadlinkCallback(const char *path,
|
|
||||||
char **linkpath,
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
virStorageFileBackendGlusterPrivPtr priv = data;
|
|
||||||
size_t bufsiz = 0;
|
|
||||||
ssize_t ret;
|
|
||||||
struct stat st;
|
|
||||||
g_autofree char *buf = NULL;
|
|
||||||
|
|
||||||
*linkpath = 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 = glfs_readlink(priv->vol, path, buf, bufsiz)) < 0) {
|
|
||||||
virReportSystemError(errno,
|
|
||||||
_("failed to read link of gluster file '%s'"),
|
|
||||||
path);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret == bufsiz)
|
|
||||||
goto realloc;
|
|
||||||
|
|
||||||
buf[ret] = '\0';
|
|
||||||
|
|
||||||
*linkpath = g_steal_pointer(&buf);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
virStorageFileBackendGlusterGetUniqueIdentifier(virStorageSourcePtr src)
|
|
||||||
{
|
|
||||||
virStorageDriverDataPtr drv = src->drv;
|
|
||||||
virStorageFileBackendGlusterPrivPtr priv = drv->priv;
|
|
||||||
g_autofree char *filePath = NULL;
|
|
||||||
|
|
||||||
if (priv->canonpath)
|
|
||||||
return priv->canonpath;
|
|
||||||
|
|
||||||
if (!(filePath = virStorageFileCanonicalizePath(src->path,
|
|
||||||
virStorageFileBackendGlusterReadlinkCallback,
|
|
||||||
priv)))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
priv->canonpath = g_strdup_printf("gluster://%s:%u/%s/%s",
|
|
||||||
src->hosts->name,
|
|
||||||
src->hosts->port,
|
|
||||||
src->volume,
|
|
||||||
filePath);
|
|
||||||
|
|
||||||
return priv->canonpath;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virStorageFileBackendGlusterChown(const virStorageSource *src,
|
virStorageFileBackendGlusterChown(const virStorageSource *src,
|
||||||
uid_t uid,
|
uid_t uid,
|
||||||
@ -349,8 +280,6 @@ virStorageFileBackend virStorageFileBackendGluster = {
|
|||||||
.storageFileRead = virStorageFileBackendGlusterRead,
|
.storageFileRead = virStorageFileBackendGlusterRead,
|
||||||
.storageFileAccess = virStorageFileBackendGlusterAccess,
|
.storageFileAccess = virStorageFileBackendGlusterAccess,
|
||||||
.storageFileChown = virStorageFileBackendGlusterChown,
|
.storageFileChown = virStorageFileBackendGlusterChown,
|
||||||
|
|
||||||
.storageFileGetUniqueIdentifier = virStorageFileBackendGlusterGetUniqueIdentifier,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -843,8 +843,7 @@ virStorageSourceSupportsBackingChainTraversal(const virStorageSource *src)
|
|||||||
if ((rv = virStorageSourceGetBackendForSupportCheck(src, &backend)) < 1)
|
if ((rv = virStorageSourceGetBackendForSupportCheck(src, &backend)) < 1)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
return backend->storageFileGetUniqueIdentifier &&
|
return backend->storageFileRead &&
|
||||||
backend->storageFileRead &&
|
|
||||||
backend->storageFileAccess ? 1 : 0;
|
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 = NULL;
|
|
||||||
|
|
||||||
if (!virStorageSourceIsInitialized(src)) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
||||||
_("storage file backend not initialized"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
drv = src->drv;
|
|
||||||
|
|
||||||
if (!drv->backend->storageFileGetUniqueIdentifier) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
||||||
_("unique storage file identifier not implemented for "
|
|
||||||
"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
|
* virStorageSourceAccess: Check accessibility of a storage file
|
||||||
*
|
*
|
||||||
|
@ -107,9 +107,6 @@ virStorageSourceRead(virStorageSourcePtr src,
|
|||||||
size_t len,
|
size_t len,
|
||||||
char **buf);
|
char **buf);
|
||||||
|
|
||||||
const char *
|
|
||||||
virStorageSourceGetUniqueIdentifier(virStorageSourcePtr src);
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virStorageSourceAccess(virStorageSourcePtr src,
|
virStorageSourceAccess(virStorageSourcePtr src,
|
||||||
int mode);
|
int mode);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user