summary refs log tree commit diff
path: root/devices/src/virtio/wl.rs
diff options
context:
space:
mode:
authorJakub Staron <jstaron@google.com>2019-04-09 12:31:14 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-04-10 02:20:58 -0700
commite7c590507c26116b2f8c63b226b0b60839ecbeff (patch)
treee42b29942035bb7b4f83e85c0e2046edca281df7 /devices/src/virtio/wl.rs
parent902e7c8450978ddf800b5a311f570aa982ff2ba4 (diff)
downloadcrosvm-e7c590507c26116b2f8c63b226b0b60839ecbeff.tar
crosvm-e7c590507c26116b2f8c63b226b0b60839ecbeff.tar.gz
crosvm-e7c590507c26116b2f8c63b226b0b60839ecbeff.tar.bz2
crosvm-e7c590507c26116b2f8c63b226b0b60839ecbeff.tar.lz
crosvm-e7c590507c26116b2f8c63b226b0b60839ecbeff.tar.xz
crosvm-e7c590507c26116b2f8c63b226b0b60839ecbeff.tar.zst
crosvm-e7c590507c26116b2f8c63b226b0b60839ecbeff.zip
Wrap the UnixSeqpacket with a more descriptive type.
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ń <jstaron@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Jakub Staroń <jstaron@google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'devices/src/virtio/wl.rs')
-rw-r--r--devices/src/virtio/wl.rs21
1 files changed, 9 insertions, 12 deletions
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<VolatileMemoryError> for WlError {
 
 #[derive(Clone)]
 struct VmRequester {
-    inner: Rc<RefCell<MsgSocket<VmRequest, VmResponse>>>,
+    inner: Rc<RefCell<VmControlRequestSocket>>,
 }
 
 impl VmRequester {
-    fn new(vm_socket: UnixSeqpacket) -> VmRequester {
+    fn new(vm_socket: VmControlRequestSocket) -> VmRequester {
         VmRequester {
-            inner: Rc::new(RefCell::new(MsgSocket::<VmRequest, VmResponse>::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<ResourceRequestSocket>,
     ) -> 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<ResourceRequestSocket>,
     ) -> Worker {
@@ -1677,7 +1674,7 @@ impl Worker {
 pub struct Wl {
     kill_evt: Option<EventFd>,
     wayland_path: PathBuf,
-    vm_socket: Option<UnixSeqpacket>,
+    vm_socket: Option<VmControlRequestSocket>,
     resource_bridge: Option<ResourceRequestSocket>,
     use_transition_flags: bool,
 }
@@ -1685,7 +1682,7 @@ pub struct Wl {
 impl Wl {
     pub fn new<P: AsRef<Path>>(
         wayland_path: P,
-        vm_socket: UnixSeqpacket,
+        vm_socket: VmControlRequestSocket,
         resource_bridge: Option<ResourceRequestSocket>,
     ) -> Result<Wl> {
         Ok(Wl {