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>
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 " unlock Unlock an encrypted filesystem prior to running/mounting\n"
34 " assemble Assemble an existing multi device filesystem\n"
35 " incremental Incrementally assemble an existing multi device filesystem\n"
36 " run Start a partially assembled filesystem\n"
37 " stop Stop a running filesystem\n"
39 "Commands for managing a running filesystem\n"
40 " fs_show Show various information about a filesystem\n"
41 " fs_set Modify filesystem options\n"
43 "Commands for managing a specific device in a filesystem\n"
44 " device_show Show information about a formatted device\n"
45 " device_add Add a device to an existing (running) filesystem\n"
46 " device_remove Remove a device from an existing (running) filesystem\n");
50 int main(int argc, char *argv[])
55 printf("%s: missing command\n", argv[0]);
61 memmove(&argv[1], &argv[2], argc * sizeof(argv[0]));
64 if (!strcmp(cmd, "format"))
65 return cmd_format(argc, argv);
66 if (!strcmp(cmd, "assemble"))
67 return cmd_assemble(argc, argv);
68 if (!strcmp(cmd, "incremental"))
69 return cmd_incremental(argc, argv);
70 if (!strcmp(cmd, "run"))
71 return cmd_run(argc, argv);
72 if (!strcmp(cmd, "stop"))
73 return cmd_stop(argc, argv);
75 if (!strcmp(cmd, "fs_show"))
76 return cmd_fs_show(argc, argv);
77 if (!strcmp(cmd, "fs_set"))
78 return cmd_fs_set(argc, argv);
80 if (!strcmp(cmd, "device_show"))
81 return cmd_device_show(argc, argv);
82 if (!strcmp(cmd, "device_add"))
83 return cmd_device_add(argc, argv);
84 if (!strcmp(cmd, "device_remove"))
85 return cmd_device_remove(argc, argv);
87 if (!strcmp(cmd, "unlock"))
88 return cmd_unlock(argc, argv);