libvmclient: Take VmCallback in VmInstance::start()
Taking VmCallback from VmInstance::new() has following issues:
- Hard to manage VmInstance and VmCallback together,
becaues VmInstance is available after Callback is instantiated.
- VmCallback is only called after being started.
Bug: 381195543
Test: T/H
Change-Id: I013dce6371156ed298a612582c392a54768c00d6
diff --git a/libs/libavf/src/lib.rs b/libs/libavf/src/lib.rs
index 6532ace..50c5e2e 100644
--- a/libs/libavf/src/lib.rs
+++ b/libs/libavf/src/lib.rs
@@ -373,7 +373,7 @@
let console_in = get_file_from_fd(console_in_fd);
let log = get_file_from_fd(log_fd);
- match VmInstance::create(service.as_ref(), &config, console_out, console_in, log, None, None) {
+ match VmInstance::create(service.as_ref(), &config, console_out, console_in, log, None) {
Ok(vm) => {
// SAFETY: `vm_ptr` is assumed to be a valid, non-null pointer to a mutable raw pointer.
// `vm` is the only reference here and `vm_ptr` takes ownership.
@@ -398,7 +398,7 @@
// SAFETY: `vm` is assumed to be a valid, non-null pointer returned by
// `AVirtualMachine_createRaw`. It's the only reference to the object.
let vm = unsafe { &*vm };
- match vm.start() {
+ match vm.start(None) {
Ok(_) => 0,
Err(e) => {
error!("AVirtualMachine_start failed: {e:?}");