提交 fe46a7e6 编写于 作者: M Matthias Bolte

Remove conn parameter from storage file functions

It was used for error reporting only.
上级 f972dc2d
......@@ -105,7 +105,7 @@ err:
static int
qemuSecurityDACSetSecurityImageLabel(virConnectPtr conn,
qemuSecurityDACSetSecurityImageLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainObjPtr vm ATTRIBUTE_UNUSED,
virDomainDiskDefPtr disk)
......@@ -125,7 +125,7 @@ qemuSecurityDACSetSecurityImageLabel(virConnectPtr conn,
memset(&meta, 0, sizeof(meta));
ret = virStorageFileGetMetadata(conn, path, &meta);
ret = virStorageFileGetMetadata(path, &meta);
if (path != disk->src)
VIR_FREE(path);
......
......@@ -407,7 +407,7 @@ SELinuxRestoreSecurityImageLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
}
static int
SELinuxSetSecurityImageLabel(virConnectPtr conn,
SELinuxSetSecurityImageLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainObjPtr vm,
virDomainDiskDefPtr disk)
......@@ -428,7 +428,7 @@ SELinuxSetSecurityImageLabel(virConnectPtr conn,
memset(&meta, 0, sizeof(meta));
ret = virStorageFileGetMetadata(conn, path, &meta);
ret = virStorageFileGetMetadata(path, &meta);
if (path != disk->src)
VIR_FREE(path);
......
......@@ -49,8 +49,7 @@
#define VIR_FROM_THIS VIR_FROM_STORAGE
static int
virStorageBackendProbeTarget(virConnectPtr conn,
virStorageVolTargetPtr target,
virStorageBackendProbeTarget(virStorageVolTargetPtr target,
char **backingStore,
unsigned long long *allocation,
unsigned long long *capacity,
......@@ -78,7 +77,7 @@ virStorageBackendProbeTarget(virConnectPtr conn,
memset(&meta, 0, sizeof(meta));
if (virStorageFileGetMetadataFromFD(conn, target->path, fd, &meta) < 0) {
if (virStorageFileGetMetadataFromFD(target->path, fd, &meta) < 0) {
close(fd);
return -1;
}
......@@ -556,7 +555,7 @@ error:
* within it. This is non-recursive.
*/
static int
virStorageBackendFileSystemRefresh(virConnectPtr conn,
virStorageBackendFileSystemRefresh(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool)
{
DIR *dir;
......@@ -591,8 +590,7 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn,
if ((vol->key = strdup(vol->target.path)) == NULL)
goto no_memory;
if ((ret = virStorageBackendProbeTarget(conn,
&vol->target,
if ((ret = virStorageBackendProbeTarget(&vol->target,
&backingStore,
&vol->allocation,
&vol->capacity,
......@@ -633,8 +631,7 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn,
} else {
vol->backingStore.path = backingStore;
if ((ret = virStorageBackendProbeTarget(conn,
&vol->backingStore,
if ((ret = virStorageBackendProbeTarget(&vol->backingStore,
NULL, NULL, NULL,
NULL)) < 0) {
if (ret == -1)
......
......@@ -73,16 +73,12 @@ struct FileTypeInfo {
int qcowCryptOffset; /* Byte offset from start of file
* where to find encryption mode,
* -1 if encryption is not used */
int (*getBackingStore)(virConnectPtr conn, char **res,
const unsigned char *buf, size_t buf_size);
int (*getBackingStore)(char **res, const unsigned char *buf, size_t buf_size);
};
static int cowGetBackingStore(virConnectPtr, char **,
const unsigned char *, size_t);
static int qcowXGetBackingStore(virConnectPtr, char **,
const unsigned char *, size_t);
static int vmdk4GetBackingStore(virConnectPtr, char **,
const unsigned char *, size_t);
static int cowGetBackingStore(char **, const unsigned char *, size_t);
static int qcowXGetBackingStore(char **, const unsigned char *, size_t);
static int vmdk4GetBackingStore(char **, const unsigned char *, size_t);
static struct FileTypeInfo const fileTypeInfo[] = {
......@@ -142,8 +138,7 @@ static struct FileTypeInfo const fileTypeInfo[] = {
};
static int
cowGetBackingStore(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
char **res,
cowGetBackingStore(char **res,
const unsigned char *buf,
size_t buf_size)
{
......@@ -163,8 +158,7 @@ cowGetBackingStore(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
}
static int
qcowXGetBackingStore(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
char **res,
qcowXGetBackingStore(char **res,
const unsigned char *buf,
size_t buf_size)
{
......@@ -205,8 +199,7 @@ qcowXGetBackingStore(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
static int
vmdk4GetBackingStore(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
char **res,
vmdk4GetBackingStore(char **res,
const unsigned char *buf,
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.
*/
int
virStorageFileGetMetadataFromFD(virConnectPtr conn,
const char *path,
virStorageFileGetMetadataFromFD(const char *path,
int fd,
virStorageFileMetadata *meta)
{
......@@ -362,7 +354,7 @@ virStorageFileGetMetadataFromFD(virConnectPtr conn,
if (fileTypeInfo[i].getBackingStore != NULL) {
char *base;
switch (fileTypeInfo[i].getBackingStore(conn, &base, head, len)) {
switch (fileTypeInfo[i].getBackingStore(&base, head, len)) {
case BACKING_STORE_OK:
break;
......@@ -400,8 +392,7 @@ virStorageFileGetMetadataFromFD(virConnectPtr conn,
}
int
virStorageFileGetMetadata(virConnectPtr conn,
const char *path,
virStorageFileGetMetadata(const char *path,
virStorageFileMetadata *meta)
{
int fd, ret;
......@@ -411,7 +402,7 @@ virStorageFileGetMetadata(virConnectPtr conn,
return -1;
}
ret = virStorageFileGetMetadataFromFD(conn, path, fd, meta);
ret = virStorageFileGetMetadataFromFD(path, fd, meta);
close(fd);
......
......@@ -51,11 +51,9 @@ typedef struct _virStorageFileMetadata {
bool encrypted;
} virStorageFileMetadata;
int virStorageFileGetMetadata(virConnectPtr conn,
const char *path,
int virStorageFileGetMetadata(const char *path,
virStorageFileMetadata *meta);
int virStorageFileGetMetadataFromFD(virConnectPtr conn,
const char *path,
int virStorageFileGetMetadataFromFD(const char *path,
int fd,
virStorageFileMetadata *meta);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册