On Mon, Feb 09, 2015 at 16:54:00 +0100, Ján Tomko wrote:
On Fri, Feb 06, 2015 at 04:32:21PM +0100, Peter Krempa wrote:
> As the RNG device is using an -object as backend refactor the code to
> use the JSON to commandline generator so that we can reuse the code
> later in hotplug.
> ---
> src/qemu/qemu_command.c | 108 +++++++++++++++++++++++++++++++++++++-----------
> 1 file changed, 84 insertions(+), 24 deletions(-)
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 6380621..9179c1f 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -6154,15 +6154,33 @@ qemuBuildSclpDevStr(virDomainChrDefPtr dev)
>
>
> static int
> -qemuBuildRNGBackendArgs(virCommandPtr cmd,
> - virDomainRNGDefPtr dev,
> - virQEMUCapsPtr qemuCaps)
> +qemuBuildRNGBackendChrdevStr(virDomainRNGDefPtr rng,
> + virQEMUCapsPtr qemuCaps,
> + char **chr)
> {
> - virBuffer buf = VIR_BUFFER_INITIALIZER;
> - char *backend = NULL;
> + *chr = NULL;
> +
> + if (rng->backend != VIR_DOMAIN_RNG_BACKEND_EGD)
> + return 0;
Making this a switch ((virDomainRNGBackend)) would check if all the
enum values are handled.
Indeed. Having the complier to complain is useful when adding new stuff.
Consider it added.
Peter