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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxx>

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)
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux