[libvirt] [PATCH 02/12] qemu: rename qemuBuildRNGDeviceArgs to qemuBuildRNGDevStr and change something

Peter Krempa pkrempa at redhat.com
Mon Jan 5 15:18:00 UTC 2015


Subject: "change something"? That's a really vague statement.

How about:

qemu: refactor qemuBuildRNGDeviceArgs to allow reuse in RNG hotplug

On 01/03/15 06:06, Luyao Huang wrote:
> rename qemuBuildRNGDeviceArgs to qemuBuildRNGDevStr, we need this function
> to build a cmdline.

Rename qemuBuildRNGDeviceArgs to qemuBuildRNGDevStr and change the
return type so that it can be reused in the device hotplug code later.


> 
> Signed-off-by: Luyao Huang <lhuang at redhat.com>
> ---
>  src/qemu/qemu_command.c | 33 ++++++++++++++++-----------------
>  src/qemu/qemu_command.h |  4 ++++
>  2 files changed, 20 insertions(+), 17 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index c1e9bca..46e289d 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -5800,22 +5800,19 @@ qemuBuildRNGBackendArgs(virCommandPtr cmd,
>      return ret;
>  }
>  
> -

Don't delete the line. Functions are usually separated by two newlines.

> -static int
> -qemuBuildRNGDeviceArgs(virCommandPtr cmd,
> -                       virDomainDefPtr def,
> -                       virDomainRNGDefPtr dev,
> -                       virQEMUCapsPtr qemuCaps)
> +char *
> +qemuBuildRNGDevStr(virDomainDefPtr def,
> +                   virDomainRNGDefPtr dev,
> +                   virQEMUCapsPtr qemuCaps)
>  {
>      virBuffer buf = VIR_BUFFER_INITIALIZER;
> -    int ret = -1;
>  
>      if (dev->model != VIR_DOMAIN_RNG_MODEL_VIRTIO ||
>          !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG)) {
>          virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
>                         _("this qemu doesn't support RNG device type '%s'"),
>                         virDomainRNGModelTypeToString(dev->model));
> -        goto cleanup;
> +        goto error;
>      }
>  
>      if (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)

ACK, looks good except for the commit message and the spurious line
deletion.

Peter


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150105/5563e780/attachment-0001.sig>


More information about the libvir-list mailing list