From e7c590507c26116b2f8c63b226b0b60839ecbeff Mon Sep 17 00:00:00 2001 From: Jakub Staron Date: Tue, 9 Apr 2019 12:31:14 -0700 Subject: Wrap the UnixSeqpacket with a more descriptive type. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Host/device sockets are now created as a pairs of MsgSockets instead of UnixSeqpacket sockets. BUG=chromium:950663 TEST=cargo check TEST=cargo test Change-Id: I8f61a711fe3c2547bf5d18fcfa23bfd0dc0ef5fd Reviewed-on: https://chromium-review.googlesource.com/1559041 Commit-Ready: Jakub Staroń Tested-by: kokoro Tested-by: Jakub Staroń Reviewed-by: Stephen Barber Reviewed-by: Zach Reizner --- devices/src/virtio/wl.rs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'devices/src/virtio/wl.rs') diff --git a/devices/src/virtio/wl.rs b/devices/src/virtio/wl.rs index 870b5ea..4a6d59d 100644 --- a/devices/src/virtio/wl.rs +++ b/devices/src/virtio/wl.rs @@ -56,10 +56,9 @@ use libc::{dup, EBADF, EINVAL}; use data_model::VolatileMemoryError; use data_model::*; -use msg_socket::{MsgError, MsgReceiver, MsgSender, MsgSocket}; +use msg_socket::{MsgError, MsgReceiver, MsgSender}; #[cfg(feature = "wl-dmabuf")] use resources::GpuMemoryDesc; -use sys_util::net::UnixSeqpacket; use sys_util::{ pipe, round_up_to_page_size, Error, EventFd, FileFlags, GuestAddress, GuestMemory, GuestMemoryError, PollContext, PollToken, Result, ScmSocket, SharedMemory, @@ -72,7 +71,7 @@ use super::resource_bridge::*; use super::{ DescriptorChain, Queue, VirtioDevice, INTERRUPT_STATUS_USED_RING, TYPE_WL, VIRTIO_F_VERSION_1, }; -use vm_control::{MaybeOwnedFd, VmRequest, VmResponse}; +use vm_control::{MaybeOwnedFd, VmControlRequestSocket, VmRequest, VmResponse}; const VIRTWL_SEND_MAX_ALLOCS: usize = 28; const VIRTIO_WL_CMD_VFD_NEW: u32 = 256; @@ -485,15 +484,13 @@ impl From for WlError { #[derive(Clone)] struct VmRequester { - inner: Rc>>, + inner: Rc>, } impl VmRequester { - fn new(vm_socket: UnixSeqpacket) -> VmRequester { + fn new(vm_socket: VmControlRequestSocket) -> VmRequester { VmRequester { - inner: Rc::new(RefCell::new(MsgSocket::::new( - vm_socket, - ))), + inner: Rc::new(RefCell::new(vm_socket)), } } @@ -1003,7 +1000,7 @@ struct WlState { impl WlState { fn new( wayland_path: PathBuf, - vm_socket: UnixSeqpacket, + vm_socket: VmControlRequestSocket, use_transition_flags: bool, resource_bridge: Option, ) -> WlState { @@ -1487,7 +1484,7 @@ impl Worker { in_queue: Queue, out_queue: Queue, wayland_path: PathBuf, - vm_socket: UnixSeqpacket, + vm_socket: VmControlRequestSocket, use_transition_flags: bool, resource_bridge: Option, ) -> Worker { @@ -1677,7 +1674,7 @@ impl Worker { pub struct Wl { kill_evt: Option, wayland_path: PathBuf, - vm_socket: Option, + vm_socket: Option, resource_bridge: Option, use_transition_flags: bool, } @@ -1685,7 +1682,7 @@ pub struct Wl { impl Wl { pub fn new>( wayland_path: P, - vm_socket: UnixSeqpacket, + vm_socket: VmControlRequestSocket, resource_bridge: Option, ) -> Result { Ok(Wl { -- cgit 1.4.1