mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-01-23 00:07:07 +03:00
2831b89a7c
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.
28 lines
489 B
C
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;
|
|
}
|