summaryrefslogtreecommitdiff
path: root/bcache-format.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2016-12-11 14:45:48 -0900
committerKent Overstreet <kent.overstreet@gmail.com>2016-12-11 14:58:27 -0900
commit7f4191a202ea4558ca2d5eb8a47daea33c9999c7 (patch)
tree137f957291da895f78b43a8903db6f744d6e202c /bcache-format.c
parent4e158e155327d09868453ae9759a58284245175a (diff)
add support for maximum journal entry size
also rip out prototype crypto support code - real code is in the dev branch, with the new superblock format
Diffstat (limited to 'bcache-format.c')
-rw-r--r--bcache-format.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/bcache-format.c b/bcache-format.c
index 1b20b55..ca04433 100644
--- a/bcache-format.c
+++ b/bcache-format.c
@@ -26,7 +26,6 @@
#include "bcache.h"
#include "libbcache.h"
-#include "crypto.h"
/* Open a block device, do magic blkid stuff: */
static int open_for_format(const char *dev, bool force)
@@ -80,9 +79,9 @@ static void usage(void)
" --metadata_checksum_type=(none|crc32c|crc64)\n"
" --data_checksum_type=(none|crc32c|crc64)\n"
" --compression_type=(none|lz4|gzip)\n"
- " --encrypted\n"
" --error_action=(continue|readonly|panic)\n"
" Action to take on filesystem error\n"
+ " --max_journal_entry_size=size\n"
" -l, --label=label\n"
" --uuid=uuid\n"
" -f, --force\n"
@@ -108,8 +107,8 @@ static void usage(void)
OPT(0, metadata_checksum_type, required_argument) \
OPT(0, data_checksum_type, required_argument) \
OPT(0, compression_type, required_argument) \
- OPT(0, encrypted, no_argument) \
OPT('e', error_action, required_argument) \
+ OPT(0, max_journal_entry_size, required_argument) \
OPT('L', label, required_argument) \
OPT('U', uuid, required_argument) \
OPT('f', force, no_argument) \
@@ -144,7 +143,6 @@ int cmd_format(int argc, char *argv[])
unsigned meta_csum_type = BCH_CSUM_CRC32C;
unsigned data_csum_type = BCH_CSUM_CRC32C;
unsigned compression_type = BCH_COMPRESSION_NONE;
- bool encrypted = false;
unsigned on_error_action = BCH_ON_ERROR_RO;
char *label = NULL;
uuid_le uuid;
@@ -155,6 +153,7 @@ int cmd_format(int argc, char *argv[])
unsigned bucket_size = 0;
unsigned tier = 0;
bool discard = false;
+ unsigned max_journal_entry_size = 0;
char *passphrase = NULL;
int opt;
@@ -187,14 +186,15 @@ int cmd_format(int argc, char *argv[])
compression_type = read_string_list_or_die(optarg,
compression_types, "compression type");
break;
- case Opt_encrypted:
- encrypted = true;
- break;
case Opt_error_action:
case 'e':
on_error_action = read_string_list_or_die(optarg,
error_actions, "error action");
break;
+ case Opt_max_journal_entry_size:
+ max_journal_entry_size = hatoi_validate(optarg,
+ "journal entry size");
+ break;
case Opt_label:
case 'L':
label = strdup(optarg);
@@ -242,22 +242,6 @@ int cmd_format(int argc, char *argv[])
if (uuid_is_null(uuid.b))
uuid_generate(uuid.b);
- if (encrypted) {
- char *pass2;
-
- passphrase = read_passphrase("Enter passphrase: ");
- pass2 = read_passphrase("Enter same passphrase again: ");
-
- if (strcmp(passphrase, pass2)) {
- memzero_explicit(passphrase, strlen(passphrase));
- memzero_explicit(pass2, strlen(pass2));
- die("Passphrases do not match");
- }
-
- memzero_explicit(pass2, strlen(pass2));
- free(pass2);
- }
-
darray_foreach(dev, devices)
dev->fd = open_for_format(dev->path, force);
@@ -267,10 +251,10 @@ int cmd_format(int argc, char *argv[])
meta_csum_type,
data_csum_type,
compression_type,
- passphrase,
1,
1,
on_error_action,
+ max_journal_entry_size,
label,
uuid);