The only reason why virstoragefile.h needs to be included in virfile.h
is that virFileNBDDeviceAssociate() takes virStorageFileFormat argument.
The function doesn't need the enum value as it converts the value to
string and uses only that.
Change the argument to string which will allow us to remove that
include.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/lxc/lxc_controller.c | 4 ++--
src/util/virfile.c | 8 ++------
src/util/virfile.h | 3 +--
3 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 67e5e63d00..8f166a436a 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -509,7 +509,7 @@ static int virLXCControllerSetupNBDDeviceFS(virDomainFSDefPtr fs)
}
if (virFileNBDDeviceAssociate(fs->src->path,
- fs->format,
+ virStorageFileFormatTypeToString(fs->format),
fs->readonly,
&dev) < 0)
return -1;
@@ -541,7 +541,7 @@ static int virLXCControllerSetupNBDDeviceDisk(virDomainDiskDefPtr
disk)
}
if (virFileNBDDeviceAssociate(src,
- format,
+ virStorageFileFormatTypeToString(format),
disk->src->readonly,
&dev) < 0)
return -1;
diff --git a/src/util/virfile.c b/src/util/virfile.c
index f7283fa72f..3f4c6d1d0a 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -879,14 +879,13 @@ virFileNBDLoadDriver(void)
}
int virFileNBDDeviceAssociate(const char *file,
- virStorageFileFormat fmt,
+ const char *fmtstr,
bool readonly,
char **dev)
{
g_autofree char *nbddev = NULL;
g_autofree char *qemunbd = NULL;
g_autoptr(virCommand) cmd = NULL;
- const char *fmtstr = NULL;
if (!virFileNBDLoadDriver())
return -1;
@@ -900,9 +899,6 @@ int virFileNBDDeviceAssociate(const char *file,
return -1;
}
- if (fmt > 0)
- fmtstr = virStorageFileFormatTypeToString(fmt);
-
cmd = virCommandNew(qemunbd);
/* Explicitly not trying to cope with old qemu-nbd which
@@ -945,7 +941,7 @@ int virFileLoopDeviceAssociate(const char *file,
}
int virFileNBDDeviceAssociate(const char *file,
- virStorageFileFormat fmt G_GNUC_UNUSED,
+ const char *fmtstr G_GNUC_UNUSED,
bool readonly G_GNUC_UNUSED,
char **dev G_GNUC_UNUSED)
{
diff --git a/src/util/virfile.h b/src/util/virfile.h
index 0f197be73d..28dfe86445 100644
--- a/src/util/virfile.h
+++ b/src/util/virfile.h
@@ -28,7 +28,6 @@
#include "internal.h"
#include "virbitmap.h"
-#include "virstoragefile.h"
#include "virenum.h"
typedef enum {
@@ -144,7 +143,7 @@ int virFileLoopDeviceAssociate(const char *file,
char **dev);
int virFileNBDDeviceAssociate(const char *file,
- virStorageFileFormat fmt,
+ const char *fmtstr,
bool readonly,
char **dev);
--
2.29.2