[PATCH 07/12] rust/qdev: Rename PropertyInfo field from VALUE to BASE_INFO

Zhao Liu posted 12 patches 1 week, 5 days ago
There is a newer version of this series
[PATCH 07/12] rust/qdev: Rename PropertyInfo field from VALUE to BASE_INFO
Posted by Zhao Liu 1 week, 5 days ago
Bit property info will added next. To distinguish different info fields,
rename `VALUE` to `BASE_INFO`, then it can better reflect that it
represents the basic property info.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 rust/hw/core/src/qdev.rs    | 12 ++++++------
 rust/qemu-macros/src/lib.rs |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/rust/hw/core/src/qdev.rs b/rust/hw/core/src/qdev.rs
index 2735e2b2c109..d887046d8de1 100644
--- a/rust/hw/core/src/qdev.rs
+++ b/rust/hw/core/src/qdev.rs
@@ -109,13 +109,13 @@ pub trait ResettablePhasesImpl {
 ///
 /// # Safety
 ///
-/// This trait is marked as `unsafe` because `VALUE` must be a valid raw
+/// This trait is marked as `unsafe` because `BASE_INFO` must be a valid raw
 /// reference to a [`bindings::PropertyInfo`].
 ///
 /// Note we could not use a regular reference:
 ///
 /// ```text
-/// const VALUE: &bindings::PropertyInfo = ...
+/// const BASE_INFO: &bindings::PropertyInfo = ...
 /// ```
 ///
 /// because this results in the following compiler error:
@@ -131,22 +131,22 @@ pub trait ResettablePhasesImpl {
 /// It is the implementer's responsibility to provide a valid
 /// [`bindings::PropertyInfo`] pointer for the trait implementation to be safe.
 pub unsafe trait QDevProp {
-    const VALUE: *const bindings::PropertyInfo;
+    const BASE_INFO: *const bindings::PropertyInfo;
 }
 
 /// Use [`bindings::qdev_prop_bool`] for `bool`.
 unsafe impl QDevProp for bool {
-    const VALUE: *const bindings::PropertyInfo = addr_of!(bindings::qdev_prop_bool);
+    const BASE_INFO: *const bindings::PropertyInfo = addr_of!(bindings::qdev_prop_bool);
 }
 
 /// Use [`bindings::qdev_prop_uint64`] for `u64`.
 unsafe impl QDevProp for u64 {
-    const VALUE: *const bindings::PropertyInfo = addr_of!(bindings::qdev_prop_uint64);
+    const BASE_INFO: *const bindings::PropertyInfo = addr_of!(bindings::qdev_prop_uint64);
 }
 
 /// Use [`bindings::qdev_prop_chr`] for [`chardev::CharBackend`].
 unsafe impl QDevProp for chardev::CharBackend {
-    const VALUE: *const bindings::PropertyInfo = addr_of!(bindings::qdev_prop_chr);
+    const BASE_INFO: *const bindings::PropertyInfo = addr_of!(bindings::qdev_prop_chr);
 }
 
 /// Trait to define device properties.
diff --git a/rust/qemu-macros/src/lib.rs b/rust/qemu-macros/src/lib.rs
index ed4064d6e110..b43ca31bae30 100644
--- a/rust/qemu-macros/src/lib.rs
+++ b/rust/qemu-macros/src/lib.rs
@@ -272,7 +272,7 @@ macro_rules! str_to_c_str {
             },
         )?;
         let field_ty = field.ty.clone();
-        let qdev_prop = quote! { <#field_ty as ::hwcore::QDevProp>::VALUE };
+        let qdev_prop = quote! { <#field_ty as ::hwcore::QDevProp>::BASE_INFO };
         let set_default = defval.is_some();
         let defval = defval.unwrap_or(syn::Expr::Verbatim(quote! { 0 }));
         properties_expanded.push(quote! {
-- 
2.34.1
Re: [PATCH 07/12] rust/qdev: Rename PropertyInfo field from VALUE to BASE_INFO
Posted by Manos Pitsidianakis 1 week, 5 days ago
On Tue, Sep 16, 2025 at 11:34 AM Zhao Liu <zhao1.liu@intel.com> wrote:
>
> Bit property info will added next. To distinguish different info fields,
> rename `VALUE` to `BASE_INFO`, then it can better reflect that it
> represents the basic property info.
>
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>

You can squash this patch to the bit info one

>  rust/hw/core/src/qdev.rs    | 12 ++++++------
>  rust/qemu-macros/src/lib.rs |  2 +-
>  2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/rust/hw/core/src/qdev.rs b/rust/hw/core/src/qdev.rs
> index 2735e2b2c109..d887046d8de1 100644
> --- a/rust/hw/core/src/qdev.rs
> +++ b/rust/hw/core/src/qdev.rs
> @@ -109,13 +109,13 @@ pub trait ResettablePhasesImpl {
>  ///
>  /// # Safety
>  ///
> -/// This trait is marked as `unsafe` because `VALUE` must be a valid raw
> +/// This trait is marked as `unsafe` because `BASE_INFO` must be a valid raw
>  /// reference to a [`bindings::PropertyInfo`].
>  ///
>  /// Note we could not use a regular reference:
>  ///
>  /// ```text
> -/// const VALUE: &bindings::PropertyInfo = ...
> +/// const BASE_INFO: &bindings::PropertyInfo = ...
>  /// ```
>  ///
>  /// because this results in the following compiler error:
> @@ -131,22 +131,22 @@ pub trait ResettablePhasesImpl {
>  /// It is the implementer's responsibility to provide a valid
>  /// [`bindings::PropertyInfo`] pointer for the trait implementation to be safe.
>  pub unsafe trait QDevProp {
> -    const VALUE: *const bindings::PropertyInfo;
> +    const BASE_INFO: *const bindings::PropertyInfo;
>  }
>
>  /// Use [`bindings::qdev_prop_bool`] for `bool`.
>  unsafe impl QDevProp for bool {
> -    const VALUE: *const bindings::PropertyInfo = addr_of!(bindings::qdev_prop_bool);
> +    const BASE_INFO: *const bindings::PropertyInfo = addr_of!(bindings::qdev_prop_bool);
>  }
>
>  /// Use [`bindings::qdev_prop_uint64`] for `u64`.
>  unsafe impl QDevProp for u64 {
> -    const VALUE: *const bindings::PropertyInfo = addr_of!(bindings::qdev_prop_uint64);
> +    const BASE_INFO: *const bindings::PropertyInfo = addr_of!(bindings::qdev_prop_uint64);
>  }
>
>  /// Use [`bindings::qdev_prop_chr`] for [`chardev::CharBackend`].
>  unsafe impl QDevProp for chardev::CharBackend {
> -    const VALUE: *const bindings::PropertyInfo = addr_of!(bindings::qdev_prop_chr);
> +    const BASE_INFO: *const bindings::PropertyInfo = addr_of!(bindings::qdev_prop_chr);
>  }
>
>  /// Trait to define device properties.
> diff --git a/rust/qemu-macros/src/lib.rs b/rust/qemu-macros/src/lib.rs
> index ed4064d6e110..b43ca31bae30 100644
> --- a/rust/qemu-macros/src/lib.rs
> +++ b/rust/qemu-macros/src/lib.rs
> @@ -272,7 +272,7 @@ macro_rules! str_to_c_str {
>              },
>          )?;
>          let field_ty = field.ty.clone();
> -        let qdev_prop = quote! { <#field_ty as ::hwcore::QDevProp>::VALUE };
> +        let qdev_prop = quote! { <#field_ty as ::hwcore::QDevProp>::BASE_INFO };
>          let set_default = defval.is_some();
>          let defval = defval.unwrap_or(syn::Expr::Verbatim(quote! { 0 }));
>          properties_expanded.push(quote! {
> --
> 2.34.1
>
Re: [PATCH 07/12] rust/qdev: Rename PropertyInfo field from VALUE to BASE_INFO
Posted by Zhao Liu 1 week, 4 days ago
On Tue, Sep 16, 2025 at 01:10:39PM +0300, Manos Pitsidianakis wrote:
> Date: Tue, 16 Sep 2025 13:10:39 +0300
> From: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> Subject: Re: [PATCH 07/12] rust/qdev: Rename PropertyInfo field from VALUE
>  to BASE_INFO
> 
> On Tue, Sep 16, 2025 at 11:34 AM Zhao Liu <zhao1.liu@intel.com> wrote:
> >
> > Bit property info will added next. To distinguish different info fields,
> > rename `VALUE` to `BASE_INFO`, then it can better reflect that it
> > represents the basic property info.
> >
> > Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> > ---
> 
> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>

Thanks!

> You can squash this patch to the bit info one

Yes, after patch 8, renaming doesn't need to change too many places.

Regards,
Zhao