[libvirt] [PATCH 6/8] qemu: conf: Export qemuAddSharedDisk

John Ferlan jferlan at redhat.com
Tue Oct 2 14:02:09 UTC 2018



On 9/27/18 11:09 AM, Peter Krempa wrote:
> In cases where we know the device is a disk we can avoid using the full
> device definition.
> 
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
>  src/qemu/qemu_conf.c | 2 +-
>  src/qemu/qemu_conf.h | 5 +++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 

<sigh> similar comment I make frequently now - stuff I know you know...
The ATTRIBUTE_NONNULL only matters if NULL is passed. There's no check
for whether the passed parameter is NULL.

In the long run, e.g. patch 7, it's one less indirection from
qemuAddSharedDevice to qemuAddSharedDisk for *ChangeEjectableMedia.

Of course there's an incredible irony that code uses *RemoveSharedDisk,
but yet no one up to this point saw fit to export *AddSharedDisk too.

Reviewed-by: John Ferlan <jferlan at redhat.com>

John

> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> index 33508174cb..6cdc0f407a 100644
> --- a/src/qemu/qemu_conf.c
> +++ b/src/qemu/qemu_conf.c
> @@ -1411,7 +1411,7 @@ qemuSharedDeviceEntryInsert(virQEMUDriverPtr driver,
>   * records all the domains that use the shared device if the entry
>   * already exists, otherwise add a new entry.
>   */
> -static int
> +int
>  qemuAddSharedDisk(virQEMUDriverPtr driver,
>                    virDomainDiskDefPtr disk,
>                    const char *name)
> diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
> index c227ac72cc..f876f9117c 100644
> --- a/src/qemu/qemu_conf.h
> +++ b/src/qemu/qemu_conf.h
> @@ -339,6 +339,11 @@ char *qemuGetSharedDeviceKey(const char *disk_path)
> 
>  void qemuSharedDeviceEntryFree(void *payload, const void *name);
> 
> +int qemuAddSharedDisk(virQEMUDriverPtr driver,
> +                      virDomainDiskDefPtr disk,
> +                      const char *name)
> +    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
> +
>  int qemuAddSharedDevice(virQEMUDriverPtr driver,
>                          virDomainDeviceDefPtr dev,
>                          const char *name)
> 




More information about the libvir-list mailing list