mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-12-10 00:00:24 +03:00
Add fmt::Display for KeyLocation
Signed-off-by: Roland Vet <RlndVt@protonmail.com>
This commit is contained in:
parent
86049a1641
commit
0ff96b2a0f
13
src/key.rs
13
src/key.rs
@ -1,4 +1,4 @@
|
|||||||
use std::io::{stdin, IsTerminal};
|
use std::{fmt, io::{stdin, IsTerminal}};
|
||||||
|
|
||||||
use log::{info};
|
use log::{info};
|
||||||
use bch_bindgen::bcachefs::bch_sb_handle;
|
use bch_bindgen::bcachefs::bch_sb_handle;
|
||||||
@ -47,6 +47,17 @@ impl clap::ValueEnum for KeyLocation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for KeyLocation {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
match self {
|
||||||
|
KeyLocation::None => write!(f, "None"),
|
||||||
|
KeyLocation::Fail => write!(f, "Fail"),
|
||||||
|
KeyLocation::Wait => write!(f, "Wait"),
|
||||||
|
KeyLocation::Ask => write!(f, "Ask"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn check_for_key(key_name: &std::ffi::CStr) -> anyhow::Result<bool> {
|
fn check_for_key(key_name: &std::ffi::CStr) -> anyhow::Result<bool> {
|
||||||
use bch_bindgen::keyutils::{self, keyctl_search};
|
use bch_bindgen::keyutils::{self, keyctl_search};
|
||||||
let key_name = key_name.to_bytes_with_nul().as_ptr() as *const _;
|
let key_name = key_name.to_bytes_with_nul().as_ptr() as *const _;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user