mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-01-23 00:07:07 +03:00
28 lines
493 B
C
28 lines
493 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 = bcache_super_read(argv[1]);
|
|
|
|
passphrase = read_passphrase("Enter passphrase: ");
|
|
|
|
add_bcache_key(sb, passphrase);
|
|
|
|
memzero_explicit(passphrase, strlen(passphrase));
|
|
free(passphrase);
|
|
return 0;
|
|
}
|