From 0805d458c47b6e8b55b780ed8e06a446e3b25c83 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Thu, 30 Apr 2020 16:24:28 +0200 Subject: [PATCH] vmm: Add support for multiple children per DeviceNode Signed-off-by: Sebastien Boeuf --- vmm/src/device_manager.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index 7b97301d8..337ba51da 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -563,7 +563,7 @@ impl Drop for ActivatedBackend { struct DeviceNode { resources: Vec, parent: Option, - child: Option, + children: Vec, } #[derive(Serialize, Deserialize)] @@ -2138,7 +2138,7 @@ impl DeviceManager { // Add the new virtio-pci node to the device tree. let node = DeviceNode { - child: Some(virtio_device_id.clone()), + children: vec![virtio_device_id.clone()], ..Default::default() }; self.device_tree.insert(id.clone(), node); @@ -2286,7 +2286,7 @@ impl DeviceManager { } else { // Add the new virtio-mmio node to the device tree. let node = DeviceNode { - child: Some(virtio_device_id.clone()), + children: vec![virtio_device_id.clone()], ..Default::default() }; self.device_tree.insert(id.clone(), node); @@ -3052,7 +3052,7 @@ impl Snapshottable for DeviceManager { // the device tree is the right way to ensure we restore a child before // its parent node. for (id, node) in self.device_tree.iter() { - if node.child.is_some() { + if !node.children.is_empty() { continue; }