]> git.ipfire.org Git - thirdparty/qemu.git/commit
rust: qom: add reference counting functionality
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 17 Jan 2025 11:00:01 +0000 (12:00 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 13 Feb 2025 11:19:33 +0000 (12:19 +0100)
commit0fcccf3ff04a54d597bffcb7a42668c52a7dcec0
treea6905ff81eb79bc8f24f2d46637196f7d49022b4
parentdf45e26a81022f4f8f976b603cb0466b1cd64baf
rust: qom: add reference counting functionality

Add a smart pointer that allows to add and remove references from
QOM objects.  It's important to note that while all QOM objects have a
reference count, in practice not all of them have their lifetime guarded
by it.  Embedded objects, specifically, are confined to the lifetime of
the owner.

When writing Rust bindings this is important, because embedded objects are
*never* used through the "Owned<>" smart pointer that is introduced here.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
rust/qemu-api/src/qom.rs
rust/qemu-api/src/vmstate.rs
rust/qemu-api/tests/tests.rs