Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .buildkite/README.md

This file was deleted.

21 changes: 0 additions & 21 deletions .buildkite/custom-tests.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
{
"tests": [
{
"test_name": "build-vhost-kern",
"command": "cargo build --features=vhost-kern",
"platform": [
"x86_64"
]
},
{
"test_name": "build-vhost-user-frontend",
"command": "cargo build --features=vhost-user-frontend",
"platform": [
"x86_64"
]
},
{
"test_name": "build-vhost-user-backend",
"command": "cargo build --features=vhost-user-backend",
"platform": [
"x86_64"
]
}
]
}
112 changes: 0 additions & 112 deletions .buildkite/rust-vmm-ci-tests.json

This file was deleted.

1 change: 1 addition & 0 deletions .buildkite/rust-vmm-ci-tests.json
2 changes: 1 addition & 1 deletion rust-vmm-ci
12 changes: 12 additions & 0 deletions vhost-user-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ repository = "https://github.com/rust-vmm/vhost"
edition = "2021"
license = "Apache-2.0"

[package.metadata.docs.rs]
all-features = true
rustc-args = ['--cfg RUTSDOC_disable_feature_compat_errors']

[features]
xen = ["vm-memory/xen", "vhost/xen"]
postcopy = ["vhost/postcopy", "userfaultfd"]
Expand All @@ -28,3 +32,11 @@ uuid = { version = "1.8.0", features=["v4"] }
vhost = { path = "../vhost", version = "0.14.0", features = ["test-utils", "vhost-user-frontend", "vhost-user-backend"] }
vm-memory = { workspace = true, features = ["backend-mmap", "backend-atomic"] }
tempfile = "3.2.0"

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(RUTSDOC_disable_feature_compat_errors)'] }

[package.metadata.cargo-all-features]
skip_feature_sets = [
["xen", "postcopy"]
]
13 changes: 9 additions & 4 deletions vhost-user-backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ pub use self::vring::{
VringMutex, VringRwLock, VringState, VringStateGuard, VringStateMutGuard, VringT,
};

/// Due to the way `xen` handles memory mappings we can not combine it with
/// `postcopy` feature which relies on persistent memory mappings. Thus we
/// disallow enabling both features at the same time.
#[cfg(all(feature = "postcopy", feature = "xen"))]
// Due to the way `xen` handles memory mappings we can not combine it with
// `postcopy` feature which relies on persistent memory mappings. Thus we
// disallow enabling both features at the same time.
#[cfg(all(
not(RUTSDOC_disable_feature_compat_errors),
not(doc),
feature = "postcopy",
feature = "xen"
))]
compile_error!("Both `postcopy` and `xen` features can not be enabled at the same time.");

/// An alias for `GuestMemoryAtomic<GuestMemoryMmap<B>>` to simplify code.
Expand Down
2 changes: 2 additions & 0 deletions vhost/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
### Deprecated
### Fixed
- [[#304]](https://github.com/rust-vmm/vhost/pull/304) Fix building docs.
- [[#326]](https://github.com/rust-vmm/vhots/pull/326) Fix `get_vring_base()` returning 0 instead of
the vring base for vhost-kern backends when compiling in release mode.

## v0.14.0

Expand Down
11 changes: 11 additions & 0 deletions vhost/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ edition = "2021"

[package.metadata.docs.rs]
all-features = true
rustc-args = ['--cfg RUTSDOC_disable_feature_compat_errors']

[features]
default = []
Expand All @@ -37,3 +38,13 @@ vm-memory = { workspace = true, features=["backend-mmap"] }
[dev-dependencies]
tempfile = "3.2.0"
serial_test = "3.0"

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(RUTSDOC_disable_feature_compat_errors)'] }

[package.metadata.cargo-all-features]
skip_feature_sets = [
["xen", "postcopy"]
]

denylist = ["test_utils"]
13 changes: 9 additions & 4 deletions vhost/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,15 @@ pub mod vhost_user;
#[cfg(feature = "vhost-vsock")]
pub mod vsock;

/// Due to the way `xen` handles memory mappings we can not combine it with
/// `postcopy` feature which relies on persistent memory mappings. Thus we
/// disallow enabling both features at the same time.
#[cfg(all(not(doc), feature = "postcopy", feature = "xen"))]
// Due to the way `xen` handles memory mappings we can not combine it with
// `postcopy` feature which relies on persistent memory mappings. Thus we
// disallow enabling both features at the same time.
#[cfg(all(
not(RUTSDOC_disable_feature_compat_errors),
not(doc),
feature = "postcopy",
feature = "xen"
))]
compile_error!("Both `postcopy` and `xen` features can not be enabled at the same time.");

/// Error codes for vhost operations
Expand Down
4 changes: 2 additions & 2 deletions vhost/src/vhost_kern/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,12 @@ impl<T: VhostKernBackend> VhostBackend for T {

/// Get a bitmask of supported virtio/vhost features.
fn get_vring_base(&self, queue_index: usize) -> Result<u32> {
let vring_state = vhost_vring_state {
let mut vring_state = vhost_vring_state {
index: queue_index as u32,
num: 0,
};
// SAFETY: This ioctl is called on a valid vhost fd and has its return value checked.
let ret = unsafe { ioctl_with_ref(self, VHOST_GET_VRING_BASE(), &vring_state) };
let ret = unsafe { ioctl_with_mut_ref(self, VHOST_GET_VRING_BASE(), &mut vring_state) };
ioctl_result(ret, vring_state.num)
}

Expand Down
4 changes: 2 additions & 2 deletions vhost/src/vhost_user/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
//! Most messages that can be sent via the Unix domain socket implementing vhost-user have an
//! equivalent ioctl to the kernel implementation.

use std::fs::File;
use std::io::Error as IOError;

pub mod message;
Expand Down Expand Up @@ -214,7 +213,8 @@ pub type HandlerResult<T> = std::result::Result<T, IOError>;

/// Utility function to take the first element from option of a vector of files.
/// Returns `None` if the vector contains no file or more than one file.
pub(crate) fn take_single_file(files: Option<Vec<File>>) -> Option<File> {
#[cfg(any(feature = "vhost-user-backend", feature = "vhost-user-frontend"))]
pub(crate) fn take_single_file(files: Option<Vec<std::fs::File>>) -> Option<std::fs::File> {
let mut files = files?;
if files.len() != 1 {
return None;
Expand Down