2 * Authors: Kent Overstreet <kent.overstreet@gmail.com>
3 * Gabriel de Perthuis <g2p.code@gmail.com>
4 * Jacob Malevich <jam@datera.io>
20 #include <sys/ioctl.h>
21 #include <sys/types.h>
24 #include "bcache-cmds.h"
26 static void usage(void)
28 puts("bcache - tool for managing bcache volumes/filesystems\n"
29 "usage: bcache <command> [<args>]\n"
31 "Commands for formatting, startup and shutdown:\n"
32 " format Format a new filesystem\n"
33 " assemble Assemble an existing multi device filesystem\n"
34 " incremental Incrementally assemble an existing multi device filesystem\n"
35 " run Start a partially assembled filesystem\n"
36 " stop Stop a running filesystem\n"
38 "Commands for managing a running filesystem:\n"
39 " fs_show Show various information about a filesystem\n"
40 " fs_set Modify filesystem options\n"
42 "Commands for managing a specific device in a filesystem:\n"
43 " device_show Show information about a formatted device\n"
44 " device_add Add a device to an existing (running) filesystem\n"
45 " device_remove Remove a device from an existing (running) filesystem\n"
48 " bcache fsck Check an existing filesystem for errors\n");
51 int main(int argc, char *argv[])
55 setvbuf(stdout, NULL, _IOLBF, 0);
58 printf("%s: missing command\n", argv[0]);
65 memmove(&argv[1], &argv[2], argc * sizeof(argv[0]));
68 if (!strcmp(cmd, "format"))
69 return cmd_format(argc, argv);
70 if (!strcmp(cmd, "assemble"))
71 return cmd_assemble(argc, argv);
72 if (!strcmp(cmd, "incremental"))
73 return cmd_incremental(argc, argv);
74 if (!strcmp(cmd, "run"))
75 return cmd_run(argc, argv);
76 if (!strcmp(cmd, "stop"))
77 return cmd_stop(argc, argv);
79 if (!strcmp(cmd, "fs_show"))
80 return cmd_fs_show(argc, argv);
81 if (!strcmp(cmd, "fs_set"))
82 return cmd_fs_set(argc, argv);
84 if (!strcmp(cmd, "device_show"))
85 return cmd_device_show(argc, argv);
86 if (!strcmp(cmd, "device_add"))
87 return cmd_device_add(argc, argv);
88 if (!strcmp(cmd, "device_remove"))
89 return cmd_device_remove(argc, argv);
91 if (!strcmp(cmd, "fsck"))
92 return cmd_fsck(argc, argv);