From 1a522613c469cbab90f7fa615cf359c7b55676ca Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sat, 1 Feb 2020 16:09:37 +0000 Subject: devices: move jailing out of JailedDevice::new Doing this in its own function, jail_device, which returns a simple record struct (JailInfo), means that callers can do other things with the jailed device than just configure a ProxyDevice. This will make it possible to have a program that acts only as a jail supervisor, and which forwards its socket to a CrosVM to be put into a ProxyDevice in that process. --- arch/src/lib.rs | 2 +- arch/src/serial.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'arch') diff --git a/arch/src/lib.rs b/arch/src/lib.rs index 2e875a5..6dc3ab5 100644 --- a/arch/src/lib.rs +++ b/arch/src/lib.rs @@ -256,7 +256,7 @@ pub fn generate_pci_root( keep_fds.push(event.as_raw_fd()); } let arced_dev: Arc> = if let Some(jail) = jail { - let proxy = JailedDevice::new(device, &jail, keep_fds) + let proxy = JailedDevice::jail(device, &jail, keep_fds) .map_err(DeviceRegistrationError::ProxyDeviceCreation)?; pid_labels.insert(proxy.pid() as u32, proxy.debug_label()); Arc::new(Mutex::new(proxy)) diff --git a/arch/src/serial.rs b/arch/src/serial.rs index 14ed70a..14c59a7 100644 --- a/arch/src/serial.rs +++ b/arch/src/serial.rs @@ -276,7 +276,7 @@ pub fn add_serial_devices( match serial_jail.as_ref() { Some(jail) => { let com = Arc::new(Mutex::new( - JailedDevice::new(com, &jail, preserved_fds) + JailedDevice::jail(com, &jail, preserved_fds) .map_err(DeviceRegistrationError::ProxyDeviceCreation)?, )); io_bus -- cgit 1.4.1