From 75497226403fa2f0ea5ed2acd74bcc24b833f2b8 Mon Sep 17 00:00:00 2001 From: Maximiliano Sandoval Date: Tue, 13 Aug 2024 10:44:12 +0200 Subject: [PATCH] fuse-loop: remove lazy_static dependency Signed-off-by: Maximiliano Sandoval --- pbs-fuse-loop/Cargo.toml | 2 +- pbs-fuse-loop/src/fuse_loop.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pbs-fuse-loop/Cargo.toml b/pbs-fuse-loop/Cargo.toml index 40a5e744..18898023 100644 --- a/pbs-fuse-loop/Cargo.toml +++ b/pbs-fuse-loop/Cargo.toml @@ -4,11 +4,11 @@ version = "0.1.0" authors.workspace = true edition.workspace = true description = "fuse and loop device helpers" +rust-version.workspace = true [dependencies] anyhow.workspace = true futures.workspace = true -lazy_static.workspace = true libc.workspace = true log.workspace = true nix.workspace = true diff --git a/pbs-fuse-loop/src/fuse_loop.rs b/pbs-fuse-loop/src/fuse_loop.rs index 3d0ef123..d55be3b0 100644 --- a/pbs-fuse-loop/src/fuse_loop.rs +++ b/pbs-fuse-loop/src/fuse_loop.rs @@ -7,6 +7,7 @@ use std::fs::{read_to_string, remove_file, File, OpenOptions}; use std::io::prelude::*; use std::io::SeekFrom; use std::path::{Path, PathBuf}; +use std::sync::LazyLock; use nix::sys::signal::{self, Signal}; use nix::unistd::Pid; @@ -22,9 +23,7 @@ use proxmox_time::epoch_i64; const RUN_DIR: &str = "/run/pbs-loopdev"; -lazy_static::lazy_static! { - static ref LOOPDEV_REGEX: Regex = Regex::new(r"^loop\d+$").unwrap(); -} +static LOOPDEV_REGEX: LazyLock = LazyLock::new(|| Regex::new(r"^loop\d+$").unwrap()); /// Represents an ongoing FUSE-session that has been mapped onto a loop device. /// Create with map_loop, then call 'main' and poll until startup_chan reports