3
3
4
4
//#![deny(warnings)]
5
5
6
- use std:: collections:: HashMap ;
7
6
#[ cfg( feature = "tee" ) ]
8
7
use std:: fs:: File ;
9
8
#[ cfg( feature = "tee" ) ]
@@ -29,7 +28,6 @@ use crate::vmm_config::machine_config::{VmConfig, VmConfigError};
29
28
use crate :: vmm_config:: net:: { NetBuilder , NetworkInterfaceConfig , NetworkInterfaceError } ;
30
29
use crate :: vmm_config:: vsock:: * ;
31
30
use crate :: vstate:: VcpuConfig ;
32
-
33
31
#[ cfg( feature = "gpu" ) ]
34
32
use devices:: virtio:: display:: DisplayInfo ;
35
33
#[ cfg( feature = "tee" ) ]
@@ -83,15 +81,12 @@ impl Default for TeeConfig {
83
81
}
84
82
}
85
83
86
- #[ derive( Copy , Clone , Debug , Eq , Hash , PartialEq ) ]
87
- pub enum ConsoleType {
88
- Serial ,
89
- Virtio ,
84
+ pub struct SerialConsoleConfig {
85
+ pub input_fd : RawFd ,
86
+ pub output_fd : RawFd ,
90
87
}
91
88
92
- #[ derive( Debug , Default ) ]
93
- pub struct ConsoleConfig {
94
- pub output_path : Option < PathBuf > ,
89
+ pub struct DefaultVirtioConsoleConfig {
95
90
pub input_fd : RawFd ,
96
91
pub output_fd : RawFd ,
97
92
pub err_fd : RawFd ,
@@ -153,8 +148,10 @@ pub struct VmResources {
153
148
pub disable_implicit_console : bool ,
154
149
/// The console id to use for console= in the kernel cmdline
155
150
pub kernel_console : Option < String > ,
156
- /// Consoles to attach to the guest
157
- pub consoles : HashMap < ConsoleType , Vec < ConsoleConfig > > ,
151
+ /// Serial consoles to attach to the guest
152
+ pub serial_consoles : Vec < SerialConsoleConfig > ,
153
+ /// Virtio consoles to attach to the guest
154
+ pub virtio_consoles : Vec < DefaultVirtioConsoleConfig > ,
158
155
}
159
156
160
157
impl VmResources {
@@ -353,7 +350,7 @@ impl VmResources {
353
350
mod tests {
354
351
#[ cfg( feature = "gpu" ) ]
355
352
use crate :: resources:: DisplayBackendConfig ;
356
- use crate :: resources:: VmResources ;
353
+ use crate :: resources:: { DefaultVirtioConsoleConfig , VmResources } ;
357
354
use crate :: vmm_config:: kernel_cmdline:: KernelCmdlineConfig ;
358
355
use crate :: vmm_config:: machine_config:: { CpuFeaturesTemplate , VmConfig , VmConfigError } ;
359
356
use crate :: vmm_config:: vsock:: tests:: { default_config, TempSockFile } ;
@@ -393,7 +390,8 @@ mod tests {
393
390
nested_enabled : false ,
394
391
split_irqchip : false ,
395
392
disable_implicit_console : false ,
396
- consoles : HashMap :: new ( ) ,
393
+ serial_consoles : Vec :: new ( ) ,
394
+ virtio_consoles : Vec :: new ( ) ,
397
395
kernel_console : None ,
398
396
}
399
397
}
0 commit comments