On Mon, Dec 09, 2024 at 01:37:10PM +0100, Paolo Bonzini wrote: > Date: Mon, 9 Dec 2024 13:37:10 +0100 > From: Paolo Bonzini <pbonz...@redhat.com> > Subject: [PATCH 19/26] rust: rename qemu-api modules to follow C code a bit > more > X-Mailer: git-send-email 2.47.1 > > A full match would mean calling them qom::object and hw::core::qdev. For now, > keep the names shorter but still a bit easier to find. > > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > rust/hw/char/pl011/src/device.rs | 4 +- > rust/qemu-api-macros/src/lib.rs | 2 +- > rust/qemu-api/meson.build | 5 +- > rust/qemu-api/src/lib.rs | 5 +- > rust/qemu-api/src/module.rs | 43 +++++++++++ > rust/qemu-api/src/prelude.rs | 2 +- > .../qemu-api/src/{device_class.rs => qdev.rs} | 4 +- > rust/qemu-api/src/{definitions.rs => qom.rs} | 74 +++++++++---------- > rust/qemu-api/src/sysbus.rs | 2 +- > rust/qemu-api/tests/tests.rs | 5 +- > 10 files changed, 92 insertions(+), 54 deletions(-) > create mode 100644 rust/qemu-api/src/module.rs > rename rust/qemu-api/src/{device_class.rs => qdev.rs} (97%) > rename rust/qemu-api/src/{definitions.rs => qom.rs} (83%) > > --- a/rust/qemu-api/src/definitions.rs > +++ b/rust/qemu-api/src/qom.rs > @@ -2,7 +2,37 @@ > // Author(s): Manos Pitsidianakis <manos.pitsidiana...@linaro.org> > // SPDX-License-Identifier: GPL-2.0-or-later > > -//! Definitions required by QEMU when registering a device. > +//! Bindings to access QOM functionality from Rust. > +//! > +//! This module provides automatic creation and registration of `TypeInfo` > +//! for classes that are written in Rust, and mapping between Rust traits > +//! and QOM vtables. > +//! > +//! # Structure of a class > +//! > +//! A concrete class only needs a struct holding instance state. The struct > must > +//! implement the [`ObjectType`] and [`IsA`] traits, as well as any `*Impl` > +//! traits provided by its superclasses.
In this commit, this comment is a bit ahead, but I think it's okay. qom and qdev are both good names. In addition, we can rename the files of PL011 as well. Perhaps device_class.rs could be merged into device.rs (and eventually renamed to pl011.rs). I guess you might be planning to keep it until the cleanup of vmstate and property is done. Reviewed-by: Zhao Liu <zhao1....@intel.com>