qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] fbaadb: qapi: introduce forwarding visitor


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] fbaadb: qapi: introduce forwarding visitor
Date: Fri, 23 Jul 2021 07:32:33 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: fbaadb71a7456d84bd53e71539b9e37334f11d0a
      
https://github.com/qemu/qemu/commit/fbaadb71a7456d84bd53e71539b9e37334f11d0a
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2021-07-23 (Fri, 23 Jul 2021)

  Changed paths:
    A include/qapi/forward-visitor.h
    M qapi/meson.build
    A qapi/qapi-forward-visitor.c
    M tests/unit/meson.build
    A tests/unit/test-forward-visitor.c

  Log Message:
  -----------
  qapi: introduce forwarding visitor

This new adaptor visitor takes a single field of the adaptee, and exposes it
with a different name.

This will be used for QOM alias properties.  Alias targets can of course
have a different name than the alias property itself (e.g. a machine's
pflash0 might be an alias of a property named 'drive').  When the target's
getter or setter invokes the visitor, it will use a different name than
what the caller expects, and the visitor will not be able to find it
(or will consume erroneously).

The solution is for alias getters and setters to wrap the incoming
visitor, and forward the sole field that the target is expecting while
renaming it appropriately.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 2f164a6c5e4a9e24a6d33fcd680f322dcf53a44e
      
https://github.com/qemu/qemu/commit/2f164a6c5e4a9e24a6d33fcd680f322dcf53a44e
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2021-07-23 (Fri, 23 Jul 2021)

  Changed paths:
    M qom/object.c

  Log Message:
  -----------
  qom: use correct field name when getting/setting alias properties

Alias targets have a different name than the alias property itself
(e.g. a machine's pflash0 might be an alias of a property named 'drive').
When the target's getter or setter invokes the visitor, it will use
a different name than what the caller expects, and the visitor will
not be able to find it (or will consume erroneously).

The solution is for alias getters and setters to wrap the incoming
visitor, and forward the sole field that the target is expecting while
renaming it appropriately.

This bug has been there forever, but it was exposed after -M parsing
switched from QemuOptions and StringInputVisitor to keyval and
QObjectInputVisitor.  Before, the visitor ignored the name. Now, it
checks "drive" against what was passed on the command line and finds
that no such property exists.

Fixes: https://gitlab.com/qemu-project/qemu/-/issues/484
Reported-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: b508c820bae2ef5bc2539b5f65421b996840fbf8
      
https://github.com/qemu/qemu/commit/b508c820bae2ef5bc2539b5f65421b996840fbf8
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-07-23 (Fri, 23 Jul 2021)

  Changed paths:
    A include/qapi/forward-visitor.h
    M qapi/meson.build
    A qapi/qapi-forward-visitor.c
    M qom/object.c
    M tests/unit/meson.build
    A tests/unit/test-forward-visitor.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream-qapi' 
into staging

Fix for QOM alias properties (e.g. -M pflash0).

# gpg: Signature made Fri 23 Jul 2021 10:57:38 BST
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini-gitlab/tags/for-upstream-qapi:
  qom: use correct field name when getting/setting alias properties
  qapi: introduce forwarding visitor

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/a146af86c824...b508c820bae2



reply via email to

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