summaryrefslogtreecommitdiff
path: root/bcache-key.c
diff options
context:
space:
mode:
Diffstat (limited to 'bcache-key.c')
-rw-r--r--bcache-key.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/bcache-key.c b/bcache-key.c
index 34005454..cac09482 100644
--- a/bcache-key.c
+++ b/bcache-key.c
@@ -18,7 +18,7 @@ int cmd_unlock(int argc, char *argv[])
struct bcache_disk_key disk_key;
struct bcache_key key;
- struct cache_sb sb;
+ struct cache_sb *sb;
char *passphrase;
char uuid[40];
char description[60];
@@ -26,12 +26,12 @@ int cmd_unlock(int argc, char *argv[])
if (!args[0] || args[1])
die("please supply a single device");
- bcache_super_read(args[0], &sb);
+ sb = bcache_super_read(args[0]);
- if (!CACHE_SET_ENCRYPTION_KEY(&sb))
+ if (!CACHE_SET_ENCRYPTION_KEY(sb))
die("filesystem is not encrypted");
- memcpy(&disk_key, sb.encryption_key, sizeof(disk_key));
+ memcpy(&disk_key, sb->encryption_key, sizeof(disk_key));
if (!memcmp(&disk_key, bch_key_header, sizeof(bch_key_header)))
die("filesystem does not have encryption key");
@@ -39,12 +39,12 @@ int cmd_unlock(int argc, char *argv[])
passphrase = read_passphrase("Enter passphrase: ");
derive_passphrase(&key, passphrase);
- disk_key_encrypt(&sb, &disk_key, &key);
+ disk_key_encrypt(sb, &disk_key, &key);
if (memcmp(&disk_key, bch_key_header, sizeof(bch_key_header)))
die("incorrect passphrase");
- uuid_unparse_lower(sb.user_uuid.b, uuid);
+ uuid_unparse_lower(sb->user_uuid.b, uuid);
sprintf(description, "bcache:%s", uuid);
if (add_key("logon", description, &key, sizeof(key),