summaryrefslogtreecommitdiff
path: root/bcacheadm-format.c
diff options
context:
space:
mode:
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 5121fd15..52acc097 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();
+}