mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Remove conn parameter from storage file functions
It was used for error reporting only.
This commit is contained in:
parent
f972dc2d5c
commit
fe46a7e686
@ -105,7 +105,7 @@ err:
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemuSecurityDACSetSecurityImageLabel(virConnectPtr conn,
|
qemuSecurityDACSetSecurityImageLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||||
virDomainObjPtr vm ATTRIBUTE_UNUSED,
|
virDomainObjPtr vm ATTRIBUTE_UNUSED,
|
||||||
virDomainDiskDefPtr disk)
|
virDomainDiskDefPtr disk)
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ qemuSecurityDACSetSecurityImageLabel(virConnectPtr conn,
|
|||||||
|
|
||||||
memset(&meta, 0, sizeof(meta));
|
memset(&meta, 0, sizeof(meta));
|
||||||
|
|
||||||
ret = virStorageFileGetMetadata(conn, path, &meta);
|
ret = virStorageFileGetMetadata(path, &meta);
|
||||||
|
|
||||||
if (path != disk->src)
|
if (path != disk->src)
|
||||||
VIR_FREE(path);
|
VIR_FREE(path);
|
||||||
|
@ -407,7 +407,7 @@ SELinuxRestoreSecurityImageLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SELinuxSetSecurityImageLabel(virConnectPtr conn,
|
SELinuxSetSecurityImageLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
virDomainDiskDefPtr disk)
|
virDomainDiskDefPtr disk)
|
||||||
|
|
||||||
@ -428,7 +428,7 @@ SELinuxSetSecurityImageLabel(virConnectPtr conn,
|
|||||||
|
|
||||||
memset(&meta, 0, sizeof(meta));
|
memset(&meta, 0, sizeof(meta));
|
||||||
|
|
||||||
ret = virStorageFileGetMetadata(conn, path, &meta);
|
ret = virStorageFileGetMetadata(path, &meta);
|
||||||
|
|
||||||
if (path != disk->src)
|
if (path != disk->src)
|
||||||
VIR_FREE(path);
|
VIR_FREE(path);
|
||||||
|
@ -49,8 +49,7 @@
|
|||||||
#define VIR_FROM_THIS VIR_FROM_STORAGE
|
#define VIR_FROM_THIS VIR_FROM_STORAGE
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virStorageBackendProbeTarget(virConnectPtr conn,
|
virStorageBackendProbeTarget(virStorageVolTargetPtr target,
|
||||||
virStorageVolTargetPtr target,
|
|
||||||
char **backingStore,
|
char **backingStore,
|
||||||
unsigned long long *allocation,
|
unsigned long long *allocation,
|
||||||
unsigned long long *capacity,
|
unsigned long long *capacity,
|
||||||
@ -78,7 +77,7 @@ virStorageBackendProbeTarget(virConnectPtr conn,
|
|||||||
|
|
||||||
memset(&meta, 0, sizeof(meta));
|
memset(&meta, 0, sizeof(meta));
|
||||||
|
|
||||||
if (virStorageFileGetMetadataFromFD(conn, target->path, fd, &meta) < 0) {
|
if (virStorageFileGetMetadataFromFD(target->path, fd, &meta) < 0) {
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -556,7 +555,7 @@ error:
|
|||||||
* within it. This is non-recursive.
|
* within it. This is non-recursive.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
virStorageBackendFileSystemRefresh(virConnectPtr conn,
|
virStorageBackendFileSystemRefresh(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||||
virStoragePoolObjPtr pool)
|
virStoragePoolObjPtr pool)
|
||||||
{
|
{
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
@ -591,8 +590,7 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn,
|
|||||||
if ((vol->key = strdup(vol->target.path)) == NULL)
|
if ((vol->key = strdup(vol->target.path)) == NULL)
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
|
||||||
if ((ret = virStorageBackendProbeTarget(conn,
|
if ((ret = virStorageBackendProbeTarget(&vol->target,
|
||||||
&vol->target,
|
|
||||||
&backingStore,
|
&backingStore,
|
||||||
&vol->allocation,
|
&vol->allocation,
|
||||||
&vol->capacity,
|
&vol->capacity,
|
||||||
@ -633,8 +631,7 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn,
|
|||||||
} else {
|
} else {
|
||||||
vol->backingStore.path = backingStore;
|
vol->backingStore.path = backingStore;
|
||||||
|
|
||||||
if ((ret = virStorageBackendProbeTarget(conn,
|
if ((ret = virStorageBackendProbeTarget(&vol->backingStore,
|
||||||
&vol->backingStore,
|
|
||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
NULL)) < 0) {
|
NULL)) < 0) {
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
|
@ -73,16 +73,12 @@ struct FileTypeInfo {
|
|||||||
int qcowCryptOffset; /* Byte offset from start of file
|
int qcowCryptOffset; /* Byte offset from start of file
|
||||||
* where to find encryption mode,
|
* where to find encryption mode,
|
||||||
* -1 if encryption is not used */
|
* -1 if encryption is not used */
|
||||||
int (*getBackingStore)(virConnectPtr conn, char **res,
|
int (*getBackingStore)(char **res, const unsigned char *buf, size_t buf_size);
|
||||||
const unsigned char *buf, size_t buf_size);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int cowGetBackingStore(virConnectPtr, char **,
|
static int cowGetBackingStore(char **, const unsigned char *, size_t);
|
||||||
const unsigned char *, size_t);
|
static int qcowXGetBackingStore(char **, const unsigned char *, size_t);
|
||||||
static int qcowXGetBackingStore(virConnectPtr, char **,
|
static int vmdk4GetBackingStore(char **, const unsigned char *, size_t);
|
||||||
const unsigned char *, size_t);
|
|
||||||
static int vmdk4GetBackingStore(virConnectPtr, char **,
|
|
||||||
const unsigned char *, size_t);
|
|
||||||
|
|
||||||
|
|
||||||
static struct FileTypeInfo const fileTypeInfo[] = {
|
static struct FileTypeInfo const fileTypeInfo[] = {
|
||||||
@ -142,8 +138,7 @@ static struct FileTypeInfo const fileTypeInfo[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cowGetBackingStore(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
|
cowGetBackingStore(char **res,
|
||||||
char **res,
|
|
||||||
const unsigned char *buf,
|
const unsigned char *buf,
|
||||||
size_t buf_size)
|
size_t buf_size)
|
||||||
{
|
{
|
||||||
@ -163,8 +158,7 @@ cowGetBackingStore(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qcowXGetBackingStore(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
|
qcowXGetBackingStore(char **res,
|
||||||
char **res,
|
|
||||||
const unsigned char *buf,
|
const unsigned char *buf,
|
||||||
size_t buf_size)
|
size_t buf_size)
|
||||||
{
|
{
|
||||||
@ -205,8 +199,7 @@ qcowXGetBackingStore(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vmdk4GetBackingStore(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
|
vmdk4GetBackingStore(char **res,
|
||||||
char **res,
|
|
||||||
const unsigned char *buf,
|
const unsigned char *buf,
|
||||||
size_t buf_size)
|
size_t buf_size)
|
||||||
{
|
{
|
||||||
@ -269,8 +262,7 @@ absolutePathFromBaseFile(const char *base_file, const char *path)
|
|||||||
* it is, and info about its capacity if available.
|
* it is, and info about its capacity if available.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virStorageFileGetMetadataFromFD(virConnectPtr conn,
|
virStorageFileGetMetadataFromFD(const char *path,
|
||||||
const char *path,
|
|
||||||
int fd,
|
int fd,
|
||||||
virStorageFileMetadata *meta)
|
virStorageFileMetadata *meta)
|
||||||
{
|
{
|
||||||
@ -362,7 +354,7 @@ virStorageFileGetMetadataFromFD(virConnectPtr conn,
|
|||||||
if (fileTypeInfo[i].getBackingStore != NULL) {
|
if (fileTypeInfo[i].getBackingStore != NULL) {
|
||||||
char *base;
|
char *base;
|
||||||
|
|
||||||
switch (fileTypeInfo[i].getBackingStore(conn, &base, head, len)) {
|
switch (fileTypeInfo[i].getBackingStore(&base, head, len)) {
|
||||||
case BACKING_STORE_OK:
|
case BACKING_STORE_OK:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -400,8 +392,7 @@ virStorageFileGetMetadataFromFD(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
virStorageFileGetMetadata(virConnectPtr conn,
|
virStorageFileGetMetadata(const char *path,
|
||||||
const char *path,
|
|
||||||
virStorageFileMetadata *meta)
|
virStorageFileMetadata *meta)
|
||||||
{
|
{
|
||||||
int fd, ret;
|
int fd, ret;
|
||||||
@ -411,7 +402,7 @@ virStorageFileGetMetadata(virConnectPtr conn,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = virStorageFileGetMetadataFromFD(conn, path, fd, meta);
|
ret = virStorageFileGetMetadataFromFD(path, fd, meta);
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
|
@ -51,11 +51,9 @@ typedef struct _virStorageFileMetadata {
|
|||||||
bool encrypted;
|
bool encrypted;
|
||||||
} virStorageFileMetadata;
|
} virStorageFileMetadata;
|
||||||
|
|
||||||
int virStorageFileGetMetadata(virConnectPtr conn,
|
int virStorageFileGetMetadata(const char *path,
|
||||||
const char *path,
|
|
||||||
virStorageFileMetadata *meta);
|
virStorageFileMetadata *meta);
|
||||||
int virStorageFileGetMetadataFromFD(virConnectPtr conn,
|
int virStorageFileGetMetadataFromFD(const char *path,
|
||||||
const char *path,
|
|
||||||
int fd,
|
int fd,
|
||||||
virStorageFileMetadata *meta);
|
virStorageFileMetadata *meta);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user