Re: [PATCH 3/4] migration: Remove redundant flags

Vladimir Sementsov-Ogievskiy <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
On 30.07.26 01:52, Fabiano Rosas wrote:
> Remove the VMS_VARRAY and VMS_VBUFFER flags that became redundant due
> to the previous commit which stores the size of the vmstate offset
> variables along with the offset itself.
> 
> Signed-off-by: Fabiano Rosas <[email protected]>
> ---

[..]

> --- a/rust/bindings/migration-sys/lib.rs
> +++ b/rust/bindings/migration-sys/lib.rs
> @@ -47,6 +47,7 @@ fn default() -> Self {
>   unsafe impl Zeroable for VMStateFlags {}
>   unsafe impl Zeroable for VMStateField {}
>   unsafe impl Zeroable for VMStateDescription {}
> +unsafe impl Zeroable for VMStateOffset {}
>   
>   // The following higher-level helpers could be in "migration"
>   // crate when Rust has const trait impl.
> @@ -57,10 +58,7 @@ pub trait VMStateFlagsExt {
>   
>   impl VMStateFlagsExt for VMStateFlags {
>       const VMS_VARRAY_FLAGS: VMStateFlags = VMStateFlags(
> -        VMStateFlags::VMS_VARRAY_INT32.0
> -            | VMStateFlags::VMS_VARRAY_UINT8.0
> -            | VMStateFlags::VMS_VARRAY_UINT16.0
> -            | VMStateFlags::VMS_VARRAY_UINT32.0,
> +        VMStateFlags::VMS_VARRAY.0
>       );
>   }
>   
> @@ -115,3 +113,12 @@ pub const fn with_varray_flag(mut self, flag: VMStateFlags) -> Self {
>           self.with_varray_flag_unchecked(flag)
>       }
>   }
> +
> +impl VMStateOffset {

This looks like part of patch 01? And may be some other changes in rust.

> +    pub const fn new(off: usize, size: usize) -> Self {
> +        Self {
> +            off: off as u32,
> +            size: size as u8,
> +        }
> +    }
> +}

[..]

> diff --git a/rust/tests/tests/vmstate_tests.rs b/rust/tests/tests/vmstate_tests.rs
> index c2c12cfab52..c5baed4d40b 100644
> --- a/rust/tests/tests/vmstate_tests.rs
> +++ b/rust/tests/tests/vmstate_tests.rs
> @@ -65,7 +65,7 @@ fn test_vmstate_uint16() {
>           b"elem\0"
>       );
>       assert_eq!(foo_fields[0].offset, 16);
> -    assert_eq!(foo_fields[0].num_offset, 0);
> +    assert_eq!(foo_fields[0].num_offset.size, 0);

This too.

>       assert_eq!(foo_fields[0].info, unsafe { &vmstate_info_int8 });
>       assert_eq!(foo_fields[0].version_id, 0);
>       assert_eq!(foo_fields[0].size, 1);
> @@ -86,7 +86,7 @@ fn test_vmstate_unused() {



-- 
Best regards,
Vladimir
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.