mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-12-10 00:00:24 +03:00
Add env. variable BCACHEFS_BLOCK_SCAN
Introduce an env. variable for users that have a broken blkid which renders the udev db as incomplete. Only checks for the existence of the variable, not its value. Signed-off-by: Tony Asleson <tasleson@redhat.com>
This commit is contained in:
parent
1fb1898b24
commit
761ef99f91
@ -5,8 +5,7 @@ use clap::Parser;
|
|||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use std::io::{stdout, IsTerminal};
|
use std::io::{stdout, IsTerminal};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::fs;
|
use std::{fs, str, env};
|
||||||
use std::str;
|
|
||||||
use crate::key;
|
use crate::key;
|
||||||
use crate::key::UnlockPolicy;
|
use crate::key::UnlockPolicy;
|
||||||
use std::ffi::{CString, c_char, c_void};
|
use std::ffi::{CString, c_char, c_void};
|
||||||
@ -124,6 +123,12 @@ fn device_property_map(dev: &udev::Device) -> HashMap<String, String> {
|
|||||||
|
|
||||||
fn udev_bcachefs_info() -> anyhow::Result<HashMap<String, Vec<String>>> {
|
fn udev_bcachefs_info() -> anyhow::Result<HashMap<String, Vec<String>>> {
|
||||||
let mut info = HashMap::new();
|
let mut info = HashMap::new();
|
||||||
|
|
||||||
|
if env::var("BCACHEFS_BLOCK_SCAN").is_ok() {
|
||||||
|
debug!("Checking all block devices for bcachefs super block!");
|
||||||
|
return Ok(info);
|
||||||
|
}
|
||||||
|
|
||||||
let mut udev = udev::Enumerator::new()?;
|
let mut udev = udev::Enumerator::new()?;
|
||||||
|
|
||||||
debug!("Walking udev db!");
|
debug!("Walking udev db!");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user