mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: config: Make the cmdline config serializable
The linux_loader crate Cmdline struct is not serializable. Instead of forcing the upstream create to carry a serde dependency, we simply use a String for the passed command line and build the actual CmdLine when we need it (in vm::new()). Also, the cmdline offset is not a configuration knob, so we remove it. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
+2
-5
@@ -5,7 +5,6 @@
|
||||
|
||||
extern crate vm_virtio;
|
||||
|
||||
use linux_loader::cmdline::Cmdline;
|
||||
use net_util::MacAddr;
|
||||
use std::convert::From;
|
||||
use std::net::AddrParseError;
|
||||
@@ -180,16 +179,14 @@ pub struct KernelConfig {
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct CmdlineConfig {
|
||||
pub args: Cmdline,
|
||||
pub args: String,
|
||||
}
|
||||
|
||||
impl CmdlineConfig {
|
||||
pub fn parse(cmdline: Option<&str>) -> Result<Self> {
|
||||
let cmdline_str = cmdline
|
||||
let args = cmdline
|
||||
.map(std::string::ToString::to_string)
|
||||
.unwrap_or_else(String::new);
|
||||
let mut args = Cmdline::new(arch::CMDLINE_MAX_SIZE);
|
||||
args.insert_str(cmdline_str).unwrap();
|
||||
|
||||
Ok(CmdlineConfig { args })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user