Skip to content

Commit

Permalink
rng: make opened property read-only
Browse files Browse the repository at this point in the history
The ``opened=on`` option in the command line or QMP ``object-add`` either had
no effect (if ``opened`` was the last option) or caused errors.  The property
is therefore useless and was deprecated in 6.0; make it read-only now.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
bonzini committed May 14, 2022
1 parent 0310641 commit 6e57793
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 25 deletions.
18 changes: 2 additions & 16 deletions backends/rng.c
Expand Up @@ -48,24 +48,10 @@ static bool rng_backend_prop_get_opened(Object *obj, Error **errp)

static void rng_backend_complete(UserCreatable *uc, Error **errp)
{
object_property_set_bool(OBJECT(uc), "opened", true, errp);
}

static void rng_backend_prop_set_opened(Object *obj, bool value, Error **errp)
{
RngBackend *s = RNG_BACKEND(obj);
RngBackend *s = RNG_BACKEND(uc);
RngBackendClass *k = RNG_BACKEND_GET_CLASS(s);
Error *local_err = NULL;

if (value == s->opened) {
return;
}

if (!value && s->opened) {
error_setg(errp, QERR_PERMISSION_DENIED);
return;
}

if (k->opened) {
k->opened(s, &local_err);
if (local_err) {
Expand Down Expand Up @@ -122,7 +108,7 @@ static void rng_backend_class_init(ObjectClass *oc, void *data)

object_class_property_add_bool(oc, "opened",
rng_backend_prop_get_opened,
rng_backend_prop_set_opened);
NULL);
}

static const TypeInfo rng_backend_info = {
Expand Down
9 changes: 0 additions & 9 deletions docs/about/deprecated.rst
Expand Up @@ -90,15 +90,6 @@ the process listing. This is replaced by the new ``password-secret``
option which lets the password be securely provided on the command
line using a ``secret`` object instance.

``opened`` property of ``rng-*`` objects (since 6.0)
''''''''''''''''''''''''''''''''''''''''''''''''''''

The only effect of specifying ``opened=on`` in the command line or QMP
``object-add`` is that the device is opened immediately, possibly before all
other options have been processed. This will either have no effect (if
``opened`` was the last option) or cause errors. The property is therefore
useless and should not be specified.

``-display sdl,window_close=...`` (since 6.1)
'''''''''''''''''''''''''''''''''''''''''''''

Expand Down
6 changes: 6 additions & 0 deletions docs/about/removed-features.rst
Expand Up @@ -363,6 +363,12 @@ no effect (if ``loaded`` was the last option) or caused options to be
effectively ignored as if they were not given. The property is therefore
useless and should simply be removed.

``opened`` property of ``rng-*`` objects (removed in 7.1)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''

The ``opened=on`` option in the command line or QMP ``object-add`` either had
no effect (if ``opened`` was the last option) or caused errors. The property
is therefore useless and should simply be removed.

QEMU Machine Protocol (QMP) commands
------------------------------------
Expand Down

0 comments on commit 6e57793

Please sign in to comment.