[libvirt PATCH 06/17] virfile: refactor virFileNBDDeviceAssociate

Peter Krempa pkrempa at redhat.com
Mon Jan 4 15:36:37 UTC 2021


On Mon, Dec 14, 2020 at 16:55:26 +0100, Pavel Hrdina wrote:
> 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.

Please split all the #include additions into a separate patch, since
that can be commited before and is a justifiable change. This will
cut-down the noise in this commit.

> Signed-off-by: Pavel Hrdina <phrdina at 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/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;

You can use my:

Reviewed-by: Peter Krempa <pkrempa at redhat.com>

on the patch(es) adding the headers as well as this with the header
additions stripped (just don't forget to send them to the list before
pushing :) )




More information about the libvir-list mailing list