Merge branch 'main' into unsafe-block

This commit is contained in:
Viresh Kumar 2021-11-16 20:16:29 +05:30 committed by GitHub
commit d986c472e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 27 deletions

42
Cargo.lock generated
View File

@ -70,16 +70,6 @@ dependencies = [
"syn",
]
[[package]]
name = "epoll"
version = "4.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20df693c700404f7e19d4d6fae6b15215d2913c27955d2b9d6f2c0f537511cd0"
dependencies = [
"bitflags",
"libc",
]
[[package]]
name = "hashbrown"
version = "0.11.2"
@ -173,9 +163,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.30"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edc3358ebc67bc8b7fa0c007f945b0b18226f78437d61bec735a9eb96b61ee70"
checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43"
dependencies = [
"unicode-xid",
]
@ -197,9 +187,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
version = "1.0.80"
version = "1.0.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d010a1623fbd906d51d650a9916aaefc05ffa0e4053ff7fe601167f3e715d194"
checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966"
dependencies = [
"proc-macro2",
"quote",
@ -282,7 +272,7 @@ checksum = "2d23ddeb452fb4f837526c6298cc8a2f4948e5595b0328a3d61b5eebe51874d7"
dependencies = [
"bitflags",
"libc",
"vm-memory",
"vm-memory 0.6.0",
"vmm-sys-util",
]
@ -291,29 +281,27 @@ name = "vhost-device-i2c"
version = "0.1.0"
dependencies = [
"clap",
"epoll",
"libc",
"log",
"thiserror",
"vhost",
"vhost-user-backend",
"virtio-bindings",
"vm-memory",
"vm-memory 0.7.0",
"vmm-sys-util",
]
[[package]]
name = "vhost-user-backend"
version = "0.1.0"
source = "git+https://github.com/rust-vmm/vhost-user-backend?rev=bd6b53348f06055abcb2b7254168d716b742f383#bd6b53348f06055abcb2b7254168d716b742f383"
source = "git+https://github.com/rust-vmm/vhost-user-backend?rev=4047c697470cc6c37e8e1835025b091d2b59c2f7#4047c697470cc6c37e8e1835025b091d2b59c2f7"
dependencies = [
"epoll",
"libc",
"log",
"vhost",
"virtio-bindings",
"virtio-queue",
"vm-memory",
"vm-memory 0.7.0",
"vmm-sys-util",
]
@ -326,10 +314,10 @@ checksum = "3ff512178285488516ed85f15b5d0113a7cdb89e9e8a760b269ae4f02b84bd6b"
[[package]]
name = "virtio-queue"
version = "0.1.0"
source = "git+https://github.com/rust-vmm/vm-virtio?rev=6013dd9#6013dd91b2e6eb77ea10c6bdeda8f5eb18de6dda"
source = "git+https://github.com/rust-vmm/vm-virtio?rev=66cda80#66cda803e406217945c1f93e6a4fb3b7c2a6983b"
dependencies = [
"log",
"vm-memory",
"vm-memory 0.7.0",
"vmm-sys-util",
]
@ -338,6 +326,16 @@ name = "vm-memory"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a8ebcb86ca457f9d6e14cf97009f679952eba42f0113de5db596e514cd0e43b"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "vm-memory"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "339d4349c126fdcd87e034631d7274370cf19eb0e87b33166bcd956589fc72c5"
dependencies = [
"arc-swap",
"libc",

View File

@ -13,12 +13,11 @@ edition = "2018"
[dependencies]
clap = { version = "=3.0.0-beta.2", features = ["yaml"] }
epoll = "4.3"
libc = ">=0.2.95"
log = ">=0.4.6"
thiserror = "1.0"
vhost = { version = "0.2", features = ["vhost-user-slave"] }
vhost-user-backend = { git = "https://github.com/rust-vmm/vhost-user-backend", rev = "bd6b53348f06055abcb2b7254168d716b742f383" }
vhost-user-backend = { git = "https://github.com/rust-vmm/vhost-user-backend", rev = "4047c697470cc6c37e8e1835025b091d2b59c2f7" }
virtio-bindings = ">=0.1"
vm-memory = "0.6"
vm-memory = "0.7"
vmm-sys-util = "=0.9.0"

View File

@ -18,6 +18,7 @@ use virtio_bindings::bindings::virtio_ring::{
VIRTIO_RING_F_EVENT_IDX, VIRTIO_RING_F_INDIRECT_DESC,
};
use vm_memory::{ByteValued, Bytes, GuestMemoryAtomic, GuestMemoryMmap, Le16, Le32};
use vmm_sys_util::epoll::EventSet;
use vmm_sys_util::eventfd::{EventFd, EFD_NONBLOCK};
use crate::i2c::*;
@ -255,11 +256,11 @@ impl<D: 'static + I2cDevice + Sync + Send> VhostUserBackendMut<VringRwLock, ()>
fn handle_event(
&mut self,
device_event: u16,
evset: epoll::Events,
evset: EventSet,
vrings: &[VringRwLock],
_thread_id: usize,
) -> VhostUserBackendResult<bool> {
if evset != epoll::Events::EPOLLIN {
if evset != EventSet::IN {
return Err(Error::HandleEventNotEpollIn.into());
}