diff options
author | Thomas Mühlbacher <tmuehlbacher@posteo.net> | 2024-06-03 17:02:27 +0200 |
---|---|---|
committer | Thomas Mühlbacher <tmuehlbacher@posteo.net> | 2024-06-03 17:05:52 +0200 |
commit | 30e16b5e15ff86b6ead0608cbd9f8bf43ab045dd (patch) | |
tree | 8973c259678eaacb39c75545656c4611b24ab77d | |
parent | fac7cce224ca38e88e30ed0f16b0e93782625b0f (diff) |
fix: avoid `addr_of` if we already use a reference
It's kind of stupid to use this macro if we have to deref the parameter
first. I was too enthusiastic about using this macro instead of `as`
because it's nicer to read (imo).
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
-rw-r--r-- | src/key.rs | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -11,7 +11,7 @@ use std::{ use anyhow::{anyhow, ensure, Result}; use bch_bindgen::{ bcachefs::{self, bch_key, bch_sb_handle}, - c::bch2_chacha_encrypt_key, + c::{bch2_chacha_encrypt_key, bch_sb_field_crypt}, keyutils::{self, keyctl_search}, }; use byteorder::{LittleEndian, ReadBytesExt}; @@ -66,7 +66,7 @@ impl KeyHandle { let bch_key_magic = BCH_KEY_MAGIC.as_bytes().read_u64::<LittleEndian>().unwrap(); let crypt = sb.sb().crypt().unwrap(); - let crypt_ptr = ptr::addr_of!(*crypt).cast_mut(); + let crypt_ptr = (crypt as *const bch_sb_field_crypt).cast_mut(); let mut output: bch_key = unsafe { bcachefs::derive_passphrase(crypt_ptr, passphrase.get().as_ptr()) }; |