qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 3/3] virtio-rng: change default backend to rn


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v3 3/3] virtio-rng: change default backend to rng-builtin
Date: Tue, 14 May 2019 16:39:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Laurent Vivier <address@hidden> writes:

> On 10/05/2019 18:36, Markus Armbruster wrote:
>> Laurent Vivier <address@hidden> writes:
>>
>>> Signed-off-by: Laurent Vivier <address@hidden>
>>> ---
>>>   backends/rng-builtin.c         |  8 +++-----
>>>   hw/virtio/virtio-rng.c         |  2 +-
>>>   include/hw/virtio/virtio-rng.h |  4 ++--
>>>   include/sysemu/rng-builtin.h   | 17 +++++++++++++++++
>>>   qemu-options.hx                |  5 ++---
>>>   5 files changed, 25 insertions(+), 11 deletions(-)
>>>   create mode 100644 include/sysemu/rng-builtin.h
> ...
>>> diff --git a/include/hw/virtio/virtio-rng.h b/include/hw/virtio/virtio-rng.h
>>> index 922dce7caccf..f9b6339b19a4 100644
>>> --- a/include/hw/virtio/virtio-rng.h
>>> +++ b/include/hw/virtio/virtio-rng.h
> ...
>>>   #define TYPE_VIRTIO_RNG "virtio-rng-device"
>>> @@ -26,7 +26,7 @@ struct VirtIORNGConf {
>>>       RngBackend *rng;
>>>       uint64_t max_bytes;
>>>       uint32_t period_ms;
>>> -    RngRandom *default_backend;
>>> +    RngBuiltin *default_backend;
>>
>> This member appears to be superfluous.  As far as I can tell, it's only
>> used in the part of virtio-rng.c visible above.  If you replace it by a
>> local variable there (in a separate patch, perhaps), this patch will
>> become simpler.  In particular, you won't need to create rng-builtin.h.
>>
>
> I don't understand how we can remove the rng-builtin.h as we need its
> macros for "RNG_BUILTIN(object_new(TYPE_RNG_BUILTIN))". Could you
> explain?

You're right, you'll still need TYPE_RNG_BUILTIN.  You don't actually
need RNG_BUILTIN(), because you can make the local variable Object *.
Bonus: saves a couple of OBJECT().

If nothing but TYPE_RNG_BUILTIN is left in rng-builtin.h, I'd stick it
into rng.h instead.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]