vhost: Use vhost_user definitions from within #[cfg] block
The `vhost-user` feature isn't enabled by default and using it without protection in backend.rs makes the vhost only build fails. Fix it by protecting it with the `#[cfg]` block. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
parent
8783a8dda0
commit
1ce5280417
1 changed files with 3 additions and 0 deletions
|
|
@ -17,6 +17,7 @@ use std::sync::RwLock;
|
|||
use vm_memory::{bitmap::Bitmap, Address, GuestMemoryRegion, GuestRegionMmap};
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
|
||||
#[cfg(feature = "vhost-user")]
|
||||
use super::vhost_user::message::{VhostUserMemoryRegion, VhostUserSingleMemoryRegion};
|
||||
use super::{Error, Result};
|
||||
|
||||
|
|
@ -106,6 +107,7 @@ impl VhostUserMemoryRegionInfo {
|
|||
}
|
||||
|
||||
/// Creates VhostUserMemoryRegion from Self.
|
||||
#[cfg(feature = "vhost-user")]
|
||||
pub fn to_region(&self) -> VhostUserMemoryRegion {
|
||||
#[cfg(not(feature = "xen"))]
|
||||
return VhostUserMemoryRegion::new(
|
||||
|
|
@ -127,6 +129,7 @@ impl VhostUserMemoryRegionInfo {
|
|||
}
|
||||
|
||||
/// Creates VhostUserSingleMemoryRegion from Self.
|
||||
#[cfg(feature = "vhost-user")]
|
||||
pub fn to_single_region(&self) -> VhostUserSingleMemoryRegion {
|
||||
VhostUserSingleMemoryRegion::new(
|
||||
self.guest_phys_addr,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue