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. The extra seemingly unrelated include changes is because all of the added includes where indirectly provided by virfile.h having virstoragefile.h. Signed-off-by: Pavel Hrdina <phrd...@redhat.com> --- src/driver.c | 1 + src/lxc/lxc_controller.c | 4 ++-- src/qemu/qemu_interop_config.c | 1 + src/qemu/qemu_shim.c | 1 + src/storage/parthelper.c | 1 + src/util/virarptable.c | 1 + src/util/vircgroupv1.c | 1 + src/util/vircgroupv2devices.c | 1 + src/util/virfile.c | 8 ++------ src/util/virfile.h | 4 ++-- src/util/virpidfile.c | 1 + src/util/virresctrl.c | 1 + src/util/virsysinfo.c | 1 + src/util/virtpm.c | 1 + tools/virsh-console.c | 1 + tools/virsh-util.c | 1 + 16 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/driver.c b/src/driver.c index 1cacec24ff..e005a89d57 100644 --- a/src/driver.c +++ b/src/driver.c @@ -29,6 +29,7 @@ #include "virfile.h" #include "virlog.h" #include "virmodule.h" +#include "virobject.h" #include "virstring.h" #include "virthread.h" #include "virutil.h" 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/qemu/qemu_interop_config.c b/src/qemu/qemu_interop_config.c index c5a5a9c6ec..bcaddda446 100644 --- a/src/qemu/qemu_interop_config.c +++ b/src/qemu/qemu_interop_config.c @@ -24,6 +24,7 @@ #include "configmake.h" #include "viralloc.h" #include "virenum.h" +#include "virerror.h" #include "virfile.h" #include "virhash.h" #include "virlog.h" diff --git a/src/qemu/qemu_shim.c b/src/qemu/qemu_shim.c index ef0ba086b5..18bdc99256 100644 --- a/src/qemu/qemu_shim.c +++ b/src/qemu/qemu_shim.c @@ -27,6 +27,7 @@ #include "virfile.h" #include "virstring.h" #include "virgettext.h" +#include "virthread.h" #define VIR_FROM_THIS VIR_FROM_QEMU diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c index caa2e8fa62..94d588615f 100644 --- a/src/storage/parthelper.c +++ b/src/storage/parthelper.c @@ -40,6 +40,7 @@ #include "virstring.h" #include "virgettext.h" #include "virdevmapper.h" +#include "virerror.h" /* we don't need to include the full internal.h just for this */ #define STREQ(a, b) (strcmp(a, b) == 0) diff --git a/src/util/virarptable.c b/src/util/virarptable.c index 01a27c0093..d62de5e3dd 100644 --- a/src/util/virarptable.c +++ b/src/util/virarptable.c @@ -26,6 +26,7 @@ #include "viralloc.h" #include "virarptable.h" +#include "virerror.h" #include "virfile.h" #include "virlog.h" #include "virnetlink.h" diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c index 06849efd38..2b4d625c35 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -41,6 +41,7 @@ #include "virsystemd.h" #include "virerror.h" #include "viralloc.h" +#include "virthread.h" VIR_LOG_INIT("util.cgroup"); diff --git a/src/util/vircgroupv2devices.c b/src/util/vircgroupv2devices.c index f31244f3c1..71591be4c4 100644 --- a/src/util/vircgroupv2devices.c +++ b/src/util/vircgroupv2devices.c @@ -34,6 +34,7 @@ #include "virbpf.h" #include "vircgroup.h" #include "vircgroupv2devices.h" +#include "virerror.h" #include "virfile.h" #include "virlog.h" 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 32505826ee..28dfe86445 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -28,7 +28,7 @@ #include "internal.h" #include "virbitmap.h" -#include "virstoragefile.h" +#include "virenum.h" typedef enum { VIR_FILE_CLOSE_PRESERVE_ERRNO = 1 << 0, @@ -143,7 +143,7 @@ int virFileLoopDeviceAssociate(const char *file, char **dev); int virFileNBDDeviceAssociate(const char *file, - virStorageFileFormat fmt, + const char *fmtstr, bool readonly, char **dev); diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c index 895eb83ea9..b4d0059405 100644 --- a/src/util/virpidfile.c +++ b/src/util/virpidfile.c @@ -30,6 +30,7 @@ #include "virpidfile.h" #include "virfile.h" #include "viralloc.h" +#include "virbuffer.h" #include "virutil.h" #include "virlog.h" #include "virerror.h" diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index d3087b98c1..67a921b44b 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -27,6 +27,7 @@ #define LIBVIRT_VIRRESCTRLPRIV_H_ALLOW #include "virresctrlpriv.h" #include "viralloc.h" +#include "virbuffer.h" #include "virfile.h" #include "virlog.h" #include "virobject.h" diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c index 217f842a37..28f7104145 100644 --- a/src/util/virsysinfo.c +++ b/src/util/virsysinfo.c @@ -32,6 +32,7 @@ #include "virlog.h" #include "virfile.h" #include "virstring.h" +#include "virxml.h" #define LIBVIRT_VIRSYSINFOPRIV_H_ALLOW #include "virsysinfopriv.h" diff --git a/src/util/virtpm.c b/src/util/virtpm.c index 0e11674a3c..b41eb00619 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -31,6 +31,7 @@ #include "virbitmap.h" #include "virjson.h" #include "virlog.h" +#include "virthread.h" #define VIR_FROM_THIS VIR_FROM_TPM diff --git a/tools/virsh-console.c b/tools/virsh-console.c index 2e498a6903..4e9bdb67e1 100644 --- a/tools/virsh-console.c +++ b/tools/virsh-console.c @@ -38,6 +38,7 @@ # include "viralloc.h" # include "virthread.h" # include "virerror.h" +# include "virobject.h" VIR_LOG_INIT("tools.virsh-console"); diff --git a/tools/virsh-util.c b/tools/virsh-util.c index af7ed55348..9f69bad8cc 100644 --- a/tools/virsh-util.c +++ b/tools/virsh-util.c @@ -23,6 +23,7 @@ #include "virfile.h" #include "virstring.h" #include "viralloc.h" +#include "virxml.h" static virDomainPtr virshLookupDomainInternal(vshControl *ctl, -- 2.28.0