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
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ path = "src/bin/blkreader.rs"
blkpath = "0.1"
blkmap = "0.1"
libc = "0.2"
once_cell = "1.19"
clap = { version = "4.5", features = ["derive"] }
sudo = "0.6"

Expand Down
7 changes: 3 additions & 4 deletions src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
//! to the underlying block device.

use blkpath::ResolveDevice;
use once_cell::sync::Lazy;
use std::collections::HashMap;
use std::fs::{File, OpenOptions};
use std::io;
use std::os::unix::fs::{MetadataExt, OpenOptionsExt};
use std::path::PathBuf;
use std::sync::{Arc, RwLock};
use std::sync::{Arc, LazyLock, RwLock};

/// A cached block device entry containing the path and file handle.
#[derive(Debug)]
Expand All @@ -39,8 +38,8 @@ impl CachedDevice {
/// The cache is keyed by the device ID (from `stat.st_dev`), which
/// uniquely identifies a filesystem. All files on the same filesystem
/// share the same underlying block device.
static DEVICE_CACHE: Lazy<RwLock<HashMap<u64, Arc<CachedDevice>>>> =
Lazy::new(|| RwLock::new(HashMap::new()));
static DEVICE_CACHE: LazyLock<RwLock<HashMap<u64, Arc<CachedDevice>>>> =
LazyLock::new(|| RwLock::new(HashMap::new()));

/// Get or create a cached block device entry for the given file.
///
Expand Down
Loading