mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-31 07:19:06 +00:00
cgroups: remove unnecessary get_paths()
Change get_mounts to get paths from a borrowed argument rather than calling get_paths a second time. Fixes #3768 Signed-off-by: Derek Lee <derlee@redhat.com>
This commit is contained in:
parent
cda1919a0a
commit
9ae2a45b38
@ -911,9 +911,8 @@ pub fn get_paths() -> Result<HashMap<String, String>> {
|
||||
Ok(m)
|
||||
}
|
||||
|
||||
pub fn get_mounts() -> Result<HashMap<String, String>> {
|
||||
pub fn get_mounts(paths: &HashMap<String, String>) -> Result<HashMap<String, String>> {
|
||||
let mut m = HashMap::new();
|
||||
let paths = get_paths()?;
|
||||
|
||||
for l in fs::read_to_string(MOUNTS)?.lines() {
|
||||
let p: Vec<&str> = l.splitn(2, " - ").collect();
|
||||
@ -951,7 +950,7 @@ impl Manager {
|
||||
let mut m = HashMap::new();
|
||||
|
||||
let paths = get_paths()?;
|
||||
let mounts = get_mounts()?;
|
||||
let mounts = get_mounts(&paths)?;
|
||||
|
||||
for key in paths.keys() {
|
||||
let mnt = mounts.get(key);
|
||||
|
Loading…
Reference in New Issue
Block a user