From 7898632b42e52109601bc06e7fc380c475430874 Mon Sep 17 00:00:00 2001 From: Zach Reizner Date: Thu, 21 Feb 2019 20:43:21 -0800 Subject: main: log responses to command line vm control requests Now that the connection oriented seqpacket sockets are used for vm control messages, a response can be received by the requested. This change prints out that response. TEST=crosvm suspend|resume|balloon|stop BUG=chromium:848187 Change-Id: I18ac23c26127332e2be498113cc0c3310fd09a7d Reviewed-on: https://chromium-review.googlesource.com/1482370 Commit-Ready: Zach Reizner Tested-by: kokoro Tested-by: Zach Reizner Reviewed-by: Daniel Verkamp --- vm_control/src/lib.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'vm_control/src') diff --git a/vm_control/src/lib.rs b/vm_control/src/lib.rs index f0fc209..72531fb 100644 --- a/vm_control/src/lib.rs +++ b/vm_control/src/lib.rs @@ -293,3 +293,24 @@ pub enum VmResponse { desc: GpuMemoryDesc, }, } + +impl Display for VmResponse { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + use self::VmResponse::*; + + match self { + Ok => write!(f, "ok"), + Err(e) => write!(f, "error: {}", e), + RegisterMemory { pfn, slot } => write!( + f, + "memory registered to page frame number {:#x} and memory slot {}", + pfn, slot + ), + AllocateAndRegisterGpuMemory { pfn, slot, .. } => write!( + f, + "gpu memory allocated and registered to page frame number {:#x} and memory slot {}", + pfn, slot + ), + } + } +} -- cgit 1.4.1