diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2016-08-23 19:50:31 -0800 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2016-08-25 17:39:01 -0800 |
commit | cdd61de630124d5b3d30e8927c9be02735f85f80 (patch) | |
tree | 522d4e4c835378f31782da90efabc15f4345bc64 /bcache-key.c | |
parent | 932ece1567dfc4ea7d993c8f62ccc9adfcf736ef (diff) |
Rework option handling
Diffstat (limited to 'bcache-key.c')
-rw-r--r-- | bcache-key.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/bcache-key.c b/bcache-key.c index 53dbe37d..34005454 100644 --- a/bcache-key.c +++ b/bcache-key.c @@ -9,12 +9,13 @@ #include "libbcache.h" #include "crypto.h" -NihOption opts_unlock[] = { - NIH_OPTION_LAST -}; - -int cmd_unlock(NihCommand *command, char * const *args) +int cmd_unlock(int argc, char *argv[]) { + NihOption opts[] = { + NIH_OPTION_LAST + }; + char **args = bch_nih_init(argc, argv, opts); + struct bcache_disk_key disk_key; struct bcache_key key; struct cache_sb sb; @@ -38,7 +39,7 @@ int cmd_unlock(NihCommand *command, char * const *args) passphrase = read_passphrase("Enter passphrase: "); derive_passphrase(&key, passphrase); - disk_key_encrypt(&disk_key, &key); + disk_key_encrypt(&sb, &disk_key, &key); if (memcmp(&disk_key, bch_key_header, sizeof(bch_key_header))) die("incorrect passphrase"); |