From 76298c12b7699ef2ee098449487e3d55d85c70a7 Mon Sep 17 00:00:00 2001 From: Christophe de Dinechin Date: Thu, 17 Sep 2020 18:55:22 +0200 Subject: [PATCH] rust-agent: Remove or rename unused parameters Parameters that are never used were removed. Parameters that are unused, but necessary because of some common interface were renamed with a _ prefix. In one case, consume the parameter by adding an info! call, and fix a minor typo in a message in the same function. This addresses the following warning: warning: unused variable: `child` --> rustjail/src/container.rs:1128:5 | 1128 | child: &mut Child, | ^^^^^ help: if this is intentional, prefix it with an underscore: `_child` warning: unused variable: `logger` --> rustjail/src/container.rs:1049:22 | 1049 | fn update_namespaces(logger: &Logger, spec: &mut Spec, init_pid: RawFd) -> Result<()> { | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_logger` Fixes: #750 Signed-off-by: Christophe de Dinechin --- src/agent/rustjail/src/cgroups/fs/mod.rs | 6 +++--- src/agent/rustjail/src/container.rs | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/agent/rustjail/src/cgroups/fs/mod.rs b/src/agent/rustjail/src/cgroups/fs/mod.rs index 1685ac4a33..13a4c7aa20 100644 --- a/src/agent/rustjail/src/cgroups/fs/mod.rs +++ b/src/agent/rustjail/src/cgroups/fs/mod.rs @@ -230,7 +230,7 @@ impl CgroupManager for Manager { } fn set_network_resources( - cg: &cgroups::Cgroup, + _cg: &cgroups::Cgroup, network: &LinuxNetwork, res: &mut cgroups::Resources, ) -> Result<()> { @@ -259,7 +259,7 @@ fn set_network_resources( } fn set_devices_resources( - cg: &cgroups::Cgroup, + _cg: &cgroups::Cgroup, device_resources: &Vec, res: &mut cgroups::Resources, ) -> Result<()> { @@ -288,7 +288,7 @@ fn set_devices_resources( } fn set_hugepages_resources( - cg: &cgroups::Cgroup, + _cg: &cgroups::Cgroup, hugepage_limits: &Vec, res: &mut cgroups::Resources, ) -> Result<()> { diff --git a/src/agent/rustjail/src/container.rs b/src/agent/rustjail/src/container.rs index 86745207cd..7f3b4d6b08 100644 --- a/src/agent/rustjail/src/container.rs +++ b/src/agent/rustjail/src/container.rs @@ -888,7 +888,6 @@ impl BaseContainer for LinuxContainer { &p, self.cgroup_manager.as_ref().unwrap(), &st, - &mut child, pwfd, prfd, ) { @@ -1039,8 +1038,9 @@ fn do_exec(args: &[String]) -> ! { } fn update_namespaces(logger: &Logger, spec: &mut Spec, init_pid: RawFd) -> Result<()> { + info!(logger, "updating namespaces"); let linux = match spec.linux.as_mut() { - None => return Err(anyhow!("Spec didn't container linux field")), + None => return Err(anyhow!("Spec didn't contain linux field")), Some(l) => l, }; @@ -1117,7 +1117,6 @@ fn join_namespaces( p: &Process, cm: &FsManager, st: &OCIState, - _child: &mut Child, pwfd: RawFd, prfd: RawFd, ) -> Result<()> {