diff --git a/c_src/cmd_key.c b/c_src/cmd_key.c index 552aa867..adb0ac8d 100644 --- a/c_src/cmd_key.c +++ b/c_src/cmd_key.c @@ -66,7 +66,7 @@ int cmd_unlock(int argc, char *argv[]) if (ret) die("Error opening %s: %s", dev, bch2_err_str(ret)); - if (!bch2_sb_is_encrypted_and_locked(sb.sb)) + if (!bch2_sb_is_encrypted(sb.sb)) die("%s is not encrypted", dev); if (check) diff --git a/c_src/crypto.c b/c_src/crypto.c index bc4a9aee..32671bd8 100644 --- a/c_src/crypto.c +++ b/c_src/crypto.c @@ -101,7 +101,7 @@ struct bch_key derive_passphrase(struct bch_sb_field_crypt *crypt, return key; } -bool bch2_sb_is_encrypted_and_locked(struct bch_sb *sb) +bool bch2_sb_is_encrypted(struct bch_sb *sb) { struct bch_sb_field_crypt *crypt; diff --git a/c_src/crypto.h b/c_src/crypto.h index b93b1b08..baea6d86 100644 --- a/c_src/crypto.h +++ b/c_src/crypto.h @@ -12,7 +12,7 @@ char *read_passphrase(const char *); char *read_passphrase_twice(const char *); struct bch_key derive_passphrase(struct bch_sb_field_crypt *, const char *); -bool bch2_sb_is_encrypted_and_locked(struct bch_sb *); +bool bch2_sb_is_encrypted(struct bch_sb *); void bch2_passphrase_check(struct bch_sb *, const char *, struct bch_key *, struct bch_encrypted_key *); void bch2_add_key(struct bch_sb *, const char *, const char *, const char *); diff --git a/src/commands/mount.rs b/src/commands/mount.rs index 7f5937d0..f6254366 100644 --- a/src/commands/mount.rs +++ b/src/commands/mount.rs @@ -344,7 +344,7 @@ fn cmd_mount_inner(opt: Cli) -> anyhow::Result<()> { .unwrap(); // Check if the filesystem's master key is encrypted and we don't have a key - if unsafe { bcachefs::bch2_sb_is_encrypted_and_locked(block_devices_to_mount[0].sb) } + if unsafe { bcachefs::bch2_sb_is_encrypted(block_devices_to_mount[0].sb) } && !key::check_for_key(&key_name)? { // First by password_file, if available