diff mbox series

[RFC,09/12] qapi/qom: Convert rng-backend/random to class

Message ID 20211103173002.209906-10-kwolf@redhat.com (mailing list archive)
State New, archived
Headers show
Series QOM/QAPI integration part 1 | expand

Commit Message

Kevin Wolf Nov. 3, 2021, 5:29 p.m. UTC
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qapi/qom.json | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

Comments

Markus Armbruster Nov. 23, 2021, 1:15 p.m. UTC | #1
Kevin Wolf <kwolf@redhat.com> writes:

> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  qapi/qom.json | 22 ++++++++++++++++------
>  1 file changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/qapi/qom.json b/qapi/qom.json
> index ccd1167808..a167e91f67 100644
> --- a/qapi/qom.json
> +++ b/qapi/qom.json
> @@ -721,6 +721,16 @@
>  { 'struct': 'RngProperties',
>    'data': { '*opened': { 'type': 'bool', 'features': ['deprecated'] } } }
>  
> +##
> +# @rng-backend:
> +#
> +# Base class for random number generator backends
> +#
> +# Since: 1.3
> +##
> +{ 'class': 'rng-backend',
> +  'config': 'RngProperties' }
> +
>  ##
>  # @RngEgdProperties:
>  #
> @@ -736,18 +746,18 @@
>    'data': { 'chardev': 'str' } }
>  
>  ##
> -# @RngRandomProperties:
> +# @rng-random:
>  #
> -# Properties for rng-random objects.
> +# Random number generator backend using a host random number device
>  #
>  # @filename: the filename of the device on the host to obtain entropy from
>  #            (default: "/dev/urandom")
>  #
>  # Since: 1.3
>  ##
> -{ 'struct': 'RngRandomProperties',
> -  'base': 'RngProperties',
> -  'data': { '*filename': 'str' } }
> +{ 'class': 'rng-random',
> +  'parent': 'rng-backend',
> +  'config': { '*filename': 'str' } }
>  
>  ##
>  # @SevGuestProperties:
> @@ -889,7 +899,7 @@
>        'qtest':                      'QtestProperties',
>        'rng-builtin':                'RngProperties',
>        'rng-egd':                    'RngEgdProperties',
> -      'rng-random':                 { 'type': 'RngRandomProperties',
> +      'rng-random':                 { 'type': 'qom-config:rng-random',
>                                        'if': 'CONFIG_POSIX' },
>        'secret':                     'SecretProperties',
>        'secret_keyring':             { 'type': 'SecretKeyringProperties',

This generates struct q_obj_rng_random_config and struct
qom_config_rng_random.  Their names violate coding style.

The former struct appears to be unused.  Hmm, the next patch will use
it.  Okay.
Kevin Wolf Dec. 10, 2021, 5:57 p.m. UTC | #2
Am 23.11.2021 um 14:15 hat Markus Armbruster geschrieben:
> Kevin Wolf <kwolf@redhat.com> writes:
> 
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > ---
> >  qapi/qom.json | 22 ++++++++++++++++------
> >  1 file changed, 16 insertions(+), 6 deletions(-)
> >
> > diff --git a/qapi/qom.json b/qapi/qom.json
> > index ccd1167808..a167e91f67 100644
> > --- a/qapi/qom.json
> > +++ b/qapi/qom.json
> > @@ -721,6 +721,16 @@
> >  { 'struct': 'RngProperties',
> >    'data': { '*opened': { 'type': 'bool', 'features': ['deprecated'] } } }
> >  
> > +##
> > +# @rng-backend:
> > +#
> > +# Base class for random number generator backends
> > +#
> > +# Since: 1.3
> > +##
> > +{ 'class': 'rng-backend',
> > +  'config': 'RngProperties' }
> > +
> >  ##
> >  # @RngEgdProperties:
> >  #
> > @@ -736,18 +746,18 @@
> >    'data': { 'chardev': 'str' } }
> >  
> >  ##
> > -# @RngRandomProperties:
> > +# @rng-random:
> >  #
> > -# Properties for rng-random objects.
> > +# Random number generator backend using a host random number device
> >  #
> >  # @filename: the filename of the device on the host to obtain entropy from
> >  #            (default: "/dev/urandom")
> >  #
> >  # Since: 1.3
> >  ##
> > -{ 'struct': 'RngRandomProperties',
> > -  'base': 'RngProperties',
> > -  'data': { '*filename': 'str' } }
> > +{ 'class': 'rng-random',
> > +  'parent': 'rng-backend',
> > +  'config': { '*filename': 'str' } }
> >  
> >  ##
> >  # @SevGuestProperties:
> > @@ -889,7 +899,7 @@
> >        'qtest':                      'QtestProperties',
> >        'rng-builtin':                'RngProperties',
> >        'rng-egd':                    'RngEgdProperties',
> > -      'rng-random':                 { 'type': 'RngRandomProperties',
> > +      'rng-random':                 { 'type': 'qom-config:rng-random',
> >                                        'if': 'CONFIG_POSIX' },
> >        'secret':                     'SecretProperties',
> >        'secret_keyring':             { 'type': 'SecretKeyringProperties',
> 
> This generates struct q_obj_rng_random_config and struct
> qom_config_rng_random.  Their names violate coding style.
> 
> The former struct appears to be unused.  Hmm, the next patch will use
> it.  Okay.

They are just for internal use of QAPI generated code. QMP command
marshallers are precedence for this.

Kevin
diff mbox series

Patch

diff --git a/qapi/qom.json b/qapi/qom.json
index ccd1167808..a167e91f67 100644
--- a/qapi/qom.json
+++ b/qapi/qom.json
@@ -721,6 +721,16 @@ 
 { 'struct': 'RngProperties',
   'data': { '*opened': { 'type': 'bool', 'features': ['deprecated'] } } }
 
+##
+# @rng-backend:
+#
+# Base class for random number generator backends
+#
+# Since: 1.3
+##
+{ 'class': 'rng-backend',
+  'config': 'RngProperties' }
+
 ##
 # @RngEgdProperties:
 #
@@ -736,18 +746,18 @@ 
   'data': { 'chardev': 'str' } }
 
 ##
-# @RngRandomProperties:
+# @rng-random:
 #
-# Properties for rng-random objects.
+# Random number generator backend using a host random number device
 #
 # @filename: the filename of the device on the host to obtain entropy from
 #            (default: "/dev/urandom")
 #
 # Since: 1.3
 ##
-{ 'struct': 'RngRandomProperties',
-  'base': 'RngProperties',
-  'data': { '*filename': 'str' } }
+{ 'class': 'rng-random',
+  'parent': 'rng-backend',
+  'config': { '*filename': 'str' } }
 
 ##
 # @SevGuestProperties:
@@ -889,7 +899,7 @@ 
       'qtest':                      'QtestProperties',
       'rng-builtin':                'RngProperties',
       'rng-egd':                    'RngEgdProperties',
-      'rng-random':                 { 'type': 'RngRandomProperties',
+      'rng-random':                 { 'type': 'qom-config:rng-random',
                                       'if': 'CONFIG_POSIX' },
       'secret':                     'SecretProperties',
       'secret_keyring':             { 'type': 'SecretKeyringProperties',