mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-11-04 19:11:11 +00:00
vmm: Use layout constant for kernel command line
Remove the unnecessary field on CmdlineConfig and switch to using the common offset. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
1bc47507b7
commit
a0455167d0
@ -12,13 +12,11 @@ use std::net::AddrParseError;
|
||||
use std::net::Ipv4Addr;
|
||||
use std::path::PathBuf;
|
||||
use std::result;
|
||||
use vm_memory::GuestAddress;
|
||||
use vm_virtio::vhost_user::VhostUserConfig;
|
||||
|
||||
pub const DEFAULT_VCPUS: &str = "1";
|
||||
pub const DEFAULT_MEMORY: &str = "size=512M";
|
||||
pub const DEFAULT_RNG_SOURCE: &str = "/dev/urandom";
|
||||
const CMDLINE_OFFSET: GuestAddress = GuestAddress(0x20000);
|
||||
|
||||
/// Errors associated with VM configuration parameters.
|
||||
#[derive(Debug)]
|
||||
@ -190,7 +188,6 @@ impl KernelConfig {
|
||||
#[derive(Clone)]
|
||||
pub struct CmdlineConfig {
|
||||
pub args: Cmdline,
|
||||
pub offset: GuestAddress,
|
||||
}
|
||||
|
||||
impl CmdlineConfig {
|
||||
@ -201,10 +198,7 @@ impl CmdlineConfig {
|
||||
let mut args = Cmdline::new(arch::CMDLINE_MAX_SIZE);
|
||||
args.insert_str(cmdline_str).unwrap();
|
||||
|
||||
Ok(CmdlineConfig {
|
||||
args,
|
||||
offset: CMDLINE_OFFSET,
|
||||
})
|
||||
Ok(CmdlineConfig { args })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -704,7 +704,7 @@ impl Vm {
|
||||
|
||||
linux_loader::loader::load_cmdline(
|
||||
mem.deref(),
|
||||
self.config.cmdline.offset,
|
||||
arch::layout::CMDLINE_START,
|
||||
&cmdline_cstring,
|
||||
)
|
||||
.map_err(|_| Error::CmdLine)?;
|
||||
@ -715,7 +715,7 @@ impl Vm {
|
||||
Some(hdr) => {
|
||||
arch::configure_system(
|
||||
&mem,
|
||||
self.config.cmdline.offset,
|
||||
arch::layout::CMDLINE_START,
|
||||
cmdline_cstring.to_bytes().len() + 1,
|
||||
vcpu_count,
|
||||
Some(hdr),
|
||||
@ -735,7 +735,7 @@ impl Vm {
|
||||
None => {
|
||||
arch::configure_system(
|
||||
&mem,
|
||||
self.config.cmdline.offset,
|
||||
arch::layout::CMDLINE_START,
|
||||
cmdline_cstring.to_bytes().len() + 1,
|
||||
vcpu_count,
|
||||
None,
|
||||
|
Loading…
Reference in New Issue
Block a user