summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Vet <RlndVt@protonmail.com>2024-02-22 22:12:40 +0100
committerRoland Vet <RlndVt@protonmail.com>2024-02-23 08:37:23 +0100
commit16661be29497ce4940039fe49e3ebb71f72a2052 (patch)
tree08aa040816de3918359e9c6d594c543d9f0889f5
parent817e957697e3ecb2447c50dbe611a5f591aa96b5 (diff)
bch2_sb_is_encrypted{,_and_locked}
Specifically also mention locked Signed-off-by: Roland Vet <RlndVt@protonmail.com>
-rw-r--r--c_src/cmd_key.c2
-rw-r--r--c_src/crypto.c2
-rw-r--r--c_src/crypto.h2
-rw-r--r--src/commands/cmd_mount.rs2
4 files changed, 4 insertions, 4 deletions
diff --git a/c_src/cmd_key.c b/c_src/cmd_key.c
index adb0ac8d..552aa867 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(sb.sb))
+ if (!bch2_sb_is_encrypted_and_locked(sb.sb))
die("%s is not encrypted", dev);
if (check)
diff --git a/c_src/crypto.c b/c_src/crypto.c
index 32671bd8..bc4a9aee 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(struct bch_sb *sb)
+bool bch2_sb_is_encrypted_and_locked(struct bch_sb *sb)
{
struct bch_sb_field_crypt *crypt;
diff --git a/c_src/crypto.h b/c_src/crypto.h
index baea6d86..b93b1b08 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(struct bch_sb *);
+bool bch2_sb_is_encrypted_and_locked(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/cmd_mount.rs b/src/commands/cmd_mount.rs
index 35b5462b..63998456 100644
--- a/src/commands/cmd_mount.rs
+++ b/src/commands/cmd_mount.rs
@@ -206,7 +206,7 @@ fn cmd_mount_inner(opt: Cli) -> anyhow::Result<()> {
Err(anyhow::anyhow!("No device found from specified parameters"))?;
}
// Check if the filesystem's master key is encrypted
- if unsafe { bcachefs::bch2_sb_is_encrypted(block_devices_to_mount[0].sb) } {
+ if unsafe { bcachefs::bch2_sb_is_encrypted_and_locked(block_devices_to_mount[0].sb) } {
// First by password_file, if available
let fallback_to_unlock_policy = if let Some(passphrase_file) = &opt.passphrase_file {
match key::read_from_passphrase_file(&block_devices_to_mount[0], passphrase_file.as_path()) {