/* * Authors: Kent Overstreet * Gabriel de Perthuis * Jacob Malevich * * GPLv2 */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "bcache.h" #include "bcache-assemble.h" #include "bcache-device.h" #include "bcache-format.h" #include "bcache-fs.h" #include "bcache-run.h" #define PACKAGE_NAME "bcache" #define PACKAGE_VERSION "1.0" #define PACKAGE_BUGREPORT "linux-bcache@vger.kernel.org" const char * const cache_state[] = { "active", "ro", "failed", "spare", NULL }; const char * const replacement_policies[] = { "lru", "fifo", "random", NULL }; const char * const csum_types[] = { "none", "crc32c", "crc64", NULL }; const char * const compression_types[] = { "none", "lz4", "gzip", NULL }; const char * const error_actions[] = { "continue", "readonly", "panic", NULL }; const char * const bdev_cache_mode[] = { "writethrough", "writeback", "writearound", "none", NULL }; const char * const bdev_state[] = { "detached", "clean", "dirty", "inconsistent", NULL }; #define CMD(_command, _usage, _synopsis) \ { \ .command = #_command, \ .usage = _usage, \ .synopsis = _synopsis, \ .help = NULL, \ .group = NULL, \ .options = opts_##_command, \ .action = cmd_##_command, \ } static NihCommand commands[] = { CMD(format, N_(""), "Create a new bcache volume from one or more devices"), /* Bringup, shutdown */ CMD(assemble, N_(""), "Assembles one or more devices into a bcache volume"), CMD(incremental, N_(""), "Start a partially assembled volume"), CMD(stop, N_(""), "Stops a running bcache volume"), /* Filesystem commands: */ CMD(fs_show, N_(""), "Show information about a filesystem"), CMD(fs_set, N_(""), "Change various filesystem options"), /* Device commands: */ CMD(device_show, N_(""), "Show information about component devices of a filesystem"), CMD(device_add, N_(" "), "Adds a list of devices to a volume"), CMD(device_remove, N_(" "), "Removes a device from its volume"), #if 0 CMD(modify, N_(""), "Modifies attributes related to the volume", N_("Modifies attributes related to the volume")), CMD(list, N_("list-cachesets"), "Lists cachesets in /sys/fs/bcache"), CMD(query, N_("query "), "Gives info about the superblock of a list of devices"), CMD(status, N_("status "), "Finds the status of the most up to date superblock"), #endif NIH_COMMAND_LAST }; static NihOption options[] = { NIH_OPTION_LAST }; int main(int argc, char *argv[]) { nih_main_init(argv[0]); nih_option_set_synopsis(_("Manage bcache devices")); nih_option_set_help( _("Helps you manage bcache devices")); int ret = nih_command_parser(NULL, argc, argv, options, commands); if (ret < 0) exit(EXIT_FAILURE); nih_signal_reset(); return 0; }