bcachefs-tools/cmd_key.c
Kent Overstreet 2831b89a7c More cmd_migrate improvements
Factor out bch2_pick_bucket_size() from the format code, and pick the
bucket size before picking the superblock location - that way we can
ensure the superblock gets its own bucket and doesn't trigger warnings
due to the allocation code noticing different types of data in the same
bucket.
2017-04-02 19:43:35 -08:00

28 lines
489 B
C

#include <errno.h>
#include <unistd.h>
#include <uuid/uuid.h>
#include "cmds.h"
#include "checksum.h"
#include "crypto.h"
#include "libbcachefs.h"
int cmd_unlock(int argc, char *argv[])
{
struct bch_sb *sb;
char *passphrase;
if (argc != 2)
die("please supply a single device");
sb = bch2_super_read(argv[1]);
passphrase = read_passphrase("Enter passphrase: ");
bch2_add_key(sb, passphrase);
memzero_explicit(passphrase, strlen(passphrase));
free(passphrase);
return 0;
}