Skip to content

Commit 57f53b4

Browse files
mayastor-borsdsharma-dc
andcommitted
Merge #1847
1847: fix(crypto): use Cstring while type converting to c_char r=dsharma-dc a=dsharma-dc Co-authored-by: Diwakar Sharma <[email protected]>
2 parents 05cd3d3 + be7a639 commit 57f53b4

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

io-engine/src/bdev/crypto.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub enum Cipher {
6464
AesXts,
6565
}
6666

67-
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
67+
#[derive(Clone, Default, PartialEq, Serialize, Deserialize)]
6868
/// A struct that represents the parameters required to create a key.
6969
pub struct EncryptionKey {
7070
pub cipher: Cipher,
@@ -76,6 +76,15 @@ pub struct EncryptionKey {
7676
pub key2_len: Option<u32>,
7777
}
7878

79+
impl Debug for EncryptionKey {
80+
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
81+
f.debug_struct("EncryptionKey")
82+
.field("cipher", &self.cipher)
83+
.field("key_name", &self.key_name)
84+
.finish()
85+
}
86+
}
87+
7988
impl Debug for Crypto {
8089
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
8190
write!(
@@ -217,7 +226,7 @@ pub async fn destroy_crypto_vbdev(vbdev_name: String) -> Result<(), BdevError> {
217226
let (s, r) = pair::<i32>();
218227
unsafe {
219228
delete_crypto_disk(
220-
vbdev_name.as_ptr() as *mut std::os::raw::c_char,
229+
vbdev_name.clone().into_cstring().as_ptr() as *mut std::os::raw::c_char,
221230
Some(crypto_vbdev_op_cb),
222231
cb_arg(s),
223232
);

io-engine/src/lvs/lvs_store.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,11 @@ impl Lvs {
686686
name: pool.clone(),
687687
})?;
688688

689-
info!("{}: lvs exported successfully", self_str);
689+
info!(
690+
"{}: lvs exported successfully. base bdev: {}",
691+
self_str,
692+
base_bdev.name()
693+
);
690694

691695
// If the base_bdev is a crypto vbdev then we need to destroy both - the crypto vbdev and it's base.
692696
if base_bdev.driver() == "crypto" {

0 commit comments

Comments
 (0)