Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@ jobs:
- name: Install asciidoctor
run: sudo apt-get install -y asciidoctor

- name: Install additional Rust rust targets
run: rustup target add aarch64-unknown-linux-gnu aarch64-apple-darwin

- name: Formatting (rustfmt)
run: cargo fmt -- --check

- name: Clippy (all features)
run: cargo clippy --all-targets --all-features
- name: Clippy x86_64-unknown-linux-gnu (all features)
run: cargo clippy --all-features --target x86_64-unknown-linux-gnu

- name: Clippy aarch64-unknown-linux-gnu (all features)
run: cargo clippy --all-features --target aarch64-unknown-linux-gnu

- name: Clippy aarch64-apple-darwin (all features)
run: cargo clippy --all-features --target aarch64-apple-darwin
3 changes: 2 additions & 1 deletion src/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ fn export_container_config(
}

pub fn create(cfg: &mut KrunvmConfig, matches: &ArgMatches) {
let cpus = match matches.value_of("cpus") {
#[allow(unused_mut)]
let mut cpus = match matches.value_of("cpus") {
Some(c) => match c.parse::<u32>() {
Err(_) => {
println!("Invalid value for \"cpus\"");
Expand Down
7 changes: 4 additions & 3 deletions src/start.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2021 Red Hat, Inc.
// SPDX-License-Identifier: Apache-2.0

use libc::c_char;
use std::ffi::CString;
use std::fs::File;
#[cfg(target_os = "linux")]
Expand Down Expand Up @@ -91,7 +92,7 @@ unsafe fn exec_vm(vmcfg: &VmConfig, rootfs: &str, cmd: Option<&str>, args: Vec<C
let map = format!("{}:{}", host_port, guest_port);
ports.push(CString::new(map).unwrap());
}
let mut ps: Vec<*const i8> = Vec::new();
let mut ps: Vec<*const c_char> = Vec::new();
for port in ports.iter() {
ps.push(port.as_ptr());
}
Expand All @@ -113,10 +114,10 @@ unsafe fn exec_vm(vmcfg: &VmConfig, rootfs: &str, cmd: Option<&str>, args: Vec<C

let hostname = CString::new(format!("HOSTNAME={}", vmcfg.name)).unwrap();
let home = CString::new("HOME=/root").unwrap();
let env: [*const i8; 3] = [hostname.as_ptr(), home.as_ptr(), std::ptr::null()];
let env: [*const c_char; 3] = [hostname.as_ptr(), home.as_ptr(), std::ptr::null()];

if let Some(cmd) = cmd {
let mut argv: Vec<*const i8> = Vec::new();
let mut argv: Vec<*const c_char> = Vec::new();
for a in args.iter() {
argv.push(a.as_ptr());
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ pub fn mount_container(cfg: &KrunvmConfig, vmcfg: &VmConfig) -> Result<String, s
let rootfs = std::str::from_utf8(&output.stdout).unwrap().trim();

#[cfg(target_os = "macos")]
fix_root_mode(&rootfs);
fix_root_mode(rootfs);

Ok(rootfs.to_string())
}
Expand Down