tape: remove lazy_static dependency
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
This commit is contained in:
parent
a480089bc9
commit
81b40e1421
@ -4,13 +4,13 @@ version = "0.1.0"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
description = "LTO tape support"
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
bitflags.workspace = true
|
||||
endian_trait.workspace = true
|
||||
hex.workspace = true
|
||||
lazy_static.workspace = true
|
||||
libc.workspace = true
|
||||
log.workspace = true
|
||||
nix.workspace = true
|
||||
|
@ -3,6 +3,7 @@ use std::fs::{File, OpenOptions};
|
||||
use std::os::unix::fs::OpenOptionsExt;
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use anyhow::{bail, format_err, Error};
|
||||
use nix::fcntl::{fcntl, FcntlArg, OFlag};
|
||||
@ -12,10 +13,8 @@ use proxmox_sys::fs::scan_subdir;
|
||||
|
||||
use pbs_api_types::{DeviceKind, OptionalDeviceIdentification, TapeDeviceInfo};
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref SCSI_GENERIC_NAME_REGEX: regex::Regex =
|
||||
regex::Regex::new(r"^sg\d+$").unwrap();
|
||||
}
|
||||
static SCSI_GENERIC_NAME_REGEX: LazyLock<regex::Regex> =
|
||||
LazyLock::new(|| regex::Regex::new(r"^sg\d+$").unwrap());
|
||||
|
||||
/// List linux tape changer devices
|
||||
pub fn linux_tape_changer_list() -> Vec<TapeDeviceInfo> {
|
||||
|
@ -1,5 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use anyhow::{bail, format_err, Error};
|
||||
use endian_trait::Endian;
|
||||
@ -114,9 +115,7 @@ static MAM_ATTRIBUTES: &[MamType] = &[
|
||||
MamType::bin(0x10_01, 24, "Alternate Unique Cartridge Identify (Alt-UCI)"),
|
||||
];
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
|
||||
static ref MAM_ATTRIBUTE_NAMES: HashMap<u16, &'static MamType> = {
|
||||
static MAM_ATTRIBUTE_NAMES: LazyLock<HashMap<u16, &'static MamType>> = LazyLock::new(|| {
|
||||
let mut map = HashMap::new();
|
||||
|
||||
for entry in MAM_ATTRIBUTES {
|
||||
@ -124,8 +123,7 @@ lazy_static::lazy_static! {
|
||||
}
|
||||
|
||||
map
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
fn read_tape_mam<F: AsRawFd>(file: &mut F) -> Result<Vec<u8>, Error> {
|
||||
let alloc_len: u32 = 32 * 1024;
|
||||
|
Loading…
Reference in New Issue
Block a user