mirror of
https://github.com/rust-vmm/vhost-device.git
synced 2025-12-28 08:01:04 +00:00
[i2c] Use log crate helpers instead of println!()
Use info! and warn! instead of println!. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
parent
60d29f98f4
commit
e62e27aead
@ -5,6 +5,7 @@
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use log::info;
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::os::unix::io::AsRawFd;
|
||||
|
||||
@ -452,7 +453,7 @@ impl<D: I2cDevice> I2cMap<D> {
|
||||
device_map[*addr as usize] = i as u32;
|
||||
}
|
||||
|
||||
println!(
|
||||
info!(
|
||||
"Added I2C master with bus id: {:x} for devices",
|
||||
adapter.adapter_no(),
|
||||
);
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
mod i2c;
|
||||
mod vhu_i2c;
|
||||
|
||||
use log::{info, warn};
|
||||
use std::convert::TryFrom;
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::thread::spawn;
|
||||
@ -175,15 +176,15 @@ fn start_backend<D: 'static + I2cDevice + Send + Sync>(
|
||||
|
||||
match daemon.wait() {
|
||||
Ok(()) => {
|
||||
println!("Stopping cleanly.");
|
||||
info!("Stopping cleanly.");
|
||||
}
|
||||
Err(vhost_user_backend::Error::HandleRequest(
|
||||
vhost_user::Error::PartialMessage,
|
||||
)) => {
|
||||
println!("vhost-user connection closed with partial message. If the VM is shutting down, this is expected behavior; otherwise, it might be a bug.");
|
||||
info!("vhost-user connection closed with partial message. If the VM is shutting down, this is expected behavior; otherwise, it might be a bug.");
|
||||
}
|
||||
Err(e) => {
|
||||
println!("Error running daemon: {:?}", e);
|
||||
warn!("Error running daemon: {:?}", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use log::warn;
|
||||
use std::mem::size_of;
|
||||
use std::sync::Arc;
|
||||
use std::{convert, error, fmt, io};
|
||||
@ -209,7 +210,7 @@ impl<D: I2cDevice> VhostUserI2cBackend<D> {
|
||||
}
|
||||
|
||||
if vring.add_used(desc_chain.head_index(), len).is_err() {
|
||||
println!("Couldn't return used descriptors to the ring");
|
||||
warn!("Couldn't return used descriptors to the ring");
|
||||
}
|
||||
}
|
||||
|
||||
@ -292,7 +293,7 @@ impl<D: 'static + I2cDevice + Sync + Send> VhostUserBackendMut<VringRwLock, ()>
|
||||
}
|
||||
|
||||
_ => {
|
||||
dbg!("unhandled device_event:", device_event);
|
||||
warn!("unhandled device_event: {}", device_event);
|
||||
return Err(Error::HandleEventUnknownEvent.into());
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user