rust: move VMState from bql to migration
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>
This commit is contained in:
parent
8999ca00a4
commit
4526418aff
8 changed files with 7 additions and 12 deletions
2
rust/Cargo.lock
generated
2
rust/Cargo.lock
generated
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ repository.workspace = true
|
|||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
migration = { path = "../migration" }
|
||||
glib-sys.workspace = true
|
||||
|
||||
[features]
|
||||
|
|
|
|||
|
|
@ -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],
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -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>,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue