]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
rust: move VMState from bql to migration
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 9 Oct 2025 08:24:54 +0000 (10:24 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 14 Oct 2025 09:04:00 +0000 (11:04 +0200)
The high-level wrapper Migratable<T> will contain a BqlCell,
which would introduce a circular dependency betwen the bql and
migration crates.  Move the implementation of VMState for cells
to "migration", together with the implementation for std types.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
rust/Cargo.lock
rust/bql/Cargo.toml
rust/bql/meson.build
rust/bql/src/cell.rs
rust/meson.build
rust/migration/Cargo.toml
rust/migration/meson.build
rust/migration/src/vmstate.rs

index 110851334905c6f0a71accdd98bca1a1b3faa524..5c2f8ea9240c7d4d307e91b0913234e52f951338 100644 (file)
@@ -59,7 +59,6 @@ name = "bql"
 version = "0.1.0"
 dependencies = [
  "glib-sys",
- "migration",
 ]
 
 [[package]]
@@ -198,6 +197,7 @@ checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
 name = "migration"
 version = "0.1.0"
 dependencies = [
+ "bql",
  "common",
  "glib-sys",
  "util",
index d5177e5f8e2a9e3c478dfd43c0dc2a1f1a5baa55..8fd81311028485ab7ebf8988e3a127e7a55cc368 100644 (file)
@@ -13,7 +13,6 @@ repository.workspace = true
 rust-version.workspace = true
 
 [dependencies]
-migration = { path = "../migration" }
 glib-sys.workspace = true
 
 [features]
index 22d7c9b8776f125010d92cbc8cd737a76c4a369f..091372dd7b660fd99e4d49f25a117273527dcb53 100644 (file)
@@ -37,7 +37,6 @@ _bql_rs = static_library(
   override_options: ['rust_std=2021', 'build.rust_std=2021'],
   rust_abi: 'rust',
   rust_args: _bql_cfg,
-  link_with: [_migration_rs],
   dependencies: [glib_sys_rs],
 )
 
index 54cfe6145c534d35efdc2985917295f0511befd1..8ade7db629cfe204f971e7f586052594fdece55a 100644 (file)
@@ -151,8 +151,6 @@ use std::{
     ptr::NonNull,
 };
 
-use migration::impl_vmstate_transparent;
-
 /// A mutable memory location that is protected by the Big QEMU Lock.
 ///
 /// # Memory layout
@@ -364,8 +362,6 @@ impl<T: Default> BqlCell<T> {
     }
 }
 
-impl_vmstate_transparent!(crate::cell::BqlCell<T> where T: VMState);
-
 /// A mutable memory location with dynamically checked borrow rules,
 /// protected by the Big QEMU Lock.
 ///
@@ -691,8 +687,6 @@ impl<T> From<T> for BqlRefCell<T> {
     }
 }
 
-impl_vmstate_transparent!(crate::cell::BqlRefCell<T> where T: VMState);
-
 struct BorrowRef<'b> {
     borrow: &'b Cell<BorrowFlag>,
 }
index 6ba075c8c716246b576430f78c3c9c74d27f15bf..76e10699b371af8c4fa7b806f1281cad27bd7caf 100644 (file)
@@ -29,8 +29,8 @@ subdir('qemu-macros')
 subdir('common')
 subdir('bits')
 subdir('util')
-subdir('migration')
 subdir('bql')
+subdir('migration')
 subdir('qom')
 subdir('system')
 subdir('chardev')
index 94504f3625c92fd045a19fb88be537d607feff19..b995c4c8c8882b00365f5d8c36dbbec33be866f0 100644 (file)
@@ -13,6 +13,7 @@ repository.workspace = true
 rust-version.workspace = true
 
 [dependencies]
+bql = { path = "../bql" }
 common = { path = "../common" }
 util = { path = "../util" }
 glib-sys.workspace = true
index 18be65c92cf001a049efa348e3432bdf873569c8..845136239e8aa0945d85c4b80b3a1d623cf640c5 100644 (file)
@@ -37,12 +37,12 @@ _migration_rs = static_library(
   ),
   override_options: ['rust_std=2021', 'build.rust_std=2021'],
   rust_abi: 'rust',
-  link_with: [_util_rs],
+  link_with: [_util_rs, _bql_rs],
   dependencies: [common_rs, glib_sys_rs],
 )
 
 migration_rs = declare_dependency(link_with: [_migration_rs],
-  dependencies: [migration, qemuutil])
+  dependencies: [bql_rs, migration, qemuutil])
 
 # Doctests are essentially integration tests, so they need the same dependencies.
 # Note that running them requires the object files for C code, so place them
index 59e665f6c3ada9b78639c370a063d4964d7620f4..445fe7fbc08a42aefa03bc8a6783254e4211ba4c 100644 (file)
@@ -276,6 +276,8 @@ macro_rules! impl_vmstate_transparent {
     };
 }
 
+impl_vmstate_transparent!(bql::BqlCell<T> where T: VMState);
+impl_vmstate_transparent!(bql::BqlRefCell<T> where T: VMState);
 impl_vmstate_transparent!(std::cell::Cell<T> where T: VMState);
 impl_vmstate_transparent!(std::cell::UnsafeCell<T> where T: VMState);
 impl_vmstate_transparent!(std::pin::Pin<T> where T: VMState);