| File: | .build-ci/../src/nvme-cmds-deprecated.c |
| Warning: | line 307, column 12 Potential leak of memory pointed to by 'sub_argv' |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | // SPDX-License-Identifier: GPL-2.0-or-later | |||
| 2 | /* | |||
| 3 | * NVM-Express command line utility. | |||
| 4 | * | |||
| 5 | * Copyright (c) 2014-2015, Intel Corporation. | |||
| 6 | * | |||
| 7 | * Written by Keith Busch <kbusch@kernel.org> | |||
| 8 | */ | |||
| 9 | ||||
| 10 | /** | |||
| 11 | * This program uses NVMe IOCTLs to run native nvme commands to a device. | |||
| 12 | */ | |||
| 13 | #include <dirent.h> | |||
| 14 | #include <errno(*__errno_location ()).h> | |||
| 15 | #include <fcntl.h> | |||
| 16 | #include <getopt.h> | |||
| 17 | #include <inttypes.h> | |||
| 18 | #include <libgen.h> | |||
| 19 | #include <locale.h> | |||
| 20 | #include <math.h> | |||
| 21 | #include <signal.h> | |||
| 22 | #include <stdint.h> | |||
| 23 | #include <stdio.h> | |||
| 24 | #include <stdlib.h> | |||
| 25 | #include <string.h> | |||
| 26 | #include <unistd.h> | |||
| 27 | ||||
| 28 | #ifdef NVME_HAVE_MMAP | |||
| 29 | #include <sys/mman.h> | |||
| 30 | #endif | |||
| 31 | #include <sys/stat.h> | |||
| 32 | #include <sys/types.h> | |||
| 33 | ||||
| 34 | #include <libnvme-mi.h> | |||
| 35 | #include <libnvme.h> | |||
| 36 | ||||
| 37 | #include <ccan/array_size/array_size.h> | |||
| 38 | #include <ccan/endian/endian.h> | |||
| 39 | #include <ccan/minmax/minmax.h> | |||
| 40 | #include <shared/compiler-attributes-util.h> | |||
| 41 | #include <shared/fs-util.h> | |||
| 42 | #include <shared/mmio-util.h> | |||
| 43 | #include <shared/parse-util.h> | |||
| 44 | #include <shared/sig-util.h> | |||
| 45 | #include <shared/suffix-util.h> | |||
| 46 | #include <shared/time-util.h> | |||
| 47 | ||||
| 48 | #include "argconfig.h" | |||
| 49 | #include "cleanup.h" | |||
| 50 | #include "nvme-print.h" | |||
| 51 | #include "plugin.h" | |||
| 52 | ||||
| 53 | #ifdef CONFIG_DEPRECATED_CMDS | |||
| 54 | ||||
| 55 | #ifdef CONFIG_FABRICS | |||
| 56 | static struct plugin *find_keys_plugin(void) | |||
| 57 | { | |||
| 58 | struct plugin *keys = builtin.next; | |||
| 59 | ||||
| 60 | while (keys && (!keys->name || strcmp(keys->name, "keys"))) | |||
| 61 | keys = keys->next; | |||
| 62 | ||||
| 63 | return keys; | |||
| 64 | } | |||
| 65 | ||||
| 66 | static int forward_to_keys_plugin(const char *old_name, const char *subcmd, | |||
| 67 | int argc, char **argv) | |||
| 68 | { | |||
| 69 | struct plugin *keys = find_keys_plugin(); | |||
| 70 | __cleanup_free__attribute__((cleanup(shr_freep))) char **sub_argv = NULL((void*)0); | |||
| 71 | ||||
| 72 | if (!keys) { | |||
| 73 | fprintf(stderrstderr, "ERROR: '%s' is deprecated and requires the 'keys' plugin, which is not available in this build; use 'nvme keys %s'\n", | |||
| 74 | old_name, subcmd); | |||
| 75 | return -ENOTTY25; | |||
| 76 | } | |||
| 77 | ||||
| 78 | fprintf(stderrstderr, "WARNING: '%s' is deprecated and will be removed in the next major version, use 'nvme keys %s' instead\n", | |||
| 79 | old_name, subcmd); | |||
| 80 | ||||
| 81 | /* | |||
| 82 | * handle_plugin() expects argv[0] to be a throwaway name (its own | |||
| 83 | * global-option parsing skips it like a program name) and argv[1] | |||
| 84 | * to be the subcommand it dispatches on, so forwarding into the | |||
| 85 | * 'keys' plugin needs both slots, not just a renamed argv[0]. | |||
| 86 | */ | |||
| 87 | sub_argv = calloc(argc + 1, sizeof(*sub_argv)); | |||
| 88 | if (!sub_argv) | |||
| 89 | return -ENOMEM12; | |||
| 90 | ||||
| 91 | sub_argv[0] = (char *)keys->name; | |||
| 92 | sub_argv[1] = (char *)subcmd; | |||
| 93 | memcpy(&sub_argv[2], &argv[1], (argc - 1) * sizeof(*argv)); | |||
| 94 | ||||
| 95 | return handle_plugin(argc + 1, sub_argv, keys); | |||
| 96 | } | |||
| 97 | ||||
| 98 | /* | |||
| 99 | * gen-kxchap-secret dropped --nqn with the transform that used it. Take | |||
| 100 | * it here anyway, warn, and drop it, so a 2.x command line still works. | |||
| 101 | */ | |||
| 102 | static int gen_dhchap_key(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 103 | { | |||
| 104 | const char *desc = | |||
| 105 | "Generate a KX-HMAC-CHAP secret in the DHHC-1 representation, usable for\n" | |||
| 106 | "NVMe In-Band Authentication.\n" | |||
| 107 | "Deprecated; use 'nvme keys gen-kxchap-secret' instead."; | |||
| 108 | const char *secret = | |||
| 109 | "Optional secret (in hexadecimal characters) to be placed in the representation."; | |||
| 110 | const char *key_len = "Length of the secret (32, 48, or 64 bytes)."; | |||
| 111 | const char *hmac = | |||
| 112 | "Hash function the consumer is to apply to the secret (0 = none, 1 = SHA-256, 2 = SHA-384, 3 = SHA-512)."; | |||
| 113 | const char *nqn = | |||
| 114 | "Accepted and ignored; nvme-cli 2.x keyed the transform with it."; | |||
| 115 | ||||
| 116 | char key_len_buf[16], hmac_buf[16]; | |||
| 117 | char *args[8] = { argv[0] }; | |||
| 118 | int nargs = 1, err; | |||
| 119 | ||||
| 120 | struct config { | |||
| 121 | char *secret; | |||
| 122 | unsigned int key_len; | |||
| 123 | char *nqn; | |||
| 124 | unsigned int hmac; | |||
| 125 | }; | |||
| 126 | ||||
| 127 | struct config cfg = { | |||
| 128 | .secret = NULL((void*)0), | |||
| 129 | .key_len = 0, | |||
| 130 | .nqn = NULL((void*)0), | |||
| 131 | .hmac = 0, | |||
| 132 | }; | |||
| 133 | ||||
| 134 | NVME_ARGS(opts,nvme_args.supported_output_formats = (NORMAL | JSON | BINARY) ; struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"secret", 's', "STRING", CFG_STRING, &cfg.secret, 1, secret, 0, }, {"key-length", 'l', "NUM", CFG_POSITIVE, & cfg.key_len, 1, key_len, 0, }, {"nqn", 'n', "STRING", CFG_STRING , &cfg.nqn, 1, nqn, 0, }, {"hmac", 'm', "NUM", CFG_POSITIVE , &cfg.hmac, 1, hmac, 0, }, {"", 0, ((void*)0), CFG_GROUP_SEPARATOR , ((void*)0), 0, "Global options", 0, ((void*)0)}, {"verbose" , 'v', "NUM", CFG_INCREMENT, &nvme_args.verbose, 0, "Increase output verbosity" , 0, }, {"quiet", 0, ((void*)0), CFG_FLAG, &nvme_args.quiet , 0, "suppress informational output", 0, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary" , 0, }, {"timeout", 0, "NUM", CFG_POSITIVE, &nvme_args.timeout , 1, "timeout value, in milliseconds", 0, }, {"dry-run", 0, ( (void*)0), CFG_FLAG, &nvme_args.dry_run, 0, "show command instead of executing" , 0, }, {"no-retries", 0, ((void*)0), CFG_FLAG, &nvme_args .no_retries, 0, "disable retry logic on errors", 0, }, {"no-ioctl-probing" , 0, ((void*)0), CFG_FLAG, &nvme_args.no_ioctl_probing, 0 , "disable 64-bit IOCTL support probing", 0, }, {"output-format-version" , 0, "NUM", CFG_POSITIVE, &nvme_args.output_format_ver, 1 , "output format version: 1|2", 0, }, {"human-readable", 'H', ((void*)0), CFG_FLAG, &nvme_args.verbose, 0, ((void*)0), 0, ((void*)0), 1}, {"set-options", 0, "KEY=VALUE", CFG_STRING , &nvme_args.set_options, 1, "set a libnvme library option (key=value[,key=value,...]);" , 0, }, { ((void*)0) } } | |||
| 135 | OPT_STR("secret", 's', &cfg.secret, secret),nvme_args.supported_output_formats = (NORMAL | JSON | BINARY) ; struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"secret", 's', "STRING", CFG_STRING, &cfg.secret, 1, secret, 0, }, {"key-length", 'l', "NUM", CFG_POSITIVE, & cfg.key_len, 1, key_len, 0, }, {"nqn", 'n', "STRING", CFG_STRING , &cfg.nqn, 1, nqn, 0, }, {"hmac", 'm', "NUM", CFG_POSITIVE , &cfg.hmac, 1, hmac, 0, }, {"", 0, ((void*)0), CFG_GROUP_SEPARATOR , ((void*)0), 0, "Global options", 0, ((void*)0)}, {"verbose" , 'v', "NUM", CFG_INCREMENT, &nvme_args.verbose, 0, "Increase output verbosity" , 0, }, {"quiet", 0, ((void*)0), CFG_FLAG, &nvme_args.quiet , 0, "suppress informational output", 0, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary" , 0, }, {"timeout", 0, "NUM", CFG_POSITIVE, &nvme_args.timeout , 1, "timeout value, in milliseconds", 0, }, {"dry-run", 0, ( (void*)0), CFG_FLAG, &nvme_args.dry_run, 0, "show command instead of executing" , 0, }, {"no-retries", 0, ((void*)0), CFG_FLAG, &nvme_args .no_retries, 0, "disable retry logic on errors", 0, }, {"no-ioctl-probing" , 0, ((void*)0), CFG_FLAG, &nvme_args.no_ioctl_probing, 0 , "disable 64-bit IOCTL support probing", 0, }, {"output-format-version" , 0, "NUM", CFG_POSITIVE, &nvme_args.output_format_ver, 1 , "output format version: 1|2", 0, }, {"human-readable", 'H', ((void*)0), CFG_FLAG, &nvme_args.verbose, 0, ((void*)0), 0, ((void*)0), 1}, {"set-options", 0, "KEY=VALUE", CFG_STRING , &nvme_args.set_options, 1, "set a libnvme library option (key=value[,key=value,...]);" , 0, }, { ((void*)0) } } | |||
| 136 | OPT_UINT("key-length", 'l', &cfg.key_len, key_len),nvme_args.supported_output_formats = (NORMAL | JSON | BINARY) ; struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"secret", 's', "STRING", CFG_STRING, &cfg.secret, 1, secret, 0, }, {"key-length", 'l', "NUM", CFG_POSITIVE, & cfg.key_len, 1, key_len, 0, }, {"nqn", 'n', "STRING", CFG_STRING , &cfg.nqn, 1, nqn, 0, }, {"hmac", 'm', "NUM", CFG_POSITIVE , &cfg.hmac, 1, hmac, 0, }, {"", 0, ((void*)0), CFG_GROUP_SEPARATOR , ((void*)0), 0, "Global options", 0, ((void*)0)}, {"verbose" , 'v', "NUM", CFG_INCREMENT, &nvme_args.verbose, 0, "Increase output verbosity" , 0, }, {"quiet", 0, ((void*)0), CFG_FLAG, &nvme_args.quiet , 0, "suppress informational output", 0, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary" , 0, }, {"timeout", 0, "NUM", CFG_POSITIVE, &nvme_args.timeout , 1, "timeout value, in milliseconds", 0, }, {"dry-run", 0, ( (void*)0), CFG_FLAG, &nvme_args.dry_run, 0, "show command instead of executing" , 0, }, {"no-retries", 0, ((void*)0), CFG_FLAG, &nvme_args .no_retries, 0, "disable retry logic on errors", 0, }, {"no-ioctl-probing" , 0, ((void*)0), CFG_FLAG, &nvme_args.no_ioctl_probing, 0 , "disable 64-bit IOCTL support probing", 0, }, {"output-format-version" , 0, "NUM", CFG_POSITIVE, &nvme_args.output_format_ver, 1 , "output format version: 1|2", 0, }, {"human-readable", 'H', ((void*)0), CFG_FLAG, &nvme_args.verbose, 0, ((void*)0), 0, ((void*)0), 1}, {"set-options", 0, "KEY=VALUE", CFG_STRING , &nvme_args.set_options, 1, "set a libnvme library option (key=value[,key=value,...]);" , 0, }, { ((void*)0) } } | |||
| 137 | OPT_STR("nqn", 'n', &cfg.nqn, nqn),nvme_args.supported_output_formats = (NORMAL | JSON | BINARY) ; struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"secret", 's', "STRING", CFG_STRING, &cfg.secret, 1, secret, 0, }, {"key-length", 'l', "NUM", CFG_POSITIVE, & cfg.key_len, 1, key_len, 0, }, {"nqn", 'n', "STRING", CFG_STRING , &cfg.nqn, 1, nqn, 0, }, {"hmac", 'm', "NUM", CFG_POSITIVE , &cfg.hmac, 1, hmac, 0, }, {"", 0, ((void*)0), CFG_GROUP_SEPARATOR , ((void*)0), 0, "Global options", 0, ((void*)0)}, {"verbose" , 'v', "NUM", CFG_INCREMENT, &nvme_args.verbose, 0, "Increase output verbosity" , 0, }, {"quiet", 0, ((void*)0), CFG_FLAG, &nvme_args.quiet , 0, "suppress informational output", 0, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary" , 0, }, {"timeout", 0, "NUM", CFG_POSITIVE, &nvme_args.timeout , 1, "timeout value, in milliseconds", 0, }, {"dry-run", 0, ( (void*)0), CFG_FLAG, &nvme_args.dry_run, 0, "show command instead of executing" , 0, }, {"no-retries", 0, ((void*)0), CFG_FLAG, &nvme_args .no_retries, 0, "disable retry logic on errors", 0, }, {"no-ioctl-probing" , 0, ((void*)0), CFG_FLAG, &nvme_args.no_ioctl_probing, 0 , "disable 64-bit IOCTL support probing", 0, }, {"output-format-version" , 0, "NUM", CFG_POSITIVE, &nvme_args.output_format_ver, 1 , "output format version: 1|2", 0, }, {"human-readable", 'H', ((void*)0), CFG_FLAG, &nvme_args.verbose, 0, ((void*)0), 0, ((void*)0), 1}, {"set-options", 0, "KEY=VALUE", CFG_STRING , &nvme_args.set_options, 1, "set a libnvme library option (key=value[,key=value,...]);" , 0, }, { ((void*)0) } } | |||
| 138 | OPT_UINT("hmac", 'm', &cfg.hmac, hmac))nvme_args.supported_output_formats = (NORMAL | JSON | BINARY) ; struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"secret", 's', "STRING", CFG_STRING, &cfg.secret, 1, secret, 0, }, {"key-length", 'l', "NUM", CFG_POSITIVE, & cfg.key_len, 1, key_len, 0, }, {"nqn", 'n', "STRING", CFG_STRING , &cfg.nqn, 1, nqn, 0, }, {"hmac", 'm', "NUM", CFG_POSITIVE , &cfg.hmac, 1, hmac, 0, }, {"", 0, ((void*)0), CFG_GROUP_SEPARATOR , ((void*)0), 0, "Global options", 0, ((void*)0)}, {"verbose" , 'v', "NUM", CFG_INCREMENT, &nvme_args.verbose, 0, "Increase output verbosity" , 0, }, {"quiet", 0, ((void*)0), CFG_FLAG, &nvme_args.quiet , 0, "suppress informational output", 0, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary" , 0, }, {"timeout", 0, "NUM", CFG_POSITIVE, &nvme_args.timeout , 1, "timeout value, in milliseconds", 0, }, {"dry-run", 0, ( (void*)0), CFG_FLAG, &nvme_args.dry_run, 0, "show command instead of executing" , 0, }, {"no-retries", 0, ((void*)0), CFG_FLAG, &nvme_args .no_retries, 0, "disable retry logic on errors", 0, }, {"no-ioctl-probing" , 0, ((void*)0), CFG_FLAG, &nvme_args.no_ioctl_probing, 0 , "disable 64-bit IOCTL support probing", 0, }, {"output-format-version" , 0, "NUM", CFG_POSITIVE, &nvme_args.output_format_ver, 1 , "output format version: 1|2", 0, }, {"human-readable", 'H', ((void*)0), CFG_FLAG, &nvme_args.verbose, 0, ((void*)0), 0, ((void*)0), 1}, {"set-options", 0, "KEY=VALUE", CFG_STRING , &nvme_args.set_options, 1, "set a libnvme library option (key=value[,key=value,...]);" , 0, }, { ((void*)0) } }; | |||
| 139 | ||||
| 140 | err = argconfig_parse(argc, argv, desc, opts); | |||
| 141 | if (err) | |||
| 142 | return err; | |||
| 143 | ||||
| 144 | if (argconfig_parse_seen(opts, "nqn")) | |||
| 145 | fprintf(stderrstderr, | |||
| 146 | "WARNING: '--nqn' is ignored, the DHHC-1 string carries the secret itself, which no NQN takes part in deriving\n"); | |||
| 147 | ||||
| 148 | if (argconfig_parse_seen(opts, "secret")) { | |||
| 149 | args[nargs++] = "--secret"; | |||
| 150 | args[nargs++] = cfg.secret; | |||
| 151 | } | |||
| 152 | if (argconfig_parse_seen(opts, "key-length")) { | |||
| 153 | snprintf(key_len_buf, sizeof(key_len_buf), "%u", cfg.key_len); | |||
| 154 | args[nargs++] = "--secret-length"; | |||
| 155 | args[nargs++] = key_len_buf; | |||
| 156 | } | |||
| 157 | if (argconfig_parse_seen(opts, "hmac")) { | |||
| 158 | snprintf(hmac_buf, sizeof(hmac_buf), "%u", cfg.hmac); | |||
| 159 | args[nargs++] = "--hmac"; | |||
| 160 | args[nargs++] = hmac_buf; | |||
| 161 | } | |||
| 162 | ||||
| 163 | return forward_to_keys_plugin("gen-dhchap-key", "gen-kxchap-secret", nargs, args); | |||
| 164 | } | |||
| 165 | ||||
| 166 | /* | |||
| 167 | * 2.x took the secret in --key/-k, which the command this forwards to | |||
| 168 | * gives to --keyring. Take the 2.x option here and pass it as --keydata. | |||
| 169 | */ | |||
| 170 | static int check_dhchap_key(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 171 | { | |||
| 172 | const char *desc = | |||
| 173 | "Check a KX-HMAC-CHAP host secret for usability for NVMe In-Band Authentication.\n" | |||
| 174 | "Deprecated; use 'nvme keys check-kxchap-secret' instead."; | |||
| 175 | const char *key = | |||
| 176 | "KX-HMAC-CHAP secret (in DHHC-1 interchange format) to be validated. Reads from stdin if not given."; | |||
| 177 | ||||
| 178 | char *args[4] = { argv[0] }; | |||
| 179 | int nargs = 1, err; | |||
| 180 | ||||
| 181 | struct config { | |||
| 182 | char *key; | |||
| 183 | }; | |||
| 184 | ||||
| 185 | struct config cfg = { | |||
| 186 | .key = NULL((void*)0), | |||
| 187 | }; | |||
| 188 | ||||
| 189 | NVME_ARGS(opts,nvme_args.supported_output_formats = (NORMAL | JSON | BINARY) ; struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"key", 'k', "STRING", CFG_STRING, &cfg.key, 1, key , 0, }, {"", 0, ((void*)0), CFG_GROUP_SEPARATOR, ((void*)0), 0 , "Global options", 0, ((void*)0)}, {"verbose", 'v', "NUM", CFG_INCREMENT , &nvme_args.verbose, 0, "Increase output verbosity", 0, } , {"quiet", 0, ((void*)0), CFG_FLAG, &nvme_args.quiet, 0, "suppress informational output", 0, }, {"output-format", 'o' , "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary" , 0, }, {"timeout", 0, "NUM", CFG_POSITIVE, &nvme_args.timeout , 1, "timeout value, in milliseconds", 0, }, {"dry-run", 0, ( (void*)0), CFG_FLAG, &nvme_args.dry_run, 0, "show command instead of executing" , 0, }, {"no-retries", 0, ((void*)0), CFG_FLAG, &nvme_args .no_retries, 0, "disable retry logic on errors", 0, }, {"no-ioctl-probing" , 0, ((void*)0), CFG_FLAG, &nvme_args.no_ioctl_probing, 0 , "disable 64-bit IOCTL support probing", 0, }, {"output-format-version" , 0, "NUM", CFG_POSITIVE, &nvme_args.output_format_ver, 1 , "output format version: 1|2", 0, }, {"human-readable", 'H', ((void*)0), CFG_FLAG, &nvme_args.verbose, 0, ((void*)0), 0, ((void*)0), 1}, {"set-options", 0, "KEY=VALUE", CFG_STRING , &nvme_args.set_options, 1, "set a libnvme library option (key=value[,key=value,...]);" , 0, }, { ((void*)0) } } | |||
| 190 | OPT_STR("key", 'k', &cfg.key, key))nvme_args.supported_output_formats = (NORMAL | JSON | BINARY) ; struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"key", 'k', "STRING", CFG_STRING, &cfg.key, 1, key , 0, }, {"", 0, ((void*)0), CFG_GROUP_SEPARATOR, ((void*)0), 0 , "Global options", 0, ((void*)0)}, {"verbose", 'v', "NUM", CFG_INCREMENT , &nvme_args.verbose, 0, "Increase output verbosity", 0, } , {"quiet", 0, ((void*)0), CFG_FLAG, &nvme_args.quiet, 0, "suppress informational output", 0, }, {"output-format", 'o' , "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary" , 0, }, {"timeout", 0, "NUM", CFG_POSITIVE, &nvme_args.timeout , 1, "timeout value, in milliseconds", 0, }, {"dry-run", 0, ( (void*)0), CFG_FLAG, &nvme_args.dry_run, 0, "show command instead of executing" , 0, }, {"no-retries", 0, ((void*)0), CFG_FLAG, &nvme_args .no_retries, 0, "disable retry logic on errors", 0, }, {"no-ioctl-probing" , 0, ((void*)0), CFG_FLAG, &nvme_args.no_ioctl_probing, 0 , "disable 64-bit IOCTL support probing", 0, }, {"output-format-version" , 0, "NUM", CFG_POSITIVE, &nvme_args.output_format_ver, 1 , "output format version: 1|2", 0, }, {"human-readable", 'H', ((void*)0), CFG_FLAG, &nvme_args.verbose, 0, ((void*)0), 0, ((void*)0), 1}, {"set-options", 0, "KEY=VALUE", CFG_STRING , &nvme_args.set_options, 1, "set a libnvme library option (key=value[,key=value,...]);" , 0, }, { ((void*)0) } }; | |||
| 191 | ||||
| 192 | err = argconfig_parse(argc, argv, desc, opts); | |||
| 193 | if (err) | |||
| 194 | return err; | |||
| 195 | ||||
| 196 | if (argconfig_parse_seen(opts, "key")) { | |||
| 197 | args[nargs++] = "--keydata"; | |||
| 198 | args[nargs++] = cfg.key; | |||
| 199 | } | |||
| 200 | ||||
| 201 | return forward_to_keys_plugin("check-dhchap-key", "check-kxchap-secret", nargs, args); | |||
| 202 | } | |||
| 203 | ||||
| 204 | static int gen_tls_key(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 205 | { | |||
| 206 | return forward_to_keys_plugin("gen-tls-key", "gen-tls-psk", argc, argv); | |||
| 207 | } | |||
| 208 | ||||
| 209 | static int check_tls_key(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 210 | { | |||
| 211 | return forward_to_keys_plugin("check-tls-key", "check-tls-psk", argc, argv); | |||
| 212 | } | |||
| 213 | ||||
| 214 | /* | |||
| 215 | * The old 'tls-key' command bundled import/export/revoke behind | |||
| 216 | * -i/-e/-r mode flags sharing -k/-t/-f; the 'keys' plugin split these | |||
| 217 | * into separate subcommands with their own option sets, so unlike the | |||
| 218 | * other legacy aliases this one has to translate argv instead of just | |||
| 219 | * renaming argv[0]. | |||
| 220 | */ | |||
| 221 | static int tls_key(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 222 | { | |||
| 223 | static const struct option opts[] = { | |||
| 224 | { "keyring", required_argument1, NULL((void*)0), 'k' }, | |||
| 225 | { "keytype", required_argument1, NULL((void*)0), 't' }, | |||
| 226 | { "keyfile", required_argument1, NULL((void*)0), 'f' }, | |||
| 227 | { "import", no_argument0, NULL((void*)0), 'i' }, | |||
| 228 | { "export", no_argument0, NULL((void*)0), 'e' }, | |||
| 229 | { "revoke", required_argument1, NULL((void*)0), 'r' }, | |||
| 230 | { NULL((void*)0), 0, NULL((void*)0), 0 }, | |||
| 231 | }; | |||
| 232 | __cleanup_free__attribute__((cleanup(shr_freep))) char *keyring_opt = NULL((void*)0); | |||
| 233 | __cleanup_free__attribute__((cleanup(shr_freep))) char *keytype_opt = NULL((void*)0); | |||
| 234 | __cleanup_free__attribute__((cleanup(shr_freep))) char *keyfile_opt = NULL((void*)0); | |||
| 235 | __cleanup_free__attribute__((cleanup(shr_freep))) char *identity_opt = NULL((void*)0); | |||
| 236 | __cleanup_free__attribute__((cleanup(shr_freep))) char **sub_argv = NULL((void*)0); | |||
| 237 | const char *keyring = NULL((void*)0), *keytype = NULL((void*)0), *keyfile = NULL((void*)0), *revoke = NULL((void*)0); | |||
| 238 | const char *subcmd = NULL((void*)0); | |||
| 239 | struct plugin *keys; | |||
| 240 | int nsub = 0, c; | |||
| 241 | ||||
| 242 | optind = 1; | |||
| 243 | while ((c = getopt_long(argc, argv, "k:t:f:ier:", opts, NULL((void*)0))) != -1) { | |||
| ||||
| 244 | switch (c) { | |||
| 245 | case 'k': | |||
| 246 | keyring = optarg; | |||
| 247 | break; | |||
| 248 | case 't': | |||
| 249 | keytype = optarg; | |||
| 250 | break; | |||
| 251 | case 'f': | |||
| 252 | keyfile = optarg; | |||
| 253 | break; | |||
| 254 | case 'i': | |||
| 255 | case 'e': | |||
| 256 | if (subcmd) { | |||
| 257 | fprintf(stderrstderr, "ERROR: only one of --import, --export, or --revoke may be given\n"); | |||
| 258 | return -EINVAL22; | |||
| 259 | } | |||
| 260 | subcmd = c == 'i' ? "import" : "export"; | |||
| 261 | break; | |||
| 262 | case 'r': | |||
| 263 | if (subcmd
| |||
| 264 | fprintf(stderrstderr, "ERROR: only one of --import, --export, or --revoke may be given\n"); | |||
| 265 | return -EINVAL22; | |||
| 266 | } | |||
| 267 | subcmd = "revoke"; | |||
| 268 | revoke = optarg; | |||
| 269 | break; | |||
| 270 | default: | |||
| 271 | return -EINVAL22; | |||
| 272 | } | |||
| 273 | } | |||
| 274 | ||||
| 275 | if (!subcmd
| |||
| 276 | fprintf(stderrstderr, "ERROR: 'tls-key' requires one of --import, --export, or --revoke\n"); | |||
| 277 | return -EINVAL22; | |||
| 278 | } | |||
| 279 | ||||
| 280 | keys = find_keys_plugin(); | |||
| 281 | if (!keys) { | |||
| 282 | fprintf(stderrstderr, "ERROR: 'tls-key' is deprecated and requires the 'keys' plugin, which is not available in this build; use 'nvme keys %s'\n", | |||
| 283 | subcmd); | |||
| 284 | return -ENOTTY25; | |||
| 285 | } | |||
| 286 | ||||
| 287 | sub_argv = calloc(6, sizeof(*sub_argv)); | |||
| 288 | if (!sub_argv) | |||
| 289 | return -ENOMEM12; | |||
| 290 | ||||
| 291 | sub_argv[nsub++] = (char *)keys->name; | |||
| 292 | sub_argv[nsub++] = (char *)subcmd; | |||
| 293 | ||||
| 294 | if (keyring
| |||
| 295 | if (asprintf(&keyring_opt, "--keyring=%s", keyring) < 0) | |||
| 296 | return -ENOMEM12; | |||
| 297 | sub_argv[nsub++] = keyring_opt; | |||
| 298 | } | |||
| 299 | ||||
| 300 | if (!strcmp(subcmd, "revoke")) { | |||
| 301 | if (keytype
| |||
| 302 | if (asprintf(&keytype_opt, "--keytype=%s", keytype) < 0) | |||
| 303 | return -ENOMEM12; | |||
| 304 | sub_argv[nsub++] = keytype_opt; | |||
| 305 | } | |||
| 306 | if (asprintf(&identity_opt, "--identity=%s", revoke) < 0) | |||
| 307 | return -ENOMEM12; | |||
| ||||
| 308 | sub_argv[nsub++] = identity_opt; | |||
| 309 | } else if (keyfile) { | |||
| 310 | if (asprintf(&keyfile_opt, "--keyfile=%s", keyfile) < 0) | |||
| 311 | return -ENOMEM12; | |||
| 312 | sub_argv[nsub++] = keyfile_opt; | |||
| 313 | } | |||
| 314 | ||||
| 315 | fprintf(stderrstderr, "WARNING: 'tls-key' is deprecated and will be removed in the next major version, use 'nvme keys %s' instead\n", | |||
| 316 | subcmd); | |||
| 317 | ||||
| 318 | return handle_plugin(nsub, sub_argv, keys); | |||
| 319 | } | |||
| 320 | #endif /* CONFIG_FABRICS */ | |||
| 321 | ||||
| 322 | static struct plugin *find_log_plugin(void) | |||
| 323 | { | |||
| 324 | struct plugin *log = builtin.next; | |||
| 325 | ||||
| 326 | while (log && (!log->name || strcmp(log->name, "log"))) | |||
| 327 | log = log->next; | |||
| 328 | ||||
| 329 | return log; | |||
| 330 | } | |||
| 331 | ||||
| 332 | static int forward_to_log_plugin(const char *old_name, const char *subcmd, | |||
| 333 | int argc, char **argv) | |||
| 334 | { | |||
| 335 | struct plugin *log = find_log_plugin(); | |||
| 336 | __cleanup_free__attribute__((cleanup(shr_freep))) char **sub_argv = NULL((void*)0); | |||
| 337 | ||||
| 338 | if (!log) { | |||
| 339 | fprintf(stderrstderr, "ERROR: '%s' is deprecated and requires the 'log' plugin, which is not available in this build; use 'nvme log %s'\n", | |||
| 340 | old_name, subcmd); | |||
| 341 | return -ENOTTY25; | |||
| 342 | } | |||
| 343 | ||||
| 344 | fprintf(stderrstderr, "WARNING: '%s' is deprecated and will be removed in the next major version, use 'nvme log %s' instead\n", | |||
| 345 | old_name, subcmd); | |||
| 346 | ||||
| 347 | sub_argv = calloc(argc + 1, sizeof(*sub_argv)); | |||
| 348 | if (!sub_argv) | |||
| 349 | return -ENOMEM12; | |||
| 350 | ||||
| 351 | sub_argv[0] = (char *)log->name; | |||
| 352 | sub_argv[1] = (char *)subcmd; | |||
| 353 | memcpy(&sub_argv[2], &argv[1], (argc - 1) * sizeof(*argv)); | |||
| 354 | ||||
| 355 | return handle_plugin(argc + 1, sub_argv, log); | |||
| 356 | } | |||
| 357 | ||||
| 358 | static int get_supported_log_pages(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 359 | { | |||
| 360 | return forward_to_log_plugin("supported-log-pages", "supported-pages", argc, argv); | |||
| 361 | } | |||
| 362 | ||||
| 363 | static int get_telemetry_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 364 | { | |||
| 365 | return forward_to_log_plugin("telemetry-log", "telemetry", argc, argv); | |||
| 366 | } | |||
| 367 | ||||
| 368 | static int get_fw_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 369 | { | |||
| 370 | return forward_to_log_plugin("fw-log", "fw", argc, argv); | |||
| 371 | } | |||
| 372 | ||||
| 373 | static int get_changed_attach_ns_list_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 374 | { | |||
| 375 | return forward_to_log_plugin("changed-ns-list-log", "changed-ns-list", argc, argv); | |||
| 376 | } | |||
| 377 | ||||
| 378 | static int get_smart_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 379 | { | |||
| 380 | return forward_to_log_plugin("smart-log", "smart", argc, argv); | |||
| 381 | } | |||
| 382 | ||||
| 383 | static int get_ana_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 384 | { | |||
| 385 | return forward_to_log_plugin("ana-log", "ana", argc, argv); | |||
| 386 | } | |||
| 387 | ||||
| 388 | static int get_error_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 389 | { | |||
| 390 | return forward_to_log_plugin("error-log", "error", argc, argv); | |||
| 391 | } | |||
| 392 | ||||
| 393 | static int get_effects_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 394 | { | |||
| 395 | return forward_to_log_plugin("effects-log", "effects", argc, argv); | |||
| 396 | } | |||
| 397 | ||||
| 398 | static int get_endurance_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 399 | { | |||
| 400 | return forward_to_log_plugin("endurance-log", "endurance", argc, argv); | |||
| 401 | } | |||
| 402 | ||||
| 403 | static int get_pred_lat_per_nvmset_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 404 | { | |||
| 405 | return forward_to_log_plugin("predictable-lat-log", "predictable-lat", argc, argv); | |||
| 406 | } | |||
| 407 | ||||
| 408 | static int get_pred_lat_event_agg_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 409 | { | |||
| 410 | return forward_to_log_plugin("pred-lat-event-agg-log", "pred-lat-event-agg", argc, argv); | |||
| 411 | } | |||
| 412 | ||||
| 413 | static int get_persistent_event_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 414 | { | |||
| 415 | return forward_to_log_plugin("persistent-event-log", "persistent-event", argc, argv); | |||
| 416 | } | |||
| 417 | ||||
| 418 | static int get_endurance_event_agg_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 419 | { | |||
| 420 | return forward_to_log_plugin("endurance-event-agg-log", "endurance-event-agg", argc, argv); | |||
| 421 | } | |||
| 422 | ||||
| 423 | static int get_lba_status_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 424 | { | |||
| 425 | return forward_to_log_plugin("lba-status-log", "lba-status", argc, argv); | |||
| 426 | } | |||
| 427 | ||||
| 428 | static int get_resv_notif_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 429 | { | |||
| 430 | return forward_to_log_plugin("resv-notif-log", "resv-notif", argc, argv); | |||
| 431 | } | |||
| 432 | ||||
| 433 | static int get_boot_part_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 434 | { | |||
| 435 | return forward_to_log_plugin("boot-part-log", "boot-part", argc, argv); | |||
| 436 | } | |||
| 437 | ||||
| 438 | static int get_phy_rx_eom_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 439 | { | |||
| 440 | return forward_to_log_plugin("phy-rx-eom-log", "phy-rx-eom", argc, argv); | |||
| 441 | } | |||
| 442 | ||||
| 443 | static int self_test_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 444 | { | |||
| 445 | return forward_to_log_plugin("self-test-log", "self-test", argc, argv); | |||
| 446 | } | |||
| 447 | ||||
| 448 | static int get_fid_support_effects_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 449 | { | |||
| 450 | return forward_to_log_plugin("fid-support-effects-log", "fid-support-effects", argc, argv); | |||
| 451 | } | |||
| 452 | ||||
| 453 | static int get_mi_cmd_support_effects_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 454 | { | |||
| 455 | return forward_to_log_plugin("mi-cmd-support-effects-log", "mi-cmd-support-effects", argc, argv); | |||
| 456 | } | |||
| 457 | ||||
| 458 | static int get_media_unit_stat_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 459 | { | |||
| 460 | return forward_to_log_plugin("media-unit-stat-log", "media-unit-stat", argc, argv); | |||
| 461 | } | |||
| 462 | ||||
| 463 | static int get_supp_cap_config_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 464 | { | |||
| 465 | return forward_to_log_plugin("supported-cap-config-log", "supported-cap-config", argc, argv); | |||
| 466 | } | |||
| 467 | ||||
| 468 | static int get_mgmt_addr_list_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 469 | { | |||
| 470 | return forward_to_log_plugin("mgmt-addr-list-log", "mgmt-addr-list", argc, argv); | |||
| 471 | } | |||
| 472 | ||||
| 473 | static int get_rotational_media_info_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 474 | { | |||
| 475 | return forward_to_log_plugin("rotational-media-info-log", "rotational-media-info", argc, argv); | |||
| 476 | } | |||
| 477 | ||||
| 478 | static int get_changed_alloc_ns_list_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 479 | { | |||
| 480 | return forward_to_log_plugin("changed-alloc-ns-list-log", "changed-alloc-ns-list", argc, argv); | |||
| 481 | } | |||
| 482 | ||||
| 483 | static int get_dispersed_ns_participating_nss_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 484 | { | |||
| 485 | return forward_to_log_plugin("dispersed-ns-participating-nss-log", "dispersed-ns-participating-nss", argc, argv); | |||
| 486 | } | |||
| 487 | ||||
| 488 | static int get_reachability_groups_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 489 | { | |||
| 490 | return forward_to_log_plugin("reachability-groups-log", "reachability-groups", argc, argv); | |||
| 491 | } | |||
| 492 | ||||
| 493 | static int get_reachability_associations_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 494 | { | |||
| 495 | return forward_to_log_plugin("reachability-associations-log", "reachability-associations", argc, argv); | |||
| 496 | } | |||
| 497 | ||||
| 498 | static int get_host_discovery_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 499 | { | |||
| 500 | return forward_to_log_plugin("host-discovery-log", "host-discovery", argc, argv); | |||
| 501 | } | |||
| 502 | ||||
| 503 | static int get_ave_discovery_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 504 | { | |||
| 505 | return forward_to_log_plugin("ave-discovery-log", "ave-discovery", argc, argv); | |||
| 506 | } | |||
| 507 | ||||
| 508 | static int get_pull_model_ddc_req_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 509 | { | |||
| 510 | return forward_to_log_plugin("pull-model-ddc-req-log", "pull-model-ddc-req", argc, argv); | |||
| 511 | } | |||
| 512 | ||||
| 513 | static int get_power_measurement_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 514 | { | |||
| 515 | return forward_to_log_plugin("power-measurement-log", "power-measurement", argc, argv); | |||
| 516 | } | |||
| 517 | ||||
| 518 | static int sanitize_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 519 | { | |||
| 520 | return forward_to_log_plugin("sanitize-log", "sanitize", argc, argv); | |||
| 521 | } | |||
| 522 | ||||
| 523 | ||||
| 524 | static struct plugin *find_id_plugin(void) | |||
| 525 | { | |||
| 526 | struct plugin *id = builtin.next; | |||
| 527 | ||||
| 528 | while (id && (!id->name || strcmp(id->name, "id"))) | |||
| 529 | id = id->next; | |||
| 530 | ||||
| 531 | return id; | |||
| 532 | } | |||
| 533 | ||||
| 534 | static int forward_to_id_plugin(const char *old_name, const char *subcmd, | |||
| 535 | int argc, char **argv) | |||
| 536 | { | |||
| 537 | struct plugin *id = find_id_plugin(); | |||
| 538 | __cleanup_free__attribute__((cleanup(shr_freep))) char **sub_argv = NULL((void*)0); | |||
| 539 | ||||
| 540 | if (!id) { | |||
| 541 | fprintf(stderrstderr, "ERROR: '%s' is deprecated and requires the 'id' plugin, which is not available in this build; use 'nvme id %s'\n", | |||
| 542 | old_name, subcmd); | |||
| 543 | return -ENOTTY25; | |||
| 544 | } | |||
| 545 | ||||
| 546 | fprintf(stderrstderr, "WARNING: '%s' is deprecated and will be removed in the next major version, use 'nvme id %s' instead\n", | |||
| 547 | old_name, subcmd); | |||
| 548 | ||||
| 549 | sub_argv = calloc(argc + 1, sizeof(*sub_argv)); | |||
| 550 | if (!sub_argv) | |||
| 551 | return -ENOMEM12; | |||
| 552 | ||||
| 553 | sub_argv[0] = (char *)id->name; | |||
| 554 | sub_argv[1] = (char *)subcmd; | |||
| 555 | memcpy(&sub_argv[2], &argv[1], (argc - 1) * sizeof(*argv)); | |||
| 556 | ||||
| 557 | return handle_plugin(argc + 1, sub_argv, id); | |||
| 558 | } | |||
| 559 | ||||
| 560 | static int id_ctrl(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 561 | { | |||
| 562 | return forward_to_id_plugin("id-ctrl", "ctrl", argc, argv); | |||
| 563 | } | |||
| 564 | ||||
| 565 | static int id_ns(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 566 | { | |||
| 567 | return forward_to_id_plugin("id-ns", "ns", argc, argv); | |||
| 568 | } | |||
| 569 | ||||
| 570 | static int id_ns_granularity(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 571 | { | |||
| 572 | return forward_to_id_plugin("id-ns-granularity", "ns-granularity", argc, argv); | |||
| 573 | } | |||
| 574 | ||||
| 575 | static int id_ns_lba_format(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 576 | { | |||
| 577 | return forward_to_id_plugin("id-ns-lba-format", "ns-lba-format", argc, argv); | |||
| 578 | } | |||
| 579 | ||||
| 580 | static int list_ns(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 581 | { | |||
| 582 | return forward_to_id_plugin("list-ns", "ns-list", argc, argv); | |||
| 583 | } | |||
| 584 | ||||
| 585 | static int list_ctrl(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 586 | { | |||
| 587 | return forward_to_id_plugin("list-ctrl", "ctrl-list", argc, argv); | |||
| 588 | } | |||
| 589 | ||||
| 590 | static int nvm_id_ctrl(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 591 | { | |||
| 592 | return forward_to_id_plugin("nvm-id-ctrl", "nvm-ctrl", argc, argv); | |||
| 593 | } | |||
| 594 | ||||
| 595 | static int nvm_id_ns(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 596 | { | |||
| 597 | return forward_to_id_plugin("nvm-id-ns", "nvm-ns", argc, argv); | |||
| 598 | } | |||
| 599 | ||||
| 600 | static int nvm_id_ns_lba_format(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 601 | { | |||
| 602 | return forward_to_id_plugin("nvm-id-ns-lba-format", "nvm-ns-lba-format", argc, argv); | |||
| 603 | } | |||
| 604 | ||||
| 605 | static int primary_ctrl_caps(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 606 | { | |||
| 607 | return forward_to_id_plugin("primary-ctrl-caps", "primary-ctrl-caps", argc, argv); | |||
| 608 | } | |||
| 609 | ||||
| 610 | static int list_secondary_ctrl(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 611 | { | |||
| 612 | return forward_to_id_plugin("list-secondary", "secondary-ctrl-list", argc, argv); | |||
| 613 | } | |||
| 614 | ||||
| 615 | static int cmd_set_independent_id_ns(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 616 | { | |||
| 617 | return forward_to_id_plugin("cmdset-ind-id-ns", "ns-ind", argc, argv); | |||
| 618 | } | |||
| 619 | ||||
| 620 | static int ns_descs(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 621 | { | |||
| 622 | return forward_to_id_plugin("ns-descs", "ns-descs", argc, argv); | |||
| 623 | } | |||
| 624 | ||||
| 625 | static int id_nvmset(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 626 | { | |||
| 627 | return forward_to_id_plugin("id-nvmset", "nvmset", argc, argv); | |||
| 628 | } | |||
| 629 | ||||
| 630 | static int id_uuid(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 631 | { | |||
| 632 | return forward_to_id_plugin("id-uuid", "uuid", argc, argv); | |||
| 633 | } | |||
| 634 | ||||
| 635 | static int id_iocs(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 636 | { | |||
| 637 | return forward_to_id_plugin("id-iocs", "iocs", argc, argv); | |||
| 638 | } | |||
| 639 | ||||
| 640 | static int id_domain(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 641 | { | |||
| 642 | return forward_to_id_plugin("id-domain", "domain", argc, argv); | |||
| 643 | } | |||
| 644 | ||||
| 645 | static int id_endurance_grp_list(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 646 | { | |||
| 647 | return forward_to_id_plugin("list-endgrp", "endgrp-list", argc, argv); | |||
| 648 | } | |||
| 649 | ||||
| 650 | ||||
| 651 | static struct plugin *find_ns_plugin(void) | |||
| 652 | { | |||
| 653 | struct plugin *ns = builtin.next; | |||
| 654 | ||||
| 655 | while (ns && (!ns->name || strcmp(ns->name, "ns"))) | |||
| 656 | ns = ns->next; | |||
| 657 | ||||
| 658 | return ns; | |||
| 659 | } | |||
| 660 | ||||
| 661 | static int forward_to_ns_plugin(const char *old_name, const char *subcmd, | |||
| 662 | int argc, char **argv) | |||
| 663 | { | |||
| 664 | struct plugin *ns = find_ns_plugin(); | |||
| 665 | __cleanup_free__attribute__((cleanup(shr_freep))) char **sub_argv = NULL((void*)0); | |||
| 666 | ||||
| 667 | if (!ns) { | |||
| 668 | fprintf(stderrstderr, "ERROR: '%s' is deprecated and requires the 'ns' plugin, which is not available in this build; use 'nvme ns %s'\n", | |||
| 669 | old_name, subcmd); | |||
| 670 | return -ENOTTY25; | |||
| 671 | } | |||
| 672 | ||||
| 673 | fprintf(stderrstderr, "WARNING: '%s' is deprecated and will be removed in the next major version, use 'nvme ns %s' instead\n", | |||
| 674 | old_name, subcmd); | |||
| 675 | ||||
| 676 | sub_argv = calloc(argc + 1, sizeof(*sub_argv)); | |||
| 677 | if (!sub_argv) | |||
| 678 | return -ENOMEM12; | |||
| 679 | ||||
| 680 | sub_argv[0] = (char *)ns->name; | |||
| 681 | sub_argv[1] = (char *)subcmd; | |||
| 682 | memcpy(&sub_argv[2], &argv[1], (argc - 1) * sizeof(*argv)); | |||
| 683 | ||||
| 684 | return handle_plugin(argc + 1, sub_argv, ns); | |||
| 685 | } | |||
| 686 | ||||
| 687 | static int create_ns(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 688 | { | |||
| 689 | return forward_to_ns_plugin("create-ns", "create", argc, argv); | |||
| 690 | } | |||
| 691 | ||||
| 692 | static int delete_ns(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 693 | { | |||
| 694 | return forward_to_ns_plugin("delete-ns", "delete", argc, argv); | |||
| 695 | } | |||
| 696 | ||||
| 697 | static int attach_ns(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 698 | { | |||
| 699 | return forward_to_ns_plugin("attach-ns", "attach", argc, argv); | |||
| 700 | } | |||
| 701 | ||||
| 702 | static int detach_ns(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 703 | { | |||
| 704 | return forward_to_ns_plugin("detach-ns", "detach", argc, argv); | |||
| 705 | } | |||
| 706 | ||||
| 707 | static int get_ns_id(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 708 | { | |||
| 709 | return forward_to_ns_plugin("get-ns-id", "get-id", argc, argv); | |||
| 710 | } | |||
| 711 | ||||
| 712 | ||||
| 713 | static struct plugin *find_resv_plugin(void) | |||
| 714 | { | |||
| 715 | struct plugin *resv = builtin.next; | |||
| 716 | ||||
| 717 | while (resv && (!resv->name || strcmp(resv->name, "resv"))) | |||
| 718 | resv = resv->next; | |||
| 719 | ||||
| 720 | return resv; | |||
| 721 | } | |||
| 722 | ||||
| 723 | static int forward_to_resv_plugin(const char *old_name, const char *subcmd, | |||
| 724 | int argc, char **argv) | |||
| 725 | { | |||
| 726 | struct plugin *resv = find_resv_plugin(); | |||
| 727 | __cleanup_free__attribute__((cleanup(shr_freep))) char **sub_argv = NULL((void*)0); | |||
| 728 | ||||
| 729 | if (!resv) { | |||
| 730 | fprintf(stderrstderr, "ERROR: '%s' is deprecated and requires the 'resv' plugin, which is not available in this build; use 'nvme resv %s'\n", | |||
| 731 | old_name, subcmd); | |||
| 732 | return -ENOTTY25; | |||
| 733 | } | |||
| 734 | ||||
| 735 | fprintf(stderrstderr, "WARNING: '%s' is deprecated and will be removed in the next major version, use 'nvme resv %s' instead\n", | |||
| 736 | old_name, subcmd); | |||
| 737 | ||||
| 738 | sub_argv = calloc(argc + 1, sizeof(*sub_argv)); | |||
| 739 | if (!sub_argv) | |||
| 740 | return -ENOMEM12; | |||
| 741 | ||||
| 742 | sub_argv[0] = (char *)resv->name; | |||
| 743 | sub_argv[1] = (char *)subcmd; | |||
| 744 | memcpy(&sub_argv[2], &argv[1], (argc - 1) * sizeof(*argv)); | |||
| 745 | ||||
| 746 | return handle_plugin(argc + 1, sub_argv, resv); | |||
| 747 | } | |||
| 748 | ||||
| 749 | static int resv_acquire(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 750 | { | |||
| 751 | return forward_to_resv_plugin("resv-acquire", "acquire", argc, argv); | |||
| 752 | } | |||
| 753 | ||||
| 754 | static int resv_register(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 755 | { | |||
| 756 | return forward_to_resv_plugin("resv-register", "register", argc, argv); | |||
| 757 | } | |||
| 758 | ||||
| 759 | static int resv_release(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 760 | { | |||
| 761 | return forward_to_resv_plugin("resv-release", "release", argc, argv); | |||
| 762 | } | |||
| 763 | ||||
| 764 | static int resv_report(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 765 | { | |||
| 766 | return forward_to_resv_plugin("resv-report", "report", argc, argv); | |||
| 767 | } | |||
| 768 | ||||
| 769 | ||||
| 770 | static struct plugin *find_nvme_mi_plugin(void) | |||
| 771 | { | |||
| 772 | struct plugin *nvme_mi = builtin.next; | |||
| 773 | ||||
| 774 | while (nvme_mi && (!nvme_mi->name || strcmp(nvme_mi->name, "nvme-mi"))) | |||
| 775 | nvme_mi = nvme_mi->next; | |||
| 776 | ||||
| 777 | return nvme_mi; | |||
| 778 | } | |||
| 779 | ||||
| 780 | static int forward_to_nvme_mi_plugin(const char *old_name, const char *subcmd, | |||
| 781 | int argc, char **argv) | |||
| 782 | { | |||
| 783 | struct plugin *nvme_mi = find_nvme_mi_plugin(); | |||
| 784 | __cleanup_free__attribute__((cleanup(shr_freep))) char **sub_argv = NULL((void*)0); | |||
| 785 | ||||
| 786 | if (!nvme_mi) { | |||
| 787 | fprintf(stderrstderr, "ERROR: '%s' is deprecated and requires the 'nvme-mi' plugin, which is not available in this build; use 'nvme nvme-mi %s'\n", | |||
| 788 | old_name, subcmd); | |||
| 789 | return -ENOTTY25; | |||
| 790 | } | |||
| 791 | ||||
| 792 | fprintf(stderrstderr, "WARNING: '%s' is deprecated and will be removed in the next major version, use 'nvme nvme-mi %s' instead\n", | |||
| 793 | old_name, subcmd); | |||
| 794 | ||||
| 795 | sub_argv = calloc(argc + 1, sizeof(*sub_argv)); | |||
| 796 | if (!sub_argv) | |||
| 797 | return -ENOMEM12; | |||
| 798 | ||||
| 799 | sub_argv[0] = (char *)nvme_mi->name; | |||
| 800 | sub_argv[1] = (char *)subcmd; | |||
| 801 | memcpy(&sub_argv[2], &argv[1], (argc - 1) * sizeof(*argv)); | |||
| 802 | ||||
| 803 | return handle_plugin(argc + 1, sub_argv, nvme_mi); | |||
| 804 | } | |||
| 805 | ||||
| 806 | static int nmi_recv(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 807 | { | |||
| 808 | return forward_to_nvme_mi_plugin("nvme-mi-recv", "recv", argc, argv); | |||
| 809 | } | |||
| 810 | ||||
| 811 | static int nmi_send(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 812 | { | |||
| 813 | return forward_to_nvme_mi_plugin("nvme-mi-send", "send", argc, argv); | |||
| 814 | } | |||
| 815 | ||||
| 816 | ||||
| 817 | static struct plugin *find_io_mgmt_plugin(void) | |||
| 818 | { | |||
| 819 | struct plugin *io_mgmt = builtin.next; | |||
| 820 | ||||
| 821 | while (io_mgmt && (!io_mgmt->name || strcmp(io_mgmt->name, "io-mgmt"))) | |||
| 822 | io_mgmt = io_mgmt->next; | |||
| 823 | ||||
| 824 | return io_mgmt; | |||
| 825 | } | |||
| 826 | ||||
| 827 | static int forward_to_io_mgmt_plugin(const char *old_name, const char *subcmd, | |||
| 828 | int argc, char **argv) | |||
| 829 | { | |||
| 830 | struct plugin *io_mgmt = find_io_mgmt_plugin(); | |||
| 831 | __cleanup_free__attribute__((cleanup(shr_freep))) char **sub_argv = NULL((void*)0); | |||
| 832 | ||||
| 833 | if (!io_mgmt) { | |||
| 834 | fprintf(stderrstderr, "ERROR: '%s' is deprecated and requires the 'io-mgmt' plugin, which is not available in this build; use 'nvme io-mgmt %s'\n", | |||
| 835 | old_name, subcmd); | |||
| 836 | return -ENOTTY25; | |||
| 837 | } | |||
| 838 | ||||
| 839 | fprintf(stderrstderr, "WARNING: '%s' is deprecated and will be removed in the next major version, use 'nvme io-mgmt %s' instead\n", | |||
| 840 | old_name, subcmd); | |||
| 841 | ||||
| 842 | sub_argv = calloc(argc + 1, sizeof(*sub_argv)); | |||
| 843 | if (!sub_argv) | |||
| 844 | return -ENOMEM12; | |||
| 845 | ||||
| 846 | sub_argv[0] = (char *)io_mgmt->name; | |||
| 847 | sub_argv[1] = (char *)subcmd; | |||
| 848 | memcpy(&sub_argv[2], &argv[1], (argc - 1) * sizeof(*argv)); | |||
| 849 | ||||
| 850 | return handle_plugin(argc + 1, sub_argv, io_mgmt); | |||
| 851 | } | |||
| 852 | ||||
| 853 | static int io_mgmt_recv(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 854 | { | |||
| 855 | return forward_to_io_mgmt_plugin("io-mgmt-recv", "recv", argc, argv); | |||
| 856 | } | |||
| 857 | ||||
| 858 | static int io_mgmt_send(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 859 | { | |||
| 860 | return forward_to_io_mgmt_plugin("io-mgmt-send", "send", argc, argv); | |||
| 861 | } | |||
| 862 | ||||
| 863 | ||||
| 864 | static struct plugin *find_dir_plugin(void) | |||
| 865 | { | |||
| 866 | struct plugin *dir = builtin.next; | |||
| 867 | ||||
| 868 | while (dir && (!dir->name || strcmp(dir->name, "dir"))) | |||
| 869 | dir = dir->next; | |||
| 870 | ||||
| 871 | return dir; | |||
| 872 | } | |||
| 873 | ||||
| 874 | static int forward_to_dir_plugin(const char *old_name, const char *subcmd, | |||
| 875 | int argc, char **argv) | |||
| 876 | { | |||
| 877 | struct plugin *dir = find_dir_plugin(); | |||
| 878 | __cleanup_free__attribute__((cleanup(shr_freep))) char **sub_argv = NULL((void*)0); | |||
| 879 | ||||
| 880 | if (!dir) { | |||
| 881 | fprintf(stderrstderr, "ERROR: '%s' is deprecated and requires the 'dir' plugin, which is not available in this build; use 'nvme dir %s'\n", | |||
| 882 | old_name, subcmd); | |||
| 883 | return -ENOTTY25; | |||
| 884 | } | |||
| 885 | ||||
| 886 | fprintf(stderrstderr, "WARNING: '%s' is deprecated and will be removed in the next major version, use 'nvme dir %s' instead\n", | |||
| 887 | old_name, subcmd); | |||
| 888 | ||||
| 889 | sub_argv = calloc(argc + 1, sizeof(*sub_argv)); | |||
| 890 | if (!sub_argv) | |||
| 891 | return -ENOMEM12; | |||
| 892 | ||||
| 893 | sub_argv[0] = (char *)dir->name; | |||
| 894 | sub_argv[1] = (char *)subcmd; | |||
| 895 | memcpy(&sub_argv[2], &argv[1], (argc - 1) * sizeof(*argv)); | |||
| 896 | ||||
| 897 | return handle_plugin(argc + 1, sub_argv, dir); | |||
| 898 | } | |||
| 899 | ||||
| 900 | static int dir_receive(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 901 | { | |||
| 902 | return forward_to_dir_plugin("dir-receive", "receive", argc, argv); | |||
| 903 | } | |||
| 904 | ||||
| 905 | static int dir_send(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 906 | { | |||
| 907 | return forward_to_dir_plugin("dir-send", "send", argc, argv); | |||
| 908 | } | |||
| 909 | ||||
| 910 | ||||
| 911 | static struct plugin *find_security_plugin(void) | |||
| 912 | { | |||
| 913 | struct plugin *security = builtin.next; | |||
| 914 | ||||
| 915 | while (security && (!security->name || strcmp(security->name, "security"))) | |||
| 916 | security = security->next; | |||
| 917 | ||||
| 918 | return security; | |||
| 919 | } | |||
| 920 | ||||
| 921 | static int forward_to_security_plugin(const char *old_name, const char *subcmd, | |||
| 922 | int argc, char **argv) | |||
| 923 | { | |||
| 924 | struct plugin *security = find_security_plugin(); | |||
| 925 | __cleanup_free__attribute__((cleanup(shr_freep))) char **sub_argv = NULL((void*)0); | |||
| 926 | ||||
| 927 | if (!security) { | |||
| 928 | fprintf(stderrstderr, "ERROR: '%s' is deprecated and requires the 'security' plugin, which is not available in this build; use 'nvme security %s'\n", | |||
| 929 | old_name, subcmd); | |||
| 930 | return -ENOTTY25; | |||
| 931 | } | |||
| 932 | ||||
| 933 | fprintf(stderrstderr, "WARNING: '%s' is deprecated and will be removed in the next major version, use 'nvme security %s' instead\n", | |||
| 934 | old_name, subcmd); | |||
| 935 | ||||
| 936 | sub_argv = calloc(argc + 1, sizeof(*sub_argv)); | |||
| 937 | if (!sub_argv) | |||
| 938 | return -ENOMEM12; | |||
| 939 | ||||
| 940 | sub_argv[0] = (char *)security->name; | |||
| 941 | sub_argv[1] = (char *)subcmd; | |||
| 942 | memcpy(&sub_argv[2], &argv[1], (argc - 1) * sizeof(*argv)); | |||
| 943 | ||||
| 944 | return handle_plugin(argc + 1, sub_argv, security); | |||
| 945 | } | |||
| 946 | ||||
| 947 | static int sec_send(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 948 | { | |||
| 949 | return forward_to_security_plugin("security-send", "send", argc, argv); | |||
| 950 | } | |||
| 951 | ||||
| 952 | static int sec_recv(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 953 | { | |||
| 954 | return forward_to_security_plugin("security-recv", "recv", argc, argv); | |||
| 955 | } | |||
| 956 | ||||
| 957 | ||||
| 958 | static struct plugin *find_fw_plugin(void) | |||
| 959 | { | |||
| 960 | struct plugin *fw = builtin.next; | |||
| 961 | ||||
| 962 | while (fw && (!fw->name || strcmp(fw->name, "fw"))) | |||
| 963 | fw = fw->next; | |||
| 964 | ||||
| 965 | return fw; | |||
| 966 | } | |||
| 967 | ||||
| 968 | static int forward_to_fw_plugin(const char *old_name, const char *subcmd, | |||
| 969 | int argc, char **argv) | |||
| 970 | { | |||
| 971 | struct plugin *fw = find_fw_plugin(); | |||
| 972 | __cleanup_free__attribute__((cleanup(shr_freep))) char **sub_argv = NULL((void*)0); | |||
| 973 | ||||
| 974 | if (!fw) { | |||
| 975 | fprintf(stderrstderr, "ERROR: '%s' is deprecated and requires the 'fw' plugin, which is not available in this build; use 'nvme fw %s'\n", | |||
| 976 | old_name, subcmd); | |||
| 977 | return -ENOTTY25; | |||
| 978 | } | |||
| 979 | ||||
| 980 | fprintf(stderrstderr, "WARNING: '%s' is deprecated and will be removed in the next major version, use 'nvme fw %s' instead\n", | |||
| 981 | old_name, subcmd); | |||
| 982 | ||||
| 983 | sub_argv = calloc(argc + 1, sizeof(*sub_argv)); | |||
| 984 | if (!sub_argv) | |||
| 985 | return -ENOMEM12; | |||
| 986 | ||||
| 987 | sub_argv[0] = (char *)fw->name; | |||
| 988 | sub_argv[1] = (char *)subcmd; | |||
| 989 | memcpy(&sub_argv[2], &argv[1], (argc - 1) * sizeof(*argv)); | |||
| 990 | ||||
| 991 | return handle_plugin(argc + 1, sub_argv, fw); | |||
| 992 | } | |||
| 993 | ||||
| 994 | static int fw_commit(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 995 | { | |||
| 996 | return forward_to_fw_plugin("fw-commit", "commit", argc, argv); | |||
| 997 | } | |||
| 998 | ||||
| 999 | static int fw_download(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 1000 | { | |||
| 1001 | return forward_to_fw_plugin("fw-download", "download", argc, argv); | |||
| 1002 | } | |||
| 1003 | ||||
| 1004 | static struct command id_ctrl_cmd = { | |||
| 1005 | .name = "id-ctrl", | |||
| 1006 | .help = "Send NVMe Identify Controller (deprecated, use 'nvme id ctrl')", | |||
| 1007 | .fn = id_ctrl, | |||
| 1008 | .deprecated = true1, | |||
| 1009 | }; | |||
| 1010 | ||||
| 1011 | static struct command id_ns_cmd = { | |||
| 1012 | .name = "id-ns", | |||
| 1013 | .help = "Send NVMe Identify Namespace, display structure (deprecated, use 'nvme id ns')", | |||
| 1014 | .fn = id_ns, | |||
| 1015 | .deprecated = true1, | |||
| 1016 | }; | |||
| 1017 | ||||
| 1018 | static struct command id_ns_granularity_cmd = { | |||
| 1019 | .name = "id-ns-granularity", | |||
| 1020 | .help = "Send NVMe Identify Namespace Granularity List, display structure (deprecated, use 'nvme " | |||
| 1021 | "id ns-granularity')", | |||
| 1022 | .fn = id_ns_granularity, | |||
| 1023 | .deprecated = true1, | |||
| 1024 | }; | |||
| 1025 | ||||
| 1026 | static struct command id_ns_lba_format_cmd = { | |||
| 1027 | .name = "id-ns-lba-format", | |||
| 1028 | .help = "Send NVMe Identify Namespace for the specified LBA Format index, display structure " | |||
| 1029 | "(deprecated, use 'nvme id ns-lba-format')", | |||
| 1030 | .fn = id_ns_lba_format, | |||
| 1031 | .deprecated = true1, | |||
| 1032 | }; | |||
| 1033 | ||||
| 1034 | static struct command list_ns_cmd = { | |||
| 1035 | .name = "list-ns", | |||
| 1036 | .help = "Send NVMe Identify List, display structure (deprecated, use 'nvme id ns-list')", | |||
| 1037 | .fn = list_ns, | |||
| 1038 | .deprecated = true1, | |||
| 1039 | }; | |||
| 1040 | ||||
| 1041 | static struct command list_ctrl_cmd = { | |||
| 1042 | .name = "list-ctrl", | |||
| 1043 | .help = "Send NVMe Identify Controller List, display structure (deprecated, use 'nvme id " | |||
| 1044 | "ctrl-list')", | |||
| 1045 | .fn = list_ctrl, | |||
| 1046 | .deprecated = true1, | |||
| 1047 | }; | |||
| 1048 | ||||
| 1049 | static struct command nvm_id_ctrl_cmd = { | |||
| 1050 | .name = "nvm-id-ctrl", | |||
| 1051 | .help = "Send NVMe Identify Controller NVM Command Set, display structure (deprecated, use 'nvme " | |||
| 1052 | "id nvm-ctrl')", | |||
| 1053 | .fn = nvm_id_ctrl, | |||
| 1054 | .deprecated = true1, | |||
| 1055 | }; | |||
| 1056 | ||||
| 1057 | static struct command nvm_id_ns_cmd = { | |||
| 1058 | .name = "nvm-id-ns", | |||
| 1059 | .help = "Send NVMe Identify Namespace NVM Command Set, display structure (deprecated, use 'nvme " | |||
| 1060 | "id nvm-ns')", | |||
| 1061 | .fn = nvm_id_ns, | |||
| 1062 | .deprecated = true1, | |||
| 1063 | }; | |||
| 1064 | ||||
| 1065 | static struct command nvm_id_ns_lba_format_cmd = { | |||
| 1066 | .name = "nvm-id-ns-lba-format", | |||
| 1067 | .help = "Send NVMe Identify Namespace NVM Command Set for the specified LBA Format index, display " | |||
| 1068 | "structure (deprecated, use 'nvme id nvm-ns-lba-format')", | |||
| 1069 | .fn = nvm_id_ns_lba_format, | |||
| 1070 | .deprecated = true1, | |||
| 1071 | }; | |||
| 1072 | ||||
| 1073 | static struct command primary_ctrl_caps_cmd = { | |||
| 1074 | .name = "primary-ctrl-caps", | |||
| 1075 | .help = "Send NVMe Identify Primary Controller Capabilities (deprecated, use 'nvme id " | |||
| 1076 | "primary-ctrl-caps')", | |||
| 1077 | .fn = primary_ctrl_caps, | |||
| 1078 | .deprecated = true1, | |||
| 1079 | }; | |||
| 1080 | ||||
| 1081 | static struct command list_secondary_ctrl_cmd = { | |||
| 1082 | .name = "list-secondary", | |||
| 1083 | .help = "List Secondary Controllers associated with a Primary Controller (deprecated, use 'nvme " | |||
| 1084 | "id secondary-ctrl-list')", | |||
| 1085 | .fn = list_secondary_ctrl, | |||
| 1086 | .deprecated = true1, | |||
| 1087 | }; | |||
| 1088 | ||||
| 1089 | static struct command cmd_set_independent_id_ns_cmd = { | |||
| 1090 | .name = "cmdset-ind-id-ns", | |||
| 1091 | .help = "I/O Command Set Independent Identify Namespace (deprecated, use 'nvme id ns-ind')", | |||
| 1092 | .fn = cmd_set_independent_id_ns, | |||
| 1093 | .deprecated = true1, | |||
| 1094 | }; | |||
| 1095 | ||||
| 1096 | static struct command ns_descs_cmd = { | |||
| 1097 | .name = "ns-descs", | |||
| 1098 | .help = "Send NVMe Namespace Descriptor List, display structure (deprecated, use 'nvme id " | |||
| 1099 | "ns-descs')", | |||
| 1100 | .fn = ns_descs, | |||
| 1101 | .deprecated = true1, | |||
| 1102 | }; | |||
| 1103 | ||||
| 1104 | static struct command id_nvmset_cmd = { | |||
| 1105 | .name = "id-nvmset", | |||
| 1106 | .help = "Send NVMe Identify NVM Set List, display structure (deprecated, use 'nvme id nvmset')", | |||
| 1107 | .fn = id_nvmset, | |||
| 1108 | .deprecated = true1, | |||
| 1109 | }; | |||
| 1110 | ||||
| 1111 | static struct command id_uuid_cmd = { | |||
| 1112 | .name = "id-uuid", | |||
| 1113 | .help = "Send NVMe Identify UUID List, display structure (deprecated, use 'nvme id uuid')", | |||
| 1114 | .fn = id_uuid, | |||
| 1115 | .deprecated = true1, | |||
| 1116 | }; | |||
| 1117 | ||||
| 1118 | static struct command id_iocs_cmd = { | |||
| 1119 | .name = "id-iocs", | |||
| 1120 | .help = "Send NVMe Identify I/O Command Set, display structure (deprecated, use 'nvme id iocs')", | |||
| 1121 | .fn = id_iocs, | |||
| 1122 | .deprecated = true1, | |||
| 1123 | }; | |||
| 1124 | ||||
| 1125 | static struct command id_domain_cmd = { | |||
| 1126 | .name = "id-domain", | |||
| 1127 | .help = "Send NVMe Identify Domain List, display structure (deprecated, use 'nvme id domain')", | |||
| 1128 | .fn = id_domain, | |||
| 1129 | .deprecated = true1, | |||
| 1130 | }; | |||
| 1131 | ||||
| 1132 | static struct command id_endurance_grp_list_cmd = { | |||
| 1133 | .name = "list-endgrp", | |||
| 1134 | .help = "Send NVMe Identify Endurance Group List, display structure (deprecated, use 'nvme id " | |||
| 1135 | "endgrp-list')", | |||
| 1136 | .fn = id_endurance_grp_list, | |||
| 1137 | .deprecated = true1, | |||
| 1138 | }; | |||
| 1139 | ||||
| 1140 | static struct command create_ns_cmd = { | |||
| 1141 | .name = "create-ns", | |||
| 1142 | .help = "Creates a namespace with the provided parameters (deprecated, use 'nvme ns create')", | |||
| 1143 | .fn = create_ns, | |||
| 1144 | .deprecated = true1, | |||
| 1145 | }; | |||
| 1146 | ||||
| 1147 | static struct command delete_ns_cmd = { | |||
| 1148 | .name = "delete-ns", | |||
| 1149 | .help = "Deletes a namespace from the controller (deprecated, use 'nvme ns delete')", | |||
| 1150 | .fn = delete_ns, | |||
| 1151 | .deprecated = true1, | |||
| 1152 | }; | |||
| 1153 | ||||
| 1154 | static struct command attach_ns_cmd = { | |||
| 1155 | .name = "attach-ns", | |||
| 1156 | .help = "Attaches a namespace to requested controller(s) (deprecated, use 'nvme ns attach')", | |||
| 1157 | .fn = attach_ns, | |||
| 1158 | .deprecated = true1, | |||
| 1159 | }; | |||
| 1160 | ||||
| 1161 | static struct command detach_ns_cmd = { | |||
| 1162 | .name = "detach-ns", | |||
| 1163 | .help = "Detaches a namespace from requested controller(s) (deprecated, use 'nvme ns detach')", | |||
| 1164 | .fn = detach_ns, | |||
| 1165 | .deprecated = true1, | |||
| 1166 | }; | |||
| 1167 | ||||
| 1168 | static struct command get_ns_id_cmd = { | |||
| 1169 | .name = "get-ns-id", | |||
| 1170 | .help = "Retrieve the namespace ID of opened block device (deprecated, use 'nvme ns get-id')", | |||
| 1171 | .fn = get_ns_id, | |||
| 1172 | .deprecated = true1, | |||
| 1173 | }; | |||
| 1174 | ||||
| 1175 | static struct command get_supported_log_pages_cmd = { | |||
| 1176 | .name = "supported-log-pages", | |||
| 1177 | .help = "Retrieve the Supported Log pages details, show it (deprecated, use 'nvme log " | |||
| 1178 | "supported-pages')", | |||
| 1179 | .fn = get_supported_log_pages, | |||
| 1180 | .deprecated = true1, | |||
| 1181 | }; | |||
| 1182 | ||||
| 1183 | static struct command get_telemetry_log_cmd = { | |||
| 1184 | .name = "telemetry-log", | |||
| 1185 | .help = "Retrieve FW Telemetry log write to file (deprecated, use 'nvme log telemetry')", | |||
| 1186 | .fn = get_telemetry_log, | |||
| 1187 | .deprecated = true1, | |||
| 1188 | }; | |||
| 1189 | ||||
| 1190 | static struct command get_fw_log_cmd = { | |||
| 1191 | .name = "fw-log", | |||
| 1192 | .help = "Retrieve FW Log, show it (deprecated, use 'nvme log fw')", | |||
| 1193 | .fn = get_fw_log, | |||
| 1194 | .deprecated = true1, | |||
| 1195 | }; | |||
| 1196 | ||||
| 1197 | static struct command get_changed_attach_ns_list_log_cmd = { | |||
| 1198 | .name = "changed-ns-list-log", | |||
| 1199 | .help = "Retrieve Changed Attached Namespace List, show it (deprecated, use 'nvme log " | |||
| 1200 | "changed-ns-list')", | |||
| 1201 | .fn = get_changed_attach_ns_list_log, | |||
| 1202 | .deprecated = true1, | |||
| 1203 | }; | |||
| 1204 | ||||
| 1205 | static struct command get_smart_log_cmd = { | |||
| 1206 | .name = "smart-log", | |||
| 1207 | .help = "Retrieve SMART Log, show it (deprecated, use 'nvme log smart')", | |||
| 1208 | .fn = get_smart_log, | |||
| 1209 | .deprecated = true1, | |||
| 1210 | }; | |||
| 1211 | ||||
| 1212 | static struct command get_ana_log_cmd = { | |||
| 1213 | .name = "ana-log", | |||
| 1214 | .help = "Retrieve ANA Log, show it (deprecated, use 'nvme log ana')", | |||
| 1215 | .fn = get_ana_log, | |||
| 1216 | .deprecated = true1, | |||
| 1217 | }; | |||
| 1218 | ||||
| 1219 | static struct command get_error_log_cmd = { | |||
| 1220 | .name = "error-log", | |||
| 1221 | .help = "Retrieve Error Log, show it (deprecated, use 'nvme log error')", | |||
| 1222 | .fn = get_error_log, | |||
| 1223 | .deprecated = true1, | |||
| 1224 | }; | |||
| 1225 | ||||
| 1226 | static struct command get_effects_log_cmd = { | |||
| 1227 | .name = "effects-log", | |||
| 1228 | .help = "Retrieve Command Effects Log, show it (deprecated, use 'nvme log effects')", | |||
| 1229 | .fn = get_effects_log, | |||
| 1230 | .deprecated = true1, | |||
| 1231 | }; | |||
| 1232 | ||||
| 1233 | static struct command get_endurance_log_cmd = { | |||
| 1234 | .name = "endurance-log", | |||
| 1235 | .help = "Retrieve Endurance Group Log, show it (deprecated, use 'nvme log endurance')", | |||
| 1236 | .fn = get_endurance_log, | |||
| 1237 | .deprecated = true1, | |||
| 1238 | }; | |||
| 1239 | ||||
| 1240 | static struct command get_pred_lat_per_nvmset_log_cmd = { | |||
| 1241 | .name = "predictable-lat-log", | |||
| 1242 | .help = "Retrieve Predictable Latency per Nvmset Log, show it (deprecated, use 'nvme log " | |||
| 1243 | "predictable-lat')", | |||
| 1244 | .fn = get_pred_lat_per_nvmset_log, | |||
| 1245 | .deprecated = true1, | |||
| 1246 | }; | |||
| 1247 | ||||
| 1248 | static struct command get_pred_lat_event_agg_log_cmd = { | |||
| 1249 | .name = "pred-lat-event-agg-log", | |||
| 1250 | .help = "Retrieve Predictable Latency Event Aggregate Log, show it (deprecated, use 'nvme log " | |||
| 1251 | "pred-lat-event-agg')", | |||
| 1252 | .fn = get_pred_lat_event_agg_log, | |||
| 1253 | .deprecated = true1, | |||
| 1254 | }; | |||
| 1255 | ||||
| 1256 | static struct command get_persistent_event_log_cmd = { | |||
| 1257 | .name = "persistent-event-log", | |||
| 1258 | .help = "Retrieve Persistent Event Log, show it (deprecated, use 'nvme log persistent-event')", | |||
| 1259 | .fn = get_persistent_event_log, | |||
| 1260 | .deprecated = true1, | |||
| 1261 | }; | |||
| 1262 | ||||
| 1263 | static struct command get_endurance_event_agg_log_cmd = { | |||
| 1264 | .name = "endurance-event-agg-log", | |||
| 1265 | .help = "Retrieve Endurance Group Event Aggregate Log, show it (deprecated, use 'nvme log " | |||
| 1266 | "endurance-event-agg')", | |||
| 1267 | .fn = get_endurance_event_agg_log, | |||
| 1268 | .deprecated = true1, | |||
| 1269 | }; | |||
| 1270 | ||||
| 1271 | static struct command get_lba_status_log_cmd = { | |||
| 1272 | .name = "lba-status-log", | |||
| 1273 | .help = "Retrieve LBA Status Information Log, show it (deprecated, use 'nvme log lba-status')", | |||
| 1274 | .fn = get_lba_status_log, | |||
| 1275 | .deprecated = true1, | |||
| 1276 | }; | |||
| 1277 | ||||
| 1278 | static struct command get_resv_notif_log_cmd = { | |||
| 1279 | .name = "resv-notif-log", | |||
| 1280 | .help = "Retrieve Reservation Notification Log, show it (deprecated, use 'nvme log resv-notif')", | |||
| 1281 | .fn = get_resv_notif_log, | |||
| 1282 | .deprecated = true1, | |||
| 1283 | }; | |||
| 1284 | ||||
| 1285 | static struct command get_boot_part_log_cmd = { | |||
| 1286 | .name = "boot-part-log", | |||
| 1287 | .help = "Retrieve Boot Partition Log, show it (deprecated, use 'nvme log boot-part')", | |||
| 1288 | .fn = get_boot_part_log, | |||
| 1289 | .deprecated = true1, | |||
| 1290 | }; | |||
| 1291 | ||||
| 1292 | static struct command get_phy_rx_eom_log_cmd = { | |||
| 1293 | .name = "phy-rx-eom-log", | |||
| 1294 | .help = "Retrieve Physical Interface Receiver Eye Opening Measurement, show it (deprecated, use " | |||
| 1295 | "'nvme log phy-rx-eom')", | |||
| 1296 | .fn = get_phy_rx_eom_log, | |||
| 1297 | .deprecated = true1, | |||
| 1298 | }; | |||
| 1299 | ||||
| 1300 | static struct command self_test_log_cmd = { | |||
| 1301 | .name = "self-test-log", | |||
| 1302 | .help = "Retrieve the SELF-TEST Log, show it (deprecated, use 'nvme log self-test')", | |||
| 1303 | .fn = self_test_log, | |||
| 1304 | .deprecated = true1, | |||
| 1305 | }; | |||
| 1306 | ||||
| 1307 | static struct command get_fid_support_effects_log_cmd = { | |||
| 1308 | .name = "fid-support-effects-log", | |||
| 1309 | .help = "Retrieve FID Support and Effects log and show it (deprecated, use 'nvme log " | |||
| 1310 | "fid-support-effects')", | |||
| 1311 | .fn = get_fid_support_effects_log, | |||
| 1312 | .deprecated = true1, | |||
| 1313 | }; | |||
| 1314 | ||||
| 1315 | static struct command get_mi_cmd_support_effects_log_cmd = { | |||
| 1316 | .name = "mi-cmd-support-effects-log", | |||
| 1317 | .help = "Retrieve MI Command Support and Effects log and show it (deprecated, use 'nvme log " | |||
| 1318 | "mi-cmd-support-effects')", | |||
| 1319 | .fn = get_mi_cmd_support_effects_log, | |||
| 1320 | .deprecated = true1, | |||
| 1321 | }; | |||
| 1322 | ||||
| 1323 | static struct command get_media_unit_stat_log_cmd = { | |||
| 1324 | .name = "media-unit-stat-log", | |||
| 1325 | .help = "Retrieve the configuration and wear of media units, show it (deprecated, use 'nvme log " | |||
| 1326 | "media-unit-stat')", | |||
| 1327 | .fn = get_media_unit_stat_log, | |||
| 1328 | .deprecated = true1, | |||
| 1329 | }; | |||
| 1330 | ||||
| 1331 | static struct command get_supp_cap_config_log_cmd = { | |||
| 1332 | .name = "supported-cap-config-log", | |||
| 1333 | .help = "Retrieve the list of Supported Capacity Configuration Descriptors (deprecated, use 'nvme " | |||
| 1334 | "log supported-cap-config')", | |||
| 1335 | .fn = get_supp_cap_config_log, | |||
| 1336 | .deprecated = true1, | |||
| 1337 | }; | |||
| 1338 | ||||
| 1339 | static struct command get_mgmt_addr_list_log_cmd = { | |||
| 1340 | .name = "mgmt-addr-list-log", | |||
| 1341 | .help = "Retrieve Management Address List Log, show it (deprecated, use 'nvme log " | |||
| 1342 | "mgmt-addr-list')", | |||
| 1343 | .fn = get_mgmt_addr_list_log, | |||
| 1344 | .deprecated = true1, | |||
| 1345 | }; | |||
| 1346 | ||||
| 1347 | static struct command get_rotational_media_info_log_cmd = { | |||
| 1348 | .name = "rotational-media-info-log", | |||
| 1349 | .help = "Retrieve Rotational Media Information Log, show it (deprecated, use 'nvme log " | |||
| 1350 | "rotational-media-info')", | |||
| 1351 | .fn = get_rotational_media_info_log, | |||
| 1352 | .deprecated = true1, | |||
| 1353 | }; | |||
| 1354 | ||||
| 1355 | static struct command get_changed_alloc_ns_list_log_cmd = { | |||
| 1356 | .name = "changed-alloc-ns-list-log", | |||
| 1357 | .help = "Retrieve Changed Allocated Namespace List, show it (deprecated, use 'nvme log " | |||
| 1358 | "changed-alloc-ns-list')", | |||
| 1359 | .fn = get_changed_alloc_ns_list_log, | |||
| 1360 | .deprecated = true1, | |||
| 1361 | }; | |||
| 1362 | ||||
| 1363 | static struct command get_dispersed_ns_participating_nss_log_cmd = { | |||
| 1364 | .name = "dispersed-ns-participating-nss-log", | |||
| 1365 | .help = "Retrieve Dispersed Namespace Participating NVM Subsystems Log, show it (deprecated, use " | |||
| 1366 | "'nvme log dispersed-ns-participating-nss')", | |||
| 1367 | .fn = get_dispersed_ns_participating_nss_log, | |||
| 1368 | .deprecated = true1, | |||
| 1369 | }; | |||
| 1370 | ||||
| 1371 | static struct command get_reachability_groups_log_cmd = { | |||
| 1372 | .name = "reachability-groups-log", | |||
| 1373 | .help = "Retrieve Reachability Groups Log, show it (deprecated, use 'nvme log " | |||
| 1374 | "reachability-groups')", | |||
| 1375 | .fn = get_reachability_groups_log, | |||
| 1376 | .deprecated = true1, | |||
| 1377 | }; | |||
| 1378 | ||||
| 1379 | static struct command get_reachability_associations_log_cmd = { | |||
| 1380 | .name = "reachability-associations-log", | |||
| 1381 | .help = "Retrieve Reachability Associations Log, show it (deprecated, use 'nvme log " | |||
| 1382 | "reachability-associations')", | |||
| 1383 | .fn = get_reachability_associations_log, | |||
| 1384 | .deprecated = true1, | |||
| 1385 | }; | |||
| 1386 | ||||
| 1387 | static struct command get_host_discovery_log_cmd = { | |||
| 1388 | .name = "host-discovery-log", | |||
| 1389 | .help = "Retrieve Host Discovery Log, show it (deprecated, use 'nvme log host-discovery')", | |||
| 1390 | .fn = get_host_discovery_log, | |||
| 1391 | .deprecated = true1, | |||
| 1392 | }; | |||
| 1393 | ||||
| 1394 | static struct command get_ave_discovery_log_cmd = { | |||
| 1395 | .name = "ave-discovery-log", | |||
| 1396 | .help = "Retrieve AVE Discovery Log, show it (deprecated, use 'nvme log ave-discovery')", | |||
| 1397 | .fn = get_ave_discovery_log, | |||
| 1398 | .deprecated = true1, | |||
| 1399 | }; | |||
| 1400 | ||||
| 1401 | static struct command get_pull_model_ddc_req_log_cmd = { | |||
| 1402 | .name = "pull-model-ddc-req-log", | |||
| 1403 | .help = "Retrieve Pull Model DDC Request Log, show it (deprecated, use 'nvme log " | |||
| 1404 | "pull-model-ddc-req')", | |||
| 1405 | .fn = get_pull_model_ddc_req_log, | |||
| 1406 | .deprecated = true1, | |||
| 1407 | }; | |||
| 1408 | ||||
| 1409 | static struct command get_power_measurement_log_cmd = { | |||
| 1410 | .name = "power-measurement-log", | |||
| 1411 | .help = "Retrieve Power Measurement Log, show it (deprecated, use 'nvme log power-measurement')", | |||
| 1412 | .fn = get_power_measurement_log, | |||
| 1413 | .deprecated = true1, | |||
| 1414 | }; | |||
| 1415 | ||||
| 1416 | static struct command fw_commit_cmd = { | |||
| 1417 | .name = "fw-commit", | |||
| 1418 | .help = "Verify and commit firmware to a specific slot (fw-activate in old version < 1.2) " | |||
| 1419 | "(deprecated, use 'nvme fw commit')", | |||
| 1420 | .fn = fw_commit, | |||
| 1421 | .alias = "fw-activate", | |||
| 1422 | .deprecated = true1, | |||
| 1423 | }; | |||
| 1424 | ||||
| 1425 | static struct command fw_download_cmd = { | |||
| 1426 | .name = "fw-download", | |||
| 1427 | .help = "Download new firmware (deprecated, use 'nvme fw download')", | |||
| 1428 | .fn = fw_download, | |||
| 1429 | .deprecated = true1, | |||
| 1430 | }; | |||
| 1431 | ||||
| 1432 | static struct command sec_send_cmd = { | |||
| 1433 | .name = "security-send", | |||
| 1434 | .help = "Submit a Security Send command, return results (deprecated, use 'nvme security send')", | |||
| 1435 | .fn = sec_send, | |||
| 1436 | .deprecated = true1, | |||
| 1437 | }; | |||
| 1438 | ||||
| 1439 | static struct command sec_recv_cmd = { | |||
| 1440 | .name = "security-recv", | |||
| 1441 | .help = "Submit a Security Receive command, return results (deprecated, use 'nvme security recv')", | |||
| 1442 | .fn = sec_recv, | |||
| 1443 | .deprecated = true1, | |||
| 1444 | }; | |||
| 1445 | ||||
| 1446 | static struct command resv_acquire_cmd = { | |||
| 1447 | .name = "resv-acquire", | |||
| 1448 | .help = "Submit a Reservation Acquire, return results (deprecated, use 'nvme resv acquire')", | |||
| 1449 | .fn = resv_acquire, | |||
| 1450 | .deprecated = true1, | |||
| 1451 | }; | |||
| 1452 | ||||
| 1453 | static struct command resv_register_cmd = { | |||
| 1454 | .name = "resv-register", | |||
| 1455 | .help = "Submit a Reservation Register, return results (deprecated, use 'nvme resv register')", | |||
| 1456 | .fn = resv_register, | |||
| 1457 | .deprecated = true1, | |||
| 1458 | }; | |||
| 1459 | ||||
| 1460 | static struct command resv_release_cmd = { | |||
| 1461 | .name = "resv-release", | |||
| 1462 | .help = "Submit a Reservation Release, return results (deprecated, use 'nvme resv release')", | |||
| 1463 | .fn = resv_release, | |||
| 1464 | .deprecated = true1, | |||
| 1465 | }; | |||
| 1466 | ||||
| 1467 | static struct command resv_report_cmd = { | |||
| 1468 | .name = "resv-report", | |||
| 1469 | .help = "Submit a Reservation Report, return results (deprecated, use 'nvme resv report')", | |||
| 1470 | .fn = resv_report, | |||
| 1471 | .deprecated = true1, | |||
| 1472 | }; | |||
| 1473 | ||||
| 1474 | static struct command sanitize_log_cmd = { | |||
| 1475 | .name = "sanitize-log", | |||
| 1476 | .help = "Retrieve sanitize log, show it (deprecated, use 'nvme log sanitize')", | |||
| 1477 | .fn = sanitize_log, | |||
| 1478 | .deprecated = true1, | |||
| 1479 | }; | |||
| 1480 | ||||
| 1481 | #ifdef CONFIG_FABRICS | |||
| 1482 | ||||
| 1483 | static struct command gen_dhchap_key_cmd = { | |||
| 1484 | .name = "gen-dhchap-key", | |||
| 1485 | .help = "Generate NVMeoF DH-HMAC-CHAP host secret (deprecated, use 'nvme keys gen-kxchap-secret')", | |||
| 1486 | .fn = gen_dhchap_key, | |||
| 1487 | .deprecated = true1, | |||
| 1488 | .no_device = true1, | |||
| 1489 | }; | |||
| 1490 | ||||
| 1491 | static struct command check_dhchap_key_cmd = { | |||
| 1492 | .name = "check-dhchap-key", | |||
| 1493 | .help = "Validate NVMeoF DH-HMAC-CHAP host secret (deprecated, use 'nvme keys " | |||
| 1494 | "check-kxchap-secret')", | |||
| 1495 | .fn = check_dhchap_key, | |||
| 1496 | .deprecated = true1, | |||
| 1497 | .no_device = true1, | |||
| 1498 | }; | |||
| 1499 | ||||
| 1500 | static struct command gen_tls_key_cmd = { | |||
| 1501 | .name = "gen-tls-key", | |||
| 1502 | .help = "Generate NVMeoF TLS PSK (deprecated, use 'nvme keys gen-tls-psk')", | |||
| 1503 | .fn = gen_tls_key, | |||
| 1504 | .deprecated = true1, | |||
| 1505 | .no_device = true1, | |||
| 1506 | }; | |||
| 1507 | ||||
| 1508 | static struct command check_tls_key_cmd = { | |||
| 1509 | .name = "check-tls-key", | |||
| 1510 | .help = "Validate NVMeoF TLS PSK (deprecated, use 'nvme keys check-tls-psk')", | |||
| 1511 | .fn = check_tls_key, | |||
| 1512 | .deprecated = true1, | |||
| 1513 | .no_device = true1, | |||
| 1514 | }; | |||
| 1515 | ||||
| 1516 | static struct command tls_key_cmd = { | |||
| 1517 | .name = "tls-key", | |||
| 1518 | .help = "Manage NVMeoF TLS PSKs (deprecated, use 'nvme keys import/export/revoke')", | |||
| 1519 | .fn = tls_key, | |||
| 1520 | .deprecated = true1, | |||
| 1521 | .no_device = true1, | |||
| 1522 | }; | |||
| 1523 | ||||
| 1524 | #endif /* CONFIG_FABRICS */ | |||
| 1525 | ||||
| 1526 | static struct command dir_receive_cmd = { | |||
| 1527 | .name = "dir-receive", | |||
| 1528 | .help = "Submit a Directive Receive command, return results (deprecated, use 'nvme dir receive')", | |||
| 1529 | .fn = dir_receive, | |||
| 1530 | .deprecated = true1, | |||
| 1531 | }; | |||
| 1532 | ||||
| 1533 | static struct command dir_send_cmd = { | |||
| 1534 | .name = "dir-send", | |||
| 1535 | .help = "Submit a Directive Send command, return results (deprecated, use 'nvme dir send')", | |||
| 1536 | .fn = dir_send, | |||
| 1537 | .deprecated = true1, | |||
| 1538 | }; | |||
| 1539 | ||||
| 1540 | static struct command io_mgmt_recv_cmd = { | |||
| 1541 | .name = "io-mgmt-recv", | |||
| 1542 | .help = "I/O Management Receive (deprecated, use 'nvme io-mgmt recv')", | |||
| 1543 | .fn = io_mgmt_recv, | |||
| 1544 | .deprecated = true1, | |||
| 1545 | }; | |||
| 1546 | ||||
| 1547 | static struct command io_mgmt_send_cmd = { | |||
| 1548 | .name = "io-mgmt-send", | |||
| 1549 | .help = "I/O Management Send (deprecated, use 'nvme io-mgmt send')", | |||
| 1550 | .fn = io_mgmt_send, | |||
| 1551 | .deprecated = true1, | |||
| 1552 | }; | |||
| 1553 | ||||
| 1554 | static struct command nmi_recv_cmd = { | |||
| 1555 | .name = "nvme-mi-recv", | |||
| 1556 | .help = "Submit a NVMe-MI Receive command, return results (deprecated, use 'nvme nvme-mi recv')", | |||
| 1557 | .fn = nmi_recv, | |||
| 1558 | .deprecated = true1, | |||
| 1559 | }; | |||
| 1560 | ||||
| 1561 | static struct command nmi_send_cmd = { | |||
| 1562 | .name = "nvme-mi-send", | |||
| 1563 | .help = "Submit a NVMe-MI Send command, return results (deprecated, use 'nvme nvme-mi send')", | |||
| 1564 | .fn = nmi_send, | |||
| 1565 | .deprecated = true1, | |||
| 1566 | }; | |||
| 1567 | ||||
| 1568 | static struct command *commands[] = { | |||
| 1569 | &id_ctrl_cmd, | |||
| 1570 | &id_ns_cmd, | |||
| 1571 | &id_ns_granularity_cmd, | |||
| 1572 | &id_ns_lba_format_cmd, | |||
| 1573 | &list_ns_cmd, | |||
| 1574 | &list_ctrl_cmd, | |||
| 1575 | &nvm_id_ctrl_cmd, | |||
| 1576 | &nvm_id_ns_cmd, | |||
| 1577 | &nvm_id_ns_lba_format_cmd, | |||
| 1578 | &primary_ctrl_caps_cmd, | |||
| 1579 | &list_secondary_ctrl_cmd, | |||
| 1580 | &cmd_set_independent_id_ns_cmd, | |||
| 1581 | &ns_descs_cmd, | |||
| 1582 | &id_nvmset_cmd, | |||
| 1583 | &id_uuid_cmd, | |||
| 1584 | &id_iocs_cmd, | |||
| 1585 | &id_domain_cmd, | |||
| 1586 | &id_endurance_grp_list_cmd, | |||
| 1587 | &create_ns_cmd, | |||
| 1588 | &delete_ns_cmd, | |||
| 1589 | &attach_ns_cmd, | |||
| 1590 | &detach_ns_cmd, | |||
| 1591 | &get_ns_id_cmd, | |||
| 1592 | &get_supported_log_pages_cmd, | |||
| 1593 | &get_telemetry_log_cmd, | |||
| 1594 | &get_fw_log_cmd, | |||
| 1595 | &get_changed_attach_ns_list_log_cmd, | |||
| 1596 | &get_smart_log_cmd, | |||
| 1597 | &get_ana_log_cmd, | |||
| 1598 | &get_error_log_cmd, | |||
| 1599 | &get_effects_log_cmd, | |||
| 1600 | &get_endurance_log_cmd, | |||
| 1601 | &get_pred_lat_per_nvmset_log_cmd, | |||
| 1602 | &get_pred_lat_event_agg_log_cmd, | |||
| 1603 | &get_persistent_event_log_cmd, | |||
| 1604 | &get_endurance_event_agg_log_cmd, | |||
| 1605 | &get_lba_status_log_cmd, | |||
| 1606 | &get_resv_notif_log_cmd, | |||
| 1607 | &get_boot_part_log_cmd, | |||
| 1608 | &get_phy_rx_eom_log_cmd, | |||
| 1609 | &self_test_log_cmd, | |||
| 1610 | &get_fid_support_effects_log_cmd, | |||
| 1611 | &get_mi_cmd_support_effects_log_cmd, | |||
| 1612 | &get_media_unit_stat_log_cmd, | |||
| 1613 | &get_supp_cap_config_log_cmd, | |||
| 1614 | &get_mgmt_addr_list_log_cmd, | |||
| 1615 | &get_rotational_media_info_log_cmd, | |||
| 1616 | &get_changed_alloc_ns_list_log_cmd, | |||
| 1617 | &get_dispersed_ns_participating_nss_log_cmd, | |||
| 1618 | &get_reachability_groups_log_cmd, | |||
| 1619 | &get_reachability_associations_log_cmd, | |||
| 1620 | &get_host_discovery_log_cmd, | |||
| 1621 | &get_ave_discovery_log_cmd, | |||
| 1622 | &get_pull_model_ddc_req_log_cmd, | |||
| 1623 | &get_power_measurement_log_cmd, | |||
| 1624 | &fw_commit_cmd, | |||
| 1625 | &fw_download_cmd, | |||
| 1626 | &sec_send_cmd, | |||
| 1627 | &sec_recv_cmd, | |||
| 1628 | &resv_acquire_cmd, | |||
| 1629 | &resv_register_cmd, | |||
| 1630 | &resv_release_cmd, | |||
| 1631 | &resv_report_cmd, | |||
| 1632 | &sanitize_log_cmd, | |||
| 1633 | #ifdef CONFIG_FABRICS | |||
| 1634 | &gen_dhchap_key_cmd, | |||
| 1635 | &check_dhchap_key_cmd, | |||
| 1636 | &gen_tls_key_cmd, | |||
| 1637 | &check_tls_key_cmd, | |||
| 1638 | &tls_key_cmd, | |||
| 1639 | #endif /* CONFIG_FABRICS */ | |||
| 1640 | &dir_receive_cmd, | |||
| 1641 | &dir_send_cmd, | |||
| 1642 | &io_mgmt_recv_cmd, | |||
| 1643 | &io_mgmt_send_cmd, | |||
| 1644 | &nmi_recv_cmd, | |||
| 1645 | &nmi_send_cmd, | |||
| 1646 | NULL((void*)0), | |||
| 1647 | }; | |||
| 1648 | ||||
| 1649 | static void __shr_constructor__attribute__((constructor)) register_group(void) | |||
| 1650 | { | |||
| 1651 | plugin_add_group(&builtin, NULL((void*)0), commands); | |||
| 1652 | } | |||
| 1653 | ||||
| 1654 | #endif /* CONFIG_DEPRECATED_CMDS */ |