From fef3cb3f21cba9e88add8ffd1aad8d6691c77109 Mon Sep 17 00:00:00 2001 From: Alasdair G Kergon Date: Fri, 31 Jul 2015 16:26:38 +0100 Subject: [PATCH] dmsetup: Add _dmsetup to help and usage fns. Prepare for dmstats. Adjust some text to avoid 80-char wrap. --- tools/dmsetup.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/tools/dmsetup.c b/tools/dmsetup.c index 64812886a..b803e44d7 100644 --- a/tools/dmsetup.c +++ b/tools/dmsetup.c @@ -3052,17 +3052,18 @@ out: return r; } -static int _help(CMD_ARGS); +static int _dmsetup_help(CMD_ARGS); /* * Dispatch table */ static struct command _dmsetup_commands[] = { - {"help", "[-c|-C|--columns]", 0, 0, 0, _help}, - {"create", " [-j|--major -m|--minor ]\n" - "\t [-U|--uid ] [-G|--gid ] [-M|--mode ]\n" - "\t [-u|uuid ] [{--addnodeonresume|--addnodeoncreate}]\n" - "\t [--notable | --table | ]", + {"help", "[-c|-C|--columns]", 0, 0, 0, _dmsetup_help}, + {"create", "\n" + "\t [-j|--major -m|--minor ]\n" + "\t [-U|--uid ] [-G|--gid ] [-M|--mode ]\n" + "\t [-u|uuid ] [{--addnodeonresume|--addnodeoncreate}]\n" + "\t [--notable | --table
| ]", 1, 2,0, _create}, {"remove", "[-f|--force] [--deferred] ", 0, -1, 1, _remove}, {"remove_all", "[-f|--force]", 0, 0, 0, _remove_all}, @@ -3095,13 +3096,14 @@ static struct command _dmsetup_commands[] = { {NULL, NULL, 0, 0, 0, NULL} }; -static void _usage(FILE *out) +static void _dmsetup_usage(FILE *out) { int i; fprintf(out, "Usage:\n\n"); fprintf(out, "dmsetup [--version] [-h|--help [-c|-C|--columns]]\n" - " [--checks] [--manglename ] [-v|--verbose [-v|--verbose ...]]\n" + " [-v|--verbose [-v|--verbose ...]]\n" + " [--checks] [--manglename ]\n" " [-r|--readonly] [--noopencount] [--nolockfs] [--inactive]\n" " [--udevcookie [cookie]] [--noudevrules] [--noudevsync] [--verifyudev]\n" " [-y|--yes] [--readahead [+]|auto|none] [--retry]\n" @@ -3128,9 +3130,9 @@ static void _losetup_usage(FILE *out) "[-o offset] [-f|loop_device] [file]\n\n"); } -static int _help(CMD_ARGS) +static int _dmsetup_help(CMD_ARGS) { - _usage(stderr); + _dmsetup_usage(stderr); if (_switches[COLS_ARG]) { _switches[OPTIONS_ARG] = 1; @@ -3834,21 +3836,21 @@ int main(int argc, char **argv) } if (argc == 0) { - _usage(stderr); + _dmsetup_usage(stderr); goto out; } if (!(cmd = _find_dmsetup_command(argv[0]))) { unknown: fprintf(stderr, "Unknown command\n"); - _usage(stderr); + _dmsetup_usage(stderr); goto out; } if (argc < cmd->min_args + 1 || (cmd->max_args >= 0 && argc > cmd->max_args + 1)) { fprintf(stderr, "Incorrect number of arguments\n"); - _usage(stderr); + _dmsetup_usage(stderr); goto out; } -- 2.43.5