summaryrefslogtreecommitdiff
path: root/bcacheadm-format.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2015-05-08 18:13:38 -0700
committerKent Overstreet <kent.overstreet@gmail.com>2015-05-10 21:36:46 -0700
commitfb22ceda3e061ea38ce78d95371ad7ceaca90c3c (patch)
tree6840c9545f6670650c64c7413220fd4f6709ab21 /bcacheadm-format.c
parentda1fff87001af2eadc3b2f3ccc81f3f8190b00e2 (diff)
rewrite
Diffstat (limited to 'bcacheadm-format.c')
-rw-r--r--bcacheadm-format.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/bcacheadm-format.c b/bcacheadm-format.c
index 5121fd1..52acc09 100644
--- a/bcacheadm-format.c
+++ b/bcacheadm-format.c
@@ -35,7 +35,7 @@
#include <nih/option.h>
#include "bcache.h"
-#include "bcacheadm.h"
+#include "bcacheadm-format.h"
static struct cache_opts {
int fd;
@@ -180,7 +180,7 @@ static int set_cache_mode(NihOption *option, const char *arg)
return 0;
}
-NihOption bcacheadm_format_options[] = {
+NihOption opts_format[] = {
// { int shortoption, char *longoption, char *help, NihOptionGroup, char *argname, void *value, NihOptionSetter}
{ 'C', "cache", N_("Format a cache device"),
@@ -259,12 +259,14 @@ static unsigned ilog2(uint64_t n)
return ret;
}
-int bcacheadm_format(NihCommand *command, char *const *args)
+static int format_v0(void)
{
- struct cache_sb *cache_set_sb;
+ return 0;
+}
- if (!nr_cache_devices && !nr_backing_devices)
- die("Please supply a device");
+static int format_v1(void)
+{
+ struct cache_sb *cache_set_sb;
if (!block_size) {
for (struct cache_opts *i = cache_devices;
@@ -403,3 +405,11 @@ int bcacheadm_format(NihCommand *command, char *const *args)
return 0;
}
+
+int cmd_format(NihCommand *command, char *const *args)
+{
+ if (!nr_cache_devices && !nr_backing_devices)
+ die("Please supply a device");
+
+ return format_v1();
+}