Re: [PATCH v2 00/16] rust: QObject and QAPI bindings

Paolo Bonzini
2026-02-23T19:04:07Z

[-- Attachment #1: Type: text/plain, Size: 1871 bytes --]

Il lun 23 feb 2026, 17:25 Daniel P. Berrangé <berrange@redhat.com> ha
scritto:

> I guess the thing I'm wondering about when I ask about the big picture
> is to understand tne interoperability implications of this impl approach,
> given the starting point that the Rust & C structs are *not* ABI
> compatible.
>
> If we're anticipating that the Rust usage flows up from a Rust QMP command
> handler, then the data is in the Rust struct right from the entry point
> and perhaps the interoperability needs are reduced in scope.
>
> If we're anticipating a calls back & forth between C & Rust code, that
> directly handle the deserialized structs, then we have an open interop
> question. Is the implication that we round-trip via JSON every time we
> need to swap between a Rust struct and C struct for a given type ?

Right now yes.

Or
> will we have a direct struct<->struct conversion mechanism ? Or is there
> something else entirely ?
>

Marc-André had such a conversion mechanism in his patches. However I would
not include it unless there's a need. Generally speaking I don't expect
anything involving QAPI to be performance critical.

I feel a bit lost in how to evaluate this series without seeing some
> real world usage, in a way that exposes the possible implications of
> the lack of C/Rust ABI compat in the structs.
>

Yes, I understand and it's a recurrent problem with all the Rust
infrastructure, it's hard to evaluate it beyond test cases. Right now my
best hope for a first user would be either QMP commands, or the block layer.

Paolo

> With regards,
> Daniel
> --
> |: https://berrange.com ~~ https://hachyderm.io/@berrange :|
> |: https://libvirt.org ~~ https://entangle-photo.org :|
> |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
>
>

[-- Attachment #2: Type: text/html, Size: 3676 bytes --]