]> git.proxmox.com Git - mirror_qemu.git/commit
qapi: introduce forwarding visitor
authorPaolo Bonzini <pbonzini@redhat.com>
Sun, 18 Jul 2021 06:49:22 +0000 (08:49 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 23 Jul 2021 16:17:17 +0000 (18:17 +0200)
commit18fa3ebc45262cebc7c9f0ba6f717452bdc51db7
treea53611506176b3f6b20ef7a9c14bac6a07d33ddf
parenteafadbbbac06a8d72baa976f4d3c42b0e5f8cfc8
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>
include/qapi/forward-visitor.h [new file with mode: 0644]
qapi/meson.build
qapi/qapi-forward-visitor.c [new file with mode: 0644]
tests/unit/meson.build
tests/unit/test-forward-visitor.c [new file with mode: 0644]