| File: | .build-ci/../nvme.c |
| Warning: | line 11132, column 6 Dereference of null pointer (loaded from field 'result') |
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 | * This program is free software; you can redistribute it and/or | |||
| 10 | * modify it under the terms of the GNU General Public License | |||
| 11 | * as published by the Free Software Foundation; either version 2 | |||
| 12 | * of the License, or (at your option) any later version. | |||
| 13 | * | |||
| 14 | * This program is distributed in the hope that it will be useful, | |||
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| 17 | * GNU General Public License for more details. | |||
| 18 | * | |||
| 19 | * You should have received a copy of the GNU General Public License | |||
| 20 | * along with this program; if not, write to the Free Software | |||
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
| 22 | */ | |||
| 23 | ||||
| 24 | /** | |||
| 25 | * This program uses NVMe IOCTLs to run native nvme commands to a device. | |||
| 26 | */ | |||
| 27 | #include <dirent.h> | |||
| 28 | #include <errno(*__errno_location ()).h> | |||
| 29 | #include <fcntl.h> | |||
| 30 | #include <getopt.h> | |||
| 31 | #include <inttypes.h> | |||
| 32 | #include <libgen.h> | |||
| 33 | #include <locale.h> | |||
| 34 | #include <math.h> | |||
| 35 | #include <signal.h> | |||
| 36 | #include <stdint.h> | |||
| 37 | #include <stdio.h> | |||
| 38 | #include <stdlib.h> | |||
| 39 | #include <string.h> | |||
| 40 | #include <unistd.h> | |||
| 41 | ||||
| 42 | #ifdef NVME_HAVE_MMAP | |||
| 43 | #include <sys/mman.h> | |||
| 44 | #endif | |||
| 45 | #include <sys/stat.h> | |||
| 46 | #include <sys/types.h> | |||
| 47 | ||||
| 48 | #include <libnvme.h> | |||
| 49 | ||||
| 50 | #include "common.h" | |||
| 51 | #include "fabrics.h" | |||
| 52 | #include "logging.h" | |||
| 53 | #include "nvme-cmds.h" | |||
| 54 | #include "nvme-print.h" | |||
| 55 | #include "nvme.h" | |||
| 56 | #include "plugin.h" | |||
| 57 | #include "util/argconfig.h" | |||
| 58 | #include "util/base64.h" | |||
| 59 | #include "util/cleanup.h" | |||
| 60 | #include "util/crc32.h" | |||
| 61 | #include "util/sighdl.h" | |||
| 62 | #include "util/suffix.h" | |||
| 63 | ||||
| 64 | #define CREATE_CMD | |||
| 65 | #include "nvme-builtin.h" | |||
| 66 | #include "malloc.h" | |||
| 67 | ||||
| 68 | struct feat_cfg { | |||
| 69 | __u8 feature_id; /* enum nvme_features_id */ | |||
| 70 | __u8 sel; /* enum nvme_get_features_sel */ | |||
| 71 | __u32 namespace_id; | |||
| 72 | __u32 cdw11; | |||
| 73 | __u32 cdw12; | |||
| 74 | __u8 uuid_index; | |||
| 75 | __u32 data_len; | |||
| 76 | bool_Bool raw_binary; | |||
| 77 | bool_Bool changed; | |||
| 78 | }; | |||
| 79 | ||||
| 80 | struct passthru_config { | |||
| 81 | __u8 opcode; | |||
| 82 | __u8 flags; | |||
| 83 | __u16 rsvd; | |||
| 84 | __u32 namespace_id; | |||
| 85 | __u32 data_len; | |||
| 86 | __u32 metadata_len; | |||
| 87 | __u32 cdw2; | |||
| 88 | __u32 cdw3; | |||
| 89 | __u32 cdw10; | |||
| 90 | __u32 cdw11; | |||
| 91 | __u32 cdw12; | |||
| 92 | __u32 cdw13; | |||
| 93 | __u32 cdw14; | |||
| 94 | __u32 cdw15; | |||
| 95 | char *input_file; | |||
| 96 | char *metadata; | |||
| 97 | bool_Bool raw_binary; | |||
| 98 | bool_Bool show_command; | |||
| 99 | bool_Bool read; | |||
| 100 | bool_Bool write; | |||
| 101 | __u8 prefill; | |||
| 102 | bool_Bool latency; | |||
| 103 | }; | |||
| 104 | ||||
| 105 | struct get_reg_config { | |||
| 106 | int offset; | |||
| 107 | bool_Bool cap; | |||
| 108 | bool_Bool vs; | |||
| 109 | bool_Bool intms; | |||
| 110 | bool_Bool intmc; | |||
| 111 | bool_Bool cc; | |||
| 112 | bool_Bool csts; | |||
| 113 | bool_Bool nssr; | |||
| 114 | bool_Bool aqa; | |||
| 115 | bool_Bool asq; | |||
| 116 | bool_Bool acq; | |||
| 117 | bool_Bool cmbloc; | |||
| 118 | bool_Bool cmbsz; | |||
| 119 | bool_Bool bpinfo; | |||
| 120 | bool_Bool bprsel; | |||
| 121 | bool_Bool bpmbl; | |||
| 122 | bool_Bool cmbmsc; | |||
| 123 | bool_Bool cmbsts; | |||
| 124 | bool_Bool cmbebs; | |||
| 125 | bool_Bool cmbswtp; | |||
| 126 | bool_Bool nssd; | |||
| 127 | bool_Bool crto; | |||
| 128 | bool_Bool pmrcap; | |||
| 129 | bool_Bool pmrctl; | |||
| 130 | bool_Bool pmrsts; | |||
| 131 | bool_Bool pmrebs; | |||
| 132 | bool_Bool pmrswtp; | |||
| 133 | bool_Bool pmrmscl; | |||
| 134 | bool_Bool pmrmscu; | |||
| 135 | bool_Bool fabrics; | |||
| 136 | }; | |||
| 137 | ||||
| 138 | struct set_reg_config { | |||
| 139 | int offset; | |||
| 140 | bool_Bool mmio32; | |||
| 141 | __u64 value; | |||
| 142 | __u32 intms; | |||
| 143 | __u32 intmc; | |||
| 144 | __u32 cc; | |||
| 145 | __u32 csts; | |||
| 146 | __u32 nssr; | |||
| 147 | __u32 aqa; | |||
| 148 | __u64 asq; | |||
| 149 | __u64 acq; | |||
| 150 | __u32 bprsel; | |||
| 151 | __u64 bpmbl; | |||
| 152 | __u64 cmbmsc; | |||
| 153 | __u32 nssd; | |||
| 154 | __u32 pmrctl; | |||
| 155 | __u32 pmrmscl; | |||
| 156 | __u32 pmrmscu; | |||
| 157 | }; | |||
| 158 | ||||
| 159 | static const char nvme_version_string[] = NVME_VERSION"3.0-a.5"; | |||
| 160 | ||||
| 161 | static struct plugin builtin = { | |||
| 162 | .commands = commands, | |||
| 163 | .name = NULL((void*)0), | |||
| 164 | .desc = NULL((void*)0), | |||
| 165 | .next = NULL((void*)0), | |||
| 166 | .tail = &builtin, | |||
| 167 | }; | |||
| 168 | ||||
| 169 | static struct program nvme = { | |||
| 170 | .name = "nvme", | |||
| 171 | .version = nvme_version_string, | |||
| 172 | .usage = "<command> [<device>] [<args>]", | |||
| 173 | .desc = "The '<device>' may be either an NVMe controller " | |||
| 174 | "device (ex: /dev/nvme0), an nvme namespace device " | |||
| 175 | "(ex: /dev/nvme0n1), or a mctp address in the form " | |||
| 176 | "mctp:<net>,<eid>[:ctrl-id]", | |||
| 177 | .extensions = &builtin, | |||
| 178 | }; | |||
| 179 | ||||
| 180 | const char *uuid_index = "UUID index"; | |||
| 181 | const char *namespace_id_desired = "identifier of desired namespace"; | |||
| 182 | ||||
| 183 | static const char *app_tag = "app tag for end-to-end PI"; | |||
| 184 | static const char *app_tag_mask = "app tag mask for end-to-end PI"; | |||
| 185 | static const char *block_count = "number of blocks (zeroes based) on device to access"; | |||
| 186 | static const char *crkey = "current reservation key"; | |||
| 187 | static const char *csi = "command set identifier"; | |||
| 188 | static const char *buf_len = "buffer len (if) data is sent or received"; | |||
| 189 | static const char *domainid = "Domain Identifier"; | |||
| 190 | static const char *doper = "directive operation"; | |||
| 191 | static const char *dspec_w_dtype = "directive specification associated with directive type"; | |||
| 192 | static const char *dtype = "directive type"; | |||
| 193 | static const char *endgid = "Endurance Group Identifier (ENDGID)"; | |||
| 194 | static const char *force_unit_access = "force device to commit data before command completes"; | |||
| 195 | static const char *iekey = "ignore existing res. key"; | |||
| 196 | static const char *latency = "output latency statistics"; | |||
| 197 | static const char *lba_format_index = "The index into the LBA Format list\n" | |||
| 198 | "identifying the LBA Format capabilities that are to be returned"; | |||
| 199 | static const char *limited_retry = "limit media access attempts"; | |||
| 200 | static const char *lsp = "log specific field"; | |||
| 201 | static const char *mos = "management operation specific"; | |||
| 202 | static const char *mo = "management operation"; | |||
| 203 | static const char *namespace_desired = "desired namespace"; | |||
| 204 | static const char *namespace_id_optional = "optional namespace attached to controller"; | |||
| 205 | static const char *nssf = "NVMe Security Specific Field"; | |||
| 206 | static const char *only_ctrl_dev = "Only controller device is allowed"; | |||
| 207 | static const char *prinfo = "PI and check field"; | |||
| 208 | static const char *rae = "Retain an Asynchronous Event"; | |||
| 209 | static const char *raw_directive = "show directive in binary format"; | |||
| 210 | static const char *raw_dump = "dump output in binary format"; | |||
| 211 | static const char *raw_identify = "show identify in binary format"; | |||
| 212 | static const char *raw_log = "show log in binary format"; | |||
| 213 | static const char *raw_output = "output in binary format"; | |||
| 214 | static const char *ref_tag = "reference tag for end-to-end PI"; | |||
| 215 | static const char *raw_use = "use binary output"; | |||
| 216 | static const char *rtype = "reservation type"; | |||
| 217 | static const char *secp = "security protocol (cf. SPC-4)"; | |||
| 218 | static const char *spsp = "security-protocol-specific (cf. SPC-4)"; | |||
| 219 | static const char *start_block = "64-bit LBA of first block to access"; | |||
| 220 | static const char *storage_tag = "storage tag for end-to-end PI"; | |||
| 221 | static const char *storage_tag_check = "This bit specifies if the Storage Tag field shall be checked as\n" | |||
| 222 | "part of end-to-end data protection processing"; | |||
| 223 | static const char *uuid_index_specify = "specify uuid index"; | |||
| 224 | static const char dash[51] = {[0 ... 49] = '=', '\0'}; | |||
| 225 | static const char space[51] = {[0 ... 49] = ' ', '\0'}; | |||
| 226 | static const char *offset = "offset of the requested register"; | |||
| 227 | static const char *intms = "INTMS=0xc register offset"; | |||
| 228 | static const char *intmc = "INTMC=0x10 register offset"; | |||
| 229 | static const char *cc = "CC=0x14 register offset"; | |||
| 230 | static const char *csts = "CSTS=0x1c register offset"; | |||
| 231 | static const char *nssr = "NSSR=0x20 register offset"; | |||
| 232 | static const char *aqa = "AQA=0x24 register offset"; | |||
| 233 | static const char *asq = "ASQ=0x28 register offset"; | |||
| 234 | static const char *acq = "ACQ=0x30 register offset"; | |||
| 235 | static const char *bprsel = "BPRSEL=0x44 register offset"; | |||
| 236 | static const char *bpmbl = "BPMBL=0x48 register offset"; | |||
| 237 | static const char *cmbmsc = "CMBMSC=0x50 register offset"; | |||
| 238 | static const char *nssd = "NSSD=0x64 register offset"; | |||
| 239 | static const char *pmrctl = "PMRCTL=0xe04 register offset"; | |||
| 240 | static const char *pmrmscl = "PMRMSCL=0xe14 register offset"; | |||
| 241 | static const char *pmrmscu = "PMRMSCU=0xe18 register offset"; | |||
| 242 | static const char *ish = "Ignore Shutdown (for NVMe-MI command)"; | |||
| 243 | ||||
| 244 | struct nvme_args nvme_args = { | |||
| 245 | .output_format = "normal", | |||
| 246 | .output_format_ver = 2, | |||
| 247 | .timeout = NVME_DEFAULT_IOCTL_TIMEOUT0, | |||
| 248 | }; | |||
| 249 | ||||
| 250 | static void *mmap_registers(struct libnvme_transport_handle *hdl, bool_Bool writable); | |||
| 251 | static int munmap_registers(void *addr); | |||
| 252 | ||||
| 253 | static OPT_VALS(feature_name)struct argconfig_opt_val feature_name[] = { | |||
| 254 | VAL_BYTE("arbitration", NVME_FEAT_FID_ARBITRATION){"arbitration", CFG_BYTE, .val.byte = NVME_FEAT_FID_ARBITRATION }, | |||
| 255 | VAL_BYTE("power-mgmt", NVME_FEAT_FID_POWER_MGMT){"power-mgmt", CFG_BYTE, .val.byte = NVME_FEAT_FID_POWER_MGMT }, | |||
| 256 | VAL_BYTE("lba-range", NVME_FEAT_FID_LBA_RANGE){"lba-range", CFG_BYTE, .val.byte = NVME_FEAT_FID_LBA_RANGE}, | |||
| 257 | VAL_BYTE("temp-thresh", NVME_FEAT_FID_TEMP_THRESH){"temp-thresh", CFG_BYTE, .val.byte = NVME_FEAT_FID_TEMP_THRESH }, | |||
| 258 | VAL_BYTE("err-recovery", NVME_FEAT_FID_ERR_RECOVERY){"err-recovery", CFG_BYTE, .val.byte = NVME_FEAT_FID_ERR_RECOVERY }, | |||
| 259 | VAL_BYTE("volatile-wc", NVME_FEAT_FID_VOLATILE_WC){"volatile-wc", CFG_BYTE, .val.byte = NVME_FEAT_FID_VOLATILE_WC }, | |||
| 260 | VAL_BYTE("num-queues", NVME_FEAT_FID_NUM_QUEUES){"num-queues", CFG_BYTE, .val.byte = NVME_FEAT_FID_NUM_QUEUES }, | |||
| 261 | VAL_BYTE("irq-coalesce", NVME_FEAT_FID_IRQ_COALESCE){"irq-coalesce", CFG_BYTE, .val.byte = NVME_FEAT_FID_IRQ_COALESCE }, | |||
| 262 | VAL_BYTE("irq-config", NVME_FEAT_FID_IRQ_CONFIG){"irq-config", CFG_BYTE, .val.byte = NVME_FEAT_FID_IRQ_CONFIG }, | |||
| 263 | VAL_BYTE("write-atomic", NVME_FEAT_FID_WRITE_ATOMIC){"write-atomic", CFG_BYTE, .val.byte = NVME_FEAT_FID_WRITE_ATOMIC }, | |||
| 264 | VAL_BYTE("async-event", NVME_FEAT_FID_ASYNC_EVENT){"async-event", CFG_BYTE, .val.byte = NVME_FEAT_FID_ASYNC_EVENT }, | |||
| 265 | VAL_BYTE("auto-pst", NVME_FEAT_FID_AUTO_PST){"auto-pst", CFG_BYTE, .val.byte = NVME_FEAT_FID_AUTO_PST}, | |||
| 266 | VAL_BYTE("host-mem-buf", NVME_FEAT_FID_HOST_MEM_BUF){"host-mem-buf", CFG_BYTE, .val.byte = NVME_FEAT_FID_HOST_MEM_BUF }, | |||
| 267 | VAL_BYTE("timestamp", NVME_FEAT_FID_TIMESTAMP){"timestamp", CFG_BYTE, .val.byte = NVME_FEAT_FID_TIMESTAMP}, | |||
| 268 | VAL_BYTE("kato", NVME_FEAT_FID_KATO){"kato", CFG_BYTE, .val.byte = NVME_FEAT_FID_KATO}, | |||
| 269 | VAL_BYTE("hctm", NVME_FEAT_FID_HCTM){"hctm", CFG_BYTE, .val.byte = NVME_FEAT_FID_HCTM}, | |||
| 270 | VAL_BYTE("nopsc", NVME_FEAT_FID_NOPSC){"nopsc", CFG_BYTE, .val.byte = NVME_FEAT_FID_NOPSC}, | |||
| 271 | VAL_BYTE("rrl", NVME_FEAT_FID_RRL){"rrl", CFG_BYTE, .val.byte = NVME_FEAT_FID_RRL}, | |||
| 272 | VAL_BYTE("plm-config", NVME_FEAT_FID_PLM_CONFIG){"plm-config", CFG_BYTE, .val.byte = NVME_FEAT_FID_PLM_CONFIG }, | |||
| 273 | VAL_BYTE("plm-window", NVME_FEAT_FID_PLM_WINDOW){"plm-window", CFG_BYTE, .val.byte = NVME_FEAT_FID_PLM_WINDOW }, | |||
| 274 | VAL_BYTE("lba-sts-interval", NVME_FEAT_FID_LBA_STS_INTERVAL){"lba-sts-interval", CFG_BYTE, .val.byte = NVME_FEAT_FID_LBA_STS_INTERVAL }, | |||
| 275 | VAL_BYTE("host-behavior", NVME_FEAT_FID_HOST_BEHAVIOR){"host-behavior", CFG_BYTE, .val.byte = NVME_FEAT_FID_HOST_BEHAVIOR }, | |||
| 276 | VAL_BYTE("sanitize", NVME_FEAT_FID_SANITIZE){"sanitize", CFG_BYTE, .val.byte = NVME_FEAT_FID_SANITIZE}, | |||
| 277 | VAL_BYTE("endurance-evt-cfg", NVME_FEAT_FID_ENDURANCE_EVT_CFG){"endurance-evt-cfg", CFG_BYTE, .val.byte = NVME_FEAT_FID_ENDURANCE_EVT_CFG }, | |||
| 278 | VAL_BYTE("iocs-profile", NVME_FEAT_FID_IOCS_PROFILE){"iocs-profile", CFG_BYTE, .val.byte = NVME_FEAT_FID_IOCS_PROFILE }, | |||
| 279 | VAL_BYTE("spinup-control", NVME_FEAT_FID_SPINUP_CONTROL){"spinup-control", CFG_BYTE, .val.byte = NVME_FEAT_FID_SPINUP_CONTROL }, | |||
| 280 | VAL_BYTE("power-loss-signal", NVME_FEAT_FID_POWER_LOSS_SIGNAL){"power-loss-signal", CFG_BYTE, .val.byte = NVME_FEAT_FID_POWER_LOSS_SIGNAL }, | |||
| 281 | VAL_BYTE("perf-characteristics", NVME_FEAT_FID_PERF_CHARACTERISTICS){"perf-characteristics", CFG_BYTE, .val.byte = NVME_FEAT_FID_PERF_CHARACTERISTICS }, | |||
| 282 | VAL_BYTE("fdp", NVME_FEAT_FID_FDP){"fdp", CFG_BYTE, .val.byte = NVME_FEAT_FID_FDP}, | |||
| 283 | VAL_BYTE("fdp-events", NVME_FEAT_FID_FDP_EVENTS){"fdp-events", CFG_BYTE, .val.byte = NVME_FEAT_FID_FDP_EVENTS }, | |||
| 284 | VAL_BYTE("ns-admin-label", NVME_FEAT_FID_NS_ADMIN_LABEL){"ns-admin-label", CFG_BYTE, .val.byte = NVME_FEAT_FID_NS_ADMIN_LABEL }, | |||
| 285 | VAL_BYTE("key-value", NVME_FEAT_FID_KEY_VALUE){"key-value", CFG_BYTE, .val.byte = NVME_FEAT_FID_KEY_VALUE}, | |||
| 286 | VAL_BYTE("ctrl-data-queue", NVME_FEAT_FID_CTRL_DATA_QUEUE){"ctrl-data-queue", CFG_BYTE, .val.byte = NVME_FEAT_FID_CTRL_DATA_QUEUE }, | |||
| 287 | VAL_BYTE("emb-mgmt-ctrl-addr", NVME_FEAT_FID_EMB_MGMT_CTRL_ADDR){"emb-mgmt-ctrl-addr", CFG_BYTE, .val.byte = NVME_FEAT_FID_EMB_MGMT_CTRL_ADDR }, | |||
| 288 | VAL_BYTE("host-mgmt-agent-addr", NVME_FEAT_FID_HOST_MGMT_AGENT_ADDR){"host-mgmt-agent-addr", CFG_BYTE, .val.byte = NVME_FEAT_FID_HOST_MGMT_AGENT_ADDR }, | |||
| 289 | VAL_BYTE("enh-ctrl-metadata", NVME_FEAT_FID_ENH_CTRL_METADATA){"enh-ctrl-metadata", CFG_BYTE, .val.byte = NVME_FEAT_FID_ENH_CTRL_METADATA }, | |||
| 290 | VAL_BYTE("ctrl-metadata", NVME_FEAT_FID_CTRL_METADATA){"ctrl-metadata", CFG_BYTE, .val.byte = NVME_FEAT_FID_CTRL_METADATA }, | |||
| 291 | VAL_BYTE("ns-metadata", NVME_FEAT_FID_NS_METADATA){"ns-metadata", CFG_BYTE, .val.byte = NVME_FEAT_FID_NS_METADATA }, | |||
| 292 | VAL_BYTE("sw-progress", NVME_FEAT_FID_SW_PROGRESS){"sw-progress", CFG_BYTE, .val.byte = NVME_FEAT_FID_SW_PROGRESS }, | |||
| 293 | VAL_BYTE("host-id", NVME_FEAT_FID_HOST_ID){"host-id", CFG_BYTE, .val.byte = NVME_FEAT_FID_HOST_ID}, | |||
| 294 | VAL_BYTE("resv-nf-mask", NVME_FEAT_FID_RESV_NF_MASK){"resv-nf-mask", CFG_BYTE, .val.byte = NVME_FEAT_FID_RESV_NF_MASK }, | |||
| 295 | VAL_BYTE("resv-persist", NVME_FEAT_FID_RESV_PERSIST){"resv-persist", CFG_BYTE, .val.byte = NVME_FEAT_FID_RESV_PERSIST }, | |||
| 296 | VAL_BYTE("write-protect", NVME_FEAT_FID_WRITE_PROTECT){"write-protect", CFG_BYTE, .val.byte = NVME_FEAT_FID_WRITE_PROTECT }, | |||
| 297 | VAL_BYTE("bp-write-protect", NVME_FEAT_FID_BP_WRITE_PROTECT){"bp-write-protect", CFG_BYTE, .val.byte = NVME_FEAT_FID_BP_WRITE_PROTECT }, | |||
| 298 | VAL_END(){ ((void*)0) } | |||
| 299 | }; | |||
| 300 | ||||
| 301 | static int check_arg_dev(int argc, char **argv) | |||
| 302 | { | |||
| 303 | if (optind >= argc) { | |||
| 304 | errno(*__errno_location ()) = EINVAL22; | |||
| 305 | nvme_show_perror(argv[0]); | |||
| 306 | return -EINVAL22; | |||
| 307 | } | |||
| 308 | return 0; | |||
| 309 | } | |||
| 310 | ||||
| 311 | static int get_transport_handle(struct libnvme_global_ctx *ctx, int argc, | |||
| 312 | char **argv, int flags, | |||
| 313 | struct libnvme_transport_handle **hdl) | |||
| 314 | { | |||
| 315 | char *devname; | |||
| 316 | int ret; | |||
| 317 | ||||
| 318 | ret = check_arg_dev(argc, argv); | |||
| 319 | if (ret) | |||
| 320 | return ret; | |||
| 321 | ||||
| 322 | devname = argv[optind]; | |||
| 323 | ||||
| 324 | ret = libnvme_open(ctx, devname, hdl); | |||
| 325 | if (ret) | |||
| 326 | nvme_show_err(ret, devname); | |||
| 327 | else if (log_level >= LIBNVME_LOG_DEBUG) | |||
| 328 | nvme_show_init(); | |||
| 329 | ||||
| 330 | return ret; | |||
| 331 | } | |||
| 332 | ||||
| 333 | void put_transport_handle(struct libnvme_transport_handle *hdl) | |||
| 334 | { | |||
| 335 | libnvme_close(hdl); | |||
| 336 | ||||
| 337 | if (log_level >= LIBNVME_LOG_DEBUG) | |||
| 338 | nvme_show_finish(); | |||
| 339 | } | |||
| 340 | ||||
| 341 | static int parse_args(int argc, char *argv[], const char *desc, | |||
| 342 | struct argconfig_commandline_options *opts) | |||
| 343 | { | |||
| 344 | int ret; | |||
| 345 | ||||
| 346 | ret = argconfig_parse(argc, argv, desc, opts); | |||
| 347 | if (ret) | |||
| 348 | return ret; | |||
| 349 | ||||
| 350 | log_level = map_log_level(nvme_args.verbose, false0); | |||
| 351 | ||||
| 352 | return 0; | |||
| 353 | } | |||
| 354 | ||||
| 355 | static void setup_transport_handle(struct libnvme_global_ctx *ctx, | |||
| 356 | struct libnvme_transport_handle *hdl, | |||
| 357 | struct argconfig_commandline_options *opts) | |||
| 358 | { | |||
| 359 | libnvme_transport_handle_set_submit_entry(hdl, nvme_submit_entry); | |||
| 360 | libnvme_transport_handle_set_submit_exit(hdl, nvme_submit_exit); | |||
| 361 | libnvme_transport_handle_set_decide_retry(hdl, nvme_decide_retry); | |||
| 362 | ||||
| 363 | #ifdef CONFIG_MI | |||
| 364 | if (libnvme_transport_handle_is_mi(hdl)) { | |||
| 365 | libnvme_mi_ep_t ep = libnvme_transport_handle_get_mi_ep(hdl); | |||
| 366 | if (ep) { | |||
| 367 | libnvme_mi_ep_set_submit_entry(ep, nvme_mi_submit_entry); | |||
| 368 | libnvme_mi_ep_set_submit_exit(ep, nvme_mi_submit_exit); | |||
| 369 | } | |||
| 370 | } | |||
| 371 | #endif | |||
| 372 | ||||
| 373 | libnvme_set_dry_run(ctx, nvme_args.dry_run); | |||
| 374 | if (nvme_args.timeout != NVME_DEFAULT_IOCTL_TIMEOUT0) | |||
| 375 | libnvme_transport_handle_set_timeout(hdl, nvme_args.timeout); | |||
| 376 | } | |||
| 377 | ||||
| 378 | int parse_and_open(struct libnvme_global_ctx **ctx, | |||
| 379 | struct libnvme_transport_handle **hdl, int argc, char **argv, | |||
| 380 | const char *desc, struct argconfig_commandline_options *opts) | |||
| 381 | { | |||
| 382 | struct libnvme_transport_handle *hdl_new; | |||
| 383 | struct libnvme_global_ctx *ctx_new; | |||
| 384 | int ret; | |||
| 385 | ||||
| 386 | ret = parse_args(argc, argv, desc, opts); | |||
| 387 | if (ret) | |||
| 388 | return ret; | |||
| 389 | ||||
| 390 | ctx_new = libnvme_create_global_ctx(stdoutstdout, log_level); | |||
| 391 | if (!ctx_new) | |||
| 392 | return -ENOMEM12; | |||
| 393 | ||||
| 394 | libnvme_set_ioctl_probing(ctx_new, | |||
| 395 | !nvme_args.no_ioctl_probing); | |||
| 396 | ||||
| 397 | ret = get_transport_handle(ctx_new, argc, argv, O_RDONLY00, &hdl_new); | |||
| 398 | if (ret) { | |||
| 399 | libnvme_free_global_ctx(ctx_new); | |||
| 400 | argconfig_print_help(desc, opts); | |||
| 401 | return -ENXIO6; | |||
| 402 | } | |||
| 403 | ||||
| 404 | setup_transport_handle(ctx_new, hdl_new, opts); | |||
| 405 | ||||
| 406 | *ctx = ctx_new; | |||
| 407 | *hdl = hdl_new; | |||
| 408 | ||||
| 409 | return 0; | |||
| 410 | } | |||
| 411 | ||||
| 412 | int open_exclusive(struct libnvme_global_ctx **ctx, | |||
| 413 | struct libnvme_transport_handle **hdl, int argc, char **argv, | |||
| 414 | int ignore_exclusive, | |||
| 415 | struct argconfig_commandline_options *opts) | |||
| 416 | { | |||
| 417 | struct libnvme_transport_handle *hdl_new; | |||
| 418 | struct libnvme_global_ctx *ctx_new; | |||
| 419 | int flags = O_RDONLY00; | |||
| 420 | int ret; | |||
| 421 | ||||
| 422 | if (!ignore_exclusive) | |||
| 423 | flags |= O_EXCL0200; | |||
| 424 | ||||
| 425 | ctx_new = libnvme_create_global_ctx(stdoutstdout, log_level); | |||
| 426 | if (!ctx_new) | |||
| 427 | return -ENOMEM12; | |||
| 428 | ||||
| 429 | libnvme_set_ioctl_probing(ctx_new, | |||
| 430 | !nvme_args.no_ioctl_probing); | |||
| 431 | ||||
| 432 | ret = get_transport_handle(ctx_new, argc, argv, flags, &hdl_new); | |||
| 433 | if (ret) { | |||
| 434 | libnvme_free_global_ctx(ctx_new); | |||
| 435 | return -ENXIO6; | |||
| 436 | } | |||
| 437 | ||||
| 438 | setup_transport_handle(ctx_new, hdl_new, opts); | |||
| 439 | ||||
| 440 | *ctx = ctx_new; | |||
| 441 | *hdl = hdl_new; | |||
| 442 | ||||
| 443 | return 0; | |||
| 444 | } | |||
| 445 | ||||
| 446 | static int open_fallback_chardev(struct libnvme_global_ctx *ctx, | |||
| 447 | __u32 nsid, | |||
| 448 | struct libnvme_transport_handle **phdl) | |||
| 449 | { | |||
| 450 | struct libnvme_transport_handle *hdl = *phdl; | |||
| 451 | int err; | |||
| 452 | ||||
| 453 | if (libnvme_transport_handle_is_ctrl(hdl)) { | |||
| 454 | __cleanup_free__attribute__((cleanup(freep))) char *cdev = NULL((void*)0); | |||
| 455 | ||||
| 456 | if (!nsid) { | |||
| 457 | nvme_show_error("controller device not supported without --namespace-id")nvme_show_message(1, "controller device not supported without --namespace-id" ); | |||
| 458 | return -EINVAL22; | |||
| 459 | } | |||
| 460 | ||||
| 461 | if (asprintf(&cdev, "/dev/%sn%d", | |||
| 462 | libnvme_transport_handle_get_name(hdl), nsid) < 0) | |||
| 463 | return -ENOMEM12; | |||
| 464 | ||||
| 465 | libnvme_close(hdl); | |||
| 466 | ||||
| 467 | err = libnvme_open(ctx, cdev, &hdl); | |||
| 468 | if (err) { | |||
| 469 | *phdl = NULL((void*)0); | |||
| 470 | ||||
| 471 | nvme_show_error("could not open %s", cdev)nvme_show_message(1, "could not open %s", cdev); | |||
| 472 | return err; | |||
| 473 | } | |||
| 474 | ||||
| 475 | *phdl = hdl; | |||
| 476 | } | |||
| 477 | ||||
| 478 | return 0; | |||
| 479 | } | |||
| 480 | ||||
| 481 | ||||
| 482 | int validate_output_format(const char *format, nvme_print_flags_t *flags) | |||
| 483 | { | |||
| 484 | nvme_print_flags_t f; | |||
| 485 | ||||
| 486 | if (!format) | |||
| 487 | return -EINVAL22; | |||
| 488 | ||||
| 489 | if (!strcmp(format, "normal")) | |||
| 490 | f = NORMAL; | |||
| 491 | #ifdef CONFIG_JSONC | |||
| 492 | else if (!strcmp(format, "json")) | |||
| 493 | f = JSON; | |||
| 494 | #endif /* CONFIG_JSONC */ | |||
| 495 | else if (!strcmp(format, "binary")) | |||
| 496 | f = BINARY; | |||
| 497 | else if (!strcmp(format, "tabular")) | |||
| 498 | f = TABULAR; | |||
| 499 | else | |||
| 500 | return -EINVAL22; | |||
| 501 | ||||
| 502 | *flags = f; | |||
| 503 | ||||
| 504 | return 0; | |||
| 505 | } | |||
| 506 | ||||
| 507 | bool_Bool nvme_is_output_format_json(void) | |||
| 508 | { | |||
| 509 | nvme_print_flags_t flags; | |||
| 510 | ||||
| 511 | if (validate_output_format(nvme_args.output_format, &flags)) | |||
| 512 | return false0; | |||
| 513 | ||||
| 514 | return flags == JSON; | |||
| 515 | } | |||
| 516 | ||||
| 517 | static int get_smart_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 518 | { | |||
| 519 | const char *desc = "Retrieve SMART log for the given device " | |||
| 520 | "(or optionally a namespace) in either decoded format " | |||
| 521 | "(default) or binary."; | |||
| 522 | ||||
| 523 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_smart_log *smart_log = NULL((void*)0); | |||
| 524 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 525 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 526 | const char *namespace = "(optional) desired namespace"; | |||
| 527 | nvme_print_flags_t flags; | |||
| 528 | int err = -1; | |||
| 529 | ||||
| 530 | struct config { | |||
| 531 | __u32 namespace_id; | |||
| 532 | bool_Bool raw_binary; | |||
| 533 | }; | |||
| 534 | ||||
| 535 | struct config cfg = { | |||
| 536 | .namespace_id = NVME_NSID_ALL, | |||
| 537 | .raw_binary = false0, | |||
| 538 | }; | |||
| 539 | ||||
| 540 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_output, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 541 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_output, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 542 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_output))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_output, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 543 | ||||
| 544 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 545 | if (err) | |||
| 546 | return err; | |||
| 547 | ||||
| 548 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 549 | if (err < 0) { | |||
| 550 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 551 | return err; | |||
| 552 | } | |||
| 553 | ||||
| 554 | if (cfg.raw_binary) | |||
| 555 | flags = BINARY; | |||
| 556 | ||||
| 557 | if (nvme_args.verbose) | |||
| 558 | flags |= VERBOSE; | |||
| 559 | ||||
| 560 | smart_log = libnvme_alloc(sizeof(*smart_log)); | |||
| 561 | if (!smart_log) | |||
| 562 | return -ENOMEM12; | |||
| 563 | ||||
| 564 | err = nvme_get_log_smart(hdl, cfg.namespace_id, smart_log); | |||
| 565 | if (err) { | |||
| 566 | nvme_show_err(err, "smart log"); | |||
| 567 | return err; | |||
| 568 | } | |||
| 569 | ||||
| 570 | nvme_show_smart_log(smart_log, cfg.namespace_id, | |||
| 571 | libnvme_transport_handle_get_name(hdl), flags); | |||
| 572 | ||||
| 573 | return err; | |||
| 574 | } | |||
| 575 | ||||
| 576 | static int get_ana_log(int argc, char **argv, struct command *acmd, | |||
| 577 | struct plugin *plugin) | |||
| 578 | { | |||
| 579 | const char *desc = "Retrieve ANA log for the given device in " | |||
| 580 | "decoded format (default), json or binary."; | |||
| 581 | const char *groups = "Return ANA groups only."; | |||
| 582 | ||||
| 583 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 584 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 585 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ctrl *ctrl = NULL((void*)0); | |||
| 586 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_ana_log *ana_log = NULL((void*)0); | |||
| 587 | size_t max_ana_log_len; | |||
| 588 | __u32 ana_log_len; | |||
| 589 | nvme_print_flags_t flags; | |||
| 590 | int err = -1; | |||
| 591 | ||||
| 592 | struct config { | |||
| 593 | bool_Bool groups; | |||
| 594 | }; | |||
| 595 | ||||
| 596 | struct config cfg = { | |||
| 597 | .groups = false0, | |||
| 598 | }; | |||
| 599 | ||||
| 600 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"groups", 'g', ((void*)0), CFG_FLAG, &cfg.groups, 0, groups, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 601 | OPT_FLAG("groups", 'g', &cfg.groups, groups))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"groups", 'g', ((void*)0), CFG_FLAG, &cfg.groups, 0, groups, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 602 | ||||
| 603 | ||||
| 604 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 605 | if (err) | |||
| 606 | return err; | |||
| 607 | ||||
| 608 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 609 | if (err < 0) { | |||
| 610 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 611 | return err; | |||
| 612 | } | |||
| 613 | ||||
| 614 | ctrl = libnvme_alloc(sizeof(*ctrl)); | |||
| 615 | if (!ctrl) | |||
| 616 | return -ENOMEM12; | |||
| 617 | ||||
| 618 | err = nvme_identify_ctrl(hdl, ctrl); | |||
| 619 | if (err) { | |||
| 620 | nvme_show_error("ERROR : nvme_identify_ctrl() failed: %s",nvme_show_message(1, "ERROR : nvme_identify_ctrl() failed: %s" , libnvme_strerror(err)) | |||
| 621 | libnvme_strerror(err))nvme_show_message(1, "ERROR : nvme_identify_ctrl() failed: %s" , libnvme_strerror(err)); | |||
| 622 | return err; | |||
| 623 | } | |||
| 624 | ||||
| 625 | max_ana_log_len = libnvme_get_ana_log_len_from_id_ctrl(ctrl, cfg.groups); | |||
| 626 | ana_log_len = max_ana_log_len; | |||
| 627 | if (ana_log_len < max_ana_log_len) { | |||
| 628 | nvme_show_error("ANA log length %zu too large", max_ana_log_len)nvme_show_message(1, "ANA log length %zu too large", max_ana_log_len ); | |||
| 629 | return -ENOMEM12; | |||
| 630 | } | |||
| 631 | ||||
| 632 | ana_log = libnvme_alloc(ana_log_len); | |||
| 633 | if (!ana_log) | |||
| 634 | return -ENOMEM12; | |||
| 635 | ||||
| 636 | err = libnvme_get_ana_log_atomic(hdl, true1, cfg.groups, ana_log, &ana_log_len, 10); | |||
| 637 | if (err) { | |||
| 638 | nvme_show_err(err, "ana-log"); | |||
| 639 | return err; | |||
| 640 | } | |||
| 641 | ||||
| 642 | nvme_show_ana_log(ana_log, libnvme_transport_handle_get_name(hdl), | |||
| 643 | ana_log_len, flags); | |||
| 644 | ||||
| 645 | return err; | |||
| 646 | } | |||
| 647 | ||||
| 648 | static int parse_telemetry_da(struct libnvme_transport_handle *hdl, | |||
| 649 | enum nvme_telemetry_da da, | |||
| 650 | struct nvme_telemetry_log *telem, | |||
| 651 | size_t *size, | |||
| 652 | bool_Bool da4_support) | |||
| 653 | ||||
| 654 | { | |||
| 655 | size_t dalb, da1lb = le16_to_cpu(telem->dalb1), da2lb = le16_to_cpu(telem->dalb2), | |||
| 656 | da3lb = le16_to_cpu(telem->dalb3), da4lb = le32_to_cpu(telem->dalb4); | |||
| 657 | ||||
| 658 | switch (da) { | |||
| 659 | case NVME_TELEMETRY_DA_CTRL_DETERMINE: | |||
| 660 | if (da4_support) | |||
| 661 | dalb = da4lb; | |||
| 662 | else | |||
| 663 | dalb = da3lb; | |||
| 664 | break; | |||
| 665 | case NVME_TELEMETRY_DA_1: | |||
| 666 | dalb = da1lb; | |||
| 667 | break; | |||
| 668 | case NVME_TELEMETRY_DA_2: | |||
| 669 | dalb = da2lb; | |||
| 670 | break; | |||
| 671 | case NVME_TELEMETRY_DA_3: | |||
| 672 | /* dalb3 >= dalb2 >= dalb1 */ | |||
| 673 | dalb = da3lb; | |||
| 674 | break; | |||
| 675 | case NVME_TELEMETRY_DA_4: | |||
| 676 | if (da4_support) { | |||
| 677 | dalb = da4lb; | |||
| 678 | } else { | |||
| 679 | nvme_show_error(nvme_show_message(1, "Data area 4 unsupported, bit 6 of Log Page Attributes not set" ) | |||
| 680 | "Data area 4 unsupported, bit 6 of Log Page Attributes not set")nvme_show_message(1, "Data area 4 unsupported, bit 6 of Log Page Attributes not set" ); | |||
| 681 | return -EINVAL22; | |||
| 682 | } | |||
| 683 | break; | |||
| 684 | default: | |||
| 685 | nvme_show_error("Invalid data area parameter - %d", da)nvme_show_message(1, "Invalid data area parameter - %d", da); | |||
| 686 | return -EINVAL22; | |||
| 687 | } | |||
| 688 | ||||
| 689 | if (dalb == 0) { | |||
| 690 | nvme_show_error("ERROR: No telemetry data block")nvme_show_message(1, "ERROR: No telemetry data block"); | |||
| 691 | return -ENOENT2; | |||
| 692 | } | |||
| 693 | *size = (dalb + 1) * NVME_LOG_TELEM_BLOCK_SIZE; | |||
| 694 | return 0; | |||
| 695 | } | |||
| 696 | ||||
| 697 | static int get_log_telemetry_ctrl(struct libnvme_transport_handle *hdl, bool_Bool rae, size_t size, | |||
| 698 | struct nvme_telemetry_log **buf) | |||
| 699 | { | |||
| 700 | struct nvme_telemetry_log *log; | |||
| 701 | int err; | |||
| 702 | ||||
| 703 | log = libnvme_alloc(size); | |||
| 704 | if (!log) | |||
| 705 | return -ENOMEM12; | |||
| 706 | ||||
| 707 | err = nvme_get_log_telemetry_ctrl(hdl, rae, 0, log, size); | |||
| 708 | if (err) { | |||
| 709 | libnvme_free(log); | |||
| 710 | return err; | |||
| 711 | } | |||
| 712 | ||||
| 713 | *buf = log; | |||
| 714 | return 0; | |||
| 715 | } | |||
| 716 | ||||
| 717 | static int get_log_telemetry_host(struct libnvme_transport_handle *hdl, size_t size, | |||
| 718 | struct nvme_telemetry_log **buf) | |||
| 719 | { | |||
| 720 | struct nvme_telemetry_log *log; | |||
| 721 | int err; | |||
| 722 | ||||
| 723 | log = libnvme_alloc(size); | |||
| 724 | if (!log) | |||
| 725 | return -ENOMEM12; | |||
| 726 | ||||
| 727 | err = nvme_get_log_telemetry_host(hdl, 0, log, size); | |||
| 728 | if (err) { | |||
| 729 | libnvme_free(log); | |||
| 730 | return err; | |||
| 731 | } | |||
| 732 | ||||
| 733 | *buf = log; | |||
| 734 | return 0; | |||
| 735 | } | |||
| 736 | ||||
| 737 | static int __create_telemetry_log_host(struct libnvme_transport_handle *hdl, | |||
| 738 | enum nvme_telemetry_da da, | |||
| 739 | size_t *size, | |||
| 740 | struct nvme_telemetry_log **buf, | |||
| 741 | bool_Bool da4_support) | |||
| 742 | { | |||
| 743 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_telemetry_log *log = NULL((void*)0); | |||
| 744 | int err; | |||
| 745 | ||||
| 746 | log = libnvme_alloc(sizeof(*log)); | |||
| 747 | if (!log) | |||
| 748 | return -ENOMEM12; | |||
| 749 | ||||
| 750 | err = nvme_get_log_create_telemetry_host_mcda(hdl, da, log); | |||
| 751 | if (err) | |||
| 752 | return err; | |||
| 753 | ||||
| 754 | err = parse_telemetry_da(hdl, da, log, size, da4_support); | |||
| 755 | if (err) | |||
| 756 | return err; | |||
| 757 | ||||
| 758 | return get_log_telemetry_host(hdl, *size, buf); | |||
| 759 | } | |||
| 760 | ||||
| 761 | static int __get_telemetry_log_ctrl(struct libnvme_transport_handle *hdl, | |||
| 762 | bool_Bool rae, | |||
| 763 | enum nvme_telemetry_da da, | |||
| 764 | size_t *size, | |||
| 765 | struct nvme_telemetry_log **buf, | |||
| 766 | bool_Bool da4_support) | |||
| 767 | { | |||
| 768 | struct nvme_telemetry_log *log; | |||
| 769 | int err; | |||
| 770 | ||||
| 771 | log = libnvme_alloc(NVME_LOG_TELEM_BLOCK_SIZE); | |||
| 772 | if (!log) | |||
| 773 | return -ENOMEM12; | |||
| 774 | ||||
| 775 | /* | |||
| 776 | * set rae = true so it won't clear the current telemetry log in | |||
| 777 | * controller | |||
| 778 | */ | |||
| 779 | err = nvme_get_log_telemetry_ctrl(hdl, true1, 0, log, | |||
| 780 | NVME_LOG_TELEM_BLOCK_SIZE); | |||
| 781 | if (err) | |||
| 782 | goto free; | |||
| 783 | ||||
| 784 | if (!log->ctrlavail) { | |||
| 785 | if (!rae) { | |||
| 786 | err = nvme_get_log_telemetry_ctrl(hdl, rae, 0, log, | |||
| 787 | NVME_LOG_TELEM_BLOCK_SIZE); | |||
| 788 | goto free; | |||
| 789 | } | |||
| 790 | ||||
| 791 | *size = NVME_LOG_TELEM_BLOCK_SIZE; | |||
| 792 | *buf = log; | |||
| 793 | ||||
| 794 | printf("Warning: Telemetry Controller-Initiated Data Not Available.\n"); | |||
| 795 | return 0; | |||
| 796 | } | |||
| 797 | ||||
| 798 | err = parse_telemetry_da(hdl, da, log, size, da4_support); | |||
| 799 | if (err) | |||
| 800 | goto free; | |||
| 801 | ||||
| 802 | return get_log_telemetry_ctrl(hdl, rae, *size, buf); | |||
| 803 | ||||
| 804 | free: | |||
| 805 | libnvme_free(log); | |||
| 806 | return err; | |||
| 807 | } | |||
| 808 | ||||
| 809 | static int __get_telemetry_log_host(struct libnvme_transport_handle *hdl, | |||
| 810 | enum nvme_telemetry_da da, | |||
| 811 | size_t *size, | |||
| 812 | struct nvme_telemetry_log **buf, | |||
| 813 | bool_Bool da4_support) | |||
| 814 | { | |||
| 815 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_telemetry_log *log = NULL((void*)0); | |||
| 816 | int err; | |||
| 817 | ||||
| 818 | log = libnvme_alloc(sizeof(*log)); | |||
| 819 | if (!log) | |||
| 820 | return -ENOMEM12; | |||
| 821 | ||||
| 822 | err = nvme_get_log_telemetry_host(hdl, 0, log, | |||
| 823 | NVME_LOG_TELEM_BLOCK_SIZE); | |||
| 824 | if (err) | |||
| 825 | return err; | |||
| 826 | ||||
| 827 | err = parse_telemetry_da(hdl, da, log, size, da4_support); | |||
| 828 | if (err) | |||
| 829 | return err; | |||
| 830 | ||||
| 831 | return get_log_telemetry_host(hdl, *size, buf); | |||
| 832 | } | |||
| 833 | ||||
| 834 | static int get_telemetry_log(int argc, char **argv, struct command *acmd, | |||
| 835 | struct plugin *plugin) | |||
| 836 | { | |||
| 837 | const char *desc = "Retrieve telemetry log and write to binary file"; | |||
| 838 | const char *fname = "File name to save raw binary, includes header"; | |||
| 839 | const char *hgen = "Have the host tell the controller to generate the report"; | |||
| 840 | const char *cgen = "Gather report generated by the controller."; | |||
| 841 | const char *dgen = "Pick which telemetry data area to report. Default is 3 to fetch areas 1-3. Valid options are 1, 2, 3, 4."; | |||
| 842 | const char *mcda = "Host-init Maximum Created Data Area. Valid options are 0 ~ 4 " | |||
| 843 | "If given, This option will override dgen. 0 : controller determines data area"; | |||
| 844 | ||||
| 845 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_telemetry_log *log = NULL((void*)0); | |||
| 846 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ctrl *id_ctrl = NULL((void*)0); | |||
| 847 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 848 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 849 | __cleanup_fd__attribute__((cleanup(cleanup_fd))) int output = -1; | |||
| 850 | int err = 0; | |||
| 851 | size_t total_size = 0; | |||
| 852 | __u8 *data_ptr = NULL((void*)0); | |||
| 853 | int data_written = 0, data_remaining = 0; | |||
| 854 | nvme_print_flags_t flags; | |||
| 855 | bool_Bool da4_support = false0, | |||
| 856 | host_behavior_changed = false0; | |||
| 857 | ||||
| 858 | struct config { | |||
| 859 | char *file_name; | |||
| 860 | __u32 host_gen; | |||
| 861 | bool_Bool ctrl_init; | |||
| 862 | int data_area; | |||
| 863 | bool_Bool rae; | |||
| 864 | __u8 mcda; | |||
| 865 | }; | |||
| 866 | struct config cfg = { | |||
| 867 | .file_name = NULL((void*)0), | |||
| 868 | .host_gen = 1, | |||
| 869 | .ctrl_init = false0, | |||
| 870 | .data_area = 3, | |||
| 871 | .rae = false0, | |||
| 872 | .mcda = 0xff, | |||
| 873 | }; | |||
| 874 | ||||
| 875 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"output-file", 'O', "FILE", CFG_STRING, &cfg.file_name , 1, fname, 0, }, {"host-generate", 'g', "NUM", CFG_POSITIVE, &cfg.host_gen, 1, hgen, 0, }, {"controller-init", 'c', ( (void*)0), CFG_FLAG, &cfg.ctrl_init, 0, cgen, 0, }, {"data-area" , 'd', "NUM", CFG_POSITIVE, &cfg.data_area, 1, dgen, 0, } , {"rae", 'r', ((void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"mcda", 'm', "NUM", CFG_BYTE, &cfg.mcda, 1, mcda, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 876 | OPT_FILE("output-file", 'O', &cfg.file_name, fname),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"output-file", 'O', "FILE", CFG_STRING, &cfg.file_name , 1, fname, 0, }, {"host-generate", 'g', "NUM", CFG_POSITIVE, &cfg.host_gen, 1, hgen, 0, }, {"controller-init", 'c', ( (void*)0), CFG_FLAG, &cfg.ctrl_init, 0, cgen, 0, }, {"data-area" , 'd', "NUM", CFG_POSITIVE, &cfg.data_area, 1, dgen, 0, } , {"rae", 'r', ((void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"mcda", 'm', "NUM", CFG_BYTE, &cfg.mcda, 1, mcda, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 877 | OPT_UINT("host-generate", 'g', &cfg.host_gen, hgen),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"output-file", 'O', "FILE", CFG_STRING, &cfg.file_name , 1, fname, 0, }, {"host-generate", 'g', "NUM", CFG_POSITIVE, &cfg.host_gen, 1, hgen, 0, }, {"controller-init", 'c', ( (void*)0), CFG_FLAG, &cfg.ctrl_init, 0, cgen, 0, }, {"data-area" , 'd', "NUM", CFG_POSITIVE, &cfg.data_area, 1, dgen, 0, } , {"rae", 'r', ((void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"mcda", 'm', "NUM", CFG_BYTE, &cfg.mcda, 1, mcda, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 878 | OPT_FLAG("controller-init", 'c', &cfg.ctrl_init, cgen),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"output-file", 'O', "FILE", CFG_STRING, &cfg.file_name , 1, fname, 0, }, {"host-generate", 'g', "NUM", CFG_POSITIVE, &cfg.host_gen, 1, hgen, 0, }, {"controller-init", 'c', ( (void*)0), CFG_FLAG, &cfg.ctrl_init, 0, cgen, 0, }, {"data-area" , 'd', "NUM", CFG_POSITIVE, &cfg.data_area, 1, dgen, 0, } , {"rae", 'r', ((void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"mcda", 'm', "NUM", CFG_BYTE, &cfg.mcda, 1, mcda, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 879 | OPT_UINT("data-area", 'd', &cfg.data_area, dgen),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"output-file", 'O', "FILE", CFG_STRING, &cfg.file_name , 1, fname, 0, }, {"host-generate", 'g', "NUM", CFG_POSITIVE, &cfg.host_gen, 1, hgen, 0, }, {"controller-init", 'c', ( (void*)0), CFG_FLAG, &cfg.ctrl_init, 0, cgen, 0, }, {"data-area" , 'd', "NUM", CFG_POSITIVE, &cfg.data_area, 1, dgen, 0, } , {"rae", 'r', ((void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"mcda", 'm', "NUM", CFG_BYTE, &cfg.mcda, 1, mcda, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 880 | OPT_FLAG("rae", 'r', &cfg.rae, rae),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"output-file", 'O', "FILE", CFG_STRING, &cfg.file_name , 1, fname, 0, }, {"host-generate", 'g', "NUM", CFG_POSITIVE, &cfg.host_gen, 1, hgen, 0, }, {"controller-init", 'c', ( (void*)0), CFG_FLAG, &cfg.ctrl_init, 0, cgen, 0, }, {"data-area" , 'd', "NUM", CFG_POSITIVE, &cfg.data_area, 1, dgen, 0, } , {"rae", 'r', ((void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"mcda", 'm', "NUM", CFG_BYTE, &cfg.mcda, 1, mcda, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 881 | OPT_BYTE("mcda", 'm', &cfg.mcda, mcda))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"output-file", 'O', "FILE", CFG_STRING, &cfg.file_name , 1, fname, 0, }, {"host-generate", 'g', "NUM", CFG_POSITIVE, &cfg.host_gen, 1, hgen, 0, }, {"controller-init", 'c', ( (void*)0), CFG_FLAG, &cfg.ctrl_init, 0, cgen, 0, }, {"data-area" , 'd', "NUM", CFG_POSITIVE, &cfg.data_area, 1, dgen, 0, } , {"rae", 'r', ((void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"mcda", 'm', "NUM", CFG_BYTE, &cfg.mcda, 1, mcda, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 882 | ||||
| 883 | ||||
| 884 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 885 | if (err) | |||
| 886 | return err; | |||
| 887 | ||||
| 888 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 889 | if (err < 0) { | |||
| 890 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 891 | return err; | |||
| 892 | } | |||
| 893 | ||||
| 894 | if (!cfg.file_name) { | |||
| 895 | nvme_show_error("Please provide an output file!")nvme_show_message(1, "Please provide an output file!"); | |||
| 896 | return -EINVAL22; | |||
| 897 | } | |||
| 898 | ||||
| 899 | cfg.host_gen = !!cfg.host_gen; | |||
| 900 | ||||
| 901 | if (cfg.mcda != 0xff) { | |||
| 902 | if (cfg.ctrl_init || !cfg.host_gen) { | |||
| 903 | nvme_show_error("mcda allowed for Host-init Creation!")nvme_show_message(1, "mcda allowed for Host-init Creation!"); | |||
| 904 | return -EINVAL22; | |||
| 905 | } | |||
| 906 | cfg.data_area = cfg.mcda; | |||
| 907 | } | |||
| 908 | ||||
| 909 | if (cfg.data_area == 4) { | |||
| 910 | id_ctrl = libnvme_alloc(sizeof(*id_ctrl)); | |||
| 911 | if (!id_ctrl) | |||
| 912 | return -ENOMEM12; | |||
| 913 | ||||
| 914 | err = nvme_identify_ctrl(hdl, id_ctrl); | |||
| 915 | if (err) { | |||
| 916 | nvme_show_error("identify-ctrl")nvme_show_message(1, "identify-ctrl"); | |||
| 917 | return err; | |||
| 918 | } | |||
| 919 | ||||
| 920 | da4_support = id_ctrl->lpa & 0x40; | |||
| 921 | ||||
| 922 | if (!da4_support) { | |||
| 923 | fprintf(stderrstderr, "%s: Telemetry data area 4 not supported by device\n", | |||
| 924 | __func__); | |||
| 925 | return -EINVAL22; | |||
| 926 | } | |||
| 927 | ||||
| 928 | err = libnvme_set_etdas(hdl, &host_behavior_changed); | |||
| 929 | if (err) { | |||
| 930 | fprintf(stderrstderr, "%s: Failed to set ETDAS bit\n", __func__); | |||
| 931 | return err; | |||
| 932 | } | |||
| 933 | } | |||
| 934 | ||||
| 935 | output = nvme_open_rawdata(cfg.file_name, O_WRONLY | O_CREAT | O_TRUNC, 0666)open((cfg.file_name), (01 | 0100 | 01000), 0666); | |||
| 936 | if (output < 0) { | |||
| 937 | nvme_show_error("Failed to open output file %s: %s!",nvme_show_message(1, "Failed to open output file %s: %s!", cfg .file_name, libnvme_strerror((*__errno_location ()))) | |||
| 938 | cfg.file_name, libnvme_strerror(errno))nvme_show_message(1, "Failed to open output file %s: %s!", cfg .file_name, libnvme_strerror((*__errno_location ()))); | |||
| 939 | return output; | |||
| 940 | } | |||
| 941 | ||||
| 942 | log = libnvme_alloc(sizeof(*log)); | |||
| 943 | if (!log) | |||
| 944 | return -ENOMEM12; | |||
| 945 | ||||
| 946 | if (cfg.ctrl_init) | |||
| 947 | err = __get_telemetry_log_ctrl(hdl, cfg.rae, cfg.data_area, | |||
| 948 | &total_size, &log, da4_support); | |||
| 949 | else if (cfg.host_gen) | |||
| 950 | err = __create_telemetry_log_host(hdl, cfg.data_area, | |||
| 951 | &total_size, &log, da4_support); | |||
| 952 | else | |||
| 953 | err = __get_telemetry_log_host(hdl, cfg.data_area, | |||
| 954 | &total_size, &log, da4_support); | |||
| 955 | ||||
| 956 | if (err) { | |||
| 957 | nvme_show_err(err, "get-telemetry-log"); | |||
| 958 | if (err > 0) | |||
| 959 | fprintf(stderrstderr, "Failed to acquire telemetry log %d!\n", | |||
| 960 | err); | |||
| 961 | return err; | |||
| 962 | } | |||
| 963 | ||||
| 964 | data_written = 0; | |||
| 965 | data_remaining = total_size; | |||
| 966 | data_ptr = (__u8 *)log; | |||
| 967 | ||||
| 968 | while (data_remaining) { | |||
| 969 | data_written = write(output, data_ptr, data_remaining); | |||
| 970 | if (data_written < 0) { | |||
| 971 | err = -errno(*__errno_location ()); | |||
| 972 | nvme_show_error("ERROR: %s: : write failed with error : %s",nvme_show_message(1, "ERROR: %s: : write failed with error : %s" , __func__, libnvme_strerror((*__errno_location ()))) | |||
| 973 | __func__, libnvme_strerror(errno))nvme_show_message(1, "ERROR: %s: : write failed with error : %s" , __func__, libnvme_strerror((*__errno_location ()))); | |||
| 974 | break; | |||
| 975 | } else if (data_written <= data_remaining) { | |||
| 976 | data_remaining -= data_written; | |||
| 977 | data_ptr += data_written; | |||
| 978 | } else { | |||
| 979 | /* Unexpected overwrite */ | |||
| 980 | fprintf(stderrstderr, "Failure: Unexpected telemetry log overwrite - data_remaining = 0x%x, data_written = 0x%x\n", | |||
| 981 | data_remaining, data_written); | |||
| 982 | err = -1; | |||
| 983 | break; | |||
| 984 | } | |||
| 985 | } | |||
| 986 | ||||
| 987 | if (fsync(output) < 0) { | |||
| 988 | nvme_show_error("ERROR : %s: : fsync : %s", __func__, libnvme_strerror(errno))nvme_show_message(1, "ERROR : %s: : fsync : %s", __func__, libnvme_strerror ((*__errno_location ()))); | |||
| 989 | return -1; | |||
| 990 | } | |||
| 991 | ||||
| 992 | if (host_behavior_changed) { | |||
| 993 | host_behavior_changed = false0; | |||
| 994 | err = libnvme_clear_etdas(hdl, &host_behavior_changed); | |||
| 995 | if (err) { | |||
| 996 | fprintf(stderrstderr, "%s: Failed to clear ETDAS bit\n", __func__); | |||
| 997 | return err; | |||
| 998 | } | |||
| 999 | } | |||
| 1000 | ||||
| 1001 | return err; | |||
| 1002 | } | |||
| 1003 | ||||
| 1004 | static int get_endurance_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 1005 | { | |||
| 1006 | const char *desc = "Retrieves endurance groups log page and prints the log."; | |||
| 1007 | const char *group_id = "The endurance group identifier"; | |||
| 1008 | ||||
| 1009 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_endurance_group_log *endurance_log = NULL((void*)0); | |||
| 1010 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 1011 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 1012 | nvme_print_flags_t flags; | |||
| 1013 | int err; | |||
| 1014 | ||||
| 1015 | struct config { | |||
| 1016 | __u16 group_id; | |||
| 1017 | }; | |||
| 1018 | ||||
| 1019 | struct config cfg = { | |||
| 1020 | .group_id = 0, | |||
| 1021 | }; | |||
| 1022 | ||||
| 1023 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"group-id", 'g', "NUM", CFG_SHORT, &cfg.group_id, 1, group_id, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1024 | OPT_SHRT("group-id", 'g', &cfg.group_id, group_id))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"group-id", 'g', "NUM", CFG_SHORT, &cfg.group_id, 1, group_id, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 1025 | ||||
| 1026 | ||||
| 1027 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 1028 | if (err) | |||
| 1029 | return err; | |||
| 1030 | ||||
| 1031 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 1032 | if (err < 0) { | |||
| 1033 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 1034 | return err; | |||
| 1035 | } | |||
| 1036 | ||||
| 1037 | endurance_log = libnvme_alloc(sizeof(*endurance_log)); | |||
| 1038 | if (!endurance_log) | |||
| 1039 | return -ENOMEM12; | |||
| 1040 | ||||
| 1041 | err = nvme_get_log_endurance_group(hdl, cfg.group_id, endurance_log); | |||
| 1042 | if (err) { | |||
| 1043 | nvme_show_err(err, "endurance log"); | |||
| 1044 | return err; | |||
| 1045 | } | |||
| 1046 | ||||
| 1047 | nvme_show_endurance_log(endurance_log, cfg.group_id, | |||
| 1048 | libnvme_transport_handle_get_name(hdl), flags); | |||
| 1049 | ||||
| 1050 | return err; | |||
| 1051 | } | |||
| 1052 | ||||
| 1053 | static int collect_effects_log(struct libnvme_transport_handle *hdl, enum nvme_csi csi, | |||
| 1054 | struct list_head *list, int flags) | |||
| 1055 | { | |||
| 1056 | nvme_effects_log_node_t *node; | |||
| 1057 | int err; | |||
| 1058 | ||||
| 1059 | node = libnvme_alloc(sizeof(*node)); | |||
| 1060 | if (!node) | |||
| 1061 | return -ENOMEM12; | |||
| 1062 | ||||
| 1063 | node->csi = csi; | |||
| 1064 | ||||
| 1065 | err = nvme_get_log_cmd_effects(hdl, csi, &node->effects); | |||
| 1066 | if (err) { | |||
| 1067 | libnvme_free(node); | |||
| 1068 | return err; | |||
| 1069 | } | |||
| 1070 | list_add(list, &node->node)list_add_(list, &node->node, "../nvme.c" ":" "1070"); | |||
| 1071 | return 0; | |||
| 1072 | } | |||
| 1073 | ||||
| 1074 | static int get_effects_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 1075 | { | |||
| 1076 | const char *desc = "Retrieve command effects log page and print the table."; | |||
| 1077 | ||||
| 1078 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 1079 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 1080 | struct libnvme_passthru_cmd cmd; | |||
| 1081 | struct list_head log_pages; | |||
| 1082 | nvme_effects_log_node_t *node; | |||
| 1083 | ||||
| 1084 | void *bar = NULL((void*)0); | |||
| 1085 | ||||
| 1086 | int err = -1; | |||
| 1087 | nvme_print_flags_t flags; | |||
| 1088 | ||||
| 1089 | struct config { | |||
| 1090 | bool_Bool raw_binary; | |||
| 1091 | int csi; | |||
| 1092 | }; | |||
| 1093 | ||||
| 1094 | struct config cfg = { | |||
| 1095 | .raw_binary = false0, | |||
| 1096 | .csi = -1, | |||
| 1097 | }; | |||
| 1098 | ||||
| 1099 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_log, 0, }, {"csi", 'c', "NUM", CFG_INT, &cfg.csi , 1, csi, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1100 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_log),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_log, 0, }, {"csi", 'c', "NUM", CFG_INT, &cfg.csi , 1, csi, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1101 | OPT_INT("csi", 'c', &cfg.csi, csi))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_log, 0, }, {"csi", 'c', "NUM", CFG_INT, &cfg.csi , 1, csi, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 1102 | ||||
| 1103 | ||||
| 1104 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 1105 | if (err) | |||
| 1106 | return err; | |||
| 1107 | ||||
| 1108 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 1109 | if (err < 0) { | |||
| 1110 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 1111 | return err; | |||
| 1112 | } | |||
| 1113 | ||||
| 1114 | if (cfg.raw_binary) | |||
| 1115 | flags = BINARY; | |||
| 1116 | ||||
| 1117 | if (nvme_args.verbose) | |||
| 1118 | flags |= VERBOSE; | |||
| 1119 | ||||
| 1120 | list_head_init(&log_pages); | |||
| 1121 | ||||
| 1122 | if (cfg.csi < 0) { | |||
| 1123 | __u64 cap; | |||
| 1124 | if (libnvme_transport_handle_is_ns(hdl)) { | |||
| 1125 | nvme_show_error("Namespace device isn't allowed without csi")nvme_show_message(1, "Namespace device isn't allowed without csi" ); | |||
| 1126 | return -EINVAL22; | |||
| 1127 | } | |||
| 1128 | bar = mmap_registers(hdl, false0); | |||
| 1129 | ||||
| 1130 | if (bar) { | |||
| 1131 | cap = mmio_read64(bar + NVME_REG_CAP); | |||
| 1132 | munmap_registers(bar); | |||
| 1133 | } else { | |||
| 1134 | nvme_init_get_property(&cmd, NVME_REG_CAP); | |||
| 1135 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 1136 | if (err) | |||
| 1137 | goto cleanup_list; | |||
| 1138 | cap = cmd.result; | |||
| 1139 | } | |||
| 1140 | ||||
| 1141 | if (NVME_CAP_CSS(cap)(((cap) >> NVME_CAP_CSS_SHIFT) & NVME_CAP_CSS_MASK) & NVME_CAP_CSS_NVM) | |||
| 1142 | err = collect_effects_log(hdl, NVME_CSI_NVM, | |||
| 1143 | &log_pages, flags); | |||
| 1144 | ||||
| 1145 | if (!err && (NVME_CAP_CSS(cap)(((cap) >> NVME_CAP_CSS_SHIFT) & NVME_CAP_CSS_MASK) & NVME_CAP_CSS_CSI)) | |||
| 1146 | err = collect_effects_log(hdl, NVME_CSI_ZNS, | |||
| 1147 | &log_pages, flags); | |||
| 1148 | } else { | |||
| 1149 | err = collect_effects_log(hdl, cfg.csi, &log_pages, flags); | |||
| 1150 | } | |||
| 1151 | ||||
| 1152 | if (err) { | |||
| 1153 | nvme_show_err(err, "effects log page"); | |||
| 1154 | goto cleanup_list; | |||
| 1155 | } | |||
| 1156 | ||||
| 1157 | nvme_print_effects_log_pages(&log_pages, flags); | |||
| 1158 | ||||
| 1159 | cleanup_list: | |||
| 1160 | while ((node = list_pop(&log_pages, nvme_effects_log_node_t, node)((nvme_effects_log_node_t *)list_pop_((&log_pages), (__builtin_offsetof (nvme_effects_log_node_t, node) + ((typeof(((nvme_effects_log_node_t *)0)->node) *)0 != (struct list_node *)0)))))) | |||
| 1161 | libnvme_free(node); | |||
| 1162 | ||||
| 1163 | return err; | |||
| 1164 | } | |||
| 1165 | ||||
| 1166 | static int get_supported_log_pages(int argc, char **argv, struct command *acmd, | |||
| 1167 | struct plugin *plugin) | |||
| 1168 | { | |||
| 1169 | const char *desc = "Retrieve supported logs and print the table."; | |||
| 1170 | ||||
| 1171 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_supported_log_pages *supports = NULL((void*)0); | |||
| 1172 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 1173 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 1174 | nvme_print_flags_t flags; | |||
| 1175 | int err = -1; | |||
| 1176 | ||||
| 1177 | NVME_ARGS(opts)struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 1178 | ||||
| 1179 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 1180 | if (err) | |||
| 1181 | return err; | |||
| 1182 | ||||
| 1183 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 1184 | if (err < 0) { | |||
| 1185 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 1186 | return err; | |||
| 1187 | } | |||
| 1188 | ||||
| 1189 | if (nvme_args.verbose) | |||
| 1190 | flags |= VERBOSE; | |||
| 1191 | ||||
| 1192 | supports = libnvme_alloc(sizeof(*supports)); | |||
| 1193 | if (!supports) | |||
| 1194 | return -ENOMEM12; | |||
| 1195 | ||||
| 1196 | err = nvme_get_log_supported_log_pages(hdl, supports); | |||
| 1197 | if (err) { | |||
| 1198 | nvme_show_err(err, "supported log pages"); | |||
| 1199 | return err; | |||
| 1200 | } | |||
| 1201 | ||||
| 1202 | nvme_show_supported_log(supports, libnvme_transport_handle_get_name(hdl), | |||
| 1203 | flags); | |||
| 1204 | ||||
| 1205 | return err; | |||
| 1206 | } | |||
| 1207 | ||||
| 1208 | static int get_error_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 1209 | { | |||
| 1210 | const char *desc = "Retrieve specified number of " | |||
| 1211 | "error log entries from a given device " | |||
| 1212 | "in either decoded format (default) or binary."; | |||
| 1213 | const char *log_entries = "number of entries to retrieve"; | |||
| 1214 | const char *status = "output specified STATUS entry only"; | |||
| 1215 | const char *nsid = "output specified NSID entry only"; | |||
| 1216 | const char *trtype = "output specified TRTYPE entry only"; | |||
| 1217 | const char *opcode = "output specified OPC entry only"; | |||
| 1218 | const char *sqid = "output specified SQID entry only"; | |||
| 1219 | const char *valid_entry = "output valid entry only"; | |||
| 1220 | const char *lba = "output specified LBA entry only"; | |||
| 1221 | const char *csi = "output specified CSI entry only"; | |||
| 1222 | const char *raw = "dump in binary format"; | |||
| 1223 | ||||
| 1224 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_error_log_page *err_log = NULL((void*)0); | |||
| 1225 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 1226 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 1227 | struct nvme_id_ctrl ctrl = { 0 }; | |||
| 1228 | nvme_print_flags_t flags; | |||
| 1229 | int err = -1; | |||
| 1230 | ||||
| 1231 | struct config { | |||
| 1232 | __u32 log_entries; | |||
| 1233 | bool_Bool raw_binary; | |||
| 1234 | struct nvme_error_log_filter flt; | |||
| 1235 | }; | |||
| 1236 | ||||
| 1237 | struct config cfg = { | |||
| 1238 | .log_entries = 64, | |||
| 1239 | .raw_binary = false0, | |||
| 1240 | }; | |||
| 1241 | ||||
| 1242 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw, 0, }, {"valid-entry", 'V', ((void *)0), CFG_FLAG, &cfg.flt.valid, 0, valid_entry, 0, }, {"sqid" , 'S', "NUM", CFG_SHORT, &cfg.flt.sqid, 1, sqid, 0, }, {"status" , 's', "NUM", CFG_SHORT, &cfg.flt.status, 1, status, 0, } , {"lba", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.flt.lba, 1, lba, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg .flt.nsid, 1, nsid, 0, }, {"trtype", 't', "NUM", CFG_BYTE, & cfg.flt.trtype, 1, trtype, 0, }, {"csi", 'c', "NUM", CFG_BYTE , &cfg.flt.csi, 1, csi, 0, }, {"opcode", 'O', "NUM", CFG_BYTE , &cfg.flt.opcode, 1, opcode, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1243 | OPT_UINT("log-entries", 'e', &cfg.log_entries, log_entries),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw, 0, }, {"valid-entry", 'V', ((void *)0), CFG_FLAG, &cfg.flt.valid, 0, valid_entry, 0, }, {"sqid" , 'S', "NUM", CFG_SHORT, &cfg.flt.sqid, 1, sqid, 0, }, {"status" , 's', "NUM", CFG_SHORT, &cfg.flt.status, 1, status, 0, } , {"lba", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.flt.lba, 1, lba, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg .flt.nsid, 1, nsid, 0, }, {"trtype", 't', "NUM", CFG_BYTE, & cfg.flt.trtype, 1, trtype, 0, }, {"csi", 'c', "NUM", CFG_BYTE , &cfg.flt.csi, 1, csi, 0, }, {"opcode", 'O', "NUM", CFG_BYTE , &cfg.flt.opcode, 1, opcode, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1244 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw, 0, }, {"valid-entry", 'V', ((void *)0), CFG_FLAG, &cfg.flt.valid, 0, valid_entry, 0, }, {"sqid" , 'S', "NUM", CFG_SHORT, &cfg.flt.sqid, 1, sqid, 0, }, {"status" , 's', "NUM", CFG_SHORT, &cfg.flt.status, 1, status, 0, } , {"lba", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.flt.lba, 1, lba, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg .flt.nsid, 1, nsid, 0, }, {"trtype", 't', "NUM", CFG_BYTE, & cfg.flt.trtype, 1, trtype, 0, }, {"csi", 'c', "NUM", CFG_BYTE , &cfg.flt.csi, 1, csi, 0, }, {"opcode", 'O', "NUM", CFG_BYTE , &cfg.flt.opcode, 1, opcode, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1245 | OPT_FLAG("valid-entry", 'V', &cfg.flt.valid, valid_entry),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw, 0, }, {"valid-entry", 'V', ((void *)0), CFG_FLAG, &cfg.flt.valid, 0, valid_entry, 0, }, {"sqid" , 'S', "NUM", CFG_SHORT, &cfg.flt.sqid, 1, sqid, 0, }, {"status" , 's', "NUM", CFG_SHORT, &cfg.flt.status, 1, status, 0, } , {"lba", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.flt.lba, 1, lba, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg .flt.nsid, 1, nsid, 0, }, {"trtype", 't', "NUM", CFG_BYTE, & cfg.flt.trtype, 1, trtype, 0, }, {"csi", 'c', "NUM", CFG_BYTE , &cfg.flt.csi, 1, csi, 0, }, {"opcode", 'O', "NUM", CFG_BYTE , &cfg.flt.opcode, 1, opcode, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1246 | OPT_SHRT("sqid", 'S', &cfg.flt.sqid, sqid),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw, 0, }, {"valid-entry", 'V', ((void *)0), CFG_FLAG, &cfg.flt.valid, 0, valid_entry, 0, }, {"sqid" , 'S', "NUM", CFG_SHORT, &cfg.flt.sqid, 1, sqid, 0, }, {"status" , 's', "NUM", CFG_SHORT, &cfg.flt.status, 1, status, 0, } , {"lba", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.flt.lba, 1, lba, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg .flt.nsid, 1, nsid, 0, }, {"trtype", 't', "NUM", CFG_BYTE, & cfg.flt.trtype, 1, trtype, 0, }, {"csi", 'c', "NUM", CFG_BYTE , &cfg.flt.csi, 1, csi, 0, }, {"opcode", 'O', "NUM", CFG_BYTE , &cfg.flt.opcode, 1, opcode, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1247 | OPT_SHRT("status", 's', &cfg.flt.status, status),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw, 0, }, {"valid-entry", 'V', ((void *)0), CFG_FLAG, &cfg.flt.valid, 0, valid_entry, 0, }, {"sqid" , 'S', "NUM", CFG_SHORT, &cfg.flt.sqid, 1, sqid, 0, }, {"status" , 's', "NUM", CFG_SHORT, &cfg.flt.status, 1, status, 0, } , {"lba", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.flt.lba, 1, lba, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg .flt.nsid, 1, nsid, 0, }, {"trtype", 't', "NUM", CFG_BYTE, & cfg.flt.trtype, 1, trtype, 0, }, {"csi", 'c', "NUM", CFG_BYTE , &cfg.flt.csi, 1, csi, 0, }, {"opcode", 'O', "NUM", CFG_BYTE , &cfg.flt.opcode, 1, opcode, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1248 | OPT_SUFFIX("lba", 'l', &cfg.flt.lba, lba),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw, 0, }, {"valid-entry", 'V', ((void *)0), CFG_FLAG, &cfg.flt.valid, 0, valid_entry, 0, }, {"sqid" , 'S', "NUM", CFG_SHORT, &cfg.flt.sqid, 1, sqid, 0, }, {"status" , 's', "NUM", CFG_SHORT, &cfg.flt.status, 1, status, 0, } , {"lba", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.flt.lba, 1, lba, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg .flt.nsid, 1, nsid, 0, }, {"trtype", 't', "NUM", CFG_BYTE, & cfg.flt.trtype, 1, trtype, 0, }, {"csi", 'c', "NUM", CFG_BYTE , &cfg.flt.csi, 1, csi, 0, }, {"opcode", 'O', "NUM", CFG_BYTE , &cfg.flt.opcode, 1, opcode, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1249 | OPT_UINT("namespace-id", 'n', &cfg.flt.nsid, nsid),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw, 0, }, {"valid-entry", 'V', ((void *)0), CFG_FLAG, &cfg.flt.valid, 0, valid_entry, 0, }, {"sqid" , 'S', "NUM", CFG_SHORT, &cfg.flt.sqid, 1, sqid, 0, }, {"status" , 's', "NUM", CFG_SHORT, &cfg.flt.status, 1, status, 0, } , {"lba", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.flt.lba, 1, lba, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg .flt.nsid, 1, nsid, 0, }, {"trtype", 't', "NUM", CFG_BYTE, & cfg.flt.trtype, 1, trtype, 0, }, {"csi", 'c', "NUM", CFG_BYTE , &cfg.flt.csi, 1, csi, 0, }, {"opcode", 'O', "NUM", CFG_BYTE , &cfg.flt.opcode, 1, opcode, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1250 | OPT_BYTE("trtype", 't', &cfg.flt.trtype, trtype),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw, 0, }, {"valid-entry", 'V', ((void *)0), CFG_FLAG, &cfg.flt.valid, 0, valid_entry, 0, }, {"sqid" , 'S', "NUM", CFG_SHORT, &cfg.flt.sqid, 1, sqid, 0, }, {"status" , 's', "NUM", CFG_SHORT, &cfg.flt.status, 1, status, 0, } , {"lba", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.flt.lba, 1, lba, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg .flt.nsid, 1, nsid, 0, }, {"trtype", 't', "NUM", CFG_BYTE, & cfg.flt.trtype, 1, trtype, 0, }, {"csi", 'c', "NUM", CFG_BYTE , &cfg.flt.csi, 1, csi, 0, }, {"opcode", 'O', "NUM", CFG_BYTE , &cfg.flt.opcode, 1, opcode, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1251 | OPT_BYTE("csi", 'c', &cfg.flt.csi, csi),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw, 0, }, {"valid-entry", 'V', ((void *)0), CFG_FLAG, &cfg.flt.valid, 0, valid_entry, 0, }, {"sqid" , 'S', "NUM", CFG_SHORT, &cfg.flt.sqid, 1, sqid, 0, }, {"status" , 's', "NUM", CFG_SHORT, &cfg.flt.status, 1, status, 0, } , {"lba", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.flt.lba, 1, lba, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg .flt.nsid, 1, nsid, 0, }, {"trtype", 't', "NUM", CFG_BYTE, & cfg.flt.trtype, 1, trtype, 0, }, {"csi", 'c', "NUM", CFG_BYTE , &cfg.flt.csi, 1, csi, 0, }, {"opcode", 'O', "NUM", CFG_BYTE , &cfg.flt.opcode, 1, opcode, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1252 | OPT_BYTE("opcode", 'O', &cfg.flt.opcode, opcode))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw, 0, }, {"valid-entry", 'V', ((void *)0), CFG_FLAG, &cfg.flt.valid, 0, valid_entry, 0, }, {"sqid" , 'S', "NUM", CFG_SHORT, &cfg.flt.sqid, 1, sqid, 0, }, {"status" , 's', "NUM", CFG_SHORT, &cfg.flt.status, 1, status, 0, } , {"lba", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.flt.lba, 1, lba, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg .flt.nsid, 1, nsid, 0, }, {"trtype", 't', "NUM", CFG_BYTE, & cfg.flt.trtype, 1, trtype, 0, }, {"csi", 'c', "NUM", CFG_BYTE , &cfg.flt.csi, 1, csi, 0, }, {"opcode", 'O', "NUM", CFG_BYTE , &cfg.flt.opcode, 1, opcode, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 1253 | ||||
| 1254 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 1255 | if (err) | |||
| 1256 | return err; | |||
| 1257 | ||||
| 1258 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 1259 | if (err < 0) { | |||
| 1260 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 1261 | return err; | |||
| 1262 | } | |||
| 1263 | ||||
| 1264 | if (cfg.raw_binary) | |||
| 1265 | flags = BINARY; | |||
| 1266 | ||||
| 1267 | if (!cfg.log_entries) { | |||
| 1268 | nvme_show_error("non-zero log-entries is required param")nvme_show_message(1, "non-zero log-entries is required param" ); | |||
| 1269 | return -1; | |||
| 1270 | } | |||
| 1271 | ||||
| 1272 | err = nvme_identify_ctrl(hdl, &ctrl); | |||
| 1273 | if (err < 0) { | |||
| 1274 | nvme_show_perror("identify controller"); | |||
| 1275 | return err; | |||
| 1276 | } else if (err) { | |||
| 1277 | nvme_show_error("could not identify controller")nvme_show_message(1, "could not identify controller"); | |||
| 1278 | return err; | |||
| 1279 | } | |||
| 1280 | ||||
| 1281 | cfg.log_entries = min(cfg.log_entries, ctrl.elpe + 1)((cfg.log_entries) > (ctrl.elpe + 1) ? (ctrl.elpe + 1) : ( cfg.log_entries)); | |||
| 1282 | err_log = libnvme_alloc(cfg.log_entries * sizeof(struct nvme_error_log_page)); | |||
| 1283 | if (!err_log) | |||
| 1284 | return -ENOMEM12; | |||
| 1285 | ||||
| 1286 | err = nvme_get_log_error(hdl, NVME_NSID_ALL, cfg.log_entries, err_log); | |||
| 1287 | if (err) { | |||
| 1288 | nvme_show_err(err, "error log"); | |||
| 1289 | return err; | |||
| 1290 | } | |||
| 1291 | ||||
| 1292 | nvme_show_error_log(err_log, cfg.log_entries, | |||
| 1293 | libnvme_transport_handle_get_name(hdl), &cfg.flt, | |||
| 1294 | flags); | |||
| 1295 | ||||
| 1296 | return err; | |||
| 1297 | } | |||
| 1298 | ||||
| 1299 | static int get_fw_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 1300 | { | |||
| 1301 | const char *desc = "Retrieve the firmware log for the " | |||
| 1302 | "specified device in either decoded format (default) or binary."; | |||
| 1303 | ||||
| 1304 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_firmware_slot *fw_log = NULL((void*)0); | |||
| 1305 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 1306 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 1307 | nvme_print_flags_t flags; | |||
| 1308 | int err; | |||
| 1309 | ||||
| 1310 | struct config { | |||
| 1311 | bool_Bool raw_binary; | |||
| 1312 | }; | |||
| 1313 | ||||
| 1314 | struct config cfg = { | |||
| 1315 | .raw_binary = false0, | |||
| 1316 | }; | |||
| 1317 | ||||
| 1318 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1319 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 1320 | ||||
| 1321 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 1322 | if (err) | |||
| 1323 | return err; | |||
| 1324 | ||||
| 1325 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 1326 | if (err < 0) { | |||
| 1327 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 1328 | return err; | |||
| 1329 | } | |||
| 1330 | ||||
| 1331 | if (cfg.raw_binary) | |||
| 1332 | flags = BINARY; | |||
| 1333 | ||||
| 1334 | fw_log = libnvme_alloc(sizeof(*fw_log)); | |||
| 1335 | if (!fw_log) | |||
| 1336 | return -ENOMEM12; | |||
| 1337 | ||||
| 1338 | err = nvme_get_log_fw_slot(hdl, false0, fw_log); | |||
| 1339 | if (err) { | |||
| 1340 | nvme_show_err(err, "fw log"); | |||
| 1341 | return err; | |||
| 1342 | } | |||
| 1343 | ||||
| 1344 | nvme_show_fw_log(fw_log, libnvme_transport_handle_get_name(hdl), flags); | |||
| 1345 | ||||
| 1346 | return err; | |||
| 1347 | } | |||
| 1348 | ||||
| 1349 | static int get_changed_ns_list_log(int argc, char **argv, bool_Bool alloc) | |||
| 1350 | { | |||
| 1351 | __cleanup_free__attribute__((cleanup(freep))) char *desc = NULL((void*)0); | |||
| 1352 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_ns_list *changed_ns_list_log = NULL((void*)0); | |||
| 1353 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 1354 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 1355 | nvme_print_flags_t flags; | |||
| 1356 | int err; | |||
| 1357 | ||||
| 1358 | struct config { | |||
| 1359 | bool_Bool raw_binary; | |||
| 1360 | }; | |||
| 1361 | ||||
| 1362 | struct config cfg = { | |||
| 1363 | .raw_binary = false0, | |||
| 1364 | }; | |||
| 1365 | ||||
| 1366 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_output, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1367 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_output))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_output, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 1368 | ||||
| 1369 | if (asprintf(&desc, "Retrieve Changed %s Namespaces log for the given device %s", | |||
| 1370 | alloc ? "Allocated" : "Attached", | |||
| 1371 | "in either decoded format (default) or binary.") < 0) | |||
| 1372 | desc = NULL((void*)0); | |||
| 1373 | ||||
| 1374 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 1375 | if (err) | |||
| 1376 | return err; | |||
| 1377 | ||||
| 1378 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 1379 | if (err < 0) { | |||
| 1380 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 1381 | return err; | |||
| 1382 | } | |||
| 1383 | ||||
| 1384 | if (cfg.raw_binary) | |||
| 1385 | flags = BINARY; | |||
| 1386 | ||||
| 1387 | changed_ns_list_log = libnvme_alloc(sizeof(*changed_ns_list_log)); | |||
| 1388 | if (!changed_ns_list_log) | |||
| 1389 | return -ENOMEM12; | |||
| 1390 | ||||
| 1391 | if (alloc) | |||
| 1392 | err = nvme_get_log_changed_alloc_ns_list(hdl, | |||
| 1393 | changed_ns_list_log, sizeof(*changed_ns_list_log)); | |||
| 1394 | else | |||
| 1395 | err = nvme_get_log_changed_ns_list(hdl, NVME_NSID_NONE, | |||
| 1396 | changed_ns_list_log); | |||
| 1397 | if (err) { | |||
| 1398 | nvme_show_err(err, alloc ? "changed allocated ns list log" : | |||
| 1399 | "changed attached ns list log"); | |||
| 1400 | return err; | |||
| 1401 | } | |||
| 1402 | ||||
| 1403 | nvme_show_changed_ns_list_log(changed_ns_list_log, | |||
| 1404 | libnvme_transport_handle_get_name(hdl), | |||
| 1405 | flags, alloc); | |||
| 1406 | ||||
| 1407 | return err; | |||
| 1408 | } | |||
| 1409 | ||||
| 1410 | static int get_changed_attach_ns_list_log(int argc, char **argv, struct command *acmd, | |||
| 1411 | struct plugin *plugin) | |||
| 1412 | { | |||
| 1413 | return get_changed_ns_list_log(argc, argv, false0); | |||
| 1414 | } | |||
| 1415 | ||||
| 1416 | static int get_changed_alloc_ns_list_log(int argc, char **argv, struct command *acmd, | |||
| 1417 | struct plugin *plugin) | |||
| 1418 | { | |||
| 1419 | return get_changed_ns_list_log(argc, argv, true1); | |||
| 1420 | } | |||
| 1421 | ||||
| 1422 | static int get_pred_lat_per_nvmset_log(int argc, char **argv, | |||
| 1423 | struct command *command, struct plugin *plugin) | |||
| 1424 | { | |||
| 1425 | const char *desc = "Retrieve Predictable latency per nvm set log " | |||
| 1426 | "page and prints it for the given device in either decoded " | |||
| 1427 | "format(default),json or binary."; | |||
| 1428 | const char *nvmset_id = "NVM Set Identifier"; | |||
| 1429 | ||||
| 1430 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_nvmset_predictable_lat_log *plpns_log = NULL((void*)0); | |||
| 1431 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 1432 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 1433 | nvme_print_flags_t flags; | |||
| 1434 | int err; | |||
| 1435 | ||||
| 1436 | struct config { | |||
| 1437 | __u16 nvmset_id; | |||
| 1438 | bool_Bool raw_binary; | |||
| 1439 | }; | |||
| 1440 | ||||
| 1441 | struct config cfg = { | |||
| 1442 | .nvmset_id = 1, | |||
| 1443 | .raw_binary = false0, | |||
| 1444 | }; | |||
| 1445 | ||||
| 1446 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"nvmset-id", 'i', "NUM", CFG_SHORT, &cfg.nvmset_id , 1, nvmset_id, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1447 | OPT_SHRT("nvmset-id", 'i', &cfg.nvmset_id, nvmset_id),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"nvmset-id", 'i', "NUM", CFG_SHORT, &cfg.nvmset_id , 1, nvmset_id, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1448 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"nvmset-id", 'i', "NUM", CFG_SHORT, &cfg.nvmset_id , 1, nvmset_id, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 1449 | ||||
| 1450 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 1451 | if (err) | |||
| 1452 | return err; | |||
| 1453 | ||||
| 1454 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 1455 | if (err < 0) { | |||
| 1456 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 1457 | return err; | |||
| 1458 | } | |||
| 1459 | ||||
| 1460 | if (cfg.raw_binary) | |||
| 1461 | flags = BINARY; | |||
| 1462 | ||||
| 1463 | plpns_log = libnvme_alloc(sizeof(*plpns_log)); | |||
| 1464 | if (!plpns_log) | |||
| 1465 | return -ENOMEM12; | |||
| 1466 | ||||
| 1467 | err = nvme_get_log_predictable_lat_nvmset(hdl, cfg.nvmset_id, | |||
| 1468 | plpns_log); | |||
| 1469 | if (err) { | |||
| 1470 | nvme_show_err(err, "predictable latency per nvm set"); | |||
| 1471 | return err; | |||
| 1472 | } | |||
| 1473 | ||||
| 1474 | nvme_show_predictable_latency_per_nvmset(plpns_log, cfg.nvmset_id, | |||
| 1475 | libnvme_transport_handle_get_name(hdl), flags); | |||
| 1476 | ||||
| 1477 | return err; | |||
| 1478 | } | |||
| 1479 | ||||
| 1480 | static int get_pred_lat_event_agg_log(int argc, char **argv, | |||
| 1481 | struct command *command, struct plugin *plugin) | |||
| 1482 | { | |||
| 1483 | const char *desc = "Retrieve Predictable Latency Event " | |||
| 1484 | "Aggregate Log page and prints it, for the given " | |||
| 1485 | "device in either decoded format(default), json or binary."; | |||
| 1486 | const char *log_entries = "Number of pending NVM Set log Entries list"; | |||
| 1487 | ||||
| 1488 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 1489 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 1490 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ctrl *ctrl = NULL((void*)0); | |||
| 1491 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) void *pea_log = NULL((void*)0); | |||
| 1492 | nvme_print_flags_t flags; | |||
| 1493 | __u32 log_size; | |||
| 1494 | int err; | |||
| 1495 | ||||
| 1496 | struct config { | |||
| 1497 | __u64 log_entries; | |||
| 1498 | bool_Bool rae; | |||
| 1499 | bool_Bool raw_binary; | |||
| 1500 | }; | |||
| 1501 | ||||
| 1502 | struct config cfg = { | |||
| 1503 | .log_entries = 2044, | |||
| 1504 | .rae = false0, | |||
| 1505 | .raw_binary = false0, | |||
| 1506 | }; | |||
| 1507 | ||||
| 1508 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"rae", 'r', ((void*)0), CFG_FLAG, & cfg.rae, 0, rae, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1509 | OPT_UINT("log-entries", 'e', &cfg.log_entries, log_entries),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"rae", 'r', ((void*)0), CFG_FLAG, & cfg.rae, 0, rae, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1510 | OPT_FLAG("rae", 'r', &cfg.rae, rae),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"rae", 'r', ((void*)0), CFG_FLAG, & cfg.rae, 0, rae, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1511 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"rae", 'r', ((void*)0), CFG_FLAG, & cfg.rae, 0, rae, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 1512 | ||||
| 1513 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 1514 | if (err) | |||
| 1515 | return err; | |||
| 1516 | ||||
| 1517 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 1518 | if (err < 0) { | |||
| 1519 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 1520 | return err; | |||
| 1521 | } | |||
| 1522 | ||||
| 1523 | if (cfg.raw_binary) | |||
| 1524 | flags = BINARY; | |||
| 1525 | ||||
| 1526 | if (!cfg.log_entries) { | |||
| 1527 | nvme_show_error("non-zero log-entries is required param")nvme_show_message(1, "non-zero log-entries is required param" ); | |||
| 1528 | return -EINVAL22; | |||
| 1529 | } | |||
| 1530 | ||||
| 1531 | ctrl = libnvme_alloc(sizeof(*ctrl)); | |||
| 1532 | if (!ctrl) | |||
| 1533 | return -ENOMEM12; | |||
| 1534 | ||||
| 1535 | err = nvme_identify_ctrl(hdl, ctrl); | |||
| 1536 | if (err) { | |||
| 1537 | nvme_show_err(err, "identify controller"); | |||
| 1538 | return err; | |||
| 1539 | } | |||
| 1540 | ||||
| 1541 | cfg.log_entries = min(cfg.log_entries, le32_to_cpu(ctrl->nsetidmax))((cfg.log_entries) > (le32_to_cpu(ctrl->nsetidmax)) ? ( le32_to_cpu(ctrl->nsetidmax)) : (cfg.log_entries)); | |||
| 1542 | log_size = sizeof(__u64) + cfg.log_entries * sizeof(__u16); | |||
| 1543 | ||||
| 1544 | pea_log = libnvme_alloc(log_size); | |||
| 1545 | if (!pea_log) | |||
| 1546 | return -ENOMEM12; | |||
| 1547 | ||||
| 1548 | err = nvme_get_log_predictable_lat_event(hdl, cfg.rae, 0, pea_log, | |||
| 1549 | log_size); | |||
| 1550 | if (err) { | |||
| 1551 | nvme_show_err(err, | |||
| 1552 | "predictable latency event aggregate log page"); | |||
| 1553 | return err; | |||
| 1554 | } | |||
| 1555 | ||||
| 1556 | nvme_show_predictable_latency_event_agg_log(pea_log, cfg.log_entries, | |||
| 1557 | log_size, libnvme_transport_handle_get_name(hdl), flags); | |||
| 1558 | ||||
| 1559 | return err; | |||
| 1560 | } | |||
| 1561 | ||||
| 1562 | static int get_persistent_event_log(int argc, char **argv, | |||
| 1563 | struct command *command, struct plugin *plugin) | |||
| 1564 | { | |||
| 1565 | const char *desc = "Retrieve Persistent Event log info for " | |||
| 1566 | "the given device in either decoded format(default), json or binary."; | |||
| 1567 | const char *action = "action the controller shall take during " | |||
| 1568 | "processing this persistent log page command."; | |||
| 1569 | const char *log_len = "number of bytes to retrieve"; | |||
| 1570 | ||||
| 1571 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_persistent_event_log *pevent = NULL((void*)0); | |||
| 1572 | struct nvme_persistent_event_log *pevent_collected = NULL((void*)0); | |||
| 1573 | __cleanup_huge__attribute__((cleanup(libnvme_free_huge))) struct libnvme_mem_huge mh = { 0, }; | |||
| 1574 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 1575 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 1576 | nvme_print_flags_t flags; | |||
| 1577 | void *pevent_log_info; | |||
| 1578 | int err; | |||
| 1579 | ||||
| 1580 | struct config { | |||
| 1581 | __u8 action; | |||
| 1582 | __u32 log_len; | |||
| 1583 | bool_Bool raw_binary; | |||
| 1584 | }; | |||
| 1585 | ||||
| 1586 | struct config cfg = { | |||
| 1587 | .action = 0xff, | |||
| 1588 | .log_len = 0, | |||
| 1589 | .raw_binary = false0, | |||
| 1590 | }; | |||
| 1591 | ||||
| 1592 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"action", 'a', "NUM", CFG_BYTE, &cfg.action, 1, action , 0, }, {"log_len", 'l', "NUM", CFG_POSITIVE, &cfg.log_len , 1, log_len, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1593 | OPT_BYTE("action", 'a', &cfg.action, action),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"action", 'a', "NUM", CFG_BYTE, &cfg.action, 1, action , 0, }, {"log_len", 'l', "NUM", CFG_POSITIVE, &cfg.log_len , 1, log_len, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1594 | OPT_UINT("log_len", 'l', &cfg.log_len, log_len),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"action", 'a', "NUM", CFG_BYTE, &cfg.action, 1, action , 0, }, {"log_len", 'l', "NUM", CFG_POSITIVE, &cfg.log_len , 1, log_len, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1595 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"action", 'a', "NUM", CFG_BYTE, &cfg.action, 1, action , 0, }, {"log_len", 'l', "NUM", CFG_POSITIVE, &cfg.log_len , 1, log_len, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 1596 | ||||
| 1597 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 1598 | if (err) | |||
| 1599 | return err; | |||
| 1600 | ||||
| 1601 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 1602 | if (err < 0) { | |||
| 1603 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 1604 | return err; | |||
| 1605 | } | |||
| 1606 | ||||
| 1607 | if (cfg.raw_binary) | |||
| 1608 | flags = BINARY; | |||
| 1609 | ||||
| 1610 | pevent = libnvme_alloc(sizeof(*pevent)); | |||
| 1611 | if (!pevent) | |||
| 1612 | return -ENOMEM12; | |||
| 1613 | ||||
| 1614 | err = nvme_get_log_persistent_event(hdl, cfg.action, pevent, | |||
| 1615 | sizeof(*pevent)); | |||
| 1616 | if (err) { | |||
| 1617 | nvme_show_err(err, "persistent event log"); | |||
| 1618 | return err; | |||
| 1619 | } | |||
| 1620 | ||||
| 1621 | if (cfg.action == NVME_PEVENT_LOG_RELEASE_CTX) { | |||
| 1622 | printf("Releasing Persistent Event Log Context\n"); | |||
| 1623 | return 0; | |||
| 1624 | } | |||
| 1625 | ||||
| 1626 | if (!cfg.log_len && cfg.action != NVME_PEVENT_LOG_EST_CTX_AND_READ) { | |||
| 1627 | cfg.log_len = le64_to_cpu(pevent->tll); | |||
| 1628 | } else if (!cfg.log_len && cfg.action == NVME_PEVENT_LOG_EST_CTX_AND_READ) { | |||
| 1629 | printf("Establishing Persistent Event Log Context\n"); | |||
| 1630 | return 0; | |||
| 1631 | } | |||
| 1632 | ||||
| 1633 | /* | |||
| 1634 | * if header already read with context establish action 0x1, | |||
| 1635 | * action shall not be 0x1 again in the subsequent request, | |||
| 1636 | * until the current context is released by issuing action | |||
| 1637 | * with 0x2, otherwise throws command sequence error, make | |||
| 1638 | * it as zero to read the log page | |||
| 1639 | */ | |||
| 1640 | if (cfg.action == NVME_PEVENT_LOG_EST_CTX_AND_READ) | |||
| 1641 | cfg.action = NVME_PEVENT_LOG_READ; | |||
| 1642 | ||||
| 1643 | pevent_log_info = libnvme_alloc_huge(cfg.log_len, &mh); | |||
| 1644 | if (!pevent_log_info) { | |||
| 1645 | nvme_show_error("failed to allocate huge memory")nvme_show_message(1, "failed to allocate huge memory"); | |||
| 1646 | return -ENOMEM12; | |||
| 1647 | } | |||
| 1648 | ||||
| 1649 | err = nvme_get_log_persistent_event(hdl, cfg.action, | |||
| 1650 | pevent_log_info, cfg.log_len); | |||
| 1651 | if (err) { | |||
| 1652 | nvme_show_err(err, "persistent event log"); | |||
| 1653 | return err; | |||
| 1654 | } | |||
| 1655 | ||||
| 1656 | err = nvme_get_log_persistent_event(hdl, cfg.action, pevent, | |||
| 1657 | sizeof(*pevent)); | |||
| 1658 | if (err) { | |||
| 1659 | nvme_show_err(err, "persistent event log"); | |||
| 1660 | return err; | |||
| 1661 | } | |||
| 1662 | ||||
| 1663 | pevent_collected = pevent_log_info; | |||
| 1664 | if (pevent_collected->gen_number != pevent->gen_number) { | |||
| 1665 | printf("Collected Persistent Event Log may be invalid,\n" | |||
| 1666 | "Re-read the log is required\n"); | |||
| 1667 | return -EINVAL22; | |||
| 1668 | } | |||
| 1669 | ||||
| 1670 | nvme_show_persistent_event_log(pevent_log_info, cfg.action, | |||
| 1671 | cfg.log_len, libnvme_transport_handle_get_name(hdl), flags); | |||
| 1672 | ||||
| 1673 | return err; | |||
| 1674 | } | |||
| 1675 | ||||
| 1676 | static int get_endurance_event_agg_log(int argc, char **argv, | |||
| 1677 | struct command *command, struct plugin *plugin) | |||
| 1678 | { | |||
| 1679 | const char *desc = "Retrieve Retrieve Predictable Latency " | |||
| 1680 | "Event Aggregate page and prints it, for the given " | |||
| 1681 | "device in either decoded format(default), json or binary."; | |||
| 1682 | const char *log_entries = "Number of pending Endurance Group Event log Entries list"; | |||
| 1683 | ||||
| 1684 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 1685 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 1686 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ctrl *ctrl = NULL((void*)0); | |||
| 1687 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) void *endurance_log = NULL((void*)0); | |||
| 1688 | nvme_print_flags_t flags; | |||
| 1689 | __u32 log_size; | |||
| 1690 | int err; | |||
| 1691 | ||||
| 1692 | struct config { | |||
| 1693 | __u64 log_entries; | |||
| 1694 | bool_Bool rae; | |||
| 1695 | bool_Bool raw_binary; | |||
| 1696 | }; | |||
| 1697 | ||||
| 1698 | struct config cfg = { | |||
| 1699 | .log_entries = 2044, | |||
| 1700 | .rae = false0, | |||
| 1701 | .raw_binary = false0, | |||
| 1702 | }; | |||
| 1703 | ||||
| 1704 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"rae", 'r', ((void*)0), CFG_FLAG, & cfg.rae, 0, rae, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1705 | OPT_UINT("log-entries", 'e', &cfg.log_entries, log_entries),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"rae", 'r', ((void*)0), CFG_FLAG, & cfg.rae, 0, rae, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1706 | OPT_FLAG("rae", 'r', &cfg.rae, rae),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"rae", 'r', ((void*)0), CFG_FLAG, & cfg.rae, 0, rae, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1707 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries , 1, log_entries, 0, }, {"rae", 'r', ((void*)0), CFG_FLAG, & cfg.rae, 0, rae, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 1708 | ||||
| 1709 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 1710 | if (err) | |||
| 1711 | return err; | |||
| 1712 | ||||
| 1713 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 1714 | if (err < 0) { | |||
| 1715 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 1716 | return err; | |||
| 1717 | } | |||
| 1718 | ||||
| 1719 | if (cfg.raw_binary) | |||
| 1720 | flags = BINARY; | |||
| 1721 | ||||
| 1722 | if (!cfg.log_entries) { | |||
| 1723 | nvme_show_error("non-zero log-entries is required param")nvme_show_message(1, "non-zero log-entries is required param" ); | |||
| 1724 | return -EINVAL22; | |||
| 1725 | } | |||
| 1726 | ||||
| 1727 | ctrl = libnvme_alloc(sizeof(*ctrl)); | |||
| 1728 | if (!ctrl) | |||
| 1729 | return -ENOMEM12; | |||
| 1730 | ||||
| 1731 | err = nvme_identify_ctrl(hdl, ctrl); | |||
| 1732 | if (err < 0) { | |||
| 1733 | nvme_show_error("identify controller: %s", libnvme_strerror(-err))nvme_show_message(1, "identify controller: %s", libnvme_strerror (-err)); | |||
| 1734 | return err; | |||
| 1735 | } else if (err) { | |||
| 1736 | nvme_show_error("could not identify controller")nvme_show_message(1, "could not identify controller"); | |||
| 1737 | return -ENODEV19; | |||
| 1738 | } | |||
| 1739 | ||||
| 1740 | cfg.log_entries = min(cfg.log_entries, le16_to_cpu(ctrl->endgidmax))((cfg.log_entries) > (le16_to_cpu(ctrl->endgidmax)) ? ( le16_to_cpu(ctrl->endgidmax)) : (cfg.log_entries)); | |||
| 1741 | log_size = sizeof(__u64) + cfg.log_entries * sizeof(__u16); | |||
| 1742 | ||||
| 1743 | endurance_log = libnvme_alloc(log_size); | |||
| 1744 | if (!endurance_log) | |||
| 1745 | return -ENOMEM12; | |||
| 1746 | ||||
| 1747 | err = nvme_get_log_endurance_grp_evt(hdl, cfg.rae, 0, endurance_log, | |||
| 1748 | log_size); | |||
| 1749 | if (err) { | |||
| 1750 | nvme_show_err(err, "endurance group event aggregate log page"); | |||
| 1751 | return err; | |||
| 1752 | } | |||
| 1753 | ||||
| 1754 | nvme_show_endurance_group_event_agg_log(endurance_log, cfg.log_entries, | |||
| 1755 | log_size, libnvme_transport_handle_get_name(hdl), flags); | |||
| 1756 | ||||
| 1757 | return err; | |||
| 1758 | } | |||
| 1759 | ||||
| 1760 | static int get_lba_status_log(int argc, char **argv, | |||
| 1761 | struct command *command, struct plugin *plugin) | |||
| 1762 | { | |||
| 1763 | const char *desc = "Retrieve Get LBA Status Info Log and prints it, " | |||
| 1764 | "for the given device in either decoded format(default),json or binary."; | |||
| 1765 | ||||
| 1766 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 1767 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 1768 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) void *lba_status = NULL((void*)0); | |||
| 1769 | nvme_print_flags_t flags; | |||
| 1770 | __u32 lslplen; | |||
| 1771 | int err; | |||
| 1772 | ||||
| 1773 | struct config { | |||
| 1774 | bool_Bool rae; | |||
| 1775 | }; | |||
| 1776 | ||||
| 1777 | struct config cfg = { | |||
| 1778 | .rae = false0, | |||
| 1779 | }; | |||
| 1780 | ||||
| 1781 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"rae", 'r', ((void*)0), CFG_FLAG, &cfg.rae, 0, rae , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 1782 | OPT_FLAG("rae", 'r', &cfg.rae, rae))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"rae", 'r', ((void*)0), CFG_FLAG, &cfg.rae, 0, rae , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 1783 | ||||
| 1784 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 1785 | if (err) | |||
| 1786 | return err; | |||
| 1787 | ||||
| 1788 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 1789 | if (err < 0) { | |||
| 1790 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 1791 | return err; | |||
| 1792 | } | |||
| 1793 | ||||
| 1794 | err = nvme_get_log_lba_status(hdl, false0, 0, &lslplen, sizeof(__u32)); | |||
| 1795 | if (err) { | |||
| 1796 | nvme_show_err(err, "lba status log page"); | |||
| 1797 | return err; | |||
| 1798 | } | |||
| 1799 | ||||
| 1800 | lba_status = libnvme_alloc(lslplen); | |||
| 1801 | if (!lba_status) | |||
| 1802 | return -ENOMEM12; | |||
| 1803 | ||||
| 1804 | err = nvme_get_log_lba_status(hdl, cfg.rae, 0, lba_status, lslplen); | |||
| 1805 | if (err) { | |||
| 1806 | nvme_show_err(err, "lba status log page"); | |||
| 1807 | return err; | |||
| 1808 | } | |||
| 1809 | ||||
| 1810 | nvme_show_lba_status_log(lba_status, lslplen, | |||
| 1811 | libnvme_transport_handle_get_name(hdl), flags); | |||
| 1812 | ||||
| 1813 | return err; | |||
| 1814 | } | |||
| 1815 | ||||
| 1816 | static int get_resv_notif_log(int argc, char **argv, | |||
| 1817 | struct command *command, struct plugin *plugin) | |||
| 1818 | { | |||
| 1819 | ||||
| 1820 | const char *desc = "Retrieve Reservation Notification " | |||
| 1821 | "log page and prints it, for the given " | |||
| 1822 | "device in either decoded format(default), json or binary."; | |||
| 1823 | ||||
| 1824 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_resv_notification_log *resv = NULL((void*)0); | |||
| 1825 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 1826 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 1827 | nvme_print_flags_t flags; | |||
| 1828 | int err; | |||
| 1829 | ||||
| 1830 | NVME_ARGS(opts)struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 1831 | ||||
| 1832 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 1833 | if (err) | |||
| 1834 | return err; | |||
| 1835 | ||||
| 1836 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 1837 | if (err < 0) { | |||
| 1838 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 1839 | return err; | |||
| 1840 | } | |||
| 1841 | ||||
| 1842 | resv = libnvme_alloc(sizeof(*resv)); | |||
| 1843 | if (!resv) | |||
| 1844 | return -ENOMEM12; | |||
| 1845 | ||||
| 1846 | err = nvme_get_log_reservation(hdl, resv); | |||
| 1847 | if (err) { | |||
| 1848 | nvme_show_err(err, "resv notifi log"); | |||
| 1849 | return err; | |||
| 1850 | } | |||
| 1851 | ||||
| 1852 | nvme_show_resv_notif_log(resv, libnvme_transport_handle_get_name(hdl), | |||
| 1853 | flags); | |||
| 1854 | ||||
| 1855 | return err; | |||
| 1856 | ||||
| 1857 | } | |||
| 1858 | ||||
| 1859 | static int get_boot_part_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 1860 | { | |||
| 1861 | const char *desc = "Retrieve Boot Partition " | |||
| 1862 | "log page and prints it, for the given " | |||
| 1863 | "device in either decoded format(default), json or binary."; | |||
| 1864 | const char *fname = "boot partition data output file name"; | |||
| 1865 | ||||
| 1866 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 1867 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 1868 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_boot_partition *boot = NULL((void*)0); | |||
| 1869 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) __u8 *bp_log = NULL((void*)0); | |||
| 1870 | nvme_print_flags_t flags; | |||
| 1871 | int err = -1; | |||
| 1872 | __cleanup_fd__attribute__((cleanup(cleanup_fd))) int output = -1; | |||
| 1873 | __u32 bpsz = 0; | |||
| 1874 | ||||
| 1875 | struct config { | |||
| 1876 | __u8 lsp; | |||
| 1877 | char *file_name; | |||
| 1878 | }; | |||
| 1879 | ||||
| 1880 | struct config cfg = { | |||
| 1881 | .lsp = 0, | |||
| 1882 | .file_name = NULL((void*)0), | |||
| 1883 | }; | |||
| 1884 | ||||
| 1885 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"lsp", 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"output-file", 'f', "FILE", CFG_STRING, &cfg.file_name , 1, fname, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1886 | OPT_BYTE("lsp", 's', &cfg.lsp, lsp),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"lsp", 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"output-file", 'f', "FILE", CFG_STRING, &cfg.file_name , 1, fname, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1887 | OPT_FILE("output-file", 'f', &cfg.file_name, fname))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"lsp", 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"output-file", 'f', "FILE", CFG_STRING, &cfg.file_name , 1, fname, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 1888 | ||||
| 1889 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 1890 | if (err) | |||
| 1891 | return err; | |||
| 1892 | ||||
| 1893 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 1894 | if (err < 0) { | |||
| 1895 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 1896 | return err; | |||
| 1897 | } | |||
| 1898 | ||||
| 1899 | if (!cfg.file_name) { | |||
| 1900 | nvme_show_error("Please provide an output file!")nvme_show_message(1, "Please provide an output file!"); | |||
| 1901 | return -1; | |||
| 1902 | } | |||
| 1903 | ||||
| 1904 | if (cfg.lsp > 127) { | |||
| 1905 | nvme_show_error("invalid lsp param: %u", cfg.lsp)nvme_show_message(1, "invalid lsp param: %u", cfg.lsp); | |||
| 1906 | return -1; | |||
| 1907 | } | |||
| 1908 | ||||
| 1909 | output = nvme_open_rawdata(cfg.file_name, O_WRONLY | O_CREAT | O_TRUNC, 0666)open((cfg.file_name), (01 | 0100 | 01000), 0666); | |||
| 1910 | if (output < 0) { | |||
| 1911 | nvme_show_error("Failed to open output file %s: %s!",nvme_show_message(1, "Failed to open output file %s: %s!", cfg .file_name, libnvme_strerror((*__errno_location ()))) | |||
| 1912 | cfg.file_name, libnvme_strerror(errno))nvme_show_message(1, "Failed to open output file %s: %s!", cfg .file_name, libnvme_strerror((*__errno_location ()))); | |||
| 1913 | return output; | |||
| 1914 | } | |||
| 1915 | ||||
| 1916 | boot = libnvme_alloc(sizeof(*boot)); | |||
| 1917 | if (!boot) | |||
| 1918 | return -ENOMEM12; | |||
| 1919 | ||||
| 1920 | err = nvme_get_log_boot_partition(hdl, cfg.lsp, boot, sizeof(*boot)); | |||
| 1921 | if (err) { | |||
| 1922 | nvme_show_err(err, "boot partition log"); | |||
| 1923 | return err; | |||
| 1924 | } | |||
| 1925 | ||||
| 1926 | bpsz = (boot->bpinfo & 0x7fff) * 128 * 1024; | |||
| 1927 | bp_log = libnvme_alloc(sizeof(*boot) + bpsz); | |||
| 1928 | if (!bp_log) | |||
| 1929 | return -ENOMEM12; | |||
| 1930 | ||||
| 1931 | err = nvme_get_log_boot_partition(hdl, cfg.lsp, | |||
| 1932 | (struct nvme_boot_partition *)bp_log, | |||
| 1933 | sizeof(*boot) + bpsz); | |||
| 1934 | if (err) | |||
| 1935 | nvme_show_err(err, "boot partition log"); | |||
| 1936 | else | |||
| 1937 | nvme_show_boot_part_log(&bp_log, | |||
| 1938 | libnvme_transport_handle_get_name(hdl), | |||
| 1939 | sizeof(*boot) + bpsz, flags); | |||
| 1940 | ||||
| 1941 | err = write(output, (void *) bp_log + sizeof(*boot), bpsz); | |||
| 1942 | if (err != bpsz) | |||
| 1943 | fprintf(stderrstderr, "Failed to flush all data to file!\n"); | |||
| 1944 | else | |||
| 1945 | printf("Data flushed into file %s\n", cfg.file_name); | |||
| 1946 | ||||
| 1947 | return 0; | |||
| 1948 | } | |||
| 1949 | ||||
| 1950 | static int get_phy_rx_eom_log(int argc, char **argv, struct command *acmd, | |||
| 1951 | struct plugin *plugin) | |||
| 1952 | { | |||
| 1953 | const char *desc = "Retrieve Physical Interface Receiver Eye Opening " | |||
| 1954 | "Measurement log for the given device in decoded format " | |||
| 1955 | "(default), json or binary."; | |||
| 1956 | const char *controller = "Target Controller ID."; | |||
| 1957 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_phy_rx_eom_log *phy_rx_eom_log = NULL((void*)0); | |||
| 1958 | size_t phy_rx_eom_log_len; | |||
| 1959 | nvme_print_flags_t flags; | |||
| 1960 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 1961 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 1962 | int err = -1; | |||
| 1963 | __u8 lsp_tmp; | |||
| 1964 | ||||
| 1965 | struct config { | |||
| 1966 | __u8 lsp; | |||
| 1967 | __u16 controller; | |||
| 1968 | }; | |||
| 1969 | ||||
| 1970 | struct config cfg = { | |||
| 1971 | .lsp = 0, | |||
| 1972 | .controller = NVME_LOG_LSI_NONE, | |||
| 1973 | }; | |||
| 1974 | ||||
| 1975 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"lsp", 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"controller", 'c', "NUM", CFG_SHORT, &cfg.controller , 1, controller, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1976 | OPT_BYTE("lsp", 's', &cfg.lsp, lsp),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"lsp", 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"controller", 'c', "NUM", CFG_SHORT, &cfg.controller , 1, controller, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 1977 | OPT_SHRT("controller", 'c', &cfg.controller, controller))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"lsp", 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"controller", 'c', "NUM", CFG_SHORT, &cfg.controller , 1, controller, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 1978 | ||||
| 1979 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 1980 | if (err) | |||
| 1981 | return err; | |||
| 1982 | ||||
| 1983 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 1984 | if (err < 0) { | |||
| 1985 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 1986 | return err; | |||
| 1987 | } | |||
| 1988 | ||||
| 1989 | if (cfg.lsp > 127) { | |||
| 1990 | nvme_show_error("invalid lsp param: %u", cfg.lsp)nvme_show_message(1, "invalid lsp param: %u", cfg.lsp); | |||
| 1991 | return -1; | |||
| 1992 | } else if ((cfg.lsp & 3) == 3) { | |||
| 1993 | nvme_show_error("invalid measurement quality: %u", cfg.lsp & 3)nvme_show_message(1, "invalid measurement quality: %u", cfg.lsp & 3); | |||
| 1994 | return -1; | |||
| 1995 | } else if ((cfg.lsp & 12) == 12) { | |||
| 1996 | nvme_show_error("invalid action: %u", cfg.lsp & 12)nvme_show_message(1, "invalid action: %u", cfg.lsp & 12); | |||
| 1997 | return -1; | |||
| 1998 | } | |||
| 1999 | ||||
| 2000 | /* Fetching header to calculate total log length */ | |||
| 2001 | phy_rx_eom_log_len = sizeof(struct nvme_phy_rx_eom_log); | |||
| 2002 | phy_rx_eom_log = libnvme_alloc(phy_rx_eom_log_len); | |||
| 2003 | if (!phy_rx_eom_log) | |||
| 2004 | return -ENOMEM12; | |||
| 2005 | ||||
| 2006 | /* Just read measurement, take given action when fetching full log */ | |||
| 2007 | lsp_tmp = cfg.lsp & 0xf3; | |||
| 2008 | ||||
| 2009 | err = nvme_get_log_phy_rx_eom(hdl, lsp_tmp, cfg.controller, | |||
| 2010 | phy_rx_eom_log, phy_rx_eom_log_len); | |||
| 2011 | if (err) { | |||
| 2012 | nvme_show_err(err, "phy-rx-eom-log"); | |||
| 2013 | return err; | |||
| 2014 | } | |||
| 2015 | ||||
| 2016 | if (phy_rx_eom_log->eomip == NVME_PHY_RX_EOM_COMPLETED) | |||
| 2017 | phy_rx_eom_log_len = le16_to_cpu(phy_rx_eom_log->hsize) + | |||
| 2018 | le32_to_cpu(phy_rx_eom_log->dsize) * | |||
| 2019 | le16_to_cpu(phy_rx_eom_log->nd); | |||
| 2020 | else | |||
| 2021 | phy_rx_eom_log_len = le16_to_cpu(phy_rx_eom_log->hsize); | |||
| 2022 | ||||
| 2023 | phy_rx_eom_log = libnvme_realloc(phy_rx_eom_log, phy_rx_eom_log_len); | |||
| 2024 | if (!phy_rx_eom_log) | |||
| 2025 | return -ENOMEM12; | |||
| 2026 | ||||
| 2027 | err = nvme_get_log_phy_rx_eom(hdl, cfg.lsp, cfg.controller, | |||
| 2028 | phy_rx_eom_log, phy_rx_eom_log_len); | |||
| 2029 | if (err) { | |||
| 2030 | nvme_show_err(err, "phy-rx-eom-log"); | |||
| 2031 | return err; | |||
| 2032 | } | |||
| 2033 | ||||
| 2034 | nvme_show_phy_rx_eom_log(phy_rx_eom_log, cfg.controller, flags); | |||
| 2035 | ||||
| 2036 | return err; | |||
| 2037 | } | |||
| 2038 | ||||
| 2039 | static int get_media_unit_stat_log(int argc, char **argv, struct command *acmd, | |||
| 2040 | struct plugin *plugin) | |||
| 2041 | { | |||
| 2042 | const char *desc = "Retrieve the configuration and wear of media units and print it"; | |||
| 2043 | ||||
| 2044 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_media_unit_stat_log *mus = NULL((void*)0); | |||
| 2045 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 2046 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 2047 | nvme_print_flags_t flags; | |||
| 2048 | int err = -1; | |||
| 2049 | ||||
| 2050 | struct config { | |||
| 2051 | __u16 domainid; | |||
| 2052 | bool_Bool raw_binary; | |||
| 2053 | }; | |||
| 2054 | ||||
| 2055 | struct config cfg = { | |||
| 2056 | .domainid = 0, | |||
| 2057 | .raw_binary = false0, | |||
| 2058 | }; | |||
| 2059 | ||||
| 2060 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"domain-id", 'd', "NUM", CFG_POSITIVE, &cfg.domainid , 1, domainid, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2061 | OPT_UINT("domain-id", 'd', &cfg.domainid, domainid),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"domain-id", 'd', "NUM", CFG_POSITIVE, &cfg.domainid , 1, domainid, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2062 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"domain-id", 'd', "NUM", CFG_POSITIVE, &cfg.domainid , 1, domainid, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 2063 | ||||
| 2064 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 2065 | if (err) | |||
| 2066 | return err; | |||
| 2067 | ||||
| 2068 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 2069 | if (err < 0) { | |||
| 2070 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 2071 | return err; | |||
| 2072 | } | |||
| 2073 | ||||
| 2074 | if (cfg.raw_binary) | |||
| 2075 | flags = BINARY; | |||
| 2076 | ||||
| 2077 | mus = libnvme_alloc(sizeof(*mus)); | |||
| 2078 | if (!mus) | |||
| 2079 | return -ENOMEM12; | |||
| 2080 | ||||
| 2081 | err = nvme_get_log_media_unit_stat(hdl, cfg.domainid, mus); | |||
| 2082 | if (err) { | |||
| 2083 | nvme_show_err(err, "media unit status log"); | |||
| 2084 | return err; | |||
| 2085 | } | |||
| 2086 | ||||
| 2087 | nvme_show_media_unit_stat_log(mus, flags); | |||
| 2088 | ||||
| 2089 | return err; | |||
| 2090 | } | |||
| 2091 | ||||
| 2092 | static int get_supp_cap_config_log(int argc, char **argv, struct command *acmd, | |||
| 2093 | struct plugin *plugin) | |||
| 2094 | { | |||
| 2095 | const char *desc = "Retrieve the list of Supported Capacity Configuration Descriptors"; | |||
| 2096 | ||||
| 2097 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_supported_cap_config_list_log *cap_log = NULL((void*)0); | |||
| 2098 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 2099 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 2100 | nvme_print_flags_t flags; | |||
| 2101 | int err = -1; | |||
| 2102 | ||||
| 2103 | struct config { | |||
| 2104 | __u16 domainid; | |||
| 2105 | bool_Bool raw_binary; | |||
| 2106 | }; | |||
| 2107 | ||||
| 2108 | struct config cfg = { | |||
| 2109 | .domainid = 0, | |||
| 2110 | .raw_binary = false0, | |||
| 2111 | }; | |||
| 2112 | ||||
| 2113 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"domain-id", 'd', "NUM", CFG_POSITIVE, &cfg.domainid , 1, domainid, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2114 | OPT_UINT("domain-id", 'd', &cfg.domainid, domainid),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"domain-id", 'd', "NUM", CFG_POSITIVE, &cfg.domainid , 1, domainid, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2115 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"domain-id", 'd', "NUM", CFG_POSITIVE, &cfg.domainid , 1, domainid, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_use, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 2116 | ||||
| 2117 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 2118 | if (err) | |||
| 2119 | return err; | |||
| 2120 | ||||
| 2121 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 2122 | if (err < 0) { | |||
| 2123 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 2124 | return err; | |||
| 2125 | } | |||
| 2126 | ||||
| 2127 | if (cfg.raw_binary) | |||
| 2128 | flags = BINARY; | |||
| 2129 | ||||
| 2130 | cap_log = libnvme_alloc(sizeof(*cap_log)); | |||
| 2131 | if (!cap_log) | |||
| 2132 | return -ENOMEM12; | |||
| 2133 | ||||
| 2134 | err = nvme_get_log_support_cap_config_list(hdl, cfg.domainid, cap_log); | |||
| 2135 | if (err) { | |||
| 2136 | nvme_show_err(err, "supported capacity configuration list log"); | |||
| 2137 | return err; | |||
| 2138 | } | |||
| 2139 | ||||
| 2140 | nvme_show_supported_cap_config_log(cap_log, flags); | |||
| 2141 | ||||
| 2142 | return err; | |||
| 2143 | } | |||
| 2144 | ||||
| 2145 | static int io_mgmt_send(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 2146 | { | |||
| 2147 | const char *desc = "I/O Management Send"; | |||
| 2148 | const char *data = "optional file for data (default stdin)"; | |||
| 2149 | ||||
| 2150 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 2151 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 2152 | __cleanup_fd__attribute__((cleanup(cleanup_fd))) int dfd = STDIN_FILENO0; | |||
| 2153 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) void *buf = NULL((void*)0); | |||
| 2154 | struct libnvme_passthru_cmd cmd; | |||
| 2155 | int err = -1; | |||
| 2156 | ||||
| 2157 | struct config { | |||
| 2158 | __u32 nsid; | |||
| 2159 | __u16 mos; | |||
| 2160 | __u8 mo; | |||
| 2161 | char *file; | |||
| 2162 | __u32 data_len; | |||
| 2163 | }; | |||
| 2164 | ||||
| 2165 | struct config cfg = { | |||
| 2166 | .mos = 0, | |||
| 2167 | }; | |||
| 2168 | ||||
| 2169 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"mos", 's', "NUM", CFG_SHORT , &cfg.mos, 1, mos, 0, }, {"mo", 'm', "NUM", CFG_BYTE, & cfg.mo, 1, mo, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, & cfg.data_len, 1, buf_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2170 | OPT_UINT("namespace-id", 'n', &cfg.nsid, namespace_id_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"mos", 's', "NUM", CFG_SHORT , &cfg.mos, 1, mos, 0, }, {"mo", 'm', "NUM", CFG_BYTE, & cfg.mo, 1, mo, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, & cfg.data_len, 1, buf_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2171 | OPT_SHRT("mos", 's', &cfg.mos, mos),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"mos", 's', "NUM", CFG_SHORT , &cfg.mos, 1, mos, 0, }, {"mo", 'm', "NUM", CFG_BYTE, & cfg.mo, 1, mo, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, & cfg.data_len, 1, buf_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2172 | OPT_BYTE("mo", 'm', &cfg.mo, mo),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"mos", 's', "NUM", CFG_SHORT , &cfg.mos, 1, mos, 0, }, {"mo", 'm', "NUM", CFG_BYTE, & cfg.mo, 1, mo, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, & cfg.data_len, 1, buf_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2173 | OPT_FILE("data", 'd', &cfg.file, data),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"mos", 's', "NUM", CFG_SHORT , &cfg.mos, 1, mos, 0, }, {"mo", 'm', "NUM", CFG_BYTE, & cfg.mo, 1, mo, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, & cfg.data_len, 1, buf_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2174 | OPT_UINT("data-len", 'l', &cfg.data_len, buf_len))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"mos", 's', "NUM", CFG_SHORT , &cfg.mos, 1, mos, 0, }, {"mo", 'm', "NUM", CFG_BYTE, & cfg.mo, 1, mo, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, & cfg.data_len, 1, buf_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 2175 | ||||
| 2176 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 2177 | if (err) | |||
| 2178 | return err; | |||
| 2179 | ||||
| 2180 | if (!cfg.nsid) { | |||
| 2181 | err = libnvme_get_nsid(hdl, &cfg.nsid); | |||
| 2182 | if (err < 0) { | |||
| 2183 | nvme_show_perror("get-namespace-id"); | |||
| 2184 | return err; | |||
| 2185 | } | |||
| 2186 | } | |||
| 2187 | ||||
| 2188 | if (cfg.data_len) { | |||
| 2189 | buf = libnvme_alloc(cfg.data_len); | |||
| 2190 | if (!buf) | |||
| 2191 | return -ENOMEM12; | |||
| 2192 | } | |||
| 2193 | ||||
| 2194 | if (cfg.file) { | |||
| 2195 | dfd = open(cfg.file, O_RDONLY00); | |||
| 2196 | if (dfd < 0) { | |||
| 2197 | nvme_show_perror(cfg.file); | |||
| 2198 | return -errno(*__errno_location ()); | |||
| 2199 | } | |||
| 2200 | } | |||
| 2201 | ||||
| 2202 | err = read(dfd, buf, cfg.data_len); | |||
| 2203 | if (err < 0) { | |||
| 2204 | nvme_show_perror("read"); | |||
| 2205 | return err; | |||
| 2206 | } | |||
| 2207 | ||||
| 2208 | nvme_init_io_mgmt_send(&cmd, cfg.nsid, cfg.mo, cfg.mos, buf, cfg.data_len); | |||
| 2209 | err = libnvme_exec_io_passthru(hdl, &cmd); | |||
| 2210 | if (err) { | |||
| 2211 | nvme_show_err(err, "io-mgmt-send"); | |||
| 2212 | return err; | |||
| 2213 | } | |||
| 2214 | ||||
| 2215 | printf("io-mgmt-send: Success, mos:%u mo:%u nsid:%d\n", cfg.mos, cfg.mo, | |||
| 2216 | cfg.nsid); | |||
| 2217 | ||||
| 2218 | return err; | |||
| 2219 | } | |||
| 2220 | ||||
| 2221 | static int io_mgmt_recv(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 2222 | { | |||
| 2223 | const char *desc = "I/O Management Receive"; | |||
| 2224 | const char *data = "optional file for data (default stdout)"; | |||
| 2225 | ||||
| 2226 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 2227 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 2228 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) void *buf = NULL((void*)0); | |||
| 2229 | struct libnvme_passthru_cmd cmd; | |||
| 2230 | __cleanup_fd__attribute__((cleanup(cleanup_fd))) int dfd = -1; | |||
| 2231 | int err = -1; | |||
| 2232 | ||||
| 2233 | struct config { | |||
| 2234 | __u16 mos; | |||
| 2235 | __u8 mo; | |||
| 2236 | __u32 nsid; | |||
| 2237 | char *file; | |||
| 2238 | __u32 data_len; | |||
| 2239 | }; | |||
| 2240 | ||||
| 2241 | struct config cfg = { | |||
| 2242 | .mos = 0, | |||
| 2243 | }; | |||
| 2244 | ||||
| 2245 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"mos", 's', "NUM", CFG_SHORT , &cfg.mos, 1, mos, 0, }, {"mo", 'm', "NUM", CFG_BYTE, & cfg.mo, 1, mo, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, & cfg.data_len, 1, buf_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2246 | OPT_UINT("namespace-id", 'n', &cfg.nsid, namespace_id_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"mos", 's', "NUM", CFG_SHORT , &cfg.mos, 1, mos, 0, }, {"mo", 'm', "NUM", CFG_BYTE, & cfg.mo, 1, mo, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, & cfg.data_len, 1, buf_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2247 | OPT_SHRT("mos", 's', &cfg.mos, mos),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"mos", 's', "NUM", CFG_SHORT , &cfg.mos, 1, mos, 0, }, {"mo", 'm', "NUM", CFG_BYTE, & cfg.mo, 1, mo, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, & cfg.data_len, 1, buf_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2248 | OPT_BYTE("mo", 'm', &cfg.mo, mo),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"mos", 's', "NUM", CFG_SHORT , &cfg.mos, 1, mos, 0, }, {"mo", 'm', "NUM", CFG_BYTE, & cfg.mo, 1, mo, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, & cfg.data_len, 1, buf_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2249 | OPT_FILE("data", 'd', &cfg.file, data),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"mos", 's', "NUM", CFG_SHORT , &cfg.mos, 1, mos, 0, }, {"mo", 'm', "NUM", CFG_BYTE, & cfg.mo, 1, mo, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, & cfg.data_len, 1, buf_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2250 | OPT_UINT("data-len", 'l', &cfg.data_len, buf_len))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"mos", 's', "NUM", CFG_SHORT , &cfg.mos, 1, mos, 0, }, {"mo", 'm', "NUM", CFG_BYTE, & cfg.mo, 1, mo, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, & cfg.data_len, 1, buf_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 2251 | ||||
| 2252 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 2253 | if (err) | |||
| 2254 | return err; | |||
| 2255 | ||||
| 2256 | if (!cfg.nsid) { | |||
| 2257 | err = libnvme_get_nsid(hdl, &cfg.nsid); | |||
| 2258 | if (err < 0) { | |||
| 2259 | nvme_show_perror("get-namespace-id"); | |||
| 2260 | return err; | |||
| 2261 | } | |||
| 2262 | } | |||
| 2263 | ||||
| 2264 | if (cfg.data_len) { | |||
| 2265 | buf = libnvme_alloc(cfg.data_len); | |||
| 2266 | if (!buf) | |||
| 2267 | return -ENOMEM12; | |||
| 2268 | } | |||
| 2269 | ||||
| 2270 | nvme_init_io_mgmt_recv(&cmd, cfg.nsid, cfg.mo, cfg.mos, buf, | |||
| 2271 | cfg.data_len); | |||
| 2272 | err = libnvme_exec_io_passthru(hdl, &cmd); | |||
| 2273 | if (err) { | |||
| 2274 | nvme_show_err(err, "io-mgmt-recv"); | |||
| 2275 | return err; | |||
| 2276 | } | |||
| 2277 | ||||
| 2278 | printf("io-mgmt-recv: Success, mos:%u mo:%u nsid:%d\n", cfg.mos, cfg.mo, | |||
| 2279 | cfg.nsid); | |||
| 2280 | ||||
| 2281 | if (cfg.file) { | |||
| 2282 | dfd = nvme_open_rawdata(cfg.file, O_WRONLY | O_CREAT | O_TRUNC, 0644)open((cfg.file), (01 | 0100 | 01000), 0644); | |||
| 2283 | if (dfd < 0) { | |||
| 2284 | nvme_show_perror(cfg.file); | |||
| 2285 | return -errno(*__errno_location ()); | |||
| 2286 | } | |||
| 2287 | ||||
| 2288 | err = write(dfd, buf, cfg.data_len); | |||
| 2289 | if (err < 0) { | |||
| 2290 | nvme_show_perror("write"); | |||
| 2291 | return -errno(*__errno_location ()); | |||
| 2292 | } | |||
| 2293 | } else { | |||
| 2294 | d((unsigned char *)buf, cfg.data_len, 16, 1); | |||
| 2295 | } | |||
| 2296 | ||||
| 2297 | return err; | |||
| 2298 | } | |||
| 2299 | ||||
| 2300 | static int get_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 2301 | { | |||
| 2302 | const char *desc = "Retrieve desired number of bytes " | |||
| 2303 | "from a given log on a specified device in either " | |||
| 2304 | "hex-dump (default) or binary format"; | |||
| 2305 | const char *log_id = "identifier of log to retrieve"; | |||
| 2306 | const char *log_len = "how many bytes to retrieve"; | |||
| 2307 | const char *aen = "result of the aen, use to override log id"; | |||
| 2308 | const char *lpo = "log page offset specifies the location within a log page from where to start returning data"; | |||
| 2309 | const char *lsi = "log specific identifier specifies an identifier that is required for a particular log page"; | |||
| 2310 | const char *raw = "output in raw format"; | |||
| 2311 | const char *offset_type = "offset type"; | |||
| 2312 | const char *xfer_len = "read chunk size (default 4k)"; | |||
| 2313 | ||||
| 2314 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 2315 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 2316 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) unsigned char *log = NULL((void*)0); | |||
| 2317 | struct libnvme_passthru_cmd cmd; | |||
| 2318 | int err; | |||
| 2319 | nvme_print_flags_t flags; | |||
| 2320 | ||||
| 2321 | struct config { | |||
| 2322 | bool_Bool ish; | |||
| 2323 | __u32 namespace_id; | |||
| 2324 | __u8 log_id; | |||
| 2325 | __u32 log_len; | |||
| 2326 | __u32 aen; | |||
| 2327 | __u64 lpo; | |||
| 2328 | __u8 lsp; | |||
| 2329 | __u16 lsi; | |||
| 2330 | bool_Bool rae; | |||
| 2331 | __u8 uuid_index; | |||
| 2332 | bool_Bool raw_binary; | |||
| 2333 | __u8 csi; | |||
| 2334 | bool_Bool ot; | |||
| 2335 | __u32 xfer_len; | |||
| 2336 | }; | |||
| 2337 | ||||
| 2338 | struct config cfg = { | |||
| 2339 | .ish = false0, | |||
| 2340 | .namespace_id = NVME_NSID_ALL, | |||
| 2341 | .log_id = 0xff, | |||
| 2342 | .log_len = 0, | |||
| 2343 | .aen = 0, | |||
| 2344 | .lpo = NVME_LOG_LPO_NONE, | |||
| 2345 | .lsp = NVME_LOG_LSP_NONE, | |||
| 2346 | .lsi = NVME_LOG_LSI_NONE, | |||
| 2347 | .rae = false0, | |||
| 2348 | .uuid_index = NVME_UUID_NONE, | |||
| 2349 | .raw_binary = false0, | |||
| 2350 | .csi = NVME_CSI_NVM, | |||
| 2351 | .ot = false0, | |||
| 2352 | .xfer_len = 4096, | |||
| 2353 | }; | |||
| 2354 | ||||
| 2355 | OPT_VALS(log_name)struct argconfig_opt_val log_name[] = { | |||
| 2356 | VAL_BYTE("supported-log-pages", NVME_LOG_LID_SUPPORTED_LOG_PAGES){"supported-log-pages", CFG_BYTE, .val.byte = NVME_LOG_LID_SUPPORTED_LOG_PAGES }, | |||
| 2357 | VAL_BYTE("error", NVME_LOG_LID_ERROR){"error", CFG_BYTE, .val.byte = NVME_LOG_LID_ERROR}, | |||
| 2358 | VAL_BYTE("smart", NVME_LOG_LID_SMART){"smart", CFG_BYTE, .val.byte = NVME_LOG_LID_SMART}, | |||
| 2359 | VAL_BYTE("fw-slot", NVME_LOG_LID_FW_SLOT){"fw-slot", CFG_BYTE, .val.byte = NVME_LOG_LID_FW_SLOT}, | |||
| 2360 | VAL_BYTE("changed-ns", NVME_LOG_LID_CHANGED_NS){"changed-ns", CFG_BYTE, .val.byte = NVME_LOG_LID_CHANGED_NS}, | |||
| 2361 | VAL_BYTE("cmd-effects", NVME_LOG_LID_CMD_EFFECTS){"cmd-effects", CFG_BYTE, .val.byte = NVME_LOG_LID_CMD_EFFECTS }, | |||
| 2362 | VAL_BYTE("device-self-test", NVME_LOG_LID_DEVICE_SELF_TEST){"device-self-test", CFG_BYTE, .val.byte = NVME_LOG_LID_DEVICE_SELF_TEST }, | |||
| 2363 | VAL_BYTE("telemetry-host", NVME_LOG_LID_TELEMETRY_HOST){"telemetry-host", CFG_BYTE, .val.byte = NVME_LOG_LID_TELEMETRY_HOST }, | |||
| 2364 | VAL_BYTE("telemetry-ctrl", NVME_LOG_LID_TELEMETRY_CTRL){"telemetry-ctrl", CFG_BYTE, .val.byte = NVME_LOG_LID_TELEMETRY_CTRL }, | |||
| 2365 | VAL_BYTE("endurance-group", NVME_LOG_LID_ENDURANCE_GROUP){"endurance-group", CFG_BYTE, .val.byte = NVME_LOG_LID_ENDURANCE_GROUP }, | |||
| 2366 | VAL_BYTE("predictable-lat-nvmset", NVME_LOG_LID_PREDICTABLE_LAT_NVMSET){"predictable-lat-nvmset", CFG_BYTE, .val.byte = NVME_LOG_LID_PREDICTABLE_LAT_NVMSET }, | |||
| 2367 | VAL_BYTE("predictable-lat-agg", NVME_LOG_LID_PREDICTABLE_LAT_AGG){"predictable-lat-agg", CFG_BYTE, .val.byte = NVME_LOG_LID_PREDICTABLE_LAT_AGG }, | |||
| 2368 | VAL_BYTE("ana", NVME_LOG_LID_ANA){"ana", CFG_BYTE, .val.byte = NVME_LOG_LID_ANA}, | |||
| 2369 | VAL_BYTE("persistent-event", NVME_LOG_LID_PERSISTENT_EVENT){"persistent-event", CFG_BYTE, .val.byte = NVME_LOG_LID_PERSISTENT_EVENT }, | |||
| 2370 | VAL_BYTE("lba-status", NVME_LOG_LID_LBA_STATUS){"lba-status", CFG_BYTE, .val.byte = NVME_LOG_LID_LBA_STATUS}, | |||
| 2371 | VAL_BYTE("endurance-grp-evt", NVME_LOG_LID_ENDURANCE_GRP_EVT){"endurance-grp-evt", CFG_BYTE, .val.byte = NVME_LOG_LID_ENDURANCE_GRP_EVT }, | |||
| 2372 | VAL_BYTE("media-unit-status", NVME_LOG_LID_MEDIA_UNIT_STATUS){"media-unit-status", CFG_BYTE, .val.byte = NVME_LOG_LID_MEDIA_UNIT_STATUS }, | |||
| 2373 | VAL_BYTE("supported-cap-config-list", NVME_LOG_LID_SUPPORTED_CAP_CONFIG_LIST){"supported-cap-config-list", CFG_BYTE, .val.byte = NVME_LOG_LID_SUPPORTED_CAP_CONFIG_LIST }, | |||
| 2374 | VAL_BYTE("fid-supported-effects", NVME_LOG_LID_FID_SUPPORTED_EFFECTS){"fid-supported-effects", CFG_BYTE, .val.byte = NVME_LOG_LID_FID_SUPPORTED_EFFECTS }, | |||
| 2375 | VAL_BYTE("mi-cmd-supported-effects", NVME_LOG_LID_MI_CMD_SUPPORTED_EFFECTS){"mi-cmd-supported-effects", CFG_BYTE, .val.byte = NVME_LOG_LID_MI_CMD_SUPPORTED_EFFECTS }, | |||
| 2376 | VAL_BYTE("cmd-and-feat-lockdown", NVME_LOG_LID_CMD_AND_FEAT_LOCKDOWN){"cmd-and-feat-lockdown", CFG_BYTE, .val.byte = NVME_LOG_LID_CMD_AND_FEAT_LOCKDOWN }, | |||
| 2377 | VAL_BYTE("boot-partition", NVME_LOG_LID_BOOT_PARTITION){"boot-partition", CFG_BYTE, .val.byte = NVME_LOG_LID_BOOT_PARTITION }, | |||
| 2378 | VAL_BYTE("rotational-media-info",{"rotational-media-info", CFG_BYTE, .val.byte = NVME_LOG_LID_ROTATIONAL_MEDIA_INFO } | |||
| 2379 | NVME_LOG_LID_ROTATIONAL_MEDIA_INFO){"rotational-media-info", CFG_BYTE, .val.byte = NVME_LOG_LID_ROTATIONAL_MEDIA_INFO }, | |||
| 2380 | VAL_BYTE("dispersed-ns-participating-ns",{"dispersed-ns-participating-ns", CFG_BYTE, .val.byte = NVME_LOG_LID_DISPERSED_NS_PARTICIPATING_NSS } | |||
| 2381 | NVME_LOG_LID_DISPERSED_NS_PARTICIPATING_NSS){"dispersed-ns-participating-ns", CFG_BYTE, .val.byte = NVME_LOG_LID_DISPERSED_NS_PARTICIPATING_NSS }, | |||
| 2382 | VAL_BYTE("mgmt-addr-list", NVME_LOG_LID_MGMT_ADDR_LIST){"mgmt-addr-list", CFG_BYTE, .val.byte = NVME_LOG_LID_MGMT_ADDR_LIST }, | |||
| 2383 | VAL_BYTE("phy-rx-eom", NVME_LOG_LID_PHY_RX_EOM){"phy-rx-eom", CFG_BYTE, .val.byte = NVME_LOG_LID_PHY_RX_EOM}, | |||
| 2384 | VAL_BYTE("reachability-groups", NVME_LOG_LID_REACHABILITY_GROUPS){"reachability-groups", CFG_BYTE, .val.byte = NVME_LOG_LID_REACHABILITY_GROUPS }, | |||
| 2385 | VAL_BYTE("reachability-associations", NVME_LOG_LID_REACHABILITY_ASSOCIATIONS){"reachability-associations", CFG_BYTE, .val.byte = NVME_LOG_LID_REACHABILITY_ASSOCIATIONS }, | |||
| 2386 | VAL_BYTE("changed-alloc-ns-list", NVME_LOG_LID_CHANGED_ALLOC_NS){"changed-alloc-ns-list", CFG_BYTE, .val.byte = NVME_LOG_LID_CHANGED_ALLOC_NS }, | |||
| 2387 | VAL_BYTE("fdp-configs", NVME_LOG_LID_FDP_CONFIGS){"fdp-configs", CFG_BYTE, .val.byte = NVME_LOG_LID_FDP_CONFIGS }, | |||
| 2388 | VAL_BYTE("fdp-ruh-usage", NVME_LOG_LID_FDP_RUH_USAGE){"fdp-ruh-usage", CFG_BYTE, .val.byte = NVME_LOG_LID_FDP_RUH_USAGE }, | |||
| 2389 | VAL_BYTE("fdp-stats", NVME_LOG_LID_FDP_STATS){"fdp-stats", CFG_BYTE, .val.byte = NVME_LOG_LID_FDP_STATS}, | |||
| 2390 | VAL_BYTE("fdp-events", NVME_LOG_LID_FDP_EVENTS){"fdp-events", CFG_BYTE, .val.byte = NVME_LOG_LID_FDP_EVENTS}, | |||
| 2391 | VAL_BYTE("discover", NVME_LOG_LID_DISCOVERY){"discover", CFG_BYTE, .val.byte = NVME_LOG_LID_DISCOVERY}, | |||
| 2392 | VAL_BYTE("host-discover", NVME_LOG_LID_HOST_DISCOVERY){"host-discover", CFG_BYTE, .val.byte = NVME_LOG_LID_HOST_DISCOVERY }, | |||
| 2393 | VAL_BYTE("ave-discover", NVME_LOG_LID_AVE_DISCOVERY){"ave-discover", CFG_BYTE, .val.byte = NVME_LOG_LID_AVE_DISCOVERY }, | |||
| 2394 | VAL_BYTE("pull-model-ddc-req", NVME_LOG_LID_PULL_MODEL_DDC_REQ){"pull-model-ddc-req", CFG_BYTE, .val.byte = NVME_LOG_LID_PULL_MODEL_DDC_REQ }, | |||
| 2395 | VAL_BYTE("reservation", NVME_LOG_LID_RESERVATION){"reservation", CFG_BYTE, .val.byte = NVME_LOG_LID_RESERVATION }, | |||
| 2396 | VAL_BYTE("sanitize", NVME_LOG_LID_SANITIZE){"sanitize", CFG_BYTE, .val.byte = NVME_LOG_LID_SANITIZE}, | |||
| 2397 | VAL_BYTE("zns-changed-zones", NVME_LOG_LID_ZNS_CHANGED_ZONES){"zns-changed-zones", CFG_BYTE, .val.byte = NVME_LOG_LID_ZNS_CHANGED_ZONES }, | |||
| 2398 | VAL_END(){ ((void*)0) } | |||
| 2399 | }; | |||
| 2400 | ||||
| 2401 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"log-id", 'i', "NUM", CFG_BYTE , &cfg.log_id, 1, log_id, 0, log_name}, {"log-len", 'l', "NUM" , CFG_POSITIVE, &cfg.log_len, 1, log_len, 0, }, {"aen", 'a' , "NUM", CFG_POSITIVE, &cfg.aen, 1, aen, 0, }, {"lpo", 'L' , "IONUM", CFG_LONG_SUFFIX, &cfg.lpo, 1, lpo, 0, }, {"lsp" , 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"lsi", 'S' , "NUM", CFG_SHORT, &cfg.lsi, 1, lsi, 0, }, {"rae", 'r', ( (void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 0 , }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw, 0, }, {"csi", 'y', "NUM", CFG_BYTE, &cfg.csi, 1 , csi, 0, }, {"ot", 'O', ((void*)0), CFG_FLAG, &cfg.ot, 0 , offset_type, 0, }, {"xfer-len", 'x', "NUM", CFG_POSITIVE, & cfg.xfer_len, 1, xfer_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2402 | OPT_FLAG("ish", 'I', &cfg.ish, ish),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"log-id", 'i', "NUM", CFG_BYTE , &cfg.log_id, 1, log_id, 0, log_name}, {"log-len", 'l', "NUM" , CFG_POSITIVE, &cfg.log_len, 1, log_len, 0, }, {"aen", 'a' , "NUM", CFG_POSITIVE, &cfg.aen, 1, aen, 0, }, {"lpo", 'L' , "IONUM", CFG_LONG_SUFFIX, &cfg.lpo, 1, lpo, 0, }, {"lsp" , 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"lsi", 'S' , "NUM", CFG_SHORT, &cfg.lsi, 1, lsi, 0, }, {"rae", 'r', ( (void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 0 , }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw, 0, }, {"csi", 'y', "NUM", CFG_BYTE, &cfg.csi, 1 , csi, 0, }, {"ot", 'O', ((void*)0), CFG_FLAG, &cfg.ot, 0 , offset_type, 0, }, {"xfer-len", 'x', "NUM", CFG_POSITIVE, & cfg.xfer_len, 1, xfer_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2403 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"log-id", 'i', "NUM", CFG_BYTE , &cfg.log_id, 1, log_id, 0, log_name}, {"log-len", 'l', "NUM" , CFG_POSITIVE, &cfg.log_len, 1, log_len, 0, }, {"aen", 'a' , "NUM", CFG_POSITIVE, &cfg.aen, 1, aen, 0, }, {"lpo", 'L' , "IONUM", CFG_LONG_SUFFIX, &cfg.lpo, 1, lpo, 0, }, {"lsp" , 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"lsi", 'S' , "NUM", CFG_SHORT, &cfg.lsi, 1, lsi, 0, }, {"rae", 'r', ( (void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 0 , }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw, 0, }, {"csi", 'y', "NUM", CFG_BYTE, &cfg.csi, 1 , csi, 0, }, {"ot", 'O', ((void*)0), CFG_FLAG, &cfg.ot, 0 , offset_type, 0, }, {"xfer-len", 'x', "NUM", CFG_POSITIVE, & cfg.xfer_len, 1, xfer_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2404 | OPT_BYTE("log-id", 'i', &cfg.log_id, log_id, log_name),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"log-id", 'i', "NUM", CFG_BYTE , &cfg.log_id, 1, log_id, 0, log_name}, {"log-len", 'l', "NUM" , CFG_POSITIVE, &cfg.log_len, 1, log_len, 0, }, {"aen", 'a' , "NUM", CFG_POSITIVE, &cfg.aen, 1, aen, 0, }, {"lpo", 'L' , "IONUM", CFG_LONG_SUFFIX, &cfg.lpo, 1, lpo, 0, }, {"lsp" , 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"lsi", 'S' , "NUM", CFG_SHORT, &cfg.lsi, 1, lsi, 0, }, {"rae", 'r', ( (void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 0 , }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw, 0, }, {"csi", 'y', "NUM", CFG_BYTE, &cfg.csi, 1 , csi, 0, }, {"ot", 'O', ((void*)0), CFG_FLAG, &cfg.ot, 0 , offset_type, 0, }, {"xfer-len", 'x', "NUM", CFG_POSITIVE, & cfg.xfer_len, 1, xfer_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2405 | OPT_UINT("log-len", 'l', &cfg.log_len, log_len),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"log-id", 'i', "NUM", CFG_BYTE , &cfg.log_id, 1, log_id, 0, log_name}, {"log-len", 'l', "NUM" , CFG_POSITIVE, &cfg.log_len, 1, log_len, 0, }, {"aen", 'a' , "NUM", CFG_POSITIVE, &cfg.aen, 1, aen, 0, }, {"lpo", 'L' , "IONUM", CFG_LONG_SUFFIX, &cfg.lpo, 1, lpo, 0, }, {"lsp" , 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"lsi", 'S' , "NUM", CFG_SHORT, &cfg.lsi, 1, lsi, 0, }, {"rae", 'r', ( (void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 0 , }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw, 0, }, {"csi", 'y', "NUM", CFG_BYTE, &cfg.csi, 1 , csi, 0, }, {"ot", 'O', ((void*)0), CFG_FLAG, &cfg.ot, 0 , offset_type, 0, }, {"xfer-len", 'x', "NUM", CFG_POSITIVE, & cfg.xfer_len, 1, xfer_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2406 | OPT_UINT("aen", 'a', &cfg.aen, aen),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"log-id", 'i', "NUM", CFG_BYTE , &cfg.log_id, 1, log_id, 0, log_name}, {"log-len", 'l', "NUM" , CFG_POSITIVE, &cfg.log_len, 1, log_len, 0, }, {"aen", 'a' , "NUM", CFG_POSITIVE, &cfg.aen, 1, aen, 0, }, {"lpo", 'L' , "IONUM", CFG_LONG_SUFFIX, &cfg.lpo, 1, lpo, 0, }, {"lsp" , 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"lsi", 'S' , "NUM", CFG_SHORT, &cfg.lsi, 1, lsi, 0, }, {"rae", 'r', ( (void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 0 , }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw, 0, }, {"csi", 'y', "NUM", CFG_BYTE, &cfg.csi, 1 , csi, 0, }, {"ot", 'O', ((void*)0), CFG_FLAG, &cfg.ot, 0 , offset_type, 0, }, {"xfer-len", 'x', "NUM", CFG_POSITIVE, & cfg.xfer_len, 1, xfer_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2407 | OPT_SUFFIX("lpo", 'L', &cfg.lpo, lpo),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"log-id", 'i', "NUM", CFG_BYTE , &cfg.log_id, 1, log_id, 0, log_name}, {"log-len", 'l', "NUM" , CFG_POSITIVE, &cfg.log_len, 1, log_len, 0, }, {"aen", 'a' , "NUM", CFG_POSITIVE, &cfg.aen, 1, aen, 0, }, {"lpo", 'L' , "IONUM", CFG_LONG_SUFFIX, &cfg.lpo, 1, lpo, 0, }, {"lsp" , 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"lsi", 'S' , "NUM", CFG_SHORT, &cfg.lsi, 1, lsi, 0, }, {"rae", 'r', ( (void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 0 , }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw, 0, }, {"csi", 'y', "NUM", CFG_BYTE, &cfg.csi, 1 , csi, 0, }, {"ot", 'O', ((void*)0), CFG_FLAG, &cfg.ot, 0 , offset_type, 0, }, {"xfer-len", 'x', "NUM", CFG_POSITIVE, & cfg.xfer_len, 1, xfer_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2408 | OPT_BYTE("lsp", 's', &cfg.lsp, lsp),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"log-id", 'i', "NUM", CFG_BYTE , &cfg.log_id, 1, log_id, 0, log_name}, {"log-len", 'l', "NUM" , CFG_POSITIVE, &cfg.log_len, 1, log_len, 0, }, {"aen", 'a' , "NUM", CFG_POSITIVE, &cfg.aen, 1, aen, 0, }, {"lpo", 'L' , "IONUM", CFG_LONG_SUFFIX, &cfg.lpo, 1, lpo, 0, }, {"lsp" , 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"lsi", 'S' , "NUM", CFG_SHORT, &cfg.lsi, 1, lsi, 0, }, {"rae", 'r', ( (void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 0 , }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw, 0, }, {"csi", 'y', "NUM", CFG_BYTE, &cfg.csi, 1 , csi, 0, }, {"ot", 'O', ((void*)0), CFG_FLAG, &cfg.ot, 0 , offset_type, 0, }, {"xfer-len", 'x', "NUM", CFG_POSITIVE, & cfg.xfer_len, 1, xfer_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2409 | OPT_SHRT("lsi", 'S', &cfg.lsi, lsi),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"log-id", 'i', "NUM", CFG_BYTE , &cfg.log_id, 1, log_id, 0, log_name}, {"log-len", 'l', "NUM" , CFG_POSITIVE, &cfg.log_len, 1, log_len, 0, }, {"aen", 'a' , "NUM", CFG_POSITIVE, &cfg.aen, 1, aen, 0, }, {"lpo", 'L' , "IONUM", CFG_LONG_SUFFIX, &cfg.lpo, 1, lpo, 0, }, {"lsp" , 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"lsi", 'S' , "NUM", CFG_SHORT, &cfg.lsi, 1, lsi, 0, }, {"rae", 'r', ( (void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 0 , }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw, 0, }, {"csi", 'y', "NUM", CFG_BYTE, &cfg.csi, 1 , csi, 0, }, {"ot", 'O', ((void*)0), CFG_FLAG, &cfg.ot, 0 , offset_type, 0, }, {"xfer-len", 'x', "NUM", CFG_POSITIVE, & cfg.xfer_len, 1, xfer_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2410 | OPT_FLAG("rae", 'r', &cfg.rae, rae),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"log-id", 'i', "NUM", CFG_BYTE , &cfg.log_id, 1, log_id, 0, log_name}, {"log-len", 'l', "NUM" , CFG_POSITIVE, &cfg.log_len, 1, log_len, 0, }, {"aen", 'a' , "NUM", CFG_POSITIVE, &cfg.aen, 1, aen, 0, }, {"lpo", 'L' , "IONUM", CFG_LONG_SUFFIX, &cfg.lpo, 1, lpo, 0, }, {"lsp" , 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"lsi", 'S' , "NUM", CFG_SHORT, &cfg.lsi, 1, lsi, 0, }, {"rae", 'r', ( (void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 0 , }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw, 0, }, {"csi", 'y', "NUM", CFG_BYTE, &cfg.csi, 1 , csi, 0, }, {"ot", 'O', ((void*)0), CFG_FLAG, &cfg.ot, 0 , offset_type, 0, }, {"xfer-len", 'x', "NUM", CFG_POSITIVE, & cfg.xfer_len, 1, xfer_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2411 | OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"log-id", 'i', "NUM", CFG_BYTE , &cfg.log_id, 1, log_id, 0, log_name}, {"log-len", 'l', "NUM" , CFG_POSITIVE, &cfg.log_len, 1, log_len, 0, }, {"aen", 'a' , "NUM", CFG_POSITIVE, &cfg.aen, 1, aen, 0, }, {"lpo", 'L' , "IONUM", CFG_LONG_SUFFIX, &cfg.lpo, 1, lpo, 0, }, {"lsp" , 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"lsi", 'S' , "NUM", CFG_SHORT, &cfg.lsi, 1, lsi, 0, }, {"rae", 'r', ( (void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 0 , }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw, 0, }, {"csi", 'y', "NUM", CFG_BYTE, &cfg.csi, 1 , csi, 0, }, {"ot", 'O', ((void*)0), CFG_FLAG, &cfg.ot, 0 , offset_type, 0, }, {"xfer-len", 'x', "NUM", CFG_POSITIVE, & cfg.xfer_len, 1, xfer_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2412 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"log-id", 'i', "NUM", CFG_BYTE , &cfg.log_id, 1, log_id, 0, log_name}, {"log-len", 'l', "NUM" , CFG_POSITIVE, &cfg.log_len, 1, log_len, 0, }, {"aen", 'a' , "NUM", CFG_POSITIVE, &cfg.aen, 1, aen, 0, }, {"lpo", 'L' , "IONUM", CFG_LONG_SUFFIX, &cfg.lpo, 1, lpo, 0, }, {"lsp" , 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"lsi", 'S' , "NUM", CFG_SHORT, &cfg.lsi, 1, lsi, 0, }, {"rae", 'r', ( (void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 0 , }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw, 0, }, {"csi", 'y', "NUM", CFG_BYTE, &cfg.csi, 1 , csi, 0, }, {"ot", 'O', ((void*)0), CFG_FLAG, &cfg.ot, 0 , offset_type, 0, }, {"xfer-len", 'x', "NUM", CFG_POSITIVE, & cfg.xfer_len, 1, xfer_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2413 | OPT_BYTE("csi", 'y', &cfg.csi, csi),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"log-id", 'i', "NUM", CFG_BYTE , &cfg.log_id, 1, log_id, 0, log_name}, {"log-len", 'l', "NUM" , CFG_POSITIVE, &cfg.log_len, 1, log_len, 0, }, {"aen", 'a' , "NUM", CFG_POSITIVE, &cfg.aen, 1, aen, 0, }, {"lpo", 'L' , "IONUM", CFG_LONG_SUFFIX, &cfg.lpo, 1, lpo, 0, }, {"lsp" , 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"lsi", 'S' , "NUM", CFG_SHORT, &cfg.lsi, 1, lsi, 0, }, {"rae", 'r', ( (void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 0 , }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw, 0, }, {"csi", 'y', "NUM", CFG_BYTE, &cfg.csi, 1 , csi, 0, }, {"ot", 'O', ((void*)0), CFG_FLAG, &cfg.ot, 0 , offset_type, 0, }, {"xfer-len", 'x', "NUM", CFG_POSITIVE, & cfg.xfer_len, 1, xfer_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2414 | OPT_FLAG("ot", 'O', &cfg.ot, offset_type),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"log-id", 'i', "NUM", CFG_BYTE , &cfg.log_id, 1, log_id, 0, log_name}, {"log-len", 'l', "NUM" , CFG_POSITIVE, &cfg.log_len, 1, log_len, 0, }, {"aen", 'a' , "NUM", CFG_POSITIVE, &cfg.aen, 1, aen, 0, }, {"lpo", 'L' , "IONUM", CFG_LONG_SUFFIX, &cfg.lpo, 1, lpo, 0, }, {"lsp" , 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"lsi", 'S' , "NUM", CFG_SHORT, &cfg.lsi, 1, lsi, 0, }, {"rae", 'r', ( (void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 0 , }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw, 0, }, {"csi", 'y', "NUM", CFG_BYTE, &cfg.csi, 1 , csi, 0, }, {"ot", 'O', ((void*)0), CFG_FLAG, &cfg.ot, 0 , offset_type, 0, }, {"xfer-len", 'x', "NUM", CFG_POSITIVE, & cfg.xfer_len, 1, xfer_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2415 | OPT_UINT("xfer-len", 'x', &cfg.xfer_len, xfer_len))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"log-id", 'i', "NUM", CFG_BYTE , &cfg.log_id, 1, log_id, 0, log_name}, {"log-len", 'l', "NUM" , CFG_POSITIVE, &cfg.log_len, 1, log_len, 0, }, {"aen", 'a' , "NUM", CFG_POSITIVE, &cfg.aen, 1, aen, 0, }, {"lpo", 'L' , "IONUM", CFG_LONG_SUFFIX, &cfg.lpo, 1, lpo, 0, }, {"lsp" , 's', "NUM", CFG_BYTE, &cfg.lsp, 1, lsp, 0, }, {"lsi", 'S' , "NUM", CFG_SHORT, &cfg.lsi, 1, lsi, 0, }, {"rae", 'r', ( (void*)0), CFG_FLAG, &cfg.rae, 0, rae, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 0 , }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw, 0, }, {"csi", 'y', "NUM", CFG_BYTE, &cfg.csi, 1 , csi, 0, }, {"ot", 'O', ((void*)0), CFG_FLAG, &cfg.ot, 0 , offset_type, 0, }, {"xfer-len", 'x', "NUM", CFG_POSITIVE, & cfg.xfer_len, 1, xfer_len, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 2416 | ||||
| 2417 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 2418 | if (err) | |||
| 2419 | return err; | |||
| 2420 | ||||
| 2421 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 2422 | if (err < 0) { | |||
| 2423 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 2424 | return err; | |||
| 2425 | } | |||
| 2426 | ||||
| 2427 | if (cfg.aen) { | |||
| 2428 | cfg.log_len = 4096; | |||
| 2429 | cfg.log_id = (cfg.aen >> 16) & 0xff; | |||
| 2430 | } | |||
| 2431 | ||||
| 2432 | if (!cfg.log_len || cfg.log_len & 0x3) { | |||
| 2433 | nvme_show_error("non-zero or non-dw alignment log-len is required param")nvme_show_message(1, "non-zero or non-dw alignment log-len is required param" ); | |||
| 2434 | return -EINVAL22; | |||
| 2435 | } | |||
| 2436 | ||||
| 2437 | if (cfg.lsp > 127) { | |||
| 2438 | nvme_show_error("invalid lsp param")nvme_show_message(1, "invalid lsp param"); | |||
| 2439 | return -EINVAL22; | |||
| 2440 | } | |||
| 2441 | ||||
| 2442 | if (cfg.uuid_index > 127) { | |||
| 2443 | nvme_show_error("invalid uuid index param")nvme_show_message(1, "invalid uuid index param"); | |||
| 2444 | return -EINVAL22; | |||
| 2445 | } | |||
| 2446 | ||||
| 2447 | if (cfg.xfer_len == 0 || cfg.xfer_len % 4096) { | |||
| 2448 | nvme_show_error("xfer-len argument invalid. It needs to be multiple of 4k")nvme_show_message(1, "xfer-len argument invalid. It needs to be multiple of 4k" ); | |||
| 2449 | return -EINVAL22; | |||
| 2450 | } | |||
| 2451 | ||||
| 2452 | log = libnvme_alloc(cfg.log_len); | |||
| 2453 | if (!log) | |||
| 2454 | return -ENOMEM12; | |||
| 2455 | ||||
| 2456 | struct nvme_get_log_args args = { | |||
| 2457 | .nsid = cfg.namespace_id, | |||
| 2458 | .rae = cfg.rae, | |||
| 2459 | .lsp = cfg.lsp, | |||
| 2460 | .lid = cfg.log_id, | |||
| 2461 | .lsi = cfg.lsi, | |||
| 2462 | .csi = cfg.csi, | |||
| 2463 | .ot = cfg.ot, | |||
| 2464 | .uidx = cfg.uuid_index, | |||
| 2465 | .lpo = cfg.lpo, | |||
| 2466 | .log = log, | |||
| 2467 | .len = cfg.log_len, | |||
| 2468 | .result = NULL((void*)0), | |||
| 2469 | }; | |||
| 2470 | nvme_init_get_log(&cmd, cfg.namespace_id, cfg.log_id, | |||
| 2471 | cfg.csi, log, cfg.log_len); | |||
| 2472 | if (cfg.ish) { | |||
| 2473 | if (libnvme_transport_handle_is_mi(hdl)) | |||
| 2474 | nvme_init_mi_cmd_flags(&cmd, ish); | |||
| 2475 | else | |||
| 2476 | printf("ISH is supported only for NVMe-MI\n"); | |||
| 2477 | } | |||
| 2478 | cmd.cdw10 |= NVME_FIELD_ENCODE(cfg.lsp,(((__u32)(cfg.lsp) & (NVME_LOG_CDW10_LSP_MASK)) << ( NVME_LOG_CDW10_LSP_SHIFT)) | |||
| 2479 | NVME_LOG_CDW10_LSP_SHIFT,(((__u32)(cfg.lsp) & (NVME_LOG_CDW10_LSP_MASK)) << ( NVME_LOG_CDW10_LSP_SHIFT)) | |||
| 2480 | NVME_LOG_CDW10_LSP_MASK)(((__u32)(cfg.lsp) & (NVME_LOG_CDW10_LSP_MASK)) << ( NVME_LOG_CDW10_LSP_SHIFT)); | |||
| 2481 | cmd.cdw11 |= NVME_FIELD_ENCODE(cfg.lsi,(((__u32)(cfg.lsi) & (NVME_LOG_CDW11_LSI_MASK)) << ( NVME_LOG_CDW11_LSI_SHIFT)) | |||
| 2482 | NVME_LOG_CDW11_LSI_SHIFT,(((__u32)(cfg.lsi) & (NVME_LOG_CDW11_LSI_MASK)) << ( NVME_LOG_CDW11_LSI_SHIFT)) | |||
| 2483 | NVME_LOG_CDW11_LSI_MASK)(((__u32)(cfg.lsi) & (NVME_LOG_CDW11_LSI_MASK)) << ( NVME_LOG_CDW11_LSI_SHIFT)); | |||
| 2484 | cmd.cdw12 = cfg.lpo & 0xffffffff; | |||
| 2485 | cmd.cdw13 = cfg.lpo >> 32; | |||
| 2486 | cmd.cdw14 |= NVME_FIELD_ENCODE(cfg.uuid_index,(((__u32)(cfg.uuid_index) & (NVME_LOG_CDW14_UUID_MASK)) << (NVME_LOG_CDW14_UUID_SHIFT)) | |||
| 2487 | NVME_LOG_CDW14_UUID_SHIFT,(((__u32)(cfg.uuid_index) & (NVME_LOG_CDW14_UUID_MASK)) << (NVME_LOG_CDW14_UUID_SHIFT)) | |||
| 2488 | NVME_LOG_CDW14_UUID_MASK)(((__u32)(cfg.uuid_index) & (NVME_LOG_CDW14_UUID_MASK)) << (NVME_LOG_CDW14_UUID_SHIFT)) | | |||
| 2489 | NVME_FIELD_ENCODE(cfg.ot,(((__u32)(cfg.ot) & (NVME_LOG_CDW14_OT_MASK)) << (NVME_LOG_CDW14_OT_SHIFT )) | |||
| 2490 | NVME_LOG_CDW14_OT_SHIFT,(((__u32)(cfg.ot) & (NVME_LOG_CDW14_OT_MASK)) << (NVME_LOG_CDW14_OT_SHIFT )) | |||
| 2491 | NVME_LOG_CDW14_OT_MASK)(((__u32)(cfg.ot) & (NVME_LOG_CDW14_OT_MASK)) << (NVME_LOG_CDW14_OT_SHIFT )); | |||
| 2492 | ||||
| 2493 | err = libnvme_get_log(hdl, &cmd, cfg.rae, NVME_LOG_PAGE_PDU_SIZE4096); | |||
| 2494 | if (err) { | |||
| 2495 | nvme_show_err(err, "log page"); | |||
| 2496 | return err; | |||
| 2497 | } | |||
| 2498 | ||||
| 2499 | if (!cfg.raw_binary) { | |||
| 2500 | printf("Device:%s log-id:%d namespace-id:%#x\n", | |||
| 2501 | libnvme_transport_handle_get_name(hdl), cfg.log_id, | |||
| 2502 | cfg.namespace_id); | |||
| 2503 | d(log, cfg.log_len, 16, 1); | |||
| 2504 | if (nvme_args.verbose) | |||
| 2505 | nvme_show_log(libnvme_transport_handle_get_name(hdl), | |||
| 2506 | &args, VERBOSE); | |||
| 2507 | } else { | |||
| 2508 | d_raw((unsigned char *)log, cfg.log_len); | |||
| 2509 | } | |||
| 2510 | ||||
| 2511 | return err; | |||
| 2512 | } | |||
| 2513 | ||||
| 2514 | static int sanitize_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 2515 | { | |||
| 2516 | const char *desc = "Retrieve sanitize log and show it."; | |||
| 2517 | ||||
| 2518 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_sanitize_log_page *sanitize_log = NULL((void*)0); | |||
| 2519 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 2520 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 2521 | nvme_print_flags_t flags; | |||
| 2522 | int err; | |||
| 2523 | ||||
| 2524 | struct config { | |||
| 2525 | bool_Bool rae; | |||
| 2526 | bool_Bool raw_binary; | |||
| 2527 | }; | |||
| 2528 | ||||
| 2529 | struct config cfg = { | |||
| 2530 | .rae = false0, | |||
| 2531 | .raw_binary = false0, | |||
| 2532 | }; | |||
| 2533 | ||||
| 2534 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"rae", 'r', ((void*)0), CFG_FLAG, &cfg.rae, 0, rae , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_log, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2535 | OPT_FLAG("rae", 'r', &cfg.rae, rae),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"rae", 'r', ((void*)0), CFG_FLAG, &cfg.rae, 0, rae , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_log, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2536 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_log))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"rae", 'r', ((void*)0), CFG_FLAG, &cfg.rae, 0, rae , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_log, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 2537 | ||||
| 2538 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 2539 | if (err) | |||
| 2540 | return err; | |||
| 2541 | ||||
| 2542 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 2543 | if (err < 0) { | |||
| 2544 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 2545 | return err; | |||
| 2546 | } | |||
| 2547 | ||||
| 2548 | if (cfg.raw_binary) | |||
| 2549 | flags = BINARY; | |||
| 2550 | ||||
| 2551 | if (nvme_args.verbose) | |||
| 2552 | flags |= VERBOSE; | |||
| 2553 | ||||
| 2554 | sanitize_log = libnvme_alloc(sizeof(*sanitize_log)); | |||
| 2555 | if (!sanitize_log) | |||
| 2556 | return -ENOMEM12; | |||
| 2557 | ||||
| 2558 | err = nvme_get_log_sanitize(hdl, cfg.rae, sanitize_log); | |||
| 2559 | if (err) { | |||
| 2560 | nvme_show_err(err, "sanitize status log"); | |||
| 2561 | return err; | |||
| 2562 | } | |||
| 2563 | ||||
| 2564 | nvme_show_sanitize_log(sanitize_log, | |||
| 2565 | libnvme_transport_handle_get_name(hdl), flags); | |||
| 2566 | ||||
| 2567 | return err; | |||
| 2568 | } | |||
| 2569 | ||||
| 2570 | static int get_fid_support_effects_log(int argc, char **argv, struct command *acmd, | |||
| 2571 | struct plugin *plugin) | |||
| 2572 | { | |||
| 2573 | const char *desc = "Retrieve FID Support and Effects log and show it."; | |||
| 2574 | ||||
| 2575 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_fid_supported_effects_log *fid_support_log = NULL((void*)0); | |||
| 2576 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 2577 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 2578 | nvme_print_flags_t flags; | |||
| 2579 | int err = -1; | |||
| 2580 | ||||
| 2581 | NVME_ARGS(opts)struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 2582 | ||||
| 2583 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 2584 | if (err) | |||
| 2585 | return err; | |||
| 2586 | ||||
| 2587 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 2588 | if (err < 0) { | |||
| 2589 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 2590 | return err; | |||
| 2591 | } | |||
| 2592 | ||||
| 2593 | if (nvme_args.verbose) | |||
| 2594 | flags |= VERBOSE; | |||
| 2595 | ||||
| 2596 | fid_support_log = libnvme_alloc(sizeof(*fid_support_log)); | |||
| 2597 | if (!fid_support_log) | |||
| 2598 | return -ENOMEM12; | |||
| 2599 | ||||
| 2600 | err = nvme_get_log_fid_supported_effects(hdl, false0, fid_support_log); | |||
| 2601 | if (err) { | |||
| 2602 | nvme_show_err(err, "fid support effects log"); | |||
| 2603 | return err; | |||
| 2604 | } | |||
| 2605 | ||||
| 2606 | nvme_show_fid_support_effects_log(fid_support_log, | |||
| 2607 | libnvme_transport_handle_get_name(hdl), | |||
| 2608 | flags); | |||
| 2609 | ||||
| 2610 | return err; | |||
| 2611 | } | |||
| 2612 | ||||
| 2613 | static int get_mi_cmd_support_effects_log(int argc, char **argv, struct command *acmd, | |||
| 2614 | struct plugin *plugin) | |||
| 2615 | { | |||
| 2616 | const char *desc = "Retrieve NVMe-MI Command Support and Effects log and show it."; | |||
| 2617 | ||||
| 2618 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_mi_cmd_supported_effects_log *mi_cmd_support_log = NULL((void*)0); | |||
| 2619 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 2620 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 2621 | nvme_print_flags_t flags; | |||
| 2622 | int err = -1; | |||
| 2623 | ||||
| 2624 | NVME_ARGS(opts)struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 2625 | ||||
| 2626 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 2627 | if (err) | |||
| 2628 | return err; | |||
| 2629 | ||||
| 2630 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 2631 | if (err < 0) { | |||
| 2632 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 2633 | return err; | |||
| 2634 | } | |||
| 2635 | ||||
| 2636 | if (nvme_args.verbose) | |||
| 2637 | flags |= VERBOSE; | |||
| 2638 | ||||
| 2639 | mi_cmd_support_log = libnvme_alloc(sizeof(*mi_cmd_support_log)); | |||
| 2640 | if (!mi_cmd_support_log) | |||
| 2641 | return -ENOMEM12; | |||
| 2642 | ||||
| 2643 | err = nvme_get_log_mi_cmd_supported_effects(hdl, mi_cmd_support_log); | |||
| 2644 | if (err) { | |||
| 2645 | nvme_show_err(err, "mi command support effects log"); | |||
| 2646 | return err; | |||
| 2647 | } | |||
| 2648 | ||||
| 2649 | nvme_show_mi_cmd_support_effects_log(mi_cmd_support_log, | |||
| 2650 | libnvme_transport_handle_get_name(hdl), flags); | |||
| 2651 | ||||
| 2652 | return err; | |||
| 2653 | } | |||
| 2654 | ||||
| 2655 | static int list_ctrl(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 2656 | { | |||
| 2657 | const char *desc = "Show controller list information for the subsystem the " | |||
| 2658 | "given device is part of, or optionally controllers attached to a specific namespace."; | |||
| 2659 | const char *controller = "controller to display"; | |||
| 2660 | ||||
| 2661 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_ctrl_list *cntlist = NULL((void*)0); | |||
| 2662 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 2663 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 2664 | struct libnvme_passthru_cmd cmd; | |||
| 2665 | nvme_print_flags_t flags; | |||
| 2666 | int err; | |||
| 2667 | ||||
| 2668 | struct config { | |||
| 2669 | __u16 cntid; | |||
| 2670 | __u32 namespace_id; | |||
| 2671 | }; | |||
| 2672 | ||||
| 2673 | struct config cfg = { | |||
| 2674 | .cntid = 0, | |||
| 2675 | .namespace_id = NVME_NSID_NONE, | |||
| 2676 | }; | |||
| 2677 | ||||
| 2678 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"cntid", 'c', "NUM", CFG_SHORT, &cfg.cntid, 1, controller , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_optional, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2679 | OPT_SHRT("cntid", 'c', &cfg.cntid, controller),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"cntid", 'c', "NUM", CFG_SHORT, &cfg.cntid, 1, controller , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_optional, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2680 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_optional))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"cntid", 'c', "NUM", CFG_SHORT, &cfg.cntid, 1, controller , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_optional, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 2681 | ||||
| 2682 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 2683 | if (err) | |||
| 2684 | return err; | |||
| 2685 | ||||
| 2686 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 2687 | if (err < 0 || (flags != JSON && flags != NORMAL)) { | |||
| 2688 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 2689 | return err; | |||
| 2690 | } | |||
| 2691 | ||||
| 2692 | cntlist = libnvme_alloc(sizeof(*cntlist)); | |||
| 2693 | if (!cntlist) | |||
| 2694 | return -ENOMEM12; | |||
| 2695 | ||||
| 2696 | if (cfg.namespace_id == NVME_NSID_NONE) | |||
| 2697 | nvme_init_identify_ctrl_list(&cmd, cfg.cntid, cntlist); | |||
| 2698 | else | |||
| 2699 | nvme_init_identify_ns_ctrl_list(&cmd, cfg.namespace_id, | |||
| 2700 | cfg.cntid, cntlist); | |||
| 2701 | ||||
| 2702 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 2703 | if (err) { | |||
| 2704 | nvme_show_err(err, "id controller list"); | |||
| 2705 | return err; | |||
| 2706 | } | |||
| 2707 | ||||
| 2708 | nvme_show_list_ctrl(cntlist, flags); | |||
| 2709 | ||||
| 2710 | return err; | |||
| 2711 | } | |||
| 2712 | ||||
| 2713 | static int list_ns(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 2714 | { | |||
| 2715 | const char *desc = "For the specified controller handle, show the " | |||
| 2716 | "namespace list in the associated NVMe subsystem, optionally starting with a given nsid."; | |||
| 2717 | const char *namespace_id = "first nsid returned list should start from"; | |||
| 2718 | const char *csi = "I/O command set identifier"; | |||
| 2719 | const char *all = "show all namespaces in the subsystem, whether attached or inactive"; | |||
| 2720 | ||||
| 2721 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_ns_list *ns_list = NULL((void*)0); | |||
| 2722 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 2723 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 2724 | enum nvme_identify_cns cns; | |||
| 2725 | nvme_print_flags_t flags; | |||
| 2726 | int err; | |||
| 2727 | ||||
| 2728 | struct config { | |||
| 2729 | __u32 namespace_id; | |||
| 2730 | int csi; | |||
| 2731 | bool_Bool all; | |||
| 2732 | }; | |||
| 2733 | ||||
| 2734 | struct config cfg = { | |||
| 2735 | .namespace_id = 1, | |||
| 2736 | .csi = -1, | |||
| 2737 | .all = false0, | |||
| 2738 | }; | |||
| 2739 | ||||
| 2740 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id, 0, }, {"csi", 'y', "NUM", CFG_INT, &cfg .csi, 1, csi, 0, }, {"all", 'a', ((void*)0), CFG_FLAG, &cfg .all, 0, all, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2741 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id, 0, }, {"csi", 'y', "NUM", CFG_INT, &cfg .csi, 1, csi, 0, }, {"all", 'a', ((void*)0), CFG_FLAG, &cfg .all, 0, all, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2742 | OPT_INT("csi", 'y', &cfg.csi, csi),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id, 0, }, {"csi", 'y', "NUM", CFG_INT, &cfg .csi, 1, csi, 0, }, {"all", 'a', ((void*)0), CFG_FLAG, &cfg .all, 0, all, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2743 | OPT_FLAG("all", 'a', &cfg.all, all))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id, 0, }, {"csi", 'y', "NUM", CFG_INT, &cfg .csi, 1, csi, 0, }, {"all", 'a', ((void*)0), CFG_FLAG, &cfg .all, 0, all, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 2744 | ||||
| 2745 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 2746 | if (err) | |||
| 2747 | return err; | |||
| 2748 | ||||
| 2749 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 2750 | if (err < 0 || (flags != JSON && flags != NORMAL)) { | |||
| 2751 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 2752 | return -EINVAL22; | |||
| 2753 | } | |||
| 2754 | ||||
| 2755 | if (!cfg.namespace_id) { | |||
| 2756 | nvme_show_error("invalid nsid parameter")nvme_show_message(1, "invalid nsid parameter"); | |||
| 2757 | return -EINVAL22; | |||
| 2758 | } | |||
| 2759 | ||||
| 2760 | if (nvme_args.verbose) | |||
| 2761 | flags |= VERBOSE; | |||
| 2762 | ||||
| 2763 | ns_list = libnvme_alloc(sizeof(*ns_list)); | |||
| 2764 | if (!ns_list) | |||
| 2765 | return -ENOMEM12; | |||
| 2766 | ||||
| 2767 | if (cfg.csi < 0) { | |||
| 2768 | cns = cfg.all ? NVME_IDENTIFY_CNS_ALLOCATED_NS_LIST : | |||
| 2769 | NVME_IDENTIFY_CNS_NS_ACTIVE_LIST; | |||
| 2770 | cfg.csi = 0; | |||
| 2771 | } else { | |||
| 2772 | cns = cfg.all ? NVME_IDENTIFY_CNS_CSI_ALLOCATED_NS_LIST : | |||
| 2773 | NVME_IDENTIFY_CNS_CSI_NS_ACTIVE_LIST; | |||
| 2774 | } | |||
| 2775 | ||||
| 2776 | err = nvme_identify(hdl, cfg.namespace_id - 1, cfg.csi, cns, ns_list, | |||
| 2777 | sizeof(*ns_list)); | |||
| 2778 | if (err) { | |||
| 2779 | nvme_show_err(err, "id namespace list"); | |||
| 2780 | return err; | |||
| 2781 | } | |||
| 2782 | ||||
| 2783 | nvme_show_list_ns(ns_list, flags); | |||
| 2784 | ||||
| 2785 | return err; | |||
| 2786 | } | |||
| 2787 | ||||
| 2788 | static int id_ns_lba_format(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 2789 | { | |||
| 2790 | const char *desc = "Send an Identify Namespace command to the given " | |||
| 2791 | "device, returns capability field properties of the specified " | |||
| 2792 | "LBA Format index in various formats."; | |||
| 2793 | ||||
| 2794 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 2795 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 2796 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ns *ns = NULL((void*)0); | |||
| 2797 | nvme_print_flags_t flags; | |||
| 2798 | int err = -1; | |||
| 2799 | ||||
| 2800 | struct config { | |||
| 2801 | __u16 lba_format_index; | |||
| 2802 | __u8 uuid_index; | |||
| 2803 | }; | |||
| 2804 | ||||
| 2805 | struct config cfg = { | |||
| 2806 | .lba_format_index = 0, | |||
| 2807 | .uuid_index = NVME_UUID_NONE, | |||
| 2808 | }; | |||
| 2809 | ||||
| 2810 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"lba-format-index", 'i', "NUM", CFG_POSITIVE, &cfg .lba_format_index, 1, lba_format_index, 0, }, {"uuid-index", 'U' , "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2811 | OPT_UINT("lba-format-index", 'i', &cfg.lba_format_index, lba_format_index),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"lba-format-index", 'i', "NUM", CFG_POSITIVE, &cfg .lba_format_index, 1, lba_format_index, 0, }, {"uuid-index", 'U' , "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2812 | OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"lba-format-index", 'i', "NUM", CFG_POSITIVE, &cfg .lba_format_index, 1, lba_format_index, 0, }, {"uuid-index", 'U' , "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 2813 | ||||
| 2814 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 2815 | if (err) | |||
| 2816 | return err; | |||
| 2817 | ||||
| 2818 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 2819 | if (err < 0) { | |||
| 2820 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 2821 | return err; | |||
| 2822 | } | |||
| 2823 | ||||
| 2824 | if (nvme_args.verbose) | |||
| 2825 | flags |= VERBOSE; | |||
| 2826 | ||||
| 2827 | ns = libnvme_alloc(sizeof(*ns)); | |||
| 2828 | if (!ns) | |||
| 2829 | return -ENOMEM12; | |||
| 2830 | ||||
| 2831 | err = nvme_identify_csi_ns_user_data_format(hdl, NVME_CSI_NVM, | |||
| 2832 | cfg.lba_format_index, | |||
| 2833 | cfg.uuid_index, ns); | |||
| 2834 | if (err) { | |||
| 2835 | nvme_show_err(err, | |||
| 2836 | "identify namespace for specific LBA format"); | |||
| 2837 | return err; | |||
| 2838 | } | |||
| 2839 | ||||
| 2840 | nvme_show_id_ns(ns, 0, cfg.lba_format_index, true1, flags); | |||
| 2841 | ||||
| 2842 | return err; | |||
| 2843 | } | |||
| 2844 | ||||
| 2845 | static int id_endurance_grp_list(int argc, char **argv, struct command *acmd, | |||
| 2846 | struct plugin *plugin) | |||
| 2847 | { | |||
| 2848 | const char *desc = "Show endurance group list information for the given endurance group id"; | |||
| 2849 | const char *endurance_grp_id = "Endurance Group ID"; | |||
| 2850 | ||||
| 2851 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_endurance_group_list *endgrp_list = NULL((void*)0); | |||
| 2852 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 2853 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 2854 | struct libnvme_passthru_cmd cmd; | |||
| 2855 | nvme_print_flags_t flags; | |||
| 2856 | int err = -1; | |||
| 2857 | ||||
| 2858 | struct config { | |||
| 2859 | __u16 endgrp_id; | |||
| 2860 | }; | |||
| 2861 | ||||
| 2862 | struct config cfg = { | |||
| 2863 | .endgrp_id = 0, | |||
| 2864 | }; | |||
| 2865 | ||||
| 2866 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"endgrp-id", 'i', "NUM", CFG_SHORT, &cfg.endgrp_id , 1, endurance_grp_id, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2867 | OPT_SHRT("endgrp-id", 'i', &cfg.endgrp_id, endurance_grp_id))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"endgrp-id", 'i', "NUM", CFG_SHORT, &cfg.endgrp_id , 1, endurance_grp_id, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 2868 | ||||
| 2869 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 2870 | if (err) | |||
| 2871 | return err; | |||
| 2872 | ||||
| 2873 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 2874 | if (err < 0 || (flags != JSON && flags != NORMAL)) { | |||
| 2875 | nvme_show_error("invalid output format")nvme_show_message(1, "invalid output format"); | |||
| 2876 | return -EINVAL22; | |||
| 2877 | } | |||
| 2878 | ||||
| 2879 | endgrp_list = libnvme_alloc(sizeof(*endgrp_list)); | |||
| 2880 | if (!endgrp_list) | |||
| 2881 | return -ENOMEM12; | |||
| 2882 | ||||
| 2883 | nvme_init_identify_endurance_group_id(&cmd, cfg.endgrp_id, | |||
| 2884 | endgrp_list); | |||
| 2885 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 2886 | if (err) { | |||
| 2887 | nvme_show_err(err, "Id endurance group list"); | |||
| 2888 | return err; | |||
| 2889 | } | |||
| 2890 | ||||
| 2891 | nvme_show_endurance_group_list(endgrp_list, flags); | |||
| 2892 | ||||
| 2893 | return err; | |||
| 2894 | } | |||
| 2895 | ||||
| 2896 | static bool_Bool is_ns_mgmt_support(struct libnvme_transport_handle *hdl) | |||
| 2897 | { | |||
| 2898 | int err; | |||
| 2899 | ||||
| 2900 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ctrl *ctrl = libnvme_alloc(sizeof(*ctrl)); | |||
| 2901 | ||||
| 2902 | if (ctrl) | |||
| 2903 | return false0; | |||
| 2904 | ||||
| 2905 | err = nvme_identify_ctrl(hdl, ctrl); | |||
| 2906 | if (err) | |||
| 2907 | return false0; | |||
| 2908 | ||||
| 2909 | return le16_to_cpu(ctrl->oacs) & NVME_CTRL_OACS_NS_MGMT; | |||
| 2910 | } | |||
| 2911 | ||||
| 2912 | static void ns_mgmt_show_status(struct libnvme_transport_handle *hdl, int err, char *cmd, __u32 nsid) | |||
| 2913 | { | |||
| 2914 | if (err < 0) { | |||
| 2915 | nvme_show_error("%s: %s", cmd, libnvme_strerror(-err))nvme_show_message(1, "%s: %s", cmd, libnvme_strerror(-err)); | |||
| 2916 | return; | |||
| 2917 | } | |||
| 2918 | ||||
| 2919 | nvme_show_init(); | |||
| 2920 | ||||
| 2921 | if (!err) { | |||
| 2922 | nvme_show_key_value(cmd, "success"); | |||
| 2923 | nvme_show_key_value("nsid", "%d", nsid); | |||
| 2924 | } else { | |||
| 2925 | nvme_show_status(err); | |||
| 2926 | if (!is_ns_mgmt_support(hdl)) | |||
| 2927 | nvme_show_error("NS management and attachment not supported")nvme_show_message(1, "NS management and attachment not supported" ); | |||
| 2928 | } | |||
| 2929 | ||||
| 2930 | nvme_show_finish(); | |||
| 2931 | } | |||
| 2932 | ||||
| 2933 | static int delete_ns(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 2934 | { | |||
| 2935 | const char *desc = "Delete the given namespace by " | |||
| 2936 | "sending a namespace management command to " | |||
| 2937 | "the provided device. All controllers should be detached from " | |||
| 2938 | "the namespace prior to namespace deletion. A namespace ID " | |||
| 2939 | "becomes inactive when that namespace is detached or, if " | |||
| 2940 | "the namespace is not already inactive, once deleted."; | |||
| 2941 | const char *namespace_id = "namespace to delete"; | |||
| 2942 | ||||
| 2943 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 2944 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 2945 | struct libnvme_passthru_cmd cmd; | |||
| 2946 | nvme_print_flags_t flags; | |||
| 2947 | int err; | |||
| 2948 | ||||
| 2949 | struct config { | |||
| 2950 | bool_Bool ish; | |||
| 2951 | __u32 namespace_id; | |||
| 2952 | }; | |||
| 2953 | ||||
| 2954 | struct config cfg = { | |||
| 2955 | .ish = false0, | |||
| 2956 | .namespace_id = 0, | |||
| 2957 | }; | |||
| 2958 | ||||
| 2959 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2960 | OPT_FLAG("ish", 'I', &cfg.ish, ish),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 2961 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 2962 | ||||
| 2963 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 2964 | if (err) | |||
| 2965 | return err; | |||
| 2966 | ||||
| 2967 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 2968 | if (err < 0) { | |||
| 2969 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 2970 | return err; | |||
| 2971 | } | |||
| 2972 | ||||
| 2973 | if (!cfg.namespace_id) { | |||
| 2974 | err = libnvme_get_nsid(hdl, &cfg.namespace_id); | |||
| 2975 | if (err < 0) { | |||
| 2976 | nvme_show_error("get-namespace-id: %s", libnvme_strerror(-err))nvme_show_message(1, "get-namespace-id: %s", libnvme_strerror (-err)); | |||
| 2977 | return err; | |||
| 2978 | } | |||
| 2979 | } | |||
| 2980 | ||||
| 2981 | nvme_init_ns_mgmt_delete(&cmd, cfg.namespace_id); | |||
| 2982 | if (cfg.ish) { | |||
| 2983 | if (libnvme_transport_handle_is_mi(hdl)) | |||
| 2984 | nvme_init_mi_cmd_flags(&cmd, ish); | |||
| 2985 | else | |||
| 2986 | printf("ISH is supported only for NVMe-MI\n"); | |||
| 2987 | } | |||
| 2988 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 2989 | ns_mgmt_show_status(hdl, err, acmd->name, cfg.namespace_id); | |||
| 2990 | ||||
| 2991 | return err; | |||
| 2992 | } | |||
| 2993 | ||||
| 2994 | static int nvme_attach_ns(int argc, char **argv, int attach, const char *desc, struct command *acmd) | |||
| 2995 | { | |||
| 2996 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 2997 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 2998 | ||||
| 2999 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_ctrl_list *cntlist = NULL((void*)0); | |||
| 3000 | __u16 list[NVME_ID_CTRL_LIST_MAX]; | |||
| 3001 | struct libnvme_passthru_cmd cmd; | |||
| 3002 | nvme_print_flags_t flags; | |||
| 3003 | int err, num; | |||
| 3004 | ||||
| 3005 | const char *namespace_id = "namespace to attach"; | |||
| 3006 | const char *cont = "optional comma-sep controller id list"; | |||
| 3007 | ||||
| 3008 | struct config { | |||
| 3009 | bool_Bool ish; | |||
| 3010 | __u32 nsid; | |||
| 3011 | char *cntlist; | |||
| 3012 | }; | |||
| 3013 | ||||
| 3014 | struct config cfg = { | |||
| 3015 | .ish = false0, | |||
| 3016 | .nsid = 0, | |||
| 3017 | .cntlist = "", | |||
| 3018 | }; | |||
| 3019 | ||||
| 3020 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id, 0, }, {"controllers", 'c', "LIST", CFG_STRING , &cfg.cntlist, 1, cont, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3021 | OPT_FLAG("ish", 'I', &cfg.ish, ish),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id, 0, }, {"controllers", 'c', "LIST", CFG_STRING , &cfg.cntlist, 1, cont, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3022 | OPT_UINT("namespace-id", 'n', &cfg.nsid, namespace_id),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id, 0, }, {"controllers", 'c', "LIST", CFG_STRING , &cfg.cntlist, 1, cont, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3023 | OPT_LIST("controllers", 'c', &cfg.cntlist, cont))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id, 0, }, {"controllers", 'c', "LIST", CFG_STRING , &cfg.cntlist, 1, cont, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 3024 | ||||
| 3025 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 3026 | if (err) | |||
| 3027 | return err; | |||
| 3028 | ||||
| 3029 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 3030 | if (err < 0) { | |||
| 3031 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 3032 | return err; | |||
| 3033 | } | |||
| 3034 | ||||
| 3035 | if (libnvme_transport_handle_is_ns(hdl)) { | |||
| 3036 | nvme_show_error("%s: a namespace device opened (dev: %s, nsid: %d)", acmd->name,nvme_show_message(1, "%s: a namespace device opened (dev: %s, nsid: %d)" , acmd->name, libnvme_transport_handle_get_name(hdl), cfg. nsid) | |||
| 3037 | libnvme_transport_handle_get_name(hdl), cfg.nsid)nvme_show_message(1, "%s: a namespace device opened (dev: %s, nsid: %d)" , acmd->name, libnvme_transport_handle_get_name(hdl), cfg. nsid); | |||
| 3038 | return -EINVAL22; | |||
| 3039 | } | |||
| 3040 | ||||
| 3041 | if (!cfg.nsid) { | |||
| 3042 | nvme_show_error("%s: namespace-id parameter required", acmd->name)nvme_show_message(1, "%s: namespace-id parameter required", acmd ->name); | |||
| 3043 | return -EINVAL22; | |||
| 3044 | } | |||
| 3045 | ||||
| 3046 | num = argconfig_parse_comma_sep_array_u16(cfg.cntlist, | |||
| 3047 | list, ARRAY_SIZE(list)(sizeof(list) / sizeof((list)[0]))); | |||
| 3048 | if (num == -1) { | |||
| 3049 | nvme_show_error("%s: controller id list is malformed", acmd->name)nvme_show_message(1, "%s: controller id list is malformed", acmd ->name); | |||
| 3050 | return -EINVAL22; | |||
| 3051 | } | |||
| 3052 | ||||
| 3053 | cntlist = libnvme_alloc(sizeof(*cntlist)); | |||
| 3054 | if (!cntlist) | |||
| 3055 | return -ENOMEM12; | |||
| 3056 | ||||
| 3057 | if (argconfig_parse_seen(opts, "controllers")) { | |||
| 3058 | nvme_init_ctrl_list(cntlist, num, list); | |||
| 3059 | } else { | |||
| 3060 | struct nvme_id_ctrl ctrl = { 0 }; | |||
| 3061 | ||||
| 3062 | err = nvme_identify_ctrl(hdl, &ctrl); | |||
| 3063 | if (err) { | |||
| 3064 | fprintf(stderrstderr, "identify-ctrl %s\n", libnvme_strerror(-err)); | |||
| 3065 | return err; | |||
| 3066 | } | |||
| 3067 | cntlist->num = cpu_to_le16(1); | |||
| 3068 | cntlist->identifier[0] = ctrl.cntlid; | |||
| 3069 | } | |||
| 3070 | ||||
| 3071 | if (attach) | |||
| 3072 | nvme_init_ns_attach_ctrls(&cmd, cfg.nsid, cntlist); | |||
| 3073 | else | |||
| 3074 | nvme_init_ns_detach_ctrls(&cmd, cfg.nsid, cntlist); | |||
| 3075 | ||||
| 3076 | if (cfg.ish) { | |||
| 3077 | if (libnvme_transport_handle_is_mi(hdl)) | |||
| 3078 | nvme_init_mi_cmd_flags(&cmd, ish); | |||
| 3079 | else | |||
| 3080 | printf("ISH is supported only for NVMe-MI\n"); | |||
| 3081 | } | |||
| 3082 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 3083 | ns_mgmt_show_status(hdl, err, acmd->name, cfg.nsid); | |||
| 3084 | ||||
| 3085 | return err; | |||
| 3086 | } | |||
| 3087 | ||||
| 3088 | static int attach_ns(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 3089 | { | |||
| 3090 | const char *desc = "Attach the given namespace to the " | |||
| 3091 | "given controller or comma-sep list of controllers. ID of the " | |||
| 3092 | "given namespace becomes active upon attachment to a " | |||
| 3093 | "controller. A namespace must be attached to a controller " | |||
| 3094 | "before IO commands may be directed to that namespace."; | |||
| 3095 | ||||
| 3096 | return nvme_attach_ns(argc, argv, 1, desc, acmd); | |||
| 3097 | } | |||
| 3098 | ||||
| 3099 | static int detach_ns(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 3100 | { | |||
| 3101 | const char *desc = "Detach the given namespace from the " | |||
| 3102 | "given controller; de-activates the given namespace's ID. A " | |||
| 3103 | "namespace must be attached to a controller before IO " | |||
| 3104 | "commands may be directed to that namespace."; | |||
| 3105 | ||||
| 3106 | return nvme_attach_ns(argc, argv, 0, desc, acmd); | |||
| 3107 | } | |||
| 3108 | ||||
| 3109 | static int parse_lba_num_si(struct libnvme_transport_handle *hdl, const char *opt, | |||
| 3110 | const char *val, __u8 flbas, __u64 *num, __u64 align) | |||
| 3111 | { | |||
| 3112 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_ns_list *ns_list = NULL((void*)0); | |||
| 3113 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ctrl *ctrl = NULL((void*)0); | |||
| 3114 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ns *ns = NULL((void*)0); | |||
| 3115 | __u32 nsid = 1; | |||
| 3116 | __u8 lbaf; | |||
| 3117 | unsigned int remainder; | |||
| 3118 | char *endptr; | |||
| 3119 | int err = -EINVAL22; | |||
| 3120 | int lbas; | |||
| 3121 | ||||
| 3122 | if (!val) | |||
| 3123 | return 0; | |||
| 3124 | ||||
| 3125 | if (*num) { | |||
| 3126 | nvme_show_error(nvme_show_message(1, "Invalid specification of both %s and its SI argument, please specify only one" , opt) | |||
| 3127 | "Invalid specification of both %s and its SI argument, please specify only one",nvme_show_message(1, "Invalid specification of both %s and its SI argument, please specify only one" , opt) | |||
| 3128 | opt)nvme_show_message(1, "Invalid specification of both %s and its SI argument, please specify only one" , opt); | |||
| 3129 | return err; | |||
| 3130 | } | |||
| 3131 | ||||
| 3132 | ctrl = libnvme_alloc(sizeof(*ctrl)); | |||
| 3133 | if (!ctrl) | |||
| 3134 | return -ENOMEM12; | |||
| 3135 | ||||
| 3136 | err = nvme_identify_ctrl(hdl, ctrl); | |||
| 3137 | if (err) { | |||
| 3138 | nvme_show_err(err, "identify controller"); | |||
| 3139 | return err; | |||
| 3140 | } | |||
| 3141 | ||||
| 3142 | ns_list = libnvme_alloc(sizeof(*ns_list)); | |||
| 3143 | if (!ns_list) | |||
| 3144 | return -ENOMEM12; | |||
| 3145 | ||||
| 3146 | if ((ctrl->oacs & 0x8) >> 3) { | |||
| 3147 | nsid = NVME_NSID_ALL; | |||
| 3148 | } else { | |||
| 3149 | err = nvme_identify_active_ns_list(hdl, nsid - 1, ns_list); | |||
| 3150 | if (err) { | |||
| 3151 | nvme_show_err(err, "identify namespace list"); | |||
| 3152 | return err; | |||
| 3153 | } | |||
| 3154 | nsid = le32_to_cpu(ns_list->ns[0]); | |||
| 3155 | } | |||
| 3156 | ||||
| 3157 | ns = libnvme_alloc(sizeof(*ns)); | |||
| 3158 | if (!ns) | |||
| 3159 | return -ENOMEM12; | |||
| 3160 | ||||
| 3161 | err = nvme_identify_ns(hdl, nsid, ns); | |||
| 3162 | if (err) { | |||
| 3163 | nvme_show_err(err, "identify namespace"); | |||
| 3164 | return err; | |||
| 3165 | } | |||
| 3166 | ||||
| 3167 | nvme_id_ns_flbas_to_lbaf_inuse(flbas, &lbaf); | |||
| 3168 | lbas = (1 << ns->lbaf[lbaf].ds) + le16_to_cpu(ns->lbaf[lbaf].ms); | |||
| 3169 | ||||
| 3170 | err = suffix_si_parse(val, &endptr, (uint64_t *)num); | |||
| 3171 | if (err) { | |||
| 3172 | nvme_show_error("Expected long suffixed integer argument for '%s-si' but got '%s'!",nvme_show_message(1, "Expected long suffixed integer argument for '%s-si' but got '%s'!" , opt, val) | |||
| 3173 | opt, val)nvme_show_message(1, "Expected long suffixed integer argument for '%s-si' but got '%s'!" , opt, val); | |||
| 3174 | return -err; | |||
| 3175 | } | |||
| 3176 | ||||
| 3177 | if (endptr[0]) { | |||
| 3178 | remainder = *num % align; | |||
| 3179 | if (remainder) | |||
| 3180 | *num += align - remainder; | |||
| 3181 | } | |||
| 3182 | ||||
| 3183 | if (endptr[0] != '\0') | |||
| 3184 | *num /= lbas; | |||
| 3185 | ||||
| 3186 | return 0; | |||
| 3187 | } | |||
| 3188 | ||||
| 3189 | static int create_ns(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 3190 | { | |||
| 3191 | const char *desc = "Send a namespace management command " | |||
| 3192 | "to the specified device to create a namespace with the given " | |||
| 3193 | "parameters. The next available namespace ID is used for the " | |||
| 3194 | "create operation. Note that create-ns does not attach the " | |||
| 3195 | "namespace to a controller, the attach-ns command is needed."; | |||
| 3196 | const char *nsze = "size of ns (NSZE)"; | |||
| 3197 | const char *ncap = "capacity of ns (NCAP)"; | |||
| 3198 | const char *flbas = | |||
| 3199 | "Formatted LBA size (FLBAS), if entering this value ignore \'block-size\' field"; | |||
| 3200 | const char *dps = "data protection settings (DPS)"; | |||
| 3201 | const char *nmic = "multipath and sharing capabilities (NMIC)"; | |||
| 3202 | const char *anagrpid = "ANA Group Identifier (ANAGRPID)"; | |||
| 3203 | const char *nvmsetid = "NVM Set Identifier (NVMSETID)"; | |||
| 3204 | const char *csi = "command set identifier (CSI)"; | |||
| 3205 | const char *lbstm = "logical block storage tag mask (LBSTM)"; | |||
| 3206 | const char *nphndls = "Number of Placement Handles (NPHNDLS)"; | |||
| 3207 | const char *bs = "target block size, specify only if \'FLBAS\' value not entered"; | |||
| 3208 | const char *nsze_si = "size of ns (NSZE) in standard SI units"; | |||
| 3209 | const char *ncap_si = "capacity of ns (NCAP) in standard SI units"; | |||
| 3210 | const char *azr = "Allocate ZRWA Resources (AZR) for Zoned Namespace Command Set"; | |||
| 3211 | const char *rar = "Requested Active Resources (RAR) for Zoned Namespace Command Set"; | |||
| 3212 | const char *ror = "Requested Open Resources (ROR) for Zoned Namespace Command Set"; | |||
| 3213 | const char *rnumzrwa = | |||
| 3214 | "Requested Number of ZRWA Resources (RNUMZRWA) for Zoned Namespace Command Set"; | |||
| 3215 | const char *phndls = "Comma separated list of Placement Handle Associated RUH"; | |||
| 3216 | ||||
| 3217 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 3218 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_ns_mgmt_host_sw_specified *data = NULL((void*)0); | |||
| 3219 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ns_granularity_list *gr_list = NULL((void*)0); | |||
| 3220 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 3221 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ctrl *id = NULL((void*)0); | |||
| 3222 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ns *ns = NULL((void*)0); | |||
| 3223 | __u64 align_nsze = 1 << 20; /* Default 1 MiB */ | |||
| 3224 | __u64 align_ncap = align_nsze; | |||
| 3225 | struct libnvme_passthru_cmd cmd; | |||
| 3226 | uint16_t phndl[128] = { 0, }; | |||
| 3227 | nvme_print_flags_t flags; | |||
| 3228 | uint16_t num_phandle; | |||
| 3229 | int err = 0, i; | |||
| 3230 | __u32 nsid; | |||
| 3231 | ||||
| 3232 | struct config { | |||
| 3233 | bool_Bool ish; | |||
| 3234 | __u64 nsze; | |||
| 3235 | __u64 ncap; | |||
| 3236 | __u8 flbas; | |||
| 3237 | __u8 dps; | |||
| 3238 | __u8 nmic; | |||
| 3239 | __u32 anagrpid; | |||
| 3240 | __u16 nvmsetid; | |||
| 3241 | __u16 endgid; | |||
| 3242 | __u64 bs; | |||
| 3243 | __u8 csi; | |||
| 3244 | __u64 lbstm; | |||
| 3245 | __u16 nphndls; | |||
| 3246 | char *nsze_si; | |||
| 3247 | char *ncap_si; | |||
| 3248 | bool_Bool azr; | |||
| 3249 | __u32 rar; | |||
| 3250 | __u32 ror; | |||
| 3251 | __u32 rnumzrwa; | |||
| 3252 | char *phndls; | |||
| 3253 | }; | |||
| 3254 | ||||
| 3255 | struct config cfg = { | |||
| 3256 | .ish = false0, | |||
| 3257 | .nsze = 0, | |||
| 3258 | .ncap = 0, | |||
| 3259 | .flbas = 0xff, | |||
| 3260 | .dps = 0, | |||
| 3261 | .nmic = 0, | |||
| 3262 | .anagrpid = 0, | |||
| 3263 | .nvmsetid = 0, | |||
| 3264 | .endgid = 0, | |||
| 3265 | .bs = 0x00, | |||
| 3266 | .csi = 0, | |||
| 3267 | .lbstm = 0, | |||
| 3268 | .nphndls = 0, | |||
| 3269 | .nsze_si = NULL((void*)0), | |||
| 3270 | .ncap_si = NULL((void*)0), | |||
| 3271 | .azr = false0, | |||
| 3272 | .rar = 0, | |||
| 3273 | .ror = 0, | |||
| 3274 | .rnumzrwa = 0, | |||
| 3275 | .phndls = "", | |||
| 3276 | }; | |||
| 3277 | ||||
| 3278 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3279 | OPT_FLAG("ish", 'I', &cfg.ish, ish),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3280 | OPT_SUFFIX("nsze", 's', &cfg.nsze, nsze),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3281 | OPT_SUFFIX("ncap", 'c', &cfg.ncap, ncap),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3282 | OPT_BYTE("flbas", 'f', &cfg.flbas, flbas),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3283 | OPT_BYTE("dps", 'd', &cfg.dps, dps),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3284 | OPT_BYTE("nmic", 'm', &cfg.nmic, nmic),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3285 | OPT_UINT("anagrp-id", 'a', &cfg.anagrpid, anagrpid),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3286 | OPT_SHRT("nvmset-id", 'i', &cfg.nvmsetid, nvmsetid),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3287 | OPT_SHRT("endg-id", 'e', &cfg.endgid, endgid),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3288 | OPT_SUFFIX("block-size", 'b', &cfg.bs, bs),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3289 | OPT_BYTE("csi", 'y', &cfg.csi, csi),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3290 | OPT_SUFFIX("lbstm", 'l', &cfg.lbstm, lbstm),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3291 | OPT_SHRT("nphndls", 'n', &cfg.nphndls, nphndls),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3292 | OPT_STR("nsze-si", 'S', &cfg.nsze_si, nsze_si),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3293 | OPT_STR("ncap-si", 'C', &cfg.ncap_si, ncap_si),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3294 | OPT_FLAG("azr", 'z', &cfg.azr, azr),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3295 | OPT_UINT("rar", 'r', &cfg.rar, rar),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3296 | OPT_UINT("ror", 'O', &cfg.ror, ror),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3297 | OPT_UINT("rnumzrwa", 'u', &cfg.rnumzrwa, rnumzrwa),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3298 | OPT_LIST("phndls", 'p', &cfg.phndls, phndls))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"nsze", 's', "IONUM", CFG_LONG_SUFFIX, &cfg.nsze , 1, nsze, 0, }, {"ncap", 'c', "IONUM", CFG_LONG_SUFFIX, & cfg.ncap, 1, ncap, 0, }, {"flbas", 'f', "NUM", CFG_BYTE, & cfg.flbas, 1, flbas, 0, }, {"dps", 'd', "NUM", CFG_BYTE, & cfg.dps, 1, dps, 0, }, {"nmic", 'm', "NUM", CFG_BYTE, &cfg .nmic, 1, nmic, 0, }, {"anagrp-id", 'a', "NUM", CFG_POSITIVE, &cfg.anagrpid, 1, anagrpid, 0, }, {"nvmset-id", 'i', "NUM" , CFG_SHORT, &cfg.nvmsetid, 1, nvmsetid, 0, }, {"endg-id" , 'e', "NUM", CFG_SHORT, &cfg.endgid, 1, endgid, 0, }, {"block-size" , 'b', "IONUM", CFG_LONG_SUFFIX, &cfg.bs, 1, bs, 0, }, {"csi" , 'y', "NUM", CFG_BYTE, &cfg.csi, 1, csi, 0, }, {"lbstm", 'l', "IONUM", CFG_LONG_SUFFIX, &cfg.lbstm, 1, lbstm, 0, } , {"nphndls", 'n', "NUM", CFG_SHORT, &cfg.nphndls, 1, nphndls , 0, }, {"nsze-si", 'S', "STRING", CFG_STRING, &cfg.nsze_si , 1, nsze_si, 0, }, {"ncap-si", 'C', "STRING", CFG_STRING, & cfg.ncap_si, 1, ncap_si, 0, }, {"azr", 'z', ((void*)0), CFG_FLAG , &cfg.azr, 0, azr, 0, }, {"rar", 'r', "NUM", CFG_POSITIVE , &cfg.rar, 1, rar, 0, }, {"ror", 'O', "NUM", CFG_POSITIVE , &cfg.ror, 1, ror, 0, }, {"rnumzrwa", 'u', "NUM", CFG_POSITIVE , &cfg.rnumzrwa, 1, rnumzrwa, 0, }, {"phndls", 'p', "LIST" , CFG_STRING, &cfg.phndls, 1, phndls, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 3299 | ||||
| 3300 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 3301 | if (err) | |||
| 3302 | return err; | |||
| 3303 | ||||
| 3304 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 3305 | if (err < 0) { | |||
| 3306 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 3307 | return err; | |||
| 3308 | } | |||
| 3309 | ||||
| 3310 | if (cfg.flbas != 0xff && cfg.bs != 0x00) { | |||
| 3311 | nvme_show_error(nvme_show_message(1, "Invalid specification of both FLBAS and Block Size, please specify only one" ) | |||
| 3312 | "Invalid specification of both FLBAS and Block Size, please specify only one")nvme_show_message(1, "Invalid specification of both FLBAS and Block Size, please specify only one" ); | |||
| 3313 | return -EINVAL22; | |||
| 3314 | } | |||
| 3315 | if (cfg.bs) { | |||
| 3316 | if ((cfg.bs & (~cfg.bs + 1)) != cfg.bs) { | |||
| 3317 | nvme_show_error(nvme_show_message(1, "Invalid value for block size (%""l" "u" "). Block size must be a power of two", (uint64_t)cfg.bs) | |||
| 3318 | "Invalid value for block size (%"PRIu64"). Block size must be a power of two",nvme_show_message(1, "Invalid value for block size (%""l" "u" "). Block size must be a power of two", (uint64_t)cfg.bs) | |||
| 3319 | (uint64_t)cfg.bs)nvme_show_message(1, "Invalid value for block size (%""l" "u" "). Block size must be a power of two", (uint64_t)cfg.bs); | |||
| 3320 | return -EINVAL22; | |||
| 3321 | } | |||
| 3322 | ||||
| 3323 | ||||
| 3324 | ns = libnvme_alloc(sizeof(*ns)); | |||
| 3325 | if (!ns) | |||
| 3326 | return -ENOMEM12; | |||
| 3327 | ||||
| 3328 | err = nvme_identify_ns(hdl, NVME_NSID_ALL, ns); | |||
| 3329 | if (err) { | |||
| 3330 | if (err > 0) | |||
| 3331 | fprintf(stderrstderr, "identify failed\n"); | |||
| 3332 | nvme_show_err(err, "identify-namespace"); | |||
| 3333 | return err; | |||
| 3334 | } | |||
| 3335 | for (i = 0; i <= ns->nlbaf; ++i) { | |||
| 3336 | if ((1 << ns->lbaf[i].ds) == cfg.bs && ns->lbaf[i].ms == 0) { | |||
| 3337 | cfg.flbas = i; | |||
| 3338 | break; | |||
| 3339 | } | |||
| 3340 | } | |||
| 3341 | ||||
| 3342 | } | |||
| 3343 | if (cfg.flbas == 0xff) { | |||
| 3344 | fprintf(stderrstderr, "FLBAS corresponding to block size %"PRIu64"l" "u"" not found\n", | |||
| 3345 | (uint64_t)cfg.bs); | |||
| 3346 | fprintf(stderrstderr, "Please correct block size, or specify FLBAS directly\n"); | |||
| 3347 | ||||
| 3348 | return -EINVAL22; | |||
| 3349 | } | |||
| 3350 | ||||
| 3351 | id = libnvme_alloc(sizeof(*id)); | |||
| 3352 | if (!id) | |||
| 3353 | return -ENOMEM12; | |||
| 3354 | ||||
| 3355 | err = nvme_identify_ctrl(hdl, id); | |||
| 3356 | if (err) { | |||
| 3357 | if (err > 0) | |||
| 3358 | fprintf(stderrstderr, "identify controller failed\n"); | |||
| 3359 | nvme_show_err(err, "identify-controller"); | |||
| 3360 | return err; | |||
| 3361 | } | |||
| 3362 | ||||
| 3363 | if (id->ctratt & NVME_CTRL_CTRATT_NAMESPACE_GRANULARITY) { | |||
| 3364 | gr_list = libnvme_alloc(sizeof(*gr_list)); | |||
| 3365 | if (!gr_list) | |||
| 3366 | return -ENOMEM12; | |||
| 3367 | ||||
| 3368 | if (!nvme_identify_ns_granularity(hdl, gr_list)) { | |||
| 3369 | struct nvme_id_ns_granularity_desc *desc; | |||
| 3370 | int index = cfg.flbas; | |||
| 3371 | ||||
| 3372 | /* FIXME: add a proper bitmask to libnvme */ | |||
| 3373 | if (!(le32_to_cpu(gr_list->attributes) & 1)) { | |||
| 3374 | /* Only the first descriptor is valid */ | |||
| 3375 | index = 0; | |||
| 3376 | } else if (index > gr_list->num_descriptors) { | |||
| 3377 | /* | |||
| 3378 | * The descriptor will contain only zeroes | |||
| 3379 | * so we don't need to read it. | |||
| 3380 | */ | |||
| 3381 | goto parse_lba; | |||
| 3382 | } | |||
| 3383 | desc = &gr_list->entry[index]; | |||
| 3384 | ||||
| 3385 | if (desc->nszegran) { | |||
| 3386 | print_info("enforce nsze alignment to %"PRIx64do { if (is_printable_at_level(LIBNVME_LOG_INFO)) printf("enforce nsze alignment to %" "l" "x" " because of namespace granularity requirements\n", le64_to_cpu (desc->nszegran)); } while (0) | |||
| 3387 | " because of namespace granularity requirements\n",do { if (is_printable_at_level(LIBNVME_LOG_INFO)) printf("enforce nsze alignment to %" "l" "x" " because of namespace granularity requirements\n", le64_to_cpu (desc->nszegran)); } while (0) | |||
| 3388 | le64_to_cpu(desc->nszegran))do { if (is_printable_at_level(LIBNVME_LOG_INFO)) printf("enforce nsze alignment to %" "l" "x" " because of namespace granularity requirements\n", le64_to_cpu (desc->nszegran)); } while (0); | |||
| 3389 | align_nsze = le64_to_cpu(desc->nszegran); | |||
| 3390 | } | |||
| 3391 | if (desc->ncapgran) { | |||
| 3392 | print_info("enforce ncap alignment to %"PRIx64do { if (is_printable_at_level(LIBNVME_LOG_INFO)) printf("enforce ncap alignment to %" "l" "x" " because of namespace granularity requirements\n", le64_to_cpu (desc->ncapgran)); } while (0) | |||
| 3393 | " because of namespace granularity requirements\n",do { if (is_printable_at_level(LIBNVME_LOG_INFO)) printf("enforce ncap alignment to %" "l" "x" " because of namespace granularity requirements\n", le64_to_cpu (desc->ncapgran)); } while (0) | |||
| 3394 | le64_to_cpu(desc->ncapgran))do { if (is_printable_at_level(LIBNVME_LOG_INFO)) printf("enforce ncap alignment to %" "l" "x" " because of namespace granularity requirements\n", le64_to_cpu (desc->ncapgran)); } while (0); | |||
| 3395 | align_ncap = le64_to_cpu(desc->ncapgran); | |||
| 3396 | } | |||
| 3397 | } | |||
| 3398 | } | |||
| 3399 | ||||
| 3400 | parse_lba: | |||
| 3401 | err = parse_lba_num_si(hdl, "nsze", cfg.nsze_si, cfg.flbas, &cfg.nsze, align_nsze); | |||
| 3402 | if (err) | |||
| 3403 | return err; | |||
| 3404 | ||||
| 3405 | err = parse_lba_num_si(hdl, "ncap", cfg.ncap_si, cfg.flbas, &cfg.ncap, align_ncap); | |||
| 3406 | if (err) | |||
| 3407 | return err; | |||
| 3408 | ||||
| 3409 | if (cfg.csi != NVME_CSI_ZNS && (cfg.azr || cfg.rar || cfg.ror || cfg.rnumzrwa)) { | |||
| 3410 | nvme_show_error("Invalid ZNS argument is given (CSI:%#x)", cfg.csi)nvme_show_message(1, "Invalid ZNS argument is given (CSI:%#x)" , cfg.csi); | |||
| 3411 | return -EINVAL22; | |||
| 3412 | } | |||
| 3413 | ||||
| 3414 | data = libnvme_alloc(sizeof(*data)); | |||
| 3415 | if (!data) | |||
| 3416 | return -ENOMEM12; | |||
| 3417 | ||||
| 3418 | data->nsze = cpu_to_le64(cfg.nsze); | |||
| 3419 | data->ncap = cpu_to_le64(cfg.ncap); | |||
| 3420 | data->flbas = cfg.flbas; | |||
| 3421 | data->dps = cfg.dps; | |||
| 3422 | data->nmic = cfg.nmic; | |||
| 3423 | data->anagrpid = cpu_to_le32(cfg.anagrpid); | |||
| 3424 | data->nvmsetid = cpu_to_le16(cfg.nvmsetid); | |||
| 3425 | data->endgid = cpu_to_le16(cfg.endgid); | |||
| 3426 | data->lbstm = cpu_to_le64(cfg.lbstm); | |||
| 3427 | data->zns.znsco = cfg.azr; | |||
| 3428 | data->zns.rar = cpu_to_le32(cfg.rar); | |||
| 3429 | data->zns.ror = cpu_to_le32(cfg.ror); | |||
| 3430 | data->zns.rnumzrwa = cpu_to_le32(cfg.rnumzrwa); | |||
| 3431 | data->nphndls = cpu_to_le16(cfg.nphndls); | |||
| 3432 | ||||
| 3433 | num_phandle = argconfig_parse_comma_sep_array_short(cfg.phndls, phndl, ARRAY_SIZE(phndl)(sizeof(phndl) / sizeof((phndl)[0]))); | |||
| 3434 | if (cfg.nphndls != num_phandle) { | |||
| 3435 | nvme_show_error("Invalid Placement handle list")nvme_show_message(1, "Invalid Placement handle list"); | |||
| 3436 | return -EINVAL22; | |||
| 3437 | } | |||
| 3438 | ||||
| 3439 | for (i = 0; i < num_phandle; i++) | |||
| 3440 | data->phndl[i] = cpu_to_le16(phndl[i]); | |||
| 3441 | ||||
| 3442 | nvme_init_ns_mgmt_create(&cmd, cfg.csi, data); | |||
| 3443 | if (cfg.ish) { | |||
| 3444 | if (libnvme_transport_handle_is_mi(hdl)) | |||
| 3445 | nvme_init_mi_cmd_flags(&cmd, ish); | |||
| 3446 | else | |||
| 3447 | printf("ISH is supported only for NVMe-MI\n"); | |||
| 3448 | } | |||
| 3449 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 3450 | nsid = cmd.result; | |||
| 3451 | ns_mgmt_show_status(hdl, err, acmd->name, nsid); | |||
| 3452 | ||||
| 3453 | return err; | |||
| 3454 | } | |||
| 3455 | ||||
| 3456 | static bool_Bool nvme_match_devname(char *devname, libnvme_ns_t ns) | |||
| 3457 | { | |||
| 3458 | libnvme_ctrl_t c = libnvme_ns_get_ctrl(ns); | |||
| 3459 | ||||
| 3460 | if (!strcmp(devname, libnvme_ns_get_name(ns)) || | |||
| 3461 | (c && !strcmp(devname, libnvme_ctrl_get_name(c))) || | |||
| 3462 | !strcmp(devname, libnvme_ns_get_generic_name(ns))) | |||
| 3463 | return true1; | |||
| 3464 | ||||
| 3465 | return false0; | |||
| 3466 | } | |||
| 3467 | ||||
| 3468 | static bool_Bool nvme_match_device_filter(libnvme_subsystem_t s, | |||
| 3469 | libnvme_ctrl_t c, libnvme_ns_t ns, void *f_args) | |||
| 3470 | { | |||
| 3471 | char *devname = f_args; | |||
| 3472 | libnvme_ns_t n; | |||
| 3473 | ||||
| 3474 | if (ns && nvme_match_devname(devname, ns)) | |||
| 3475 | return true1; | |||
| 3476 | ||||
| 3477 | if (c) { | |||
| 3478 | s = libnvme_ctrl_get_subsystem(c); | |||
| 3479 | libnvme_ctrl_for_each_ns(c, n)for (n = libnvme_ctrl_first_ns(c); n != ((void*)0); n = libnvme_ctrl_next_ns (c, n)) { | |||
| 3480 | if (nvme_match_devname(devname, n)) | |||
| 3481 | return true1; | |||
| 3482 | } | |||
| 3483 | } | |||
| 3484 | if (s) { | |||
| 3485 | libnvme_subsystem_for_each_ns(s, n)for (n = libnvme_subsystem_first_ns(s); n != ((void*)0); n = libnvme_subsystem_next_ns (s, n)) { | |||
| 3486 | if (!strcmp(devname, libnvme_ns_get_name(n))) | |||
| 3487 | return true1; | |||
| 3488 | } | |||
| 3489 | } | |||
| 3490 | ||||
| 3491 | return false0; | |||
| 3492 | } | |||
| 3493 | ||||
| 3494 | static int handle_scan_topology_error(int err) | |||
| 3495 | { | |||
| 3496 | /* Do not report an error when nvme_core module is not loaded */ | |||
| 3497 | if (err == -ENOENT2) { | |||
| 3498 | if (log_level >= LIBNVME_LOG_INFO) | |||
| 3499 | nvme_show_error("nvme modules not loaded")nvme_show_message(1, "nvme modules not loaded"); | |||
| 3500 | return 0; | |||
| 3501 | } | |||
| 3502 | ||||
| 3503 | nvme_show_error("Failed to scan topology: %s", libnvme_strerror(-err))nvme_show_message(1, "Failed to scan topology: %s", libnvme_strerror (-err)); | |||
| 3504 | return err; | |||
| 3505 | } | |||
| 3506 | ||||
| 3507 | static int list_subsys(int argc, char **argv, struct command *acmd, | |||
| 3508 | struct plugin *plugin) | |||
| 3509 | { | |||
| 3510 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 3511 | nvme_print_flags_t flags; | |||
| 3512 | const char *desc = "Retrieve information for subsystems"; | |||
| 3513 | libnvme_scan_filter_t filter = NULL((void*)0); | |||
| 3514 | char *devname; | |||
| 3515 | int err; | |||
| 3516 | int nsid = NVME_NSID_ALL; | |||
| 3517 | ||||
| 3518 | NVME_ARGS(opts)struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 3519 | ||||
| 3520 | err = parse_args(argc, argv, desc, opts); | |||
| 3521 | if (err) | |||
| 3522 | return err; | |||
| 3523 | ||||
| 3524 | devname = NULL((void*)0); | |||
| 3525 | if (optind < argc) | |||
| 3526 | devname = basename__xpg_basename(argv[optind++]); | |||
| 3527 | ||||
| 3528 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 3529 | if (err < 0 || (flags != JSON && flags != NORMAL)) { | |||
| 3530 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 3531 | return -EINVAL22; | |||
| 3532 | } | |||
| 3533 | ||||
| 3534 | if (nvme_args.verbose) | |||
| 3535 | flags |= VERBOSE; | |||
| 3536 | ||||
| 3537 | ctx = libnvme_create_global_ctx(stdoutstdout, log_level); | |||
| 3538 | if (!ctx) { | |||
| 3539 | if (devname) | |||
| 3540 | nvme_show_error("Failed to scan nvme subsystem for %s", devname)nvme_show_message(1, "Failed to scan nvme subsystem for %s", devname ); | |||
| 3541 | else | |||
| 3542 | nvme_show_error("Failed to scan nvme subsystem")nvme_show_message(1, "Failed to scan nvme subsystem"); | |||
| 3543 | return -ENOMEM12; | |||
| 3544 | } | |||
| 3545 | ||||
| 3546 | if (devname) { | |||
| 3547 | int subsys_num; | |||
| 3548 | ||||
| 3549 | if (sscanf(devname, "nvme%dn%d", &subsys_num, &nsid) < 1 && | |||
| 3550 | sscanf(devname, "ng%dn%d", &subsys_num, &nsid) != 2) { | |||
| 3551 | nvme_show_error("Invalid device name %s", devname)nvme_show_message(1, "Invalid device name %s", devname); | |||
| 3552 | return -EINVAL22; | |||
| 3553 | } | |||
| 3554 | filter = nvme_match_device_filter; | |||
| 3555 | } | |||
| 3556 | ||||
| 3557 | err = libnvme_scan_topology(ctx, filter, (void *)devname); | |||
| 3558 | if (err) | |||
| 3559 | return handle_scan_topology_error(err); | |||
| 3560 | ||||
| 3561 | nvme_show_subsystem_list(ctx, nsid != NVME_NSID_ALL, flags); | |||
| 3562 | ||||
| 3563 | return 0; | |||
| 3564 | } | |||
| 3565 | ||||
| 3566 | #ifdef CONFIG_TOP | |||
| 3567 | static int top(int argc, char **argv, struct command *acmd, | |||
| 3568 | struct plugin *plugin) | |||
| 3569 | { | |||
| 3570 | int err; | |||
| 3571 | nvme_print_flags_t flags = 0; | |||
| 3572 | const char *desc = "show nvme top output"; | |||
| 3573 | const char *delay = "refresh interval in seconds"; | |||
| 3574 | ||||
| 3575 | struct config { | |||
| 3576 | int delay; | |||
| 3577 | }; | |||
| 3578 | ||||
| 3579 | struct config cfg = { | |||
| 3580 | .delay = 1, | |||
| 3581 | }; | |||
| 3582 | ||||
| 3583 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"delay", 'd', "NUM", CFG_INT, &cfg.delay, 1, delay , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 3584 | OPT_INT("delay", 'd', &cfg.delay, delay))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"delay", 'd', "NUM", CFG_INT, &cfg.delay, 1, delay , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 3585 | ||||
| 3586 | err = parse_args(argc, argv, desc, opts); | |||
| 3587 | if (err) | |||
| 3588 | return err; | |||
| 3589 | ||||
| 3590 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 3591 | if (err < 0 || flags != NORMAL) { | |||
| 3592 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 3593 | return -EINVAL22; | |||
| 3594 | } | |||
| 3595 | ||||
| 3596 | if (cfg.delay < 1) { | |||
| 3597 | nvme_show_error("delay must be greater than or equal to 1")nvme_show_message(1, "delay must be greater than or equal to 1" ); | |||
| 3598 | return -EINVAL22; | |||
| 3599 | } | |||
| 3600 | ||||
| 3601 | err = nvme_install_sigwinch_handler(); | |||
| 3602 | if (err) { | |||
| 3603 | nvme_show_error("failed to install sig handler for SIGWINCH")nvme_show_message(1, "failed to install sig handler for SIGWINCH" ); | |||
| 3604 | return err; | |||
| 3605 | } | |||
| 3606 | ||||
| 3607 | nvme_show_top(flags, cfg.delay); | |||
| 3608 | ||||
| 3609 | return err; | |||
| 3610 | } | |||
| 3611 | #endif | |||
| 3612 | ||||
| 3613 | static int list(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 3614 | { | |||
| 3615 | const char *desc = "Retrieve basic information for all NVMe namespaces"; | |||
| 3616 | nvme_print_flags_t flags; | |||
| 3617 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 3618 | int err = 0; | |||
| 3619 | ||||
| 3620 | NVME_ARGS(opts)struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 3621 | ||||
| 3622 | err = parse_args(argc, argv, desc, opts); | |||
| 3623 | if (err) | |||
| 3624 | return err; | |||
| 3625 | ||||
| 3626 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 3627 | if (err < 0 || (flags != JSON && flags != NORMAL)) { | |||
| 3628 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 3629 | return -EINVAL22; | |||
| 3630 | } | |||
| 3631 | ||||
| 3632 | if (nvme_args.verbose) | |||
| 3633 | flags |= VERBOSE; | |||
| 3634 | ||||
| 3635 | ctx = libnvme_create_global_ctx(stdoutstdout, log_level); | |||
| 3636 | if (!ctx) { | |||
| 3637 | nvme_show_error("Failed to create global context")nvme_show_message(1, "Failed to create global context"); | |||
| 3638 | return -ENOMEM12; | |||
| 3639 | } | |||
| 3640 | err = libnvme_scan_topology(ctx, NULL((void*)0), NULL((void*)0)); | |||
| 3641 | if (err < 0) | |||
| 3642 | return handle_scan_topology_error(err); | |||
| 3643 | ||||
| 3644 | nvme_show_list_items(ctx, flags); | |||
| 3645 | ||||
| 3646 | return err; | |||
| 3647 | } | |||
| 3648 | ||||
| 3649 | int __id_ctrl(int argc, char **argv, struct command *acmd, struct plugin *plugin, | |||
| 3650 | void (*vs)(__u8 *vs, struct json_object *root)) | |||
| 3651 | { | |||
| 3652 | const char *desc = "Send an Identify Controller command to " | |||
| 3653 | "the given device and report information about the specified " | |||
| 3654 | "controller in human-readable or " | |||
| 3655 | "binary format. May also return vendor-specific " | |||
| 3656 | "controller attributes in hex-dump if requested."; | |||
| 3657 | const char *vendor_specific = "dump binary vendor field"; | |||
| 3658 | ||||
| 3659 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ctrl *ctrl = NULL((void*)0); | |||
| 3660 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 3661 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 3662 | nvme_print_flags_t flags; | |||
| 3663 | int err; | |||
| 3664 | ||||
| 3665 | struct config { | |||
| 3666 | bool_Bool vendor_specific; | |||
| 3667 | bool_Bool raw_binary; | |||
| 3668 | }; | |||
| 3669 | ||||
| 3670 | struct config cfg = { | |||
| 3671 | .vendor_specific = false0, | |||
| 3672 | .raw_binary = false0, | |||
| 3673 | }; | |||
| 3674 | ||||
| 3675 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"vendor-specific", 'V', ((void*)0), CFG_FLAG, &cfg .vendor_specific, 0, vendor_specific, 0, }, {"raw-binary", 'b' , ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_identify, 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 3676 | OPT_FLAG("vendor-specific", 'V', &cfg.vendor_specific, vendor_specific),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"vendor-specific", 'V', ((void*)0), CFG_FLAG, &cfg .vendor_specific, 0, vendor_specific, 0, }, {"raw-binary", 'b' , ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_identify, 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 3677 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_identify))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"vendor-specific", 'V', ((void*)0), CFG_FLAG, &cfg .vendor_specific, 0, vendor_specific, 0, }, {"raw-binary", 'b' , ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_identify, 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 3678 | ||||
| 3679 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 3680 | if (err) | |||
| 3681 | return err; | |||
| 3682 | ||||
| 3683 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 3684 | if (err < 0) { | |||
| 3685 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 3686 | return err; | |||
| 3687 | } | |||
| 3688 | ||||
| 3689 | if (cfg.raw_binary) | |||
| 3690 | flags = BINARY; | |||
| 3691 | ||||
| 3692 | if (cfg.vendor_specific) | |||
| 3693 | flags |= VS; | |||
| 3694 | ||||
| 3695 | if (nvme_args.verbose) | |||
| 3696 | flags |= VERBOSE; | |||
| 3697 | ||||
| 3698 | ctrl = libnvme_alloc(sizeof(*ctrl)); | |||
| 3699 | if (!ctrl) | |||
| 3700 | return -ENOMEM12; | |||
| 3701 | ||||
| 3702 | err = nvme_identify_ctrl(hdl, ctrl); | |||
| 3703 | if (err) { | |||
| 3704 | nvme_show_err(err, "identify controller"); | |||
| 3705 | return err; | |||
| 3706 | } | |||
| 3707 | ||||
| 3708 | nvme_show_id_ctrl(ctrl, libnvme_transport_handle_get_name(hdl), flags, vs); | |||
| 3709 | ||||
| 3710 | return err; | |||
| 3711 | } | |||
| 3712 | ||||
| 3713 | static int id_ctrl(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 3714 | { | |||
| 3715 | return __id_ctrl(argc, argv, acmd, plugin, NULL((void*)0)); | |||
| 3716 | } | |||
| 3717 | ||||
| 3718 | static int nvm_id_ctrl(int argc, char **argv, struct command *acmd, | |||
| 3719 | struct plugin *plugin) | |||
| 3720 | { | |||
| 3721 | const char *desc = "Send an Identify Controller NVM Command Set " | |||
| 3722 | "command to the given device and report information about " | |||
| 3723 | "the specified controller in various formats."; | |||
| 3724 | ||||
| 3725 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ctrl_nvm *ctrl_nvm = NULL((void*)0); | |||
| 3726 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 3727 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 3728 | struct libnvme_passthru_cmd cmd; | |||
| 3729 | nvme_print_flags_t flags; | |||
| 3730 | int err = -1; | |||
| 3731 | ||||
| 3732 | NVME_ARGS(opts)struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 3733 | ||||
| 3734 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 3735 | if (err) | |||
| 3736 | return err; | |||
| 3737 | ||||
| 3738 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 3739 | if (err < 0) { | |||
| 3740 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 3741 | return err; | |||
| 3742 | } | |||
| 3743 | ||||
| 3744 | if (nvme_args.verbose) | |||
| 3745 | flags |= VERBOSE; | |||
| 3746 | ||||
| 3747 | ctrl_nvm = libnvme_alloc(sizeof(*ctrl_nvm)); | |||
| 3748 | if (!ctrl_nvm) | |||
| 3749 | return -ENOMEM12; | |||
| 3750 | ||||
| 3751 | nvme_init_identify_csi_ctrl(&cmd, NVME_CSI_NVM, ctrl_nvm); | |||
| 3752 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 3753 | if (err) { | |||
| 3754 | nvme_show_err(err, "nvm identify controller"); | |||
| 3755 | return err; | |||
| 3756 | } | |||
| 3757 | ||||
| 3758 | nvme_show_id_ctrl_nvm(ctrl_nvm, flags); | |||
| 3759 | ||||
| 3760 | return err; | |||
| 3761 | } | |||
| 3762 | ||||
| 3763 | static int nvm_id_ns(int argc, char **argv, struct command *acmd, | |||
| 3764 | struct plugin *plugin) | |||
| 3765 | { | |||
| 3766 | const char *desc = "Send an Identify Namespace NVM Command Set " | |||
| 3767 | "command to the given device and report information about " | |||
| 3768 | "the specified namespace in various formats."; | |||
| 3769 | ||||
| 3770 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_nvm_id_ns *id_ns = NULL((void*)0); | |||
| 3771 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ns *ns = NULL((void*)0); | |||
| 3772 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 3773 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 3774 | nvme_print_flags_t flags; | |||
| 3775 | int err = -1; | |||
| 3776 | ||||
| 3777 | struct config { | |||
| 3778 | __u32 namespace_id; | |||
| 3779 | __u8 uuid_index; | |||
| 3780 | }; | |||
| 3781 | ||||
| 3782 | struct config cfg = { | |||
| 3783 | .namespace_id = 0, | |||
| 3784 | .uuid_index = NVME_UUID_NONE, | |||
| 3785 | }; | |||
| 3786 | ||||
| 3787 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"uuid-index", 'U', "NUM", CFG_BYTE , &cfg.uuid_index, 1, uuid_index, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3788 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"uuid-index", 'U', "NUM", CFG_BYTE , &cfg.uuid_index, 1, uuid_index, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3789 | OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"uuid-index", 'U', "NUM", CFG_BYTE , &cfg.uuid_index, 1, uuid_index, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 3790 | ||||
| 3791 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 3792 | if (err) | |||
| 3793 | return err; | |||
| 3794 | ||||
| 3795 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 3796 | if (err < 0) { | |||
| 3797 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 3798 | return err; | |||
| 3799 | } | |||
| 3800 | ||||
| 3801 | if (nvme_args.verbose) | |||
| 3802 | flags |= VERBOSE; | |||
| 3803 | ||||
| 3804 | if (!cfg.namespace_id) { | |||
| 3805 | err = libnvme_get_nsid(hdl, &cfg.namespace_id); | |||
| 3806 | if (err < 0) { | |||
| 3807 | nvme_show_perror("get-namespace-id"); | |||
| 3808 | return err; | |||
| 3809 | } | |||
| 3810 | } | |||
| 3811 | ||||
| 3812 | ns = libnvme_alloc(sizeof(*ns)); | |||
| 3813 | if (!ns) | |||
| 3814 | return -ENOMEM12; | |||
| 3815 | ||||
| 3816 | err = nvme_identify_ns(hdl, cfg.namespace_id, ns); | |||
| 3817 | if (err) { | |||
| 3818 | nvme_show_err(err, "nvm identify namespace"); | |||
| 3819 | return err; | |||
| 3820 | } | |||
| 3821 | ||||
| 3822 | id_ns = libnvme_alloc(sizeof(*id_ns)); | |||
| 3823 | if (!id_ns) | |||
| 3824 | return -ENOMEM12; | |||
| 3825 | ||||
| 3826 | err = nvme_identify_csi_ns(hdl, cfg.namespace_id, NVME_CSI_NVM, | |||
| 3827 | cfg.uuid_index, id_ns); | |||
| 3828 | if (err) { | |||
| 3829 | nvme_show_err(err, "nvm identify csi namespace"); | |||
| 3830 | return err; | |||
| 3831 | } | |||
| 3832 | ||||
| 3833 | nvme_show_nvm_id_ns(id_ns, cfg.namespace_id, ns, 0, false0, flags); | |||
| 3834 | ||||
| 3835 | return err; | |||
| 3836 | } | |||
| 3837 | ||||
| 3838 | static int nvm_id_ns_lba_format(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 3839 | { | |||
| 3840 | const char *desc = "Send an NVM Command Set specific Identify Namespace " | |||
| 3841 | "command to the given device, returns capability field properties of " | |||
| 3842 | "the specified LBA Format index in the specified namespace in various formats."; | |||
| 3843 | ||||
| 3844 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_nvm_id_ns *nvm_ns = NULL((void*)0); | |||
| 3845 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ns *ns = NULL((void*)0); | |||
| 3846 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 3847 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 3848 | nvme_print_flags_t flags; | |||
| 3849 | int err = -1; | |||
| 3850 | ||||
| 3851 | struct config { | |||
| 3852 | __u16 lba_format_index; | |||
| 3853 | __u8 uuid_index; | |||
| 3854 | }; | |||
| 3855 | ||||
| 3856 | struct config cfg = { | |||
| 3857 | .lba_format_index = 0, | |||
| 3858 | .uuid_index = NVME_UUID_NONE, | |||
| 3859 | }; | |||
| 3860 | ||||
| 3861 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"lba-format-index", 'i', "NUM", CFG_POSITIVE, &cfg .lba_format_index, 1, lba_format_index, 0, }, {"uuid-index", 'U' , "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3862 | OPT_UINT("lba-format-index", 'i', &cfg.lba_format_index, lba_format_index),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"lba-format-index", 'i', "NUM", CFG_POSITIVE, &cfg .lba_format_index, 1, lba_format_index, 0, }, {"uuid-index", 'U' , "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3863 | OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"lba-format-index", 'i', "NUM", CFG_POSITIVE, &cfg .lba_format_index, 1, lba_format_index, 0, }, {"uuid-index", 'U' , "NUM", CFG_BYTE, &cfg.uuid_index, 1, uuid_index, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 3864 | ||||
| 3865 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 3866 | if (err) | |||
| 3867 | return err; | |||
| 3868 | ||||
| 3869 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 3870 | if (err < 0) { | |||
| 3871 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 3872 | return err; | |||
| 3873 | } | |||
| 3874 | ||||
| 3875 | if (nvme_args.verbose) | |||
| 3876 | flags |= VERBOSE; | |||
| 3877 | ||||
| 3878 | ns = libnvme_alloc(sizeof(*ns)); | |||
| 3879 | if (!ns) | |||
| 3880 | return -ENOMEM12; | |||
| 3881 | ||||
| 3882 | err = nvme_identify_ns(hdl, NVME_NSID_ALL, ns); | |||
| 3883 | if (err) { | |||
| 3884 | ns->nlbaf = NVME_FEAT_LBA_RANGE_MAX - 1; | |||
| 3885 | ns->nulbaf = 0; | |||
| 3886 | } | |||
| 3887 | ||||
| 3888 | nvm_ns = libnvme_alloc(sizeof(*nvm_ns)); | |||
| 3889 | if (!nvm_ns) | |||
| 3890 | return -ENOMEM12; | |||
| 3891 | ||||
| 3892 | err = nvme_identify_csi_ns_user_data_format(hdl, NVME_CSI_NVM, | |||
| 3893 | cfg.lba_format_index, | |||
| 3894 | cfg.uuid_index, nvm_ns); | |||
| 3895 | if (err) { | |||
| 3896 | nvme_show_err(err, | |||
| 3897 | "NVM identify namespace for specific LBA format"); | |||
| 3898 | return err; | |||
| 3899 | } | |||
| 3900 | ||||
| 3901 | nvme_show_nvm_id_ns(nvm_ns, 0, ns, cfg.lba_format_index, true1, flags); | |||
| 3902 | ||||
| 3903 | return err; | |||
| 3904 | } | |||
| 3905 | ||||
| 3906 | static int ns_descs(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 3907 | { | |||
| 3908 | const char *desc = "Send Namespace Identification Descriptors command to the " | |||
| 3909 | "given device, returns the namespace identification descriptors " | |||
| 3910 | "of the specific namespace in either human-readable or binary format."; | |||
| 3911 | const char *raw = "show descriptors in binary format"; | |||
| 3912 | ||||
| 3913 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 3914 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 3915 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) void *nsdescs = NULL((void*)0); | |||
| 3916 | nvme_print_flags_t flags; | |||
| 3917 | int err; | |||
| 3918 | ||||
| 3919 | struct config { | |||
| 3920 | __u32 namespace_id; | |||
| 3921 | bool_Bool raw_binary; | |||
| 3922 | }; | |||
| 3923 | ||||
| 3924 | struct config cfg = { | |||
| 3925 | .namespace_id = 0, | |||
| 3926 | .raw_binary = false0, | |||
| 3927 | }; | |||
| 3928 | ||||
| 3929 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"raw-binary", 'b', ((void*) 0), CFG_FLAG, &cfg.raw_binary, 0, raw, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3930 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"raw-binary", 'b', ((void*) 0), CFG_FLAG, &cfg.raw_binary, 0, raw, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 3931 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"raw-binary", 'b', ((void*) 0), CFG_FLAG, &cfg.raw_binary, 0, raw, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 3932 | ||||
| 3933 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 3934 | if (err) | |||
| 3935 | return err; | |||
| 3936 | ||||
| 3937 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 3938 | if (err < 0) { | |||
| 3939 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 3940 | return err; | |||
| 3941 | } | |||
| 3942 | ||||
| 3943 | if (cfg.raw_binary) | |||
| 3944 | flags = BINARY; | |||
| 3945 | ||||
| 3946 | if (nvme_args.verbose) | |||
| 3947 | flags |= VERBOSE; | |||
| 3948 | ||||
| 3949 | if (!cfg.namespace_id) { | |||
| 3950 | err = libnvme_get_nsid(hdl, &cfg.namespace_id); | |||
| 3951 | if (err < 0) { | |||
| 3952 | nvme_show_error("get-namespace-id: %s", libnvme_strerror(-err))nvme_show_message(1, "get-namespace-id: %s", libnvme_strerror (-err)); | |||
| 3953 | return err; | |||
| 3954 | } | |||
| 3955 | } | |||
| 3956 | ||||
| 3957 | nsdescs = libnvme_alloc(NVME_IDENTIFY_DATA_SIZE); | |||
| 3958 | if (!nsdescs) | |||
| 3959 | return -ENOMEM12; | |||
| 3960 | ||||
| 3961 | err = nvme_identify_ns_descs_list(hdl, cfg.namespace_id, nsdescs); | |||
| 3962 | if (err) { | |||
| 3963 | nvme_show_err(err, "identify namespace"); | |||
| 3964 | return err; | |||
| 3965 | } | |||
| 3966 | ||||
| 3967 | nvme_show_id_ns_descs(nsdescs, cfg.namespace_id, flags); | |||
| 3968 | ||||
| 3969 | return err; | |||
| 3970 | } | |||
| 3971 | ||||
| 3972 | static int id_ns(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 3973 | { | |||
| 3974 | const char *desc = "Send an Identify Namespace command to the " | |||
| 3975 | "given device, returns properties of the specified namespace " | |||
| 3976 | "in either human-readable or binary format. Can also return " | |||
| 3977 | "binary vendor-specific namespace attributes."; | |||
| 3978 | const char *force = "Return this namespace, even if not attached (1.2 devices only)"; | |||
| 3979 | const char *vendor_specific = "dump binary vendor fields"; | |||
| 3980 | ||||
| 3981 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 3982 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 3983 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ns *ns = NULL((void*)0); | |||
| 3984 | struct libnvme_passthru_cmd cmd; | |||
| 3985 | nvme_print_flags_t flags; | |||
| 3986 | int err; | |||
| 3987 | ||||
| 3988 | struct config { | |||
| 3989 | __u32 namespace_id; | |||
| 3990 | bool_Bool force; | |||
| 3991 | bool_Bool vendor_specific; | |||
| 3992 | bool_Bool raw_binary; | |||
| 3993 | }; | |||
| 3994 | ||||
| 3995 | struct config cfg = { | |||
| 3996 | .namespace_id = 0, | |||
| 3997 | .force = false0, | |||
| 3998 | .vendor_specific = false0, | |||
| 3999 | .raw_binary = false0, | |||
| 4000 | }; | |||
| 4001 | ||||
| 4002 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"force", 0, ((void*)0), CFG_FLAG , &cfg.force, 0, force, 0, }, {"vendor-specific", 'V', (( void*)0), CFG_FLAG, &cfg.vendor_specific, 0, vendor_specific , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_identify, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4003 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"force", 0, ((void*)0), CFG_FLAG , &cfg.force, 0, force, 0, }, {"vendor-specific", 'V', (( void*)0), CFG_FLAG, &cfg.vendor_specific, 0, vendor_specific , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_identify, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4004 | OPT_FLAG("force", 0, &cfg.force, force),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"force", 0, ((void*)0), CFG_FLAG , &cfg.force, 0, force, 0, }, {"vendor-specific", 'V', (( void*)0), CFG_FLAG, &cfg.vendor_specific, 0, vendor_specific , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_identify, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4005 | OPT_FLAG("vendor-specific", 'V', &cfg.vendor_specific, vendor_specific),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"force", 0, ((void*)0), CFG_FLAG , &cfg.force, 0, force, 0, }, {"vendor-specific", 'V', (( void*)0), CFG_FLAG, &cfg.vendor_specific, 0, vendor_specific , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_identify, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4006 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_identify))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"force", 0, ((void*)0), CFG_FLAG , &cfg.force, 0, force, 0, }, {"vendor-specific", 'V', (( void*)0), CFG_FLAG, &cfg.vendor_specific, 0, vendor_specific , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_identify, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 4007 | ||||
| 4008 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 4009 | if (err) | |||
| 4010 | return err; | |||
| 4011 | ||||
| 4012 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 4013 | if (err < 0) { | |||
| 4014 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 4015 | return err; | |||
| 4016 | } | |||
| 4017 | ||||
| 4018 | if (cfg.raw_binary) | |||
| 4019 | flags = BINARY; | |||
| 4020 | ||||
| 4021 | if (cfg.vendor_specific) | |||
| 4022 | flags |= VS; | |||
| 4023 | ||||
| 4024 | if (nvme_args.verbose) | |||
| 4025 | flags |= VERBOSE; | |||
| 4026 | ||||
| 4027 | if (!cfg.namespace_id) { | |||
| 4028 | err = libnvme_get_nsid(hdl, &cfg.namespace_id); | |||
| 4029 | if (err < 0) { | |||
| 4030 | nvme_show_error("get-namespace-id: %s", libnvme_strerror(-err))nvme_show_message(1, "get-namespace-id: %s", libnvme_strerror (-err)); | |||
| 4031 | return err; | |||
| 4032 | } | |||
| 4033 | } | |||
| 4034 | ||||
| 4035 | ns = libnvme_alloc(sizeof(*ns)); | |||
| 4036 | if (!ns) | |||
| 4037 | return -ENOMEM12; | |||
| 4038 | ||||
| 4039 | if (cfg.force) { | |||
| 4040 | nvme_init_identify_allocated_ns(&cmd, cfg.namespace_id, ns); | |||
| 4041 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 4042 | } else { | |||
| 4043 | err = nvme_identify_ns(hdl, cfg.namespace_id, ns); | |||
| 4044 | } | |||
| 4045 | ||||
| 4046 | if (err) { | |||
| 4047 | nvme_show_err(err, "identify namespace"); | |||
| 4048 | return err; | |||
| 4049 | } | |||
| 4050 | ||||
| 4051 | nvme_show_id_ns(ns, cfg.namespace_id, 0, false0, flags); | |||
| 4052 | ||||
| 4053 | return err; | |||
| 4054 | } | |||
| 4055 | ||||
| 4056 | static int cmd_set_independent_id_ns(int argc, char **argv, struct command *acmd, | |||
| 4057 | struct plugin *plugin) | |||
| 4058 | { | |||
| 4059 | const char *desc = "Send an I/O Command Set Independent Identify " | |||
| 4060 | "Namespace command to the given device, returns properties of the " | |||
| 4061 | "specified namespace in human-readable or binary or json format."; | |||
| 4062 | ||||
| 4063 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_independent_id_ns *ns = NULL((void*)0); | |||
| 4064 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 4065 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 4066 | struct libnvme_passthru_cmd cmd; | |||
| 4067 | nvme_print_flags_t flags; | |||
| 4068 | int err = -1; | |||
| 4069 | ||||
| 4070 | struct config { | |||
| 4071 | __u32 namespace_id; | |||
| 4072 | bool_Bool raw_binary; | |||
| 4073 | }; | |||
| 4074 | ||||
| 4075 | struct config cfg = { | |||
| 4076 | .namespace_id = 0, | |||
| 4077 | .raw_binary = false0, | |||
| 4078 | }; | |||
| 4079 | ||||
| 4080 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"raw-binary", 'b', ((void*) 0), CFG_FLAG, &cfg.raw_binary, 0, raw_identify, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4081 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"raw-binary", 'b', ((void*) 0), CFG_FLAG, &cfg.raw_binary, 0, raw_identify, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4082 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_identify))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"raw-binary", 'b', ((void*) 0), CFG_FLAG, &cfg.raw_binary, 0, raw_identify, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 4083 | ||||
| 4084 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 4085 | if (err) | |||
| 4086 | return err; | |||
| 4087 | ||||
| 4088 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 4089 | if (err < 0) { | |||
| 4090 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 4091 | return err; | |||
| 4092 | } | |||
| 4093 | ||||
| 4094 | if (cfg.raw_binary) | |||
| 4095 | flags = BINARY; | |||
| 4096 | ||||
| 4097 | if (nvme_args.verbose) | |||
| 4098 | flags |= VERBOSE; | |||
| 4099 | ||||
| 4100 | if (!cfg.namespace_id) { | |||
| 4101 | err = libnvme_get_nsid(hdl, &cfg.namespace_id); | |||
| 4102 | if (err < 0) { | |||
| 4103 | nvme_show_perror("get-namespace-id"); | |||
| 4104 | return err; | |||
| 4105 | } | |||
| 4106 | } | |||
| 4107 | ||||
| 4108 | ns = libnvme_alloc(sizeof(*ns)); | |||
| 4109 | if (!ns) | |||
| 4110 | return -ENOMEM12; | |||
| 4111 | ||||
| 4112 | nvme_init_identify_csi_independent_identify_id_ns(&cmd, | |||
| 4113 | cfg.namespace_id, ns); | |||
| 4114 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 4115 | if (err) { | |||
| 4116 | nvme_show_err(err, | |||
| 4117 | "I/O command set independent identify namespace"); | |||
| 4118 | return err; | |||
| 4119 | } | |||
| 4120 | ||||
| 4121 | nvme_show_cmd_set_independent_id_ns(ns, cfg.namespace_id, flags); | |||
| 4122 | ||||
| 4123 | return err; | |||
| 4124 | } | |||
| 4125 | ||||
| 4126 | static int id_ns_granularity(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 4127 | { | |||
| 4128 | const char *desc = "Send an Identify Namespace Granularity List command to the " | |||
| 4129 | "given device, returns namespace granularity list " | |||
| 4130 | "in either human-readable or binary format."; | |||
| 4131 | ||||
| 4132 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ns_granularity_list *granularity_list = NULL((void*)0); | |||
| 4133 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 4134 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 4135 | nvme_print_flags_t flags; | |||
| 4136 | int err; | |||
| 4137 | ||||
| 4138 | NVME_ARGS(opts)struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 4139 | ||||
| 4140 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 4141 | if (err) | |||
| 4142 | return err; | |||
| 4143 | ||||
| 4144 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 4145 | if (err < 0) { | |||
| 4146 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 4147 | return err; | |||
| 4148 | } | |||
| 4149 | ||||
| 4150 | granularity_list = libnvme_alloc(NVME_IDENTIFY_DATA_SIZE); | |||
| 4151 | if (!granularity_list) | |||
| 4152 | return -ENOMEM12; | |||
| 4153 | ||||
| 4154 | err = nvme_identify_ns_granularity(hdl, granularity_list); | |||
| 4155 | if (err) { | |||
| 4156 | nvme_show_err(err, "identify namespace granularity"); | |||
| 4157 | return err; | |||
| 4158 | } | |||
| 4159 | ||||
| 4160 | nvme_show_id_ns_granularity_list(granularity_list, flags); | |||
| 4161 | ||||
| 4162 | return err; | |||
| 4163 | } | |||
| 4164 | ||||
| 4165 | static int id_nvmset(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 4166 | { | |||
| 4167 | const char *desc = "Send an Identify NVM Set List command to the " | |||
| 4168 | "given device, returns entries for NVM Set identifiers greater " | |||
| 4169 | "than or equal to the value specified CDW11.NVMSETID " | |||
| 4170 | "in either binary format or json format"; | |||
| 4171 | const char *nvmset_id = "NVM Set Identify value"; | |||
| 4172 | ||||
| 4173 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_nvmset_list *nvmset = NULL((void*)0); | |||
| 4174 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 4175 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 4176 | struct libnvme_passthru_cmd cmd; | |||
| 4177 | nvme_print_flags_t flags; | |||
| 4178 | int err; | |||
| 4179 | ||||
| 4180 | struct config { | |||
| 4181 | __u16 nvmset_id; | |||
| 4182 | }; | |||
| 4183 | ||||
| 4184 | struct config cfg = { | |||
| 4185 | .nvmset_id = 0, | |||
| 4186 | }; | |||
| 4187 | ||||
| 4188 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"nvmset_id", 'i', "NUM", CFG_SHORT, &cfg.nvmset_id , 1, nvmset_id, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4189 | OPT_SHRT("nvmset_id", 'i', &cfg.nvmset_id, nvmset_id))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"nvmset_id", 'i', "NUM", CFG_SHORT, &cfg.nvmset_id , 1, nvmset_id, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 4190 | ||||
| 4191 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 4192 | if (err) | |||
| 4193 | return err; | |||
| 4194 | ||||
| 4195 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 4196 | if (err < 0) { | |||
| 4197 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 4198 | return err; | |||
| 4199 | } | |||
| 4200 | ||||
| 4201 | nvmset = libnvme_alloc(sizeof(*nvmset)); | |||
| 4202 | if (!nvmset) | |||
| 4203 | return -ENOMEM12; | |||
| 4204 | ||||
| 4205 | nvme_init_identify_nvmset_list(&cmd, NVME_NSID_NONE, | |||
| 4206 | cfg.nvmset_id, nvmset); | |||
| 4207 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 4208 | if (err) { | |||
| 4209 | nvme_show_err(err, "identify nvm set list"); | |||
| 4210 | return err; | |||
| 4211 | } | |||
| 4212 | ||||
| 4213 | nvme_show_id_nvmset(nvmset, cfg.nvmset_id, flags); | |||
| 4214 | ||||
| 4215 | return err; | |||
| 4216 | } | |||
| 4217 | ||||
| 4218 | static int id_uuid(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 4219 | { | |||
| 4220 | const char *desc = "Send an Identify UUID List command to the " | |||
| 4221 | "given device, returns list of supported Vendor Specific UUIDs " | |||
| 4222 | "in either human-readable or binary format."; | |||
| 4223 | const char *raw = "show uuid in binary format"; | |||
| 4224 | ||||
| 4225 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_uuid_list *uuid_list = NULL((void*)0); | |||
| 4226 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 4227 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 4228 | nvme_print_flags_t flags; | |||
| 4229 | int err; | |||
| 4230 | ||||
| 4231 | struct config { | |||
| 4232 | bool_Bool raw_binary; | |||
| 4233 | }; | |||
| 4234 | ||||
| 4235 | struct config cfg = { | |||
| 4236 | .raw_binary = false0, | |||
| 4237 | }; | |||
| 4238 | ||||
| 4239 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4240 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 4241 | ||||
| 4242 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 4243 | if (err) | |||
| 4244 | return err; | |||
| 4245 | ||||
| 4246 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 4247 | if (err < 0) { | |||
| 4248 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 4249 | return err; | |||
| 4250 | } | |||
| 4251 | ||||
| 4252 | if (cfg.raw_binary) | |||
| 4253 | flags = BINARY; | |||
| 4254 | ||||
| 4255 | if (nvme_args.verbose) | |||
| 4256 | flags |= VERBOSE; | |||
| 4257 | ||||
| 4258 | uuid_list = libnvme_alloc(sizeof(*uuid_list)); | |||
| 4259 | if (!uuid_list) | |||
| 4260 | return -ENOMEM12; | |||
| 4261 | ||||
| 4262 | err = nvme_identify_uuid_list(hdl, uuid_list); | |||
| 4263 | if (err) { | |||
| 4264 | nvme_show_err(err, "identify UUID list"); | |||
| 4265 | return err; | |||
| 4266 | } | |||
| 4267 | ||||
| 4268 | nvme_show_id_uuid_list(uuid_list, flags); | |||
| 4269 | ||||
| 4270 | return err; | |||
| 4271 | } | |||
| 4272 | ||||
| 4273 | static int id_iocs(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 4274 | { | |||
| 4275 | const char *desc = "Send an Identify Command Set Data command to " | |||
| 4276 | "the given device, returns properties of the specified controller " | |||
| 4277 | "in either human-readable or binary format."; | |||
| 4278 | const char *controller_id = "identifier of desired controller"; | |||
| 4279 | ||||
| 4280 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_iocs *iocs = NULL((void*)0); | |||
| 4281 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 4282 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 4283 | struct libnvme_passthru_cmd cmd; | |||
| 4284 | nvme_print_flags_t flags; | |||
| 4285 | int err; | |||
| 4286 | ||||
| 4287 | struct config { | |||
| 4288 | __u16 cntid; | |||
| 4289 | }; | |||
| 4290 | ||||
| 4291 | struct config cfg = { | |||
| 4292 | .cntid = 0xffff, | |||
| 4293 | }; | |||
| 4294 | ||||
| 4295 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"controller-id", 'c', "NUM", CFG_SHORT, &cfg.cntid , 1, controller_id, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4296 | OPT_SHRT("controller-id", 'c', &cfg.cntid, controller_id))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"controller-id", 'c', "NUM", CFG_SHORT, &cfg.cntid , 1, controller_id, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 4297 | ||||
| 4298 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 4299 | if (err) | |||
| 4300 | return err; | |||
| 4301 | ||||
| 4302 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 4303 | if (err < 0) { | |||
| 4304 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 4305 | return err; | |||
| 4306 | } | |||
| 4307 | ||||
| 4308 | if (nvme_args.verbose) | |||
| 4309 | flags |= VERBOSE; | |||
| 4310 | ||||
| 4311 | iocs = libnvme_alloc(sizeof(*iocs)); | |||
| 4312 | if (!iocs) | |||
| 4313 | return -ENOMEM12; | |||
| 4314 | ||||
| 4315 | nvme_init_identify_command_set_structure(&cmd, cfg.cntid, iocs); | |||
| 4316 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 4317 | if (err) { | |||
| 4318 | nvme_show_err(err, "NVMe Identify I/O Command Set"); | |||
| 4319 | return err; | |||
| 4320 | } | |||
| 4321 | ||||
| 4322 | printf("NVMe Identify I/O Command Set:\n"); | |||
| 4323 | nvme_show_id_iocs(iocs, flags); | |||
| 4324 | ||||
| 4325 | return err; | |||
| 4326 | } | |||
| 4327 | ||||
| 4328 | static int id_domain(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 4329 | { | |||
| 4330 | const char *desc = "Send an Identify Domain List command to the " | |||
| 4331 | "given device, returns properties of the specified domain " | |||
| 4332 | "in either normal|json|binary format."; | |||
| 4333 | const char *domain_id = "identifier of desired domain"; | |||
| 4334 | ||||
| 4335 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_domain_list *id_domain = NULL((void*)0); | |||
| 4336 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 4337 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 4338 | struct libnvme_passthru_cmd cmd; | |||
| 4339 | nvme_print_flags_t flags; | |||
| 4340 | int err; | |||
| 4341 | ||||
| 4342 | struct config { | |||
| 4343 | __u16 dom_id; | |||
| 4344 | }; | |||
| 4345 | ||||
| 4346 | struct config cfg = { | |||
| 4347 | .dom_id = 0xffff, | |||
| 4348 | }; | |||
| 4349 | ||||
| 4350 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"dom-id", 'd', "NUM", CFG_SHORT, &cfg.dom_id, 1, domain_id , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 4351 | OPT_SHRT("dom-id", 'd', &cfg.dom_id, domain_id))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"dom-id", 'd', "NUM", CFG_SHORT, &cfg.dom_id, 1, domain_id , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 4352 | ||||
| 4353 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 4354 | if (err) | |||
| 4355 | return err; | |||
| 4356 | ||||
| 4357 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 4358 | if (err < 0) { | |||
| 4359 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 4360 | return err; | |||
| 4361 | } | |||
| 4362 | ||||
| 4363 | id_domain = libnvme_alloc(sizeof(*id_domain)); | |||
| 4364 | if (!id_domain) | |||
| 4365 | return -ENOMEM12; | |||
| 4366 | ||||
| 4367 | nvme_init_identify_domain_list(&cmd, cfg.dom_id, id_domain); | |||
| 4368 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 4369 | if (err) { | |||
| 4370 | nvme_show_err(err, "NVMe Identify Domain List"); | |||
| 4371 | return err; | |||
| 4372 | } | |||
| 4373 | ||||
| 4374 | printf("NVMe Identify command for Domain List is successful:\n"); | |||
| 4375 | printf("NVMe Identify Domain List:\n"); | |||
| 4376 | nvme_show_id_domain_list(id_domain, flags); | |||
| 4377 | ||||
| 4378 | return err; | |||
| 4379 | } | |||
| 4380 | ||||
| 4381 | static int get_ns_id(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 4382 | { | |||
| 4383 | const char *desc = "Get namespace ID of a the block device."; | |||
| 4384 | ||||
| 4385 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 4386 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 4387 | unsigned int nsid; | |||
| 4388 | int err; | |||
| 4389 | nvme_print_flags_t flags; | |||
| 4390 | ||||
| 4391 | NVME_ARGS(opts)struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 4392 | ||||
| 4393 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 4394 | if (err) | |||
| 4395 | return err; | |||
| 4396 | ||||
| 4397 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 4398 | if (err < 0) { | |||
| 4399 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 4400 | return err; | |||
| 4401 | } | |||
| 4402 | ||||
| 4403 | err = libnvme_get_nsid(hdl, &nsid); | |||
| 4404 | if (err < 0) { | |||
| 4405 | nvme_show_error("get namespace ID: %s", libnvme_strerror(-err))nvme_show_message(1, "get namespace ID: %s", libnvme_strerror (-err)); | |||
| 4406 | return -errno(*__errno_location ()); | |||
| 4407 | } | |||
| 4408 | ||||
| 4409 | printf("%s: namespace-id:%d\n", libnvme_transport_handle_get_name(hdl), nsid); | |||
| 4410 | ||||
| 4411 | return 0; | |||
| 4412 | } | |||
| 4413 | ||||
| 4414 | static int virtual_mgmt(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 4415 | { | |||
| 4416 | const char *desc = "The Virtualization Management command is supported by primary controllers " | |||
| 4417 | "that support the Virtualization Enhancements capability. This command is used for:\n" | |||
| 4418 | " 1. Modifying Flexible Resource allocation for the primary controller\n" | |||
| 4419 | " 2. Assigning Flexible Resources for secondary controllers\n" | |||
| 4420 | " 3. Setting the Online and Offline state for secondary controllers"; | |||
| 4421 | const char *cntlid = "Controller Identifier(CNTLID)"; | |||
| 4422 | const char *rt = "Resource Type(RT): [0,1]\n" | |||
| 4423 | "0h: VQ Resources\n" | |||
| 4424 | "1h: VI Resources"; | |||
| 4425 | const char *act = "Action(ACT): [1,7,8,9]\n" | |||
| 4426 | "1h: Primary Flexible\n" | |||
| 4427 | "7h: Secondary Offline\n" | |||
| 4428 | "8h: Secondary Assign\n" | |||
| 4429 | "9h: Secondary Online"; | |||
| 4430 | const char *nr = "Number of Controller Resources(NR)"; | |||
| 4431 | ||||
| 4432 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 4433 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 4434 | struct libnvme_passthru_cmd cmd; | |||
| 4435 | int err; | |||
| 4436 | ||||
| 4437 | struct config { | |||
| 4438 | __u16 cntlid; | |||
| 4439 | __u8 rt; | |||
| 4440 | __u8 act; | |||
| 4441 | __u16 nr; | |||
| 4442 | }; | |||
| 4443 | ||||
| 4444 | struct config cfg = { | |||
| 4445 | .cntlid = 0, | |||
| 4446 | .rt = 0, | |||
| 4447 | .act = 0, | |||
| 4448 | .nr = 0, | |||
| 4449 | }; | |||
| 4450 | ||||
| 4451 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"cntlid", 'c', "NUM", CFG_SHORT, &cfg.cntlid, 1, cntlid , 0, }, {"rt", 'r', "NUM", CFG_BYTE, &cfg.rt, 1, rt, 0, } , {"act", 'a', "NUM", CFG_BYTE, &cfg.act, 1, act, 0, }, { "nr", 'n', "NUM", CFG_SHORT, &cfg.nr, 1, nr, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4452 | OPT_SHRT("cntlid", 'c', &cfg.cntlid, cntlid),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"cntlid", 'c', "NUM", CFG_SHORT, &cfg.cntlid, 1, cntlid , 0, }, {"rt", 'r', "NUM", CFG_BYTE, &cfg.rt, 1, rt, 0, } , {"act", 'a', "NUM", CFG_BYTE, &cfg.act, 1, act, 0, }, { "nr", 'n', "NUM", CFG_SHORT, &cfg.nr, 1, nr, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4453 | OPT_BYTE("rt", 'r', &cfg.rt, rt),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"cntlid", 'c', "NUM", CFG_SHORT, &cfg.cntlid, 1, cntlid , 0, }, {"rt", 'r', "NUM", CFG_BYTE, &cfg.rt, 1, rt, 0, } , {"act", 'a', "NUM", CFG_BYTE, &cfg.act, 1, act, 0, }, { "nr", 'n', "NUM", CFG_SHORT, &cfg.nr, 1, nr, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4454 | OPT_BYTE("act", 'a', &cfg.act, act),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"cntlid", 'c', "NUM", CFG_SHORT, &cfg.cntlid, 1, cntlid , 0, }, {"rt", 'r', "NUM", CFG_BYTE, &cfg.rt, 1, rt, 0, } , {"act", 'a', "NUM", CFG_BYTE, &cfg.act, 1, act, 0, }, { "nr", 'n', "NUM", CFG_SHORT, &cfg.nr, 1, nr, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4455 | OPT_SHRT("nr", 'n', &cfg.nr, nr))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"cntlid", 'c', "NUM", CFG_SHORT, &cfg.cntlid, 1, cntlid , 0, }, {"rt", 'r', "NUM", CFG_BYTE, &cfg.rt, 1, rt, 0, } , {"act", 'a', "NUM", CFG_BYTE, &cfg.act, 1, act, 0, }, { "nr", 'n', "NUM", CFG_SHORT, &cfg.nr, 1, nr, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 4456 | ||||
| 4457 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 4458 | if (err) | |||
| 4459 | return err; | |||
| 4460 | ||||
| 4461 | nvme_init_virtual_mgmt(&cmd, cfg.act, cfg.rt, cfg.cntlid, cfg.nr); | |||
| 4462 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 4463 | if (err) { | |||
| 4464 | nvme_show_err(err, "virt-mgmt"); | |||
| 4465 | return err; | |||
| 4466 | } | |||
| 4467 | ||||
| 4468 | printf("success, Number of Controller Resources Modified (NRM):%" | |||
| 4469 | PRIu64"l" "u" "\n", (uint64_t)cmd.result); | |||
| 4470 | ||||
| 4471 | return err; | |||
| 4472 | } | |||
| 4473 | ||||
| 4474 | static int primary_ctrl_caps(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 4475 | { | |||
| 4476 | const char *cntlid = "Controller ID"; | |||
| 4477 | const char *desc = "Send an Identify Primary Controller Capabilities " | |||
| 4478 | "command to the given device and report the information in a " | |||
| 4479 | "decoded format (default), json or binary."; | |||
| 4480 | ||||
| 4481 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_primary_ctrl_cap *caps = NULL((void*)0); | |||
| 4482 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 4483 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 4484 | struct libnvme_passthru_cmd cmd; | |||
| 4485 | nvme_print_flags_t flags; | |||
| 4486 | int err; | |||
| 4487 | ||||
| 4488 | struct config { | |||
| 4489 | __u16 cntlid; | |||
| 4490 | }; | |||
| 4491 | ||||
| 4492 | struct config cfg = { | |||
| 4493 | .cntlid = 0, | |||
| 4494 | }; | |||
| 4495 | ||||
| 4496 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"cntlid", 'c', "NUM", CFG_POSITIVE, &cfg.cntlid, 1 , cntlid, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4497 | OPT_UINT("cntlid", 'c', &cfg.cntlid, cntlid))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"cntlid", 'c', "NUM", CFG_POSITIVE, &cfg.cntlid, 1 , cntlid, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 4498 | ||||
| 4499 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 4500 | if (err) | |||
| 4501 | return err; | |||
| 4502 | ||||
| 4503 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 4504 | if (err < 0) { | |||
| 4505 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 4506 | return err; | |||
| 4507 | } | |||
| 4508 | ||||
| 4509 | if (nvme_args.verbose) | |||
| 4510 | flags |= VERBOSE; | |||
| 4511 | ||||
| 4512 | caps = libnvme_alloc(sizeof(*caps)); | |||
| 4513 | if (!caps) | |||
| 4514 | return -ENOMEM12; | |||
| 4515 | ||||
| 4516 | nvme_init_identify_primary_ctrl_cap(&cmd, cfg.cntlid, caps); | |||
| 4517 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 4518 | if (err) { | |||
| 4519 | nvme_show_err(err, "identify primary controller capabilities"); | |||
| 4520 | return err; | |||
| 4521 | } | |||
| 4522 | ||||
| 4523 | nvme_show_primary_ctrl_cap(caps, flags); | |||
| 4524 | ||||
| 4525 | return err; | |||
| 4526 | } | |||
| 4527 | ||||
| 4528 | static int list_secondary_ctrl(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 4529 | { | |||
| 4530 | const char *desc = | |||
| 4531 | "Show secondary controller list associated with the primary controller of the given device."; | |||
| 4532 | const char *controller = "lowest controller identifier to display"; | |||
| 4533 | const char *num_entries = "number of entries to retrieve"; | |||
| 4534 | ||||
| 4535 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_secondary_ctrl_list *sc_list = NULL((void*)0); | |||
| 4536 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 4537 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 4538 | struct libnvme_passthru_cmd cmd; | |||
| 4539 | nvme_print_flags_t flags; | |||
| 4540 | int err; | |||
| 4541 | ||||
| 4542 | struct config { | |||
| 4543 | __u16 cntid; | |||
| 4544 | __u32 num_entries; | |||
| 4545 | }; | |||
| 4546 | ||||
| 4547 | struct config cfg = { | |||
| 4548 | .cntid = 0, | |||
| 4549 | .num_entries = ARRAY_SIZE(sc_list->sc_entry)(sizeof(sc_list->sc_entry) / sizeof((sc_list->sc_entry) [0])), | |||
| 4550 | }; | |||
| 4551 | ||||
| 4552 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"cntid", 'c', "NUM", CFG_SHORT, &cfg.cntid, 1, controller , 0, }, {"num-entries", 'e', "NUM", CFG_POSITIVE, &cfg.num_entries , 1, num_entries, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4553 | OPT_SHRT("cntid", 'c', &cfg.cntid, controller),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"cntid", 'c', "NUM", CFG_SHORT, &cfg.cntid, 1, controller , 0, }, {"num-entries", 'e', "NUM", CFG_POSITIVE, &cfg.num_entries , 1, num_entries, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4554 | OPT_UINT("num-entries", 'e', &cfg.num_entries, num_entries))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"cntid", 'c', "NUM", CFG_SHORT, &cfg.cntid, 1, controller , 0, }, {"num-entries", 'e', "NUM", CFG_POSITIVE, &cfg.num_entries , 1, num_entries, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 4555 | ||||
| 4556 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 4557 | if (err) | |||
| 4558 | return err; | |||
| 4559 | ||||
| 4560 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 4561 | if (err < 0) { | |||
| 4562 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 4563 | return err; | |||
| 4564 | } | |||
| 4565 | ||||
| 4566 | if (!cfg.num_entries) { | |||
| 4567 | nvme_show_error("non-zero num-entries is required param")nvme_show_message(1, "non-zero num-entries is required param" ); | |||
| 4568 | return -EINVAL22; | |||
| 4569 | } | |||
| 4570 | ||||
| 4571 | sc_list = libnvme_alloc(sizeof(*sc_list)); | |||
| 4572 | if (!sc_list) | |||
| 4573 | return -ENOMEM12; | |||
| 4574 | ||||
| 4575 | nvme_init_identify_secondary_ctrl_list(&cmd, cfg.cntid, sc_list); | |||
| 4576 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 4577 | if (err) { | |||
| 4578 | nvme_show_err(err, "id secondary controller list"); | |||
| 4579 | return err; | |||
| 4580 | } | |||
| 4581 | ||||
| 4582 | nvme_show_list_secondary_ctrl(sc_list, cfg.num_entries, flags); | |||
| 4583 | ||||
| 4584 | return err; | |||
| 4585 | } | |||
| 4586 | ||||
| 4587 | static int nvme_sleep(unsigned int seconds) | |||
| 4588 | { | |||
| 4589 | nvme_sigint_received = false0; | |||
| 4590 | ||||
| 4591 | sleep(seconds); | |||
| 4592 | ||||
| 4593 | if (nvme_sigint_received) { | |||
| 4594 | printf("\nInterrupted device self-test operation by SIGINT\n"); | |||
| 4595 | return -SIGINT2; | |||
| 4596 | } | |||
| 4597 | ||||
| 4598 | return 0; | |||
| 4599 | } | |||
| 4600 | ||||
| 4601 | static int wait_self_test(struct libnvme_transport_handle *hdl) | |||
| 4602 | { | |||
| 4603 | static const char spin[] = {'-', '\\', '|', '/' }; | |||
| 4604 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_self_test_log *log = NULL((void*)0); | |||
| 4605 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ctrl *ctrl = NULL((void*)0); | |||
| 4606 | int err, i = 0, p = 0, cnt = 0; | |||
| 4607 | int wthr; | |||
| 4608 | ||||
| 4609 | ctrl = libnvme_alloc(sizeof(*ctrl)); | |||
| 4610 | if (!ctrl) | |||
| 4611 | return -ENOMEM12; | |||
| 4612 | ||||
| 4613 | log = libnvme_alloc(sizeof(*log)); | |||
| 4614 | if (!log) | |||
| 4615 | return -ENOMEM12; | |||
| 4616 | ||||
| 4617 | err = nvme_identify_ctrl(hdl, ctrl); | |||
| 4618 | if (err) { | |||
| 4619 | nvme_show_error("identify-ctrl: %s", libnvme_strerror(err))nvme_show_message(1, "identify-ctrl: %s", libnvme_strerror(err )); | |||
| 4620 | return err; | |||
| 4621 | } | |||
| 4622 | ||||
| 4623 | wthr = le16_to_cpu(ctrl->edstt) * 60 / 100 + 60; | |||
| 4624 | ||||
| 4625 | printf("Waiting for self test completion...\n"); | |||
| 4626 | while (true1) { | |||
| 4627 | printf("\r[%.*s%c%.*s] %3d%%", p / 2, dash, spin[i % 4], 49 - p / 2, space, p); | |||
| 4628 | fflush(stdoutstdout); | |||
| 4629 | err = nvme_sleep(1); | |||
| 4630 | if (err) | |||
| 4631 | return err; | |||
| 4632 | ||||
| 4633 | err = nvme_get_log_device_self_test(hdl, log); | |||
| 4634 | if (err) { | |||
| 4635 | printf("\n"); | |||
| 4636 | nvme_show_err(err, "self test log\n"); | |||
| 4637 | return err; | |||
| 4638 | } | |||
| 4639 | ||||
| 4640 | if (++cnt > wthr) { | |||
| 4641 | nvme_show_error("no progress for %d seconds, stop waiting", wthr)nvme_show_message(1, "no progress for %d seconds, stop waiting" , wthr); | |||
| 4642 | return -EIO5; | |||
| 4643 | } | |||
| 4644 | ||||
| 4645 | if (log->completion == 0 && p > 0) { | |||
| 4646 | printf("\r[%.*s] %3d%%\n", 50, dash, 100); | |||
| 4647 | break; | |||
| 4648 | } | |||
| 4649 | ||||
| 4650 | if (log->completion < p) { | |||
| 4651 | printf("\n"); | |||
| 4652 | nvme_show_error("progress broken")nvme_show_message(1, "progress broken"); | |||
| 4653 | return -EIO5; | |||
| 4654 | } else if (log->completion != p) { | |||
| 4655 | p = log->completion; | |||
| 4656 | cnt = 0; | |||
| 4657 | } | |||
| 4658 | ||||
| 4659 | i++; | |||
| 4660 | } | |||
| 4661 | ||||
| 4662 | return 0; | |||
| 4663 | } | |||
| 4664 | ||||
| 4665 | static void abort_self_test(struct libnvme_transport_handle *hdl, bool_Bool ish, | |||
| 4666 | __u32 nsid) | |||
| 4667 | { | |||
| 4668 | struct libnvme_passthru_cmd cmd; | |||
| 4669 | int err; | |||
| 4670 | ||||
| 4671 | nvme_init_dev_self_test(&cmd, nsid, NVME_DST_STC_ABORT); | |||
| 4672 | if (ish) { | |||
| 4673 | if (libnvme_transport_handle_is_mi(hdl)) | |||
| 4674 | nvme_init_mi_cmd_flags(&cmd, ish); | |||
| 4675 | else | |||
| 4676 | printf("ISH is supported only for NVMe-MI\n"); | |||
| 4677 | } | |||
| 4678 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 4679 | if (err) { | |||
| 4680 | nvme_show_err(err, "Device self-test"); | |||
| 4681 | return; | |||
| 4682 | } | |||
| 4683 | ||||
| 4684 | printf("Aborting device self-test operation\n"); | |||
| 4685 | } | |||
| 4686 | ||||
| 4687 | static int device_self_test(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 4688 | { | |||
| 4689 | const char *desc = "Implementing the device self-test feature " | |||
| 4690 | "which provides the necessary log to determine the state of the device"; | |||
| 4691 | const char *namespace_id = | |||
| 4692 | "Indicate the namespace in which the device self-test has to be carried out"; | |||
| 4693 | const char *self_test_code = | |||
| 4694 | "This field specifies the action taken by the device self-test command :\n" | |||
| 4695 | "0h Show current state of device self-test operation\n" | |||
| 4696 | "1h Start a short device self-test operation\n" | |||
| 4697 | "2h Start a extended device self-test operation\n" | |||
| 4698 | "3h Start a Host-Initiated Refresh operation\n" | |||
| 4699 | "eh Start a vendor specific device self-test operation\n" | |||
| 4700 | "fh Abort the device self-test operation"; | |||
| 4701 | const char *wait = "Wait for the test to finish"; | |||
| 4702 | ||||
| 4703 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 4704 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 4705 | struct libnvme_passthru_cmd cmd; | |||
| 4706 | nvme_print_flags_t flags; | |||
| 4707 | int err; | |||
| 4708 | ||||
| 4709 | struct config { | |||
| 4710 | bool_Bool ish; | |||
| 4711 | __u32 namespace_id; | |||
| 4712 | __u8 stc; | |||
| 4713 | bool_Bool wait; | |||
| 4714 | }; | |||
| 4715 | ||||
| 4716 | struct config cfg = { | |||
| 4717 | .ish = false0, | |||
| 4718 | .namespace_id = NVME_NSID_ALL, | |||
| 4719 | .stc = NVME_ST_CODE_RESERVED, | |||
| 4720 | .wait = false0, | |||
| 4721 | }; | |||
| 4722 | ||||
| 4723 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id, 0, }, {"self-test-code", 's', "NUM", CFG_BYTE , &cfg.stc, 1, self_test_code, 0, }, {"wait", 'w', ((void *)0), CFG_FLAG, &cfg.wait, 0, wait, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4724 | OPT_FLAG("ish", 'I', &cfg.ish, ish),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id, 0, }, {"self-test-code", 's', "NUM", CFG_BYTE , &cfg.stc, 1, self_test_code, 0, }, {"wait", 'w', ((void *)0), CFG_FLAG, &cfg.wait, 0, wait, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4725 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id, 0, }, {"self-test-code", 's', "NUM", CFG_BYTE , &cfg.stc, 1, self_test_code, 0, }, {"wait", 'w', ((void *)0), CFG_FLAG, &cfg.wait, 0, wait, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4726 | OPT_BYTE("self-test-code", 's', &cfg.stc, self_test_code),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id, 0, }, {"self-test-code", 's', "NUM", CFG_BYTE , &cfg.stc, 1, self_test_code, 0, }, {"wait", 'w', ((void *)0), CFG_FLAG, &cfg.wait, 0, wait, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4727 | OPT_FLAG("wait", 'w', &cfg.wait, wait))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id, 0, }, {"self-test-code", 's', "NUM", CFG_BYTE , &cfg.stc, 1, self_test_code, 0, }, {"wait", 'w', ((void *)0), CFG_FLAG, &cfg.wait, 0, wait, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 4728 | ||||
| 4729 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 4730 | if (err) | |||
| 4731 | return err; | |||
| 4732 | ||||
| 4733 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 4734 | if (err < 0) { | |||
| 4735 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 4736 | return err; | |||
| 4737 | } | |||
| 4738 | ||||
| 4739 | if (cfg.stc == NVME_ST_CODE_RESERVED) { | |||
| 4740 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_self_test_log *log = NULL((void*)0); | |||
| 4741 | ||||
| 4742 | log = libnvme_alloc(sizeof(*log)); | |||
| 4743 | if (!log) | |||
| 4744 | return -ENOMEM12; | |||
| 4745 | ||||
| 4746 | err = nvme_get_log_device_self_test(hdl, log); | |||
| 4747 | if (err) { | |||
| 4748 | printf("\n"); | |||
| 4749 | nvme_show_err(err, "self test log\n"); | |||
| 4750 | } | |||
| 4751 | ||||
| 4752 | if (log->completion == 0) { | |||
| 4753 | printf("no self test running\n"); | |||
| 4754 | } else { | |||
| 4755 | if (cfg.wait) | |||
| 4756 | err = wait_self_test(hdl); | |||
| 4757 | else | |||
| 4758 | printf("progress %d%%\n", log->completion); | |||
| 4759 | } | |||
| 4760 | ||||
| 4761 | goto check_abort; | |||
| 4762 | } | |||
| 4763 | ||||
| 4764 | nvme_init_dev_self_test(&cmd, cfg.namespace_id, cfg.stc); | |||
| 4765 | if (cfg.ish) { | |||
| 4766 | if (libnvme_transport_handle_is_mi(hdl)) | |||
| 4767 | nvme_init_mi_cmd_flags(&cmd, ish); | |||
| 4768 | else | |||
| 4769 | printf("ISH is supported only for NVMe-MI\n"); | |||
| 4770 | } | |||
| 4771 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 4772 | if (err) { | |||
| 4773 | nvme_show_err(err, "Device self-test"); | |||
| 4774 | goto check_abort; | |||
| 4775 | } | |||
| 4776 | ||||
| 4777 | if (cfg.stc == NVME_ST_CODE_ABORT) | |||
| 4778 | printf("Aborting device self-test operation\n"); | |||
| 4779 | else if (cfg.stc == NVME_ST_CODE_EXTENDED) | |||
| 4780 | printf("Extended Device self-test started\n"); | |||
| 4781 | else if (cfg.stc == NVME_ST_CODE_SHORT) | |||
| 4782 | printf("Short Device self-test started\n"); | |||
| 4783 | else if (cfg.stc == NVME_ST_CODE_HOST_INIT) | |||
| 4784 | printf("Host-Initiated Refresh started\n"); | |||
| 4785 | ||||
| 4786 | if (cfg.wait && cfg.stc != NVME_ST_CODE_ABORT) | |||
| 4787 | err = wait_self_test(hdl); | |||
| 4788 | ||||
| 4789 | check_abort: | |||
| 4790 | if (err == -EINTR4) | |||
| 4791 | abort_self_test(hdl, cfg.ish, cfg.namespace_id); | |||
| 4792 | ||||
| 4793 | return err; | |||
| 4794 | } | |||
| 4795 | ||||
| 4796 | static int self_test_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 4797 | { | |||
| 4798 | const char *desc = "Retrieve the self-test log for the given device and given test " | |||
| 4799 | "(or optionally a namespace) in either decoded format (default) or binary."; | |||
| 4800 | const char *dst_entries = "Indicate how many DST log entries to be retrieved, " | |||
| 4801 | "by default all the 20 entries will be retrieved"; | |||
| 4802 | ||||
| 4803 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_self_test_log *log = NULL((void*)0); | |||
| 4804 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 4805 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 4806 | nvme_print_flags_t flags; | |||
| 4807 | int err; | |||
| 4808 | ||||
| 4809 | struct config { | |||
| 4810 | __u8 dst_entries; | |||
| 4811 | }; | |||
| 4812 | ||||
| 4813 | struct config cfg = { | |||
| 4814 | .dst_entries = NVME_LOG_ST_MAX_RESULTS, | |||
| 4815 | }; | |||
| 4816 | ||||
| 4817 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"dst-entries", 'e', "NUM", CFG_BYTE, &cfg.dst_entries , 1, dst_entries, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 4818 | OPT_BYTE("dst-entries", 'e', &cfg.dst_entries, dst_entries))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"dst-entries", 'e', "NUM", CFG_BYTE, &cfg.dst_entries , 1, dst_entries, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 4819 | ||||
| 4820 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 4821 | if (err) | |||
| 4822 | return err; | |||
| 4823 | ||||
| 4824 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 4825 | if (err < 0) { | |||
| 4826 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 4827 | return err; | |||
| 4828 | } | |||
| 4829 | ||||
| 4830 | if (nvme_args.verbose) | |||
| 4831 | flags |= VERBOSE; | |||
| 4832 | ||||
| 4833 | log = libnvme_alloc(sizeof(*log)); | |||
| 4834 | if (!log) | |||
| 4835 | return -ENOMEM12; | |||
| 4836 | ||||
| 4837 | err = nvme_get_log_device_self_test(hdl, log); | |||
| 4838 | if (err) { | |||
| 4839 | nvme_show_err(err, "self test log"); | |||
| 4840 | return err; | |||
| 4841 | } | |||
| 4842 | ||||
| 4843 | nvme_show_self_test_log(log, cfg.dst_entries, 0, | |||
| 4844 | libnvme_transport_handle_get_name(hdl), flags); | |||
| 4845 | ||||
| 4846 | return err; | |||
| 4847 | } | |||
| 4848 | ||||
| 4849 | static int get_feature_id(struct libnvme_transport_handle *hdl, struct feat_cfg *cfg, | |||
| 4850 | void **buf, __u64 *result) | |||
| 4851 | { | |||
| 4852 | if (!cfg->data_len) | |||
| 4853 | libnvme_get_feature_length(cfg->feature_id, cfg->cdw11, | |||
| 4854 | NVME_DATA_TFR_CTRL_TO_HOST, | |||
| 4855 | &cfg->data_len); | |||
| 4856 | ||||
| 4857 | if (cfg->feature_id == NVME_FEAT_FID_FDP_EVENTS) { | |||
| 4858 | cfg->data_len = 0xff * sizeof(__u16); | |||
| 4859 | cfg->cdw11 |= 0xff << 16; | |||
| 4860 | } | |||
| 4861 | ||||
| 4862 | if (NVME_CHECK(cfg->sel, GET_FEATURES_SEL, SUPPORTED)((cfg->sel) == NVME_GET_FEATURES_SEL_SUPPORTED)) | |||
| 4863 | cfg->data_len = 0; | |||
| 4864 | ||||
| 4865 | if (cfg->data_len) { | |||
| 4866 | *buf = libnvme_alloc(cfg->data_len - 1); | |||
| 4867 | if (!*buf) | |||
| 4868 | return -1; | |||
| 4869 | } | |||
| 4870 | ||||
| 4871 | return nvme_get_features(hdl, cfg->namespace_id, cfg->feature_id, cfg->sel, | |||
| 4872 | cfg->cdw11, cfg->uuid_index, *buf, cfg->data_len, result); | |||
| 4873 | } | |||
| 4874 | ||||
| 4875 | static int filter_out_flags(int status) | |||
| 4876 | { | |||
| 4877 | return status & (NVME_VAL(SCT)(NVME_SCT_MASK << NVME_SCT_SHIFT) | NVME_VAL(SC)(NVME_SC_MASK << NVME_SC_SHIFT)); | |||
| 4878 | } | |||
| 4879 | ||||
| 4880 | static void get_feature_id_print(struct feat_cfg cfg, int err, __u64 result, | |||
| 4881 | void *buf, nvme_print_flags_t flags) | |||
| 4882 | { | |||
| 4883 | int status = err > 0 ? filter_out_flags(err) : err; | |||
| 4884 | enum nvme_status_type type = NVME_STATUS_TYPE_NVME; | |||
| 4885 | ||||
| 4886 | if (err) { | |||
| 4887 | if (nvme_status_equals(status, type, NVME_SC_INVALID_FIELD) || | |||
| 4888 | nvme_status_equals(status, type, NVME_SC_INVALID_NS)) | |||
| 4889 | return; | |||
| 4890 | nvme_show_err(err, "get-feature"); | |||
| 4891 | return; | |||
| 4892 | } | |||
| 4893 | ||||
| 4894 | nvme_show_feature(cfg.feature_id, cfg.sel, result, buf, cfg.data_len, | |||
| 4895 | flags); | |||
| 4896 | } | |||
| 4897 | ||||
| 4898 | static bool_Bool is_get_feature_result_set(enum nvme_features_id feature_id) | |||
| 4899 | { | |||
| 4900 | switch (feature_id) { | |||
| 4901 | case NVME_FEAT_FID_PERF_CHARACTERISTICS: | |||
| 4902 | case NVME_FEAT_FID_HOST_ID: | |||
| 4903 | return false0; | |||
| 4904 | default: | |||
| 4905 | break; | |||
| 4906 | } | |||
| 4907 | ||||
| 4908 | return true1; | |||
| 4909 | } | |||
| 4910 | ||||
| 4911 | static int get_feature_id_changed(struct libnvme_transport_handle *hdl, struct feat_cfg cfg, | |||
| 4912 | nvme_print_flags_t flags) | |||
| 4913 | { | |||
| 4914 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) void *buf_def = NULL((void*)0); | |||
| 4915 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) void *buf = NULL((void*)0); | |||
| 4916 | __u64 result_def = 0; | |||
| 4917 | __u64 result = 0; | |||
| 4918 | int err_def = 0; | |||
| 4919 | int err; | |||
| 4920 | ||||
| 4921 | if (cfg.changed) | |||
| 4922 | cfg.sel = NVME_GET_FEATURES_SEL_CURRENT; | |||
| 4923 | ||||
| 4924 | err = get_feature_id(hdl, &cfg, &buf, &result); | |||
| 4925 | ||||
| 4926 | if (!err && cfg.changed) { | |||
| 4927 | cfg.sel = NVME_GET_FEATURES_SEL_DEFAULT; | |||
| 4928 | err_def = get_feature_id(hdl, &cfg, &buf_def, &result_def); | |||
| 4929 | } | |||
| 4930 | ||||
| 4931 | if (!err && !is_get_feature_result_set(cfg.feature_id)) | |||
| 4932 | result = cfg.cdw11; | |||
| 4933 | ||||
| 4934 | if (err || !cfg.changed || err_def || result != result_def || | |||
| 4935 | (buf && buf_def && !strcmp(buf, buf_def))) | |||
| 4936 | get_feature_id_print(cfg, err, result, buf, flags); | |||
| 4937 | ||||
| 4938 | return err; | |||
| 4939 | } | |||
| 4940 | ||||
| 4941 | static int get_feature_ids(struct libnvme_transport_handle *hdl, struct feat_cfg cfg, | |||
| 4942 | nvme_print_flags_t flags) | |||
| 4943 | { | |||
| 4944 | int err = 0; | |||
| 4945 | int i; | |||
| 4946 | int feat_max = 0x100; | |||
| 4947 | int feat_num = 0; | |||
| 4948 | int status = 0; | |||
| 4949 | enum nvme_status_type type = NVME_STATUS_TYPE_NVME; | |||
| 4950 | ||||
| 4951 | if (cfg.feature_id) | |||
| 4952 | feat_max = cfg.feature_id + 1; | |||
| 4953 | ||||
| 4954 | for (i = cfg.feature_id; i < feat_max; i++, feat_num++) { | |||
| 4955 | cfg.feature_id = i; | |||
| 4956 | err = get_feature_id_changed(hdl, cfg, flags); | |||
| 4957 | if (!err) | |||
| 4958 | continue; | |||
| 4959 | status = filter_out_flags(err); | |||
| 4960 | if (nvme_status_equals(status, type, NVME_SC_INVALID_FIELD)) | |||
| 4961 | continue; | |||
| 4962 | if (!nvme_status_equals(status, type, NVME_SC_INVALID_NS)) | |||
| 4963 | break; | |||
| 4964 | nvme_show_error_status(err, "get-feature:%#0*x (%s)", cfg.feature_id ? 4 : 2, | |||
| 4965 | cfg.feature_id, nvme_feature_to_string(cfg.feature_id)); | |||
| 4966 | } | |||
| 4967 | ||||
| 4968 | if (feat_num == 1 && nvme_status_equals(status, type, NVME_SC_INVALID_FIELD)) | |||
| 4969 | nvme_show_status(err); | |||
| 4970 | ||||
| 4971 | return err; | |||
| 4972 | } | |||
| 4973 | ||||
| 4974 | static int get_feature(int argc, char **argv, struct command *acmd, | |||
| 4975 | struct plugin *plugin) | |||
| 4976 | { | |||
| 4977 | const char *desc = "Read operating parameters of the " | |||
| 4978 | "specified controller. Operating parameters are grouped " | |||
| 4979 | "and identified by Feature Identifiers; each Feature " | |||
| 4980 | "Identifier contains one or more attributes that may affect " | |||
| 4981 | "behavior of the feature. Each Feature has three possible " | |||
| 4982 | "settings: default, saveable, and current. If a Feature is " | |||
| 4983 | "saveable, it may be modified by set-feature. Default values " | |||
| 4984 | "are vendor-specific and not changeable. Use set-feature to " | |||
| 4985 | "change saveable Features."; | |||
| 4986 | const char *raw = "show feature in binary format"; | |||
| 4987 | const char *feature_id = "feature identifier"; | |||
| 4988 | const char *sel = "[0-3]: current/default/saved/supported"; | |||
| 4989 | const char *cdw11 = "feature specific dword 11"; | |||
| 4990 | const char *changed = "show feature changed"; | |||
| 4991 | nvme_print_flags_t flags = NORMAL; | |||
| 4992 | ||||
| 4993 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 4994 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 4995 | int err; | |||
| 4996 | ||||
| 4997 | struct feat_cfg cfg = { | |||
| 4998 | .feature_id = 0, | |||
| 4999 | .namespace_id = 0, | |||
| 5000 | .sel = NVME_GET_FEATURES_SEL_CURRENT, | |||
| 5001 | .data_len = 0, | |||
| 5002 | .raw_binary = false0, | |||
| 5003 | .cdw11 = 0, | |||
| 5004 | .uuid_index = 0, | |||
| 5005 | }; | |||
| 5006 | ||||
| 5007 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"feature-id", 'f', "NUM", CFG_BYTE, &cfg.feature_id , 1, feature_id, 0, feature_name}, {"namespace-id", 'n', "NUM" , CFG_POSITIVE, &cfg.namespace_id, 1, namespace_id_desired , 0, }, {"sel", 's', "NUM", CFG_BYTE, &cfg.sel, 1, sel, 0 , }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw, 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"uuid-index", 'U', "NUM", CFG_BYTE , &cfg.uuid_index, 1, uuid_index_specify, 0, }, {"changed" , 'C', ((void*)0), CFG_FLAG, &cfg.changed, 0, changed, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5008 | OPT_BYTE("feature-id", 'f', &cfg.feature_id, feature_id, feature_name),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"feature-id", 'f', "NUM", CFG_BYTE, &cfg.feature_id , 1, feature_id, 0, feature_name}, {"namespace-id", 'n', "NUM" , CFG_POSITIVE, &cfg.namespace_id, 1, namespace_id_desired , 0, }, {"sel", 's', "NUM", CFG_BYTE, &cfg.sel, 1, sel, 0 , }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw, 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"uuid-index", 'U', "NUM", CFG_BYTE , &cfg.uuid_index, 1, uuid_index_specify, 0, }, {"changed" , 'C', ((void*)0), CFG_FLAG, &cfg.changed, 0, changed, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5009 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"feature-id", 'f', "NUM", CFG_BYTE, &cfg.feature_id , 1, feature_id, 0, feature_name}, {"namespace-id", 'n', "NUM" , CFG_POSITIVE, &cfg.namespace_id, 1, namespace_id_desired , 0, }, {"sel", 's', "NUM", CFG_BYTE, &cfg.sel, 1, sel, 0 , }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw, 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"uuid-index", 'U', "NUM", CFG_BYTE , &cfg.uuid_index, 1, uuid_index_specify, 0, }, {"changed" , 'C', ((void*)0), CFG_FLAG, &cfg.changed, 0, changed, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5010 | OPT_BYTE("sel", 's', &cfg.sel, sel),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"feature-id", 'f', "NUM", CFG_BYTE, &cfg.feature_id , 1, feature_id, 0, feature_name}, {"namespace-id", 'n', "NUM" , CFG_POSITIVE, &cfg.namespace_id, 1, namespace_id_desired , 0, }, {"sel", 's', "NUM", CFG_BYTE, &cfg.sel, 1, sel, 0 , }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw, 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"uuid-index", 'U', "NUM", CFG_BYTE , &cfg.uuid_index, 1, uuid_index_specify, 0, }, {"changed" , 'C', ((void*)0), CFG_FLAG, &cfg.changed, 0, changed, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5011 | OPT_UINT("data-len", 'l', &cfg.data_len, buf_len),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"feature-id", 'f', "NUM", CFG_BYTE, &cfg.feature_id , 1, feature_id, 0, feature_name}, {"namespace-id", 'n', "NUM" , CFG_POSITIVE, &cfg.namespace_id, 1, namespace_id_desired , 0, }, {"sel", 's', "NUM", CFG_BYTE, &cfg.sel, 1, sel, 0 , }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw, 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"uuid-index", 'U', "NUM", CFG_BYTE , &cfg.uuid_index, 1, uuid_index_specify, 0, }, {"changed" , 'C', ((void*)0), CFG_FLAG, &cfg.changed, 0, changed, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5012 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"feature-id", 'f', "NUM", CFG_BYTE, &cfg.feature_id , 1, feature_id, 0, feature_name}, {"namespace-id", 'n', "NUM" , CFG_POSITIVE, &cfg.namespace_id, 1, namespace_id_desired , 0, }, {"sel", 's', "NUM", CFG_BYTE, &cfg.sel, 1, sel, 0 , }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw, 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"uuid-index", 'U', "NUM", CFG_BYTE , &cfg.uuid_index, 1, uuid_index_specify, 0, }, {"changed" , 'C', ((void*)0), CFG_FLAG, &cfg.changed, 0, changed, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5013 | OPT_UINT("cdw11", 'c', &cfg.cdw11, cdw11),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"feature-id", 'f', "NUM", CFG_BYTE, &cfg.feature_id , 1, feature_id, 0, feature_name}, {"namespace-id", 'n', "NUM" , CFG_POSITIVE, &cfg.namespace_id, 1, namespace_id_desired , 0, }, {"sel", 's', "NUM", CFG_BYTE, &cfg.sel, 1, sel, 0 , }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw, 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"uuid-index", 'U', "NUM", CFG_BYTE , &cfg.uuid_index, 1, uuid_index_specify, 0, }, {"changed" , 'C', ((void*)0), CFG_FLAG, &cfg.changed, 0, changed, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5014 | OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index_specify),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"feature-id", 'f', "NUM", CFG_BYTE, &cfg.feature_id , 1, feature_id, 0, feature_name}, {"namespace-id", 'n', "NUM" , CFG_POSITIVE, &cfg.namespace_id, 1, namespace_id_desired , 0, }, {"sel", 's', "NUM", CFG_BYTE, &cfg.sel, 1, sel, 0 , }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw, 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"uuid-index", 'U', "NUM", CFG_BYTE , &cfg.uuid_index, 1, uuid_index_specify, 0, }, {"changed" , 'C', ((void*)0), CFG_FLAG, &cfg.changed, 0, changed, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5015 | OPT_FLAG("changed", 'C', &cfg.changed, changed))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"feature-id", 'f', "NUM", CFG_BYTE, &cfg.feature_id , 1, feature_id, 0, feature_name}, {"namespace-id", 'n', "NUM" , CFG_POSITIVE, &cfg.namespace_id, 1, namespace_id_desired , 0, }, {"sel", 's', "NUM", CFG_BYTE, &cfg.sel, 1, sel, 0 , }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw, 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"uuid-index", 'U', "NUM", CFG_BYTE , &cfg.uuid_index, 1, uuid_index_specify, 0, }, {"changed" , 'C', ((void*)0), CFG_FLAG, &cfg.changed, 0, changed, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 5016 | ||||
| 5017 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 5018 | if (err) | |||
| 5019 | return err; | |||
| 5020 | ||||
| 5021 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 5022 | if (err < 0) { | |||
| 5023 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 5024 | return err; | |||
| 5025 | } | |||
| 5026 | ||||
| 5027 | if (!argconfig_parse_seen(opts, "namespace-id")) { | |||
| 5028 | err = libnvme_get_nsid(hdl, &cfg.namespace_id); | |||
| 5029 | if (err < 0) { | |||
| 5030 | if (errno(*__errno_location ()) != ENOTTY25) { | |||
| 5031 | nvme_show_error("get-namespace-id: %s", libnvme_strerror(-err))nvme_show_message(1, "get-namespace-id: %s", libnvme_strerror (-err)); | |||
| 5032 | return err; | |||
| 5033 | } | |||
| 5034 | cfg.namespace_id = NVME_NSID_ALL; | |||
| 5035 | } | |||
| 5036 | } | |||
| 5037 | ||||
| 5038 | if (cfg.sel > NVME_GET_FEATURES_SEL_SUPPORTED) { | |||
| 5039 | nvme_show_error("invalid 'select' param:%d", cfg.sel)nvme_show_message(1, "invalid 'select' param:%d", cfg.sel); | |||
| 5040 | return -EINVAL22; | |||
| 5041 | } | |||
| 5042 | ||||
| 5043 | if (cfg.uuid_index > 127) { | |||
| 5044 | nvme_show_error("invalid uuid index param: %u", cfg.uuid_index)nvme_show_message(1, "invalid uuid index param: %u", cfg.uuid_index ); | |||
| 5045 | return -1; | |||
| 5046 | } | |||
| 5047 | ||||
| 5048 | if (nvme_args.verbose) | |||
| 5049 | flags |= VERBOSE; | |||
| 5050 | ||||
| 5051 | nvme_show_init(); | |||
| 5052 | ||||
| 5053 | err = get_feature_ids(hdl, cfg, flags); | |||
| 5054 | ||||
| 5055 | nvme_show_finish(); | |||
| 5056 | ||||
| 5057 | return err; | |||
| 5058 | } | |||
| 5059 | ||||
| 5060 | /* | |||
| 5061 | * Transfers one chunk of firmware to the device, and decodes & reports any | |||
| 5062 | * errors. Returns -1 on (fatal) error; signifying that the transfer should | |||
| 5063 | * be aborted. | |||
| 5064 | */ | |||
| 5065 | static int fw_download_single(struct libnvme_transport_handle *hdl, void *fw_buf, | |||
| 5066 | bool_Bool ish, unsigned int fw_len, uint32_t offset, | |||
| 5067 | uint32_t len, bool_Bool progress, bool_Bool ignore_ovr) | |||
| 5068 | { | |||
| 5069 | const unsigned int max_retries = 3; | |||
| 5070 | struct libnvme_passthru_cmd cmd; | |||
| 5071 | bool_Bool retryable, ovr; | |||
| 5072 | int err, try; | |||
| 5073 | ||||
| 5074 | if (progress) { | |||
| 5075 | printf("Firmware download: transferring 0x%08x/0x%08x bytes: %03d%%\r", | |||
| 5076 | offset, fw_len, (int)(100 * offset / fw_len)); | |||
| 5077 | } | |||
| 5078 | ||||
| 5079 | if (libnvme_transport_handle_is_mi(hdl)) | |||
| 5080 | nvme_init_mi_cmd_flags(&cmd, ish); | |||
| 5081 | ||||
| 5082 | for (try = 0; try < max_retries; try++) { | |||
| 5083 | if (try > 0) { | |||
| 5084 | fprintf(stderrstderr, "retrying offset %x (%u/%u)\n", | |||
| 5085 | offset, try, max_retries); | |||
| 5086 | } | |||
| 5087 | ||||
| 5088 | err = nvme_init_fw_download(&cmd, fw_buf, len, offset); | |||
| 5089 | if (err) | |||
| 5090 | return err; | |||
| 5091 | ||||
| 5092 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 5093 | if (!err) | |||
| 5094 | return 0; | |||
| 5095 | ||||
| 5096 | /* | |||
| 5097 | * don't retry if the NVMe-type error indicates Do Not Resend. | |||
| 5098 | */ | |||
| 5099 | retryable = !((err > 0) && | |||
| 5100 | (nvme_status_get_type(err) == NVME_STATUS_TYPE_NVME) && | |||
| 5101 | (nvme_status_get_value(err) & NVME_SC_DNR)); | |||
| 5102 | ||||
| 5103 | /* | |||
| 5104 | * detect overwrite errors, which are handled differently | |||
| 5105 | * depending on ignore_ovr | |||
| 5106 | */ | |||
| 5107 | ovr = (err > 0) && | |||
| 5108 | (nvme_status_get_type(err) == NVME_STATUS_TYPE_NVME) && | |||
| 5109 | (NVME_GET(err, SCT)(((err) >> NVME_SCT_SHIFT) & NVME_SCT_MASK) == NVME_SCT_CMD_SPECIFIC) && | |||
| 5110 | (NVME_GET(err, SC)(((err) >> NVME_SC_SHIFT) & NVME_SC_MASK) == NVME_SC_OVERLAPPING_RANGE); | |||
| 5111 | ||||
| 5112 | if (ovr && ignore_ovr) | |||
| 5113 | return 0; | |||
| 5114 | ||||
| 5115 | /* | |||
| 5116 | * if we're printing progress, we'll need a newline to separate | |||
| 5117 | * error output from the progress data (which doesn't have a | |||
| 5118 | * \n), and flush before we write to stderr. | |||
| 5119 | */ | |||
| 5120 | if (progress) { | |||
| 5121 | printf("\n"); | |||
| 5122 | fflush(stdoutstdout); | |||
| 5123 | } | |||
| 5124 | ||||
| 5125 | fprintf(stderrstderr, "fw-download: error on offset 0x%08x/0x%08x\n", | |||
| 5126 | offset, fw_len); | |||
| 5127 | ||||
| 5128 | nvme_show_err(err, "fw-download"); | |||
| 5129 | if (err > 0 && ovr) { | |||
| 5130 | /* | |||
| 5131 | * non-ignored ovr error: print a little extra info | |||
| 5132 | * about recovering | |||
| 5133 | */ | |||
| 5134 | fprintf(stderrstderr, | |||
| 5135 | "Use --ignore-ovr to ignore overwrite errors\n"); | |||
| 5136 | ||||
| 5137 | /* | |||
| 5138 | * We'll just be attempting more overwrites if | |||
| 5139 | * we retry. DNR will likely be set, but force | |||
| 5140 | * an exit anyway. | |||
| 5141 | */ | |||
| 5142 | retryable = false0; | |||
| 5143 | } | |||
| 5144 | ||||
| 5145 | if (!retryable) | |||
| 5146 | break; | |||
| 5147 | } | |||
| 5148 | ||||
| 5149 | return -1; | |||
| 5150 | } | |||
| 5151 | ||||
| 5152 | static int fw_download(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 5153 | { | |||
| 5154 | const char *desc = "Copy all or part of a firmware image to " | |||
| 5155 | "a controller for future update. Optionally, specify how " | |||
| 5156 | "many KiB of the firmware to transfer at once. The offset will " | |||
| 5157 | "start at 0 and automatically adjust based on xfer size " | |||
| 5158 | "unless fw is split across multiple files. May be submitted " | |||
| 5159 | "while outstanding commands exist on the Admin and IO " | |||
| 5160 | "Submission Queues. Activate downloaded firmware with " | |||
| 5161 | "fw-activate, and then reset the device to apply the downloaded firmware."; | |||
| 5162 | const char *fw = "firmware file (required)"; | |||
| 5163 | const char *xfer = "transfer chunksize limit"; | |||
| 5164 | const char *offset = "starting dword offset, default 0"; | |||
| 5165 | const char *progress = "display firmware transfer progress"; | |||
| 5166 | const char *ignore_ovr = "ignore overwrite errors"; | |||
| 5167 | ||||
| 5168 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 5169 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 5170 | __cleanup_huge__attribute__((cleanup(libnvme_free_huge))) struct libnvme_mem_huge mh = { 0, }; | |||
| 5171 | __cleanup_fd__attribute__((cleanup(cleanup_fd))) int fw_fd = -1; | |||
| 5172 | unsigned int fw_size, pos; | |||
| 5173 | int err; | |||
| 5174 | struct stat sb; | |||
| 5175 | void *fw_buf; | |||
| 5176 | struct nvme_id_ctrl ctrl = { 0 }; | |||
| 5177 | nvme_print_flags_t flags; | |||
| 5178 | ||||
| 5179 | struct config { | |||
| 5180 | char *fw; | |||
| 5181 | bool_Bool ish; | |||
| 5182 | __u32 xfer; | |||
| 5183 | __u32 offset; | |||
| 5184 | bool_Bool progress; | |||
| 5185 | bool_Bool ignore_ovr; | |||
| 5186 | }; | |||
| 5187 | ||||
| 5188 | struct config cfg = { | |||
| 5189 | .fw = "", | |||
| 5190 | .ish = false0, | |||
| 5191 | .xfer = 0, | |||
| 5192 | .offset = 0, | |||
| 5193 | .progress = false0, | |||
| 5194 | .ignore_ovr = false0, | |||
| 5195 | }; | |||
| 5196 | ||||
| 5197 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"fw", 'f', "FILE", CFG_STRING, &cfg.fw, 1, fw, 0, }, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish, 0 , }, {"xfer", 'x', "NUM", CFG_POSITIVE, &cfg.xfer, 1, xfer , 0, }, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1, offset, 0, }, {"progress", 'p', ((void*)0), CFG_FLAG, & cfg.progress, 0, progress, 0, }, {"ignore-ovr", 'i', ((void*) 0), CFG_FLAG, &cfg.ignore_ovr, 0, ignore_ovr, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5198 | OPT_FILE("fw", 'f', &cfg.fw, fw),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"fw", 'f', "FILE", CFG_STRING, &cfg.fw, 1, fw, 0, }, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish, 0 , }, {"xfer", 'x', "NUM", CFG_POSITIVE, &cfg.xfer, 1, xfer , 0, }, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1, offset, 0, }, {"progress", 'p', ((void*)0), CFG_FLAG, & cfg.progress, 0, progress, 0, }, {"ignore-ovr", 'i', ((void*) 0), CFG_FLAG, &cfg.ignore_ovr, 0, ignore_ovr, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5199 | OPT_FLAG("ish", 'I', &cfg.ish, ish),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"fw", 'f', "FILE", CFG_STRING, &cfg.fw, 1, fw, 0, }, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish, 0 , }, {"xfer", 'x', "NUM", CFG_POSITIVE, &cfg.xfer, 1, xfer , 0, }, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1, offset, 0, }, {"progress", 'p', ((void*)0), CFG_FLAG, & cfg.progress, 0, progress, 0, }, {"ignore-ovr", 'i', ((void*) 0), CFG_FLAG, &cfg.ignore_ovr, 0, ignore_ovr, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5200 | OPT_UINT("xfer", 'x', &cfg.xfer, xfer),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"fw", 'f', "FILE", CFG_STRING, &cfg.fw, 1, fw, 0, }, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish, 0 , }, {"xfer", 'x', "NUM", CFG_POSITIVE, &cfg.xfer, 1, xfer , 0, }, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1, offset, 0, }, {"progress", 'p', ((void*)0), CFG_FLAG, & cfg.progress, 0, progress, 0, }, {"ignore-ovr", 'i', ((void*) 0), CFG_FLAG, &cfg.ignore_ovr, 0, ignore_ovr, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5201 | OPT_UINT("offset", 'O', &cfg.offset, offset),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"fw", 'f', "FILE", CFG_STRING, &cfg.fw, 1, fw, 0, }, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish, 0 , }, {"xfer", 'x', "NUM", CFG_POSITIVE, &cfg.xfer, 1, xfer , 0, }, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1, offset, 0, }, {"progress", 'p', ((void*)0), CFG_FLAG, & cfg.progress, 0, progress, 0, }, {"ignore-ovr", 'i', ((void*) 0), CFG_FLAG, &cfg.ignore_ovr, 0, ignore_ovr, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5202 | OPT_FLAG("progress", 'p', &cfg.progress, progress),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"fw", 'f', "FILE", CFG_STRING, &cfg.fw, 1, fw, 0, }, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish, 0 , }, {"xfer", 'x', "NUM", CFG_POSITIVE, &cfg.xfer, 1, xfer , 0, }, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1, offset, 0, }, {"progress", 'p', ((void*)0), CFG_FLAG, & cfg.progress, 0, progress, 0, }, {"ignore-ovr", 'i', ((void*) 0), CFG_FLAG, &cfg.ignore_ovr, 0, ignore_ovr, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5203 | OPT_FLAG("ignore-ovr", 'i', &cfg.ignore_ovr, ignore_ovr))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"fw", 'f', "FILE", CFG_STRING, &cfg.fw, 1, fw, 0, }, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish, 0 , }, {"xfer", 'x', "NUM", CFG_POSITIVE, &cfg.xfer, 1, xfer , 0, }, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1, offset, 0, }, {"progress", 'p', ((void*)0), CFG_FLAG, & cfg.progress, 0, progress, 0, }, {"ignore-ovr", 'i', ((void*) 0), CFG_FLAG, &cfg.ignore_ovr, 0, ignore_ovr, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 5204 | ||||
| 5205 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 5206 | if (err) | |||
| 5207 | return err; | |||
| 5208 | ||||
| 5209 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 5210 | if (err < 0) { | |||
| 5211 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 5212 | return err; | |||
| 5213 | } | |||
| 5214 | ||||
| 5215 | fw_fd = open(cfg.fw, O_RDONLY00); | |||
| 5216 | cfg.offset <<= 2; | |||
| 5217 | if (fw_fd < 0) { | |||
| 5218 | nvme_show_error("Failed to open firmware file %s: %s", cfg.fw, libnvme_strerror(errno))nvme_show_message(1, "Failed to open firmware file %s: %s", cfg .fw, libnvme_strerror((*__errno_location ()))); | |||
| 5219 | return -EINVAL22; | |||
| 5220 | } | |||
| 5221 | ||||
| 5222 | err = fstat(fw_fd, &sb); | |||
| 5223 | if (err < 0) { | |||
| 5224 | nvme_show_perror("fstat"); | |||
| 5225 | return err; | |||
| 5226 | } | |||
| 5227 | ||||
| 5228 | fw_size = sb.st_size; | |||
| 5229 | if ((fw_size & 0x3) || (fw_size == 0)) { | |||
| 5230 | nvme_show_error("Invalid size:%d for f/w image", fw_size)nvme_show_message(1, "Invalid size:%d for f/w image", fw_size ); | |||
| 5231 | return -EINVAL22; | |||
| 5232 | } | |||
| 5233 | ||||
| 5234 | if (cfg.xfer == 0) { | |||
| 5235 | err = nvme_identify_ctrl(hdl, &ctrl); | |||
| 5236 | if (err) { | |||
| 5237 | nvme_show_error("identify-ctrl: %s", libnvme_strerror(err))nvme_show_message(1, "identify-ctrl: %s", libnvme_strerror(err )); | |||
| 5238 | return err; | |||
| 5239 | } | |||
| 5240 | if (ctrl.fwug == 0 || ctrl.fwug == 0xff) | |||
| 5241 | cfg.xfer = 4096; | |||
| 5242 | else | |||
| 5243 | cfg.xfer = ctrl.fwug * 4096; | |||
| 5244 | } else if (cfg.xfer % 4096) | |||
| 5245 | cfg.xfer = 4096; | |||
| 5246 | ||||
| 5247 | if (ctrl.fwug && ctrl.fwug != 0xff && fw_size % cfg.xfer) | |||
| 5248 | nvme_show_error("WARNING: firmware file size %u not conform to FWUG alignment %lu",nvme_show_message(1, "WARNING: firmware file size %u not conform to FWUG alignment %lu" , fw_size, cfg.xfer) | |||
| 5249 | fw_size, cfg.xfer)nvme_show_message(1, "WARNING: firmware file size %u not conform to FWUG alignment %lu" , fw_size, cfg.xfer); | |||
| 5250 | ||||
| 5251 | fw_buf = libnvme_alloc_huge(fw_size, &mh); | |||
| 5252 | if (!fw_buf) { | |||
| 5253 | nvme_show_error("failed to allocate huge memory")nvme_show_message(1, "failed to allocate huge memory"); | |||
| 5254 | return -ENOMEM12; | |||
| 5255 | } | |||
| 5256 | ||||
| 5257 | if (read(fw_fd, fw_buf, fw_size) != ((ssize_t)(fw_size))) { | |||
| 5258 | err = -errno(*__errno_location ()); | |||
| 5259 | nvme_show_error("read :%s :%s", cfg.fw, libnvme_strerror(errno))nvme_show_message(1, "read :%s :%s", cfg.fw, libnvme_strerror ((*__errno_location ()))); | |||
| 5260 | return err; | |||
| 5261 | } | |||
| 5262 | ||||
| 5263 | if (cfg.ish && !libnvme_transport_handle_is_mi(hdl)) { | |||
| 5264 | printf("ISH is supported only for NVMe-MI\n"); | |||
| 5265 | } | |||
| 5266 | ||||
| 5267 | for (pos = 0; pos < fw_size; pos += cfg.xfer) { | |||
| 5268 | cfg.xfer = min(cfg.xfer, fw_size - pos)((cfg.xfer) > (fw_size - pos) ? (fw_size - pos) : (cfg.xfer )); | |||
| 5269 | ||||
| 5270 | err = fw_download_single(hdl, fw_buf + pos, cfg.ish, fw_size, | |||
| 5271 | cfg.offset + pos, cfg.xfer, | |||
| 5272 | cfg.progress, cfg.ignore_ovr); | |||
| 5273 | if (err) | |||
| 5274 | break; | |||
| 5275 | } | |||
| 5276 | ||||
| 5277 | if (!err) { | |||
| 5278 | /* end the progress output */ | |||
| 5279 | if (cfg.progress) | |||
| 5280 | printf("\n"); | |||
| 5281 | printf("Firmware download success\n"); | |||
| 5282 | } | |||
| 5283 | ||||
| 5284 | return err; | |||
| 5285 | } | |||
| 5286 | ||||
| 5287 | static char *nvme_fw_status_reset_type(__u16 status) | |||
| 5288 | { | |||
| 5289 | switch (status & 0x7ff) { | |||
| 5290 | case NVME_SC_FW_NEEDS_CONV_RESET: | |||
| 5291 | return "conventional"; | |||
| 5292 | case NVME_SC_FW_NEEDS_SUBSYS_RESET: | |||
| 5293 | return "subsystem"; | |||
| 5294 | case NVME_SC_FW_NEEDS_RESET: | |||
| 5295 | return "any controller"; | |||
| 5296 | default: | |||
| 5297 | return "unknown"; | |||
| 5298 | } | |||
| 5299 | } | |||
| 5300 | ||||
| 5301 | static bool_Bool fw_commit_support_mud(struct libnvme_transport_handle *hdl) | |||
| 5302 | { | |||
| 5303 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ctrl *ctrl = NULL((void*)0); | |||
| 5304 | int err; | |||
| 5305 | ||||
| 5306 | ctrl = libnvme_alloc(sizeof(*ctrl)); | |||
| 5307 | if (!ctrl) | |||
| 5308 | return false0; | |||
| 5309 | ||||
| 5310 | err = nvme_identify_ctrl(hdl, ctrl); | |||
| 5311 | ||||
| 5312 | if (err) | |||
| 5313 | nvme_show_error("identify-ctrl: %s", libnvme_strerror(err))nvme_show_message(1, "identify-ctrl: %s", libnvme_strerror(err )); | |||
| 5314 | else if (ctrl->frmw >> 5 & 0x1) | |||
| 5315 | return true1; | |||
| 5316 | ||||
| 5317 | return false0; | |||
| 5318 | } | |||
| 5319 | ||||
| 5320 | static void fw_commit_print_mud(bool_Bool mud_supported, __u64 result) | |||
| 5321 | { | |||
| 5322 | if (!mud_supported) | |||
| 5323 | return; | |||
| 5324 | ||||
| 5325 | printf("Multiple Update Detected (MUD) Value: %#" PRIx64"l" "x" "\n", | |||
| 5326 | (uint64_t)result); | |||
| 5327 | ||||
| 5328 | if (result & 0x1) | |||
| 5329 | printf("Detected an overlapping firmware/boot partition image update command\n" | |||
| 5330 | "sequence due to processing a command from an Admin SQ on a controller\n"); | |||
| 5331 | ||||
| 5332 | if (result >> 1 & 0x1) | |||
| 5333 | printf("Detected an overlapping firmware/boot partition image update command\n" | |||
| 5334 | "sequence due to processing a command from a Management Endpoint\n"); | |||
| 5335 | } | |||
| 5336 | ||||
| 5337 | static void fw_commit_err(int err, __u8 action, __u8 slot, __u8 bpid) | |||
| 5338 | { | |||
| 5339 | __u32 val; | |||
| 5340 | ||||
| 5341 | if (err > 0 && nvme_status_get_type(err) == NVME_STATUS_TYPE_NVME) { | |||
| 5342 | val = nvme_status_get_value(err); | |||
| 5343 | switch (val & 0x7ff) { | |||
| 5344 | case NVME_SC_FW_NEEDS_CONV_RESET: | |||
| 5345 | case NVME_SC_FW_NEEDS_SUBSYS_RESET: | |||
| 5346 | case NVME_SC_FW_NEEDS_RESET: | |||
| 5347 | printf("Success activating firmware action:%d slot:%d", | |||
| 5348 | action, slot); | |||
| 5349 | if (action == 6 || action == 7) | |||
| 5350 | printf(" bpid:%d", bpid); | |||
| 5351 | printf(", but firmware requires %s reset\n", | |||
| 5352 | nvme_fw_status_reset_type(val)); | |||
| 5353 | return; | |||
| 5354 | default: | |||
| 5355 | break; | |||
| 5356 | } | |||
| 5357 | } | |||
| 5358 | ||||
| 5359 | nvme_show_err(err, "fw-commit"); | |||
| 5360 | } | |||
| 5361 | ||||
| 5362 | static int fw_commit(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 5363 | { | |||
| 5364 | const char *desc = "Verify downloaded firmware image and " | |||
| 5365 | "commit to specific firmware slot. Device is not automatically " | |||
| 5366 | "reset following firmware activation. A reset may be issued " | |||
| 5367 | "with an 'echo 1 > /sys/class/nvme/nvmeX/reset_controller'. " | |||
| 5368 | "Ensure nvmeX is the device you just activated before reset."; | |||
| 5369 | const char *slot = "[0-7]: firmware slot for commit action"; | |||
| 5370 | const char *action = "[0-7]: commit action: 0 = replace, " | |||
| 5371 | "1 = replace and activate, 2 = set active, " | |||
| 5372 | "3 = replace and activate immediate, " | |||
| 5373 | "6 = replace boot partition, " | |||
| 5374 | "7 = activate boot partition"; | |||
| 5375 | const char *bpid = "[0,1]: boot partition identifier, if applicable (default: 0)"; | |||
| 5376 | ||||
| 5377 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 5378 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 5379 | struct libnvme_passthru_cmd cmd; | |||
| 5380 | int err; | |||
| 5381 | nvme_print_flags_t flags; | |||
| 5382 | bool_Bool mud_supported; | |||
| 5383 | ||||
| 5384 | struct config { | |||
| 5385 | bool_Bool ish; | |||
| 5386 | __u8 slot; | |||
| 5387 | __u8 action; | |||
| 5388 | __u8 bpid; | |||
| 5389 | }; | |||
| 5390 | ||||
| 5391 | struct config cfg = { | |||
| 5392 | .ish = false0, | |||
| 5393 | .slot = 0, | |||
| 5394 | .action = 0, | |||
| 5395 | .bpid = 0, | |||
| 5396 | }; | |||
| 5397 | ||||
| 5398 | OPT_VALS(ca)struct argconfig_opt_val ca[] = { | |||
| 5399 | VAL_BYTE("replace", NVME_FW_COMMIT_CA_REPLACE){"replace", CFG_BYTE, .val.byte = NVME_FW_COMMIT_CA_REPLACE}, | |||
| 5400 | VAL_BYTE("replace-and-activate",{"replace-and-activate", CFG_BYTE, .val.byte = NVME_FW_COMMIT_CA_REPLACE_AND_ACTIVATE } | |||
| 5401 | NVME_FW_COMMIT_CA_REPLACE_AND_ACTIVATE){"replace-and-activate", CFG_BYTE, .val.byte = NVME_FW_COMMIT_CA_REPLACE_AND_ACTIVATE }, | |||
| 5402 | VAL_BYTE("set-active", NVME_FW_COMMIT_CA_SET_ACTIVE){"set-active", CFG_BYTE, .val.byte = NVME_FW_COMMIT_CA_SET_ACTIVE }, | |||
| 5403 | VAL_BYTE("replace-and-activate-immediate",{"replace-and-activate-immediate", CFG_BYTE, .val.byte = NVME_FW_COMMIT_CA_REPLACE_AND_ACTIVATE_IMMEDIATE } | |||
| 5404 | NVME_FW_COMMIT_CA_REPLACE_AND_ACTIVATE_IMMEDIATE){"replace-and-activate-immediate", CFG_BYTE, .val.byte = NVME_FW_COMMIT_CA_REPLACE_AND_ACTIVATE_IMMEDIATE }, | |||
| 5405 | VAL_BYTE("replace-boot-partition",{"replace-boot-partition", CFG_BYTE, .val.byte = NVME_FW_COMMIT_CA_REPLACE_BOOT_PARTITION } | |||
| 5406 | NVME_FW_COMMIT_CA_REPLACE_BOOT_PARTITION){"replace-boot-partition", CFG_BYTE, .val.byte = NVME_FW_COMMIT_CA_REPLACE_BOOT_PARTITION }, | |||
| 5407 | VAL_BYTE("activate-boot-partition",{"activate-boot-partition", CFG_BYTE, .val.byte = NVME_FW_COMMIT_CA_ACTIVATE_BOOT_PARTITION } | |||
| 5408 | NVME_FW_COMMIT_CA_ACTIVATE_BOOT_PARTITION){"activate-boot-partition", CFG_BYTE, .val.byte = NVME_FW_COMMIT_CA_ACTIVATE_BOOT_PARTITION }, | |||
| 5409 | VAL_END(){ ((void*)0) } | |||
| 5410 | }; | |||
| 5411 | ||||
| 5412 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"slot", 's', "NUM", CFG_BYTE, &cfg.slot, 1, slot , 0, }, {"action", 'a', "NUM", CFG_BYTE, &cfg.action, 1, action , 0, ca}, {"bpid", 'b', "NUM", CFG_BYTE, &cfg.bpid, 1, bpid , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 5413 | OPT_FLAG("ish", 'I', &cfg.ish, ish),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"slot", 's', "NUM", CFG_BYTE, &cfg.slot, 1, slot , 0, }, {"action", 'a', "NUM", CFG_BYTE, &cfg.action, 1, action , 0, ca}, {"bpid", 'b', "NUM", CFG_BYTE, &cfg.bpid, 1, bpid , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 5414 | OPT_BYTE("slot", 's', &cfg.slot, slot),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"slot", 's', "NUM", CFG_BYTE, &cfg.slot, 1, slot , 0, }, {"action", 'a', "NUM", CFG_BYTE, &cfg.action, 1, action , 0, ca}, {"bpid", 'b', "NUM", CFG_BYTE, &cfg.bpid, 1, bpid , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 5415 | OPT_BYTE("action", 'a', &cfg.action, action, ca),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"slot", 's', "NUM", CFG_BYTE, &cfg.slot, 1, slot , 0, }, {"action", 'a', "NUM", CFG_BYTE, &cfg.action, 1, action , 0, ca}, {"bpid", 'b', "NUM", CFG_BYTE, &cfg.bpid, 1, bpid , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 5416 | OPT_BYTE("bpid", 'b', &cfg.bpid, bpid))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"slot", 's', "NUM", CFG_BYTE, &cfg.slot, 1, slot , 0, }, {"action", 'a', "NUM", CFG_BYTE, &cfg.action, 1, action , 0, ca}, {"bpid", 'b', "NUM", CFG_BYTE, &cfg.bpid, 1, bpid , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 5417 | ||||
| 5418 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 5419 | if (err) | |||
| 5420 | return err; | |||
| 5421 | ||||
| 5422 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 5423 | if (err < 0) { | |||
| 5424 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 5425 | return err; | |||
| 5426 | } | |||
| 5427 | ||||
| 5428 | if (cfg.slot > 7) { | |||
| 5429 | nvme_show_error("invalid slot:%d", cfg.slot)nvme_show_message(1, "invalid slot:%d", cfg.slot); | |||
| 5430 | return -EINVAL22; | |||
| 5431 | } | |||
| 5432 | ||||
| 5433 | switch (cfg.action) { | |||
| 5434 | case NVME_FW_COMMIT_CA_REPLACE: | |||
| 5435 | case NVME_FW_COMMIT_CA_REPLACE_AND_ACTIVATE: | |||
| 5436 | case NVME_FW_COMMIT_CA_SET_ACTIVE: | |||
| 5437 | case NVME_FW_COMMIT_CA_REPLACE_AND_ACTIVATE_IMMEDIATE: | |||
| 5438 | case NVME_FW_COMMIT_CA_REPLACE_BOOT_PARTITION: | |||
| 5439 | case NVME_FW_COMMIT_CA_ACTIVATE_BOOT_PARTITION: | |||
| 5440 | break; | |||
| 5441 | default: | |||
| 5442 | nvme_show_error("invalid action:%d", cfg.action)nvme_show_message(1, "invalid action:%d", cfg.action); | |||
| 5443 | return -EINVAL22; | |||
| 5444 | } | |||
| 5445 | ||||
| 5446 | if (cfg.bpid > 1) { | |||
| 5447 | nvme_show_error("invalid boot partition id:%d", cfg.bpid)nvme_show_message(1, "invalid boot partition id:%d", cfg.bpid ); | |||
| 5448 | return -EINVAL22; | |||
| 5449 | } | |||
| 5450 | ||||
| 5451 | mud_supported = fw_commit_support_mud(hdl); | |||
| 5452 | ||||
| 5453 | nvme_init_fw_commit(&cmd, cfg.slot, cfg.action, cfg.bpid); | |||
| 5454 | if (cfg.ish) { | |||
| 5455 | if (libnvme_transport_handle_is_mi(hdl)) | |||
| 5456 | nvme_init_mi_cmd_flags(&cmd, ish); | |||
| 5457 | else | |||
| 5458 | printf("ISH is supported only for NVMe-MI\n"); | |||
| 5459 | } | |||
| 5460 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 5461 | if (err) { | |||
| 5462 | fw_commit_err(err, cfg.action, cfg.slot, cfg.bpid); | |||
| 5463 | return err; | |||
| 5464 | } | |||
| 5465 | ||||
| 5466 | printf("Success committing firmware action:%d slot:%d", | |||
| 5467 | cfg.action, cfg.slot); | |||
| 5468 | if (cfg.action == 6 || cfg.action == 7) | |||
| 5469 | printf(" bpid:%d", cfg.bpid); | |||
| 5470 | printf("\n"); | |||
| 5471 | fw_commit_print_mud(mud_supported, cmd.result); | |||
| 5472 | ||||
| 5473 | return err; | |||
| 5474 | } | |||
| 5475 | ||||
| 5476 | static int subsystem_reset(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 5477 | { | |||
| 5478 | const char *desc = "Resets the NVMe subsystem"; | |||
| 5479 | ||||
| 5480 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 5481 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 5482 | int err; | |||
| 5483 | ||||
| 5484 | NVME_ARGS(opts)struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 5485 | ||||
| 5486 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 5487 | if (err) | |||
| 5488 | return err; | |||
| 5489 | ||||
| 5490 | if (!libnvme_transport_handle_is_ctrl(hdl)) { | |||
| 5491 | nvme_show_error(only_ctrl_dev)nvme_show_message(1, only_ctrl_dev); | |||
| 5492 | return -EINVAL22; | |||
| 5493 | } | |||
| 5494 | ||||
| 5495 | err = libnvme_reset_subsystem(hdl); | |||
| 5496 | if (err < 0) { | |||
| 5497 | if (errno(*__errno_location ()) == ENOTTY25) | |||
| 5498 | nvme_show_error("Subsystem-reset: NVM Subsystem Reset not supported.")nvme_show_message(1, "Subsystem-reset: NVM Subsystem Reset not supported." ); | |||
| 5499 | else | |||
| 5500 | nvme_show_error("Subsystem-reset: %s", libnvme_strerror(-err))nvme_show_message(1, "Subsystem-reset: %s", libnvme_strerror( -err)); | |||
| 5501 | } else if (nvme_args.verbose) | |||
| 5502 | printf("resetting subsystem through %s\n", libnvme_transport_handle_get_name(hdl)); | |||
| 5503 | ||||
| 5504 | return err; | |||
| 5505 | } | |||
| 5506 | ||||
| 5507 | static int reset(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 5508 | { | |||
| 5509 | const char *desc = "Resets the NVMe controller\n"; | |||
| 5510 | ||||
| 5511 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 5512 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 5513 | int err; | |||
| 5514 | ||||
| 5515 | NVME_ARGS(opts)struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 5516 | ||||
| 5517 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 5518 | if (err) | |||
| 5519 | return err; | |||
| 5520 | ||||
| 5521 | if (!libnvme_transport_handle_is_ctrl(hdl)) { | |||
| 5522 | nvme_show_error(only_ctrl_dev)nvme_show_message(1, only_ctrl_dev); | |||
| 5523 | return -EINVAL22; | |||
| 5524 | } | |||
| 5525 | ||||
| 5526 | err = libnvme_reset_ctrl(hdl); | |||
| 5527 | if (err < 0) | |||
| 5528 | nvme_show_error("Reset: %s", libnvme_strerror(-err))nvme_show_message(1, "Reset: %s", libnvme_strerror(-err)); | |||
| 5529 | else if (nvme_args.verbose) | |||
| 5530 | printf("resetting controller %s\n", libnvme_transport_handle_get_name(hdl)); | |||
| 5531 | ||||
| 5532 | return err; | |||
| 5533 | } | |||
| 5534 | ||||
| 5535 | static int ns_rescan(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 5536 | { | |||
| 5537 | const char *desc = "Rescans the NVMe namespaces\n"; | |||
| 5538 | ||||
| 5539 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 5540 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 5541 | int err; | |||
| 5542 | nvme_print_flags_t flags; | |||
| 5543 | ||||
| 5544 | NVME_ARGS(opts)struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 5545 | ||||
| 5546 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 5547 | if (err) | |||
| 5548 | return err; | |||
| 5549 | ||||
| 5550 | if (!libnvme_transport_handle_is_ctrl(hdl)) { | |||
| 5551 | nvme_show_error(only_ctrl_dev)nvme_show_message(1, only_ctrl_dev); | |||
| 5552 | return -EINVAL22; | |||
| 5553 | } | |||
| 5554 | ||||
| 5555 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 5556 | if (err < 0) { | |||
| 5557 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 5558 | return err; | |||
| 5559 | } | |||
| 5560 | ||||
| 5561 | err = libnvme_rescan_ns(hdl); | |||
| 5562 | if (err < 0) | |||
| 5563 | nvme_show_error("Namespace Rescan: %s\n", libnvme_strerror(-err))nvme_show_message(1, "Namespace Rescan: %s\n", libnvme_strerror (-err)); | |||
| 5564 | else if (nvme_args.verbose) | |||
| 5565 | printf("rescanning namespaces through %s\n", libnvme_transport_handle_get_name(hdl)); | |||
| 5566 | ||||
| 5567 | return err; | |||
| 5568 | } | |||
| 5569 | ||||
| 5570 | static int wait_sanitize(struct libnvme_transport_handle *hdl) | |||
| 5571 | { | |||
| 5572 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_sanitize_log_page *log = NULL((void*)0); | |||
| 5573 | static const char spin[] = {'-', '\\', '|', '/' }; | |||
| 5574 | __u64 i = 0, cnt = 0, wthr = 0; | |||
| 5575 | __u32 p = 0; | |||
| 5576 | int err; | |||
| 5577 | ||||
| 5578 | log = libnvme_alloc(sizeof(*log)); | |||
| 5579 | if (!log) | |||
| 5580 | return -ENOMEM12; | |||
| 5581 | ||||
| 5582 | err = nvme_get_log_sanitize(hdl, false0, log); | |||
| 5583 | if (err) { | |||
| 5584 | nvme_show_err(err, "sanitize status log"); | |||
| 5585 | return err; | |||
| 5586 | } | |||
| 5587 | ||||
| 5588 | switch (NVME_GET(log->scdw10, SANITIZE_CDW10_SANACT)(((log->scdw10) >> NVME_SANITIZE_CDW10_SANACT_SHIFT) & NVME_SANITIZE_CDW10_SANACT_MASK)) { | |||
| 5589 | case NVME_SANITIZE_SANACT_EXIT_FAILURE: | |||
| 5590 | break; | |||
| 5591 | case NVME_SANITIZE_SANACT_START_BLOCK_ERASE: | |||
| 5592 | if (NVME_GET(log->scdw10, SANITIZE_CDW10_NDAS)(((log->scdw10) >> NVME_SANITIZE_CDW10_NDAS_SHIFT) & NVME_SANITIZE_CDW10_NDAS_MASK)) | |||
| 5593 | wthr = le32_to_cpu(log->etbend); | |||
| 5594 | else | |||
| 5595 | wthr = le32_to_cpu(log->etbe); | |||
| 5596 | break; | |||
| 5597 | case NVME_SANITIZE_SANACT_START_OVERWRITE: | |||
| 5598 | if (NVME_GET(log->scdw10, SANITIZE_CDW10_NDAS)(((log->scdw10) >> NVME_SANITIZE_CDW10_NDAS_SHIFT) & NVME_SANITIZE_CDW10_NDAS_MASK)) | |||
| 5599 | wthr = le32_to_cpu(log->etond); | |||
| 5600 | else | |||
| 5601 | wthr = le32_to_cpu(log->eto); | |||
| 5602 | break; | |||
| 5603 | case NVME_SANITIZE_SANACT_START_CRYPTO_ERASE: | |||
| 5604 | if (NVME_GET(log->scdw10, SANITIZE_CDW10_NDAS)(((log->scdw10) >> NVME_SANITIZE_CDW10_NDAS_SHIFT) & NVME_SANITIZE_CDW10_NDAS_MASK)) | |||
| 5605 | wthr = le32_to_cpu(log->etcend); | |||
| 5606 | else | |||
| 5607 | wthr = le32_to_cpu(log->etce); | |||
| 5608 | break; | |||
| 5609 | case NVME_SANITIZE_SANACT_EXIT_MEDIA_VERIF: | |||
| 5610 | default: | |||
| 5611 | break; | |||
| 5612 | } | |||
| 5613 | if (wthr != 0xffffffff && NVME_GET(log->scdw10, SANITIZE_CDW10_EMVS)(((log->scdw10) >> NVME_SANITIZE_CDW10_EMVS_SHIFT) & NVME_SANITIZE_CDW10_EMVS_MASK)) | |||
| 5614 | wthr += le32_to_cpu(log->etpvds); | |||
| 5615 | ||||
| 5616 | printf("Waiting for sanitize completion...\n"); | |||
| 5617 | while (true1) { | |||
| 5618 | printf("\r[%.*s%c%.*s] %3d%%", p * 100 / 0xffff / 2, dash, | |||
| 5619 | spin[i % 4], 49 - p * 100 / 0xffff / 2, space, | |||
| 5620 | p * 100 / 0xffff); | |||
| 5621 | fflush(stdoutstdout); | |||
| 5622 | err = nvme_sleep(1); | |||
| 5623 | if (err) | |||
| 5624 | return err; | |||
| 5625 | ||||
| 5626 | err = nvme_get_log_sanitize(hdl, false0, log); | |||
| 5627 | if (err) { | |||
| 5628 | printf("\n"); | |||
| 5629 | nvme_show_err(err, "sanitize status log"); | |||
| 5630 | return err; | |||
| 5631 | } | |||
| 5632 | ||||
| 5633 | if (++cnt > wthr) { | |||
| 5634 | nvme_show_error(nvme_show_message(1, "no progress for %""l" "u"" seconds, stop waiting" , wthr) | |||
| 5635 | "no progress for %"PRIu64" seconds, stop waiting",nvme_show_message(1, "no progress for %""l" "u"" seconds, stop waiting" , wthr) | |||
| 5636 | wthr)nvme_show_message(1, "no progress for %""l" "u"" seconds, stop waiting" , wthr); | |||
| 5637 | return -EIO5; | |||
| 5638 | } | |||
| 5639 | ||||
| 5640 | if (le16_to_cpu(log->sprog) == 0xffff) { | |||
| 5641 | printf("\r[%.*s] %3d%%\n", 50, dash, 100); | |||
| 5642 | break; | |||
| 5643 | } | |||
| 5644 | ||||
| 5645 | if (le16_to_cpu(log->sprog) < p) { | |||
| 5646 | printf("\n"); | |||
| 5647 | nvme_show_error("progress broken")nvme_show_message(1, "progress broken"); | |||
| 5648 | return -EIO5; | |||
| 5649 | } else if (le16_to_cpu(log->sprog) != p) { | |||
| 5650 | p = le16_to_cpu(log->sprog); | |||
| 5651 | cnt = 0; | |||
| 5652 | } | |||
| 5653 | ||||
| 5654 | i++; | |||
| 5655 | } | |||
| 5656 | ||||
| 5657 | return 0; | |||
| 5658 | } | |||
| 5659 | ||||
| 5660 | static bool_Bool is_sanitized(struct libnvme_transport_handle *hdl) | |||
| 5661 | { | |||
| 5662 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_sanitize_log_page *log = NULL((void*)0); | |||
| 5663 | int err; | |||
| 5664 | ||||
| 5665 | log = libnvme_alloc(sizeof(*log)); | |||
| 5666 | if (!log) | |||
| 5667 | return -ENOMEM12; | |||
| 5668 | ||||
| 5669 | err = nvme_get_log_sanitize(hdl, false0, log); | |||
| 5670 | if (err) { | |||
| 5671 | nvme_show_err(err, "sanitize status log"); | |||
| 5672 | return err; | |||
| 5673 | } | |||
| 5674 | ||||
| 5675 | switch (NVME_GET(le16_to_cpu(log->sstat), SANITIZE_SSTAT_STATUS)(((le16_to_cpu(log->sstat)) >> NVME_SANITIZE_SSTAT_STATUS_SHIFT ) & NVME_SANITIZE_SSTAT_STATUS_MASK)) { | |||
| 5676 | case NVME_SANITIZE_SSTAT_STATUS_NEVER_SANITIZED: | |||
| 5677 | break; | |||
| 5678 | case NVME_SANITIZE_SSTAT_STATUS_COMPLETE_SUCCESS: | |||
| 5679 | return true1; | |||
| 5680 | case NVME_SANITIZE_SSTAT_STATUS_IN_PROGRESS: | |||
| 5681 | case NVME_SANITIZE_SSTAT_STATUS_COMPLETED_FAILED: | |||
| 5682 | case NVME_SANITIZE_SSTAT_STATUS_ND_COMPLETE_SUCCESS: | |||
| 5683 | default: | |||
| 5684 | break; | |||
| 5685 | } | |||
| 5686 | ||||
| 5687 | return false0; | |||
| 5688 | } | |||
| 5689 | ||||
| 5690 | struct nvme_id_ctrl *identify_ctrl(struct libnvme_transport_handle *hdl) | |||
| 5691 | { | |||
| 5692 | struct nvme_id_ctrl *ctrl = libnvme_alloc(sizeof(*ctrl)); | |||
| 5693 | int err = 0; | |||
| 5694 | ||||
| 5695 | if (!ctrl) { | |||
| 5696 | errno(*__errno_location ()) = ENOMEM12; | |||
| 5697 | return NULL((void*)0); | |||
| 5698 | } | |||
| 5699 | ||||
| 5700 | err = nvme_identify_ctrl(hdl, ctrl); | |||
| 5701 | if (err) { | |||
| 5702 | nvme_show_error("identify-ctrl: %s", libnvme_strerror(err))nvme_show_message(1, "identify-ctrl: %s", libnvme_strerror(err )); | |||
| 5703 | libnvme_free(ctrl); | |||
| 5704 | return NULL((void*)0); | |||
| 5705 | } | |||
| 5706 | ||||
| 5707 | return ctrl; | |||
| 5708 | } | |||
| 5709 | ||||
| 5710 | static int sanitize_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 5711 | { | |||
| 5712 | const char *desc = "Send a sanitize command."; | |||
| 5713 | const char *emvs_desc = "Enter media verification state."; | |||
| 5714 | const char *no_dealloc_desc = "No deallocate after sanitize."; | |||
| 5715 | const char *oipbp_desc = "Overwrite invert pattern between passes."; | |||
| 5716 | const char *owpass_desc = "Overwrite pass count."; | |||
| 5717 | const char *ause_desc = "Allow unrestricted sanitize exit."; | |||
| 5718 | const char *sanact_desc = "Sanitize action: 1 = Exit failure mode, 2 = Start block erase," | |||
| 5719 | "3 = Start overwrite, 4 = Start crypto erase, 5 = Exit media verification"; | |||
| 5720 | const char *ovrpat_desc = "Overwrite pattern."; | |||
| 5721 | const char *wait = "Wait for the sanitize to finish"; | |||
| 5722 | const char *repeat = "Repeat for the multi cycle sanitization"; | |||
| 5723 | ||||
| 5724 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 5725 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 5726 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ctrl *ctrl = NULL((void*)0); | |||
| 5727 | struct libnvme_passthru_cmd cmd; | |||
| 5728 | nvme_print_flags_t flags; | |||
| 5729 | int err; | |||
| 5730 | ||||
| 5731 | struct config { | |||
| 5732 | bool_Bool ish; | |||
| 5733 | bool_Bool no_dealloc; | |||
| 5734 | bool_Bool oipbp; | |||
| 5735 | __u8 owpass; | |||
| 5736 | bool_Bool ause; | |||
| 5737 | __u8 sanact; | |||
| 5738 | __u32 ovrpat; | |||
| 5739 | bool_Bool emvs; | |||
| 5740 | bool_Bool wait; | |||
| 5741 | __u32 repeat; | |||
| 5742 | }; | |||
| 5743 | ||||
| 5744 | struct config cfg = { | |||
| 5745 | .ish = false0, | |||
| 5746 | .no_dealloc = false0, | |||
| 5747 | .oipbp = false0, | |||
| 5748 | .owpass = 0, | |||
| 5749 | .ause = false0, | |||
| 5750 | .sanact = 0, | |||
| 5751 | .ovrpat = 0, | |||
| 5752 | .emvs = false0, | |||
| 5753 | .repeat = 1, | |||
| 5754 | }; | |||
| 5755 | ||||
| 5756 | OPT_VALS(sanact)struct argconfig_opt_val sanact[] = { | |||
| 5757 | VAL_BYTE("exit-failure", NVME_SANITIZE_SANACT_EXIT_FAILURE){"exit-failure", CFG_BYTE, .val.byte = NVME_SANITIZE_SANACT_EXIT_FAILURE }, | |||
| 5758 | VAL_BYTE("start-block-erase", NVME_SANITIZE_SANACT_START_BLOCK_ERASE){"start-block-erase", CFG_BYTE, .val.byte = NVME_SANITIZE_SANACT_START_BLOCK_ERASE }, | |||
| 5759 | VAL_BYTE("start-overwrite", NVME_SANITIZE_SANACT_START_OVERWRITE){"start-overwrite", CFG_BYTE, .val.byte = NVME_SANITIZE_SANACT_START_OVERWRITE }, | |||
| 5760 | VAL_BYTE("start-crypto-erase", NVME_SANITIZE_SANACT_START_CRYPTO_ERASE){"start-crypto-erase", CFG_BYTE, .val.byte = NVME_SANITIZE_SANACT_START_CRYPTO_ERASE }, | |||
| 5761 | VAL_BYTE("exit-media-verification", NVME_SANITIZE_SANACT_EXIT_MEDIA_VERIF){"exit-media-verification", CFG_BYTE, .val.byte = NVME_SANITIZE_SANACT_EXIT_MEDIA_VERIF }, | |||
| 5762 | VAL_END(){ ((void*)0) } | |||
| 5763 | }; | |||
| 5764 | ||||
| 5765 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"no-dealloc", 'd', ((void*)0), CFG_FLAG, &cfg.no_dealloc , 0, no_dealloc_desc, 0, }, {"oipbp", 'i', ((void*)0), CFG_FLAG , &cfg.oipbp, 0, oipbp_desc, 0, }, {"owpass", 'n', "NUM", CFG_BYTE, &cfg.owpass, 1, owpass_desc, 0, }, {"ause", 'u' , ((void*)0), CFG_FLAG, &cfg.ause, 0, ause_desc, 0, }, {"sanact" , 'a', "NUM", CFG_BYTE, &cfg.sanact, 1, sanact_desc, 0, sanact }, {"ovrpat", 'p', "NUM", CFG_POSITIVE, &cfg.ovrpat, 1, ovrpat_desc , 0, }, {"emvs", 'e', ((void*)0), CFG_FLAG, &cfg.emvs, 0, emvs_desc, 0, }, {"wait", 'w', ((void*)0), CFG_FLAG, &cfg .wait, 0, wait, 0, }, {"repeat", 'r', "NUM", CFG_POSITIVE, & cfg.repeat, 1, repeat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5766 | OPT_FLAG("ish", 'I', &cfg.ish, ish),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"no-dealloc", 'd', ((void*)0), CFG_FLAG, &cfg.no_dealloc , 0, no_dealloc_desc, 0, }, {"oipbp", 'i', ((void*)0), CFG_FLAG , &cfg.oipbp, 0, oipbp_desc, 0, }, {"owpass", 'n', "NUM", CFG_BYTE, &cfg.owpass, 1, owpass_desc, 0, }, {"ause", 'u' , ((void*)0), CFG_FLAG, &cfg.ause, 0, ause_desc, 0, }, {"sanact" , 'a', "NUM", CFG_BYTE, &cfg.sanact, 1, sanact_desc, 0, sanact }, {"ovrpat", 'p', "NUM", CFG_POSITIVE, &cfg.ovrpat, 1, ovrpat_desc , 0, }, {"emvs", 'e', ((void*)0), CFG_FLAG, &cfg.emvs, 0, emvs_desc, 0, }, {"wait", 'w', ((void*)0), CFG_FLAG, &cfg .wait, 0, wait, 0, }, {"repeat", 'r', "NUM", CFG_POSITIVE, & cfg.repeat, 1, repeat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5767 | OPT_FLAG("no-dealloc", 'd', &cfg.no_dealloc, no_dealloc_desc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"no-dealloc", 'd', ((void*)0), CFG_FLAG, &cfg.no_dealloc , 0, no_dealloc_desc, 0, }, {"oipbp", 'i', ((void*)0), CFG_FLAG , &cfg.oipbp, 0, oipbp_desc, 0, }, {"owpass", 'n', "NUM", CFG_BYTE, &cfg.owpass, 1, owpass_desc, 0, }, {"ause", 'u' , ((void*)0), CFG_FLAG, &cfg.ause, 0, ause_desc, 0, }, {"sanact" , 'a', "NUM", CFG_BYTE, &cfg.sanact, 1, sanact_desc, 0, sanact }, {"ovrpat", 'p', "NUM", CFG_POSITIVE, &cfg.ovrpat, 1, ovrpat_desc , 0, }, {"emvs", 'e', ((void*)0), CFG_FLAG, &cfg.emvs, 0, emvs_desc, 0, }, {"wait", 'w', ((void*)0), CFG_FLAG, &cfg .wait, 0, wait, 0, }, {"repeat", 'r', "NUM", CFG_POSITIVE, & cfg.repeat, 1, repeat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5768 | OPT_FLAG("oipbp", 'i', &cfg.oipbp, oipbp_desc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"no-dealloc", 'd', ((void*)0), CFG_FLAG, &cfg.no_dealloc , 0, no_dealloc_desc, 0, }, {"oipbp", 'i', ((void*)0), CFG_FLAG , &cfg.oipbp, 0, oipbp_desc, 0, }, {"owpass", 'n', "NUM", CFG_BYTE, &cfg.owpass, 1, owpass_desc, 0, }, {"ause", 'u' , ((void*)0), CFG_FLAG, &cfg.ause, 0, ause_desc, 0, }, {"sanact" , 'a', "NUM", CFG_BYTE, &cfg.sanact, 1, sanact_desc, 0, sanact }, {"ovrpat", 'p', "NUM", CFG_POSITIVE, &cfg.ovrpat, 1, ovrpat_desc , 0, }, {"emvs", 'e', ((void*)0), CFG_FLAG, &cfg.emvs, 0, emvs_desc, 0, }, {"wait", 'w', ((void*)0), CFG_FLAG, &cfg .wait, 0, wait, 0, }, {"repeat", 'r', "NUM", CFG_POSITIVE, & cfg.repeat, 1, repeat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5769 | OPT_BYTE("owpass", 'n', &cfg.owpass, owpass_desc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"no-dealloc", 'd', ((void*)0), CFG_FLAG, &cfg.no_dealloc , 0, no_dealloc_desc, 0, }, {"oipbp", 'i', ((void*)0), CFG_FLAG , &cfg.oipbp, 0, oipbp_desc, 0, }, {"owpass", 'n', "NUM", CFG_BYTE, &cfg.owpass, 1, owpass_desc, 0, }, {"ause", 'u' , ((void*)0), CFG_FLAG, &cfg.ause, 0, ause_desc, 0, }, {"sanact" , 'a', "NUM", CFG_BYTE, &cfg.sanact, 1, sanact_desc, 0, sanact }, {"ovrpat", 'p', "NUM", CFG_POSITIVE, &cfg.ovrpat, 1, ovrpat_desc , 0, }, {"emvs", 'e', ((void*)0), CFG_FLAG, &cfg.emvs, 0, emvs_desc, 0, }, {"wait", 'w', ((void*)0), CFG_FLAG, &cfg .wait, 0, wait, 0, }, {"repeat", 'r', "NUM", CFG_POSITIVE, & cfg.repeat, 1, repeat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5770 | OPT_FLAG("ause", 'u', &cfg.ause, ause_desc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"no-dealloc", 'd', ((void*)0), CFG_FLAG, &cfg.no_dealloc , 0, no_dealloc_desc, 0, }, {"oipbp", 'i', ((void*)0), CFG_FLAG , &cfg.oipbp, 0, oipbp_desc, 0, }, {"owpass", 'n', "NUM", CFG_BYTE, &cfg.owpass, 1, owpass_desc, 0, }, {"ause", 'u' , ((void*)0), CFG_FLAG, &cfg.ause, 0, ause_desc, 0, }, {"sanact" , 'a', "NUM", CFG_BYTE, &cfg.sanact, 1, sanact_desc, 0, sanact }, {"ovrpat", 'p', "NUM", CFG_POSITIVE, &cfg.ovrpat, 1, ovrpat_desc , 0, }, {"emvs", 'e', ((void*)0), CFG_FLAG, &cfg.emvs, 0, emvs_desc, 0, }, {"wait", 'w', ((void*)0), CFG_FLAG, &cfg .wait, 0, wait, 0, }, {"repeat", 'r', "NUM", CFG_POSITIVE, & cfg.repeat, 1, repeat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5771 | OPT_BYTE("sanact", 'a', &cfg.sanact, sanact_desc, sanact),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"no-dealloc", 'd', ((void*)0), CFG_FLAG, &cfg.no_dealloc , 0, no_dealloc_desc, 0, }, {"oipbp", 'i', ((void*)0), CFG_FLAG , &cfg.oipbp, 0, oipbp_desc, 0, }, {"owpass", 'n', "NUM", CFG_BYTE, &cfg.owpass, 1, owpass_desc, 0, }, {"ause", 'u' , ((void*)0), CFG_FLAG, &cfg.ause, 0, ause_desc, 0, }, {"sanact" , 'a', "NUM", CFG_BYTE, &cfg.sanact, 1, sanact_desc, 0, sanact }, {"ovrpat", 'p', "NUM", CFG_POSITIVE, &cfg.ovrpat, 1, ovrpat_desc , 0, }, {"emvs", 'e', ((void*)0), CFG_FLAG, &cfg.emvs, 0, emvs_desc, 0, }, {"wait", 'w', ((void*)0), CFG_FLAG, &cfg .wait, 0, wait, 0, }, {"repeat", 'r', "NUM", CFG_POSITIVE, & cfg.repeat, 1, repeat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5772 | OPT_UINT("ovrpat", 'p', &cfg.ovrpat, ovrpat_desc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"no-dealloc", 'd', ((void*)0), CFG_FLAG, &cfg.no_dealloc , 0, no_dealloc_desc, 0, }, {"oipbp", 'i', ((void*)0), CFG_FLAG , &cfg.oipbp, 0, oipbp_desc, 0, }, {"owpass", 'n', "NUM", CFG_BYTE, &cfg.owpass, 1, owpass_desc, 0, }, {"ause", 'u' , ((void*)0), CFG_FLAG, &cfg.ause, 0, ause_desc, 0, }, {"sanact" , 'a', "NUM", CFG_BYTE, &cfg.sanact, 1, sanact_desc, 0, sanact }, {"ovrpat", 'p', "NUM", CFG_POSITIVE, &cfg.ovrpat, 1, ovrpat_desc , 0, }, {"emvs", 'e', ((void*)0), CFG_FLAG, &cfg.emvs, 0, emvs_desc, 0, }, {"wait", 'w', ((void*)0), CFG_FLAG, &cfg .wait, 0, wait, 0, }, {"repeat", 'r', "NUM", CFG_POSITIVE, & cfg.repeat, 1, repeat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5773 | OPT_FLAG("emvs", 'e', &cfg.emvs, emvs_desc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"no-dealloc", 'd', ((void*)0), CFG_FLAG, &cfg.no_dealloc , 0, no_dealloc_desc, 0, }, {"oipbp", 'i', ((void*)0), CFG_FLAG , &cfg.oipbp, 0, oipbp_desc, 0, }, {"owpass", 'n', "NUM", CFG_BYTE, &cfg.owpass, 1, owpass_desc, 0, }, {"ause", 'u' , ((void*)0), CFG_FLAG, &cfg.ause, 0, ause_desc, 0, }, {"sanact" , 'a', "NUM", CFG_BYTE, &cfg.sanact, 1, sanact_desc, 0, sanact }, {"ovrpat", 'p', "NUM", CFG_POSITIVE, &cfg.ovrpat, 1, ovrpat_desc , 0, }, {"emvs", 'e', ((void*)0), CFG_FLAG, &cfg.emvs, 0, emvs_desc, 0, }, {"wait", 'w', ((void*)0), CFG_FLAG, &cfg .wait, 0, wait, 0, }, {"repeat", 'r', "NUM", CFG_POSITIVE, & cfg.repeat, 1, repeat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5774 | OPT_FLAG("wait", 'w', &cfg.wait, wait),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"no-dealloc", 'd', ((void*)0), CFG_FLAG, &cfg.no_dealloc , 0, no_dealloc_desc, 0, }, {"oipbp", 'i', ((void*)0), CFG_FLAG , &cfg.oipbp, 0, oipbp_desc, 0, }, {"owpass", 'n', "NUM", CFG_BYTE, &cfg.owpass, 1, owpass_desc, 0, }, {"ause", 'u' , ((void*)0), CFG_FLAG, &cfg.ause, 0, ause_desc, 0, }, {"sanact" , 'a', "NUM", CFG_BYTE, &cfg.sanact, 1, sanact_desc, 0, sanact }, {"ovrpat", 'p', "NUM", CFG_POSITIVE, &cfg.ovrpat, 1, ovrpat_desc , 0, }, {"emvs", 'e', ((void*)0), CFG_FLAG, &cfg.emvs, 0, emvs_desc, 0, }, {"wait", 'w', ((void*)0), CFG_FLAG, &cfg .wait, 0, wait, 0, }, {"repeat", 'r', "NUM", CFG_POSITIVE, & cfg.repeat, 1, repeat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5775 | OPT_UINT("repeat", 'r', &cfg.repeat, repeat))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"no-dealloc", 'd', ((void*)0), CFG_FLAG, &cfg.no_dealloc , 0, no_dealloc_desc, 0, }, {"oipbp", 'i', ((void*)0), CFG_FLAG , &cfg.oipbp, 0, oipbp_desc, 0, }, {"owpass", 'n', "NUM", CFG_BYTE, &cfg.owpass, 1, owpass_desc, 0, }, {"ause", 'u' , ((void*)0), CFG_FLAG, &cfg.ause, 0, ause_desc, 0, }, {"sanact" , 'a', "NUM", CFG_BYTE, &cfg.sanact, 1, sanact_desc, 0, sanact }, {"ovrpat", 'p', "NUM", CFG_POSITIVE, &cfg.ovrpat, 1, ovrpat_desc , 0, }, {"emvs", 'e', ((void*)0), CFG_FLAG, &cfg.emvs, 0, emvs_desc, 0, }, {"wait", 'w', ((void*)0), CFG_FLAG, &cfg .wait, 0, wait, 0, }, {"repeat", 'r', "NUM", CFG_POSITIVE, & cfg.repeat, 1, repeat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 5776 | ||||
| 5777 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 5778 | if (err) | |||
| 5779 | return err; | |||
| 5780 | ||||
| 5781 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 5782 | if (err < 0) { | |||
| 5783 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 5784 | return err; | |||
| 5785 | } | |||
| 5786 | ||||
| 5787 | ctrl = identify_ctrl(hdl); | |||
| 5788 | if (!ctrl) | |||
| 5789 | return -errno(*__errno_location ()); | |||
| 5790 | ||||
| 5791 | switch (cfg.sanact) { | |||
| 5792 | case NVME_SANITIZE_SANACT_EXIT_FAILURE: | |||
| 5793 | break; | |||
| 5794 | case NVME_SANITIZE_SANACT_START_BLOCK_ERASE: | |||
| 5795 | if (!NVME_CTRL_SANICAP_BES(le32_to_cpu(ctrl->sanicap))(((le32_to_cpu(ctrl->sanicap)) >> NVME_CTRL_SANICAP_BES_SHIFT ) & NVME_CTRL_SANICAP_BES_MASK)) { | |||
| 5796 | nvme_show_error("block erase action unsupported")nvme_show_message(1, "block erase action unsupported"); | |||
| 5797 | return -EINVAL22; | |||
| 5798 | } | |||
| 5799 | break; | |||
| 5800 | case NVME_SANITIZE_SANACT_START_OVERWRITE: | |||
| 5801 | if (!NVME_CTRL_SANICAP_OWS(le32_to_cpu(ctrl->sanicap))(((le32_to_cpu(ctrl->sanicap)) >> NVME_CTRL_SANICAP_OWS_SHIFT ) & NVME_CTRL_SANICAP_OWS_MASK)) { | |||
| 5802 | nvme_show_error("overwrite action unsupported")nvme_show_message(1, "overwrite action unsupported"); | |||
| 5803 | return -EINVAL22; | |||
| 5804 | } | |||
| 5805 | break; | |||
| 5806 | case NVME_SANITIZE_SANACT_START_CRYPTO_ERASE: | |||
| 5807 | if (!NVME_CTRL_SANICAP_CES(le32_to_cpu(ctrl->sanicap))(((le32_to_cpu(ctrl->sanicap)) >> NVME_CTRL_SANICAP_CES_SHIFT ) & NVME_CTRL_SANICAP_CES_MASK)) { | |||
| 5808 | nvme_show_error("crypto erase action unsupported")nvme_show_message(1, "crypto erase action unsupported"); | |||
| 5809 | return -EINVAL22; | |||
| 5810 | } | |||
| 5811 | break; | |||
| 5812 | case NVME_SANITIZE_SANACT_EXIT_MEDIA_VERIF: | |||
| 5813 | break; | |||
| 5814 | default: | |||
| 5815 | nvme_show_error("Invalid Sanitize Action")nvme_show_message(1, "Invalid Sanitize Action"); | |||
| 5816 | return -EINVAL22; | |||
| 5817 | } | |||
| 5818 | ||||
| 5819 | if (cfg.emvs && !NVME_CTRL_SANICAP_VERS(le32_to_cpu(ctrl->sanicap))(((le32_to_cpu(ctrl->sanicap)) >> NVME_CTRL_SANICAP_VERS_SHIFT ) & NVME_CTRL_SANICAP_VERS_MASK)) { | |||
| 5820 | nvme_show_error("media verification unsupported")nvme_show_message(1, "media verification unsupported"); | |||
| 5821 | return -EINVAL22; | |||
| 5822 | } | |||
| 5823 | ||||
| 5824 | if (cfg.ause || cfg.no_dealloc) { | |||
| 5825 | if (cfg.sanact == NVME_SANITIZE_SANACT_EXIT_FAILURE) { | |||
| 5826 | nvme_show_error("SANACT is Exit Failure Mode")nvme_show_message(1, "SANACT is Exit Failure Mode"); | |||
| 5827 | return -EINVAL22; | |||
| 5828 | } else if (cfg.sanact == NVME_SANITIZE_SANACT_EXIT_MEDIA_VERIF) { | |||
| 5829 | nvme_show_error("SANACT is Exit Media Verification State")nvme_show_message(1, "SANACT is Exit Media Verification State" ); | |||
| 5830 | return -EINVAL22; | |||
| 5831 | } | |||
| 5832 | } | |||
| 5833 | ||||
| 5834 | if (cfg.sanact == NVME_SANITIZE_SANACT_START_OVERWRITE) { | |||
| 5835 | if (cfg.owpass > 15) { | |||
| 5836 | nvme_show_error("OWPASS out of range [0-15]")nvme_show_message(1, "OWPASS out of range [0-15]"); | |||
| 5837 | return -EINVAL22; | |||
| 5838 | } | |||
| 5839 | } else { | |||
| 5840 | if (cfg.owpass || cfg.oipbp || cfg.ovrpat) { | |||
| 5841 | nvme_show_error("SANACT is not Overwrite")nvme_show_message(1, "SANACT is not Overwrite"); | |||
| 5842 | return -EINVAL22; | |||
| 5843 | } | |||
| 5844 | } | |||
| 5845 | ||||
| 5846 | nvme_init_sanitize_nvm(&cmd, cfg.sanact, cfg.ause, cfg.owpass, | |||
| 5847 | cfg.oipbp, cfg.no_dealloc, cfg.emvs, cfg.ovrpat); | |||
| 5848 | if (cfg.ish) { | |||
| 5849 | if (libnvme_transport_handle_is_mi(hdl)) | |||
| 5850 | nvme_init_mi_cmd_flags(&cmd, ish); | |||
| 5851 | else | |||
| 5852 | printf("ISH is supported only for NVMe-MI\n"); | |||
| 5853 | } | |||
| 5854 | ||||
| 5855 | do { | |||
| 5856 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 5857 | if (err) { | |||
| 5858 | nvme_show_err(err, "sanitize"); | |||
| 5859 | return err; | |||
| 5860 | } | |||
| 5861 | ||||
| 5862 | if (cfg.wait) | |||
| 5863 | err = wait_sanitize(hdl); | |||
| 5864 | } while (--cfg.repeat && !err && is_sanitized(hdl)); | |||
| 5865 | ||||
| 5866 | return err; | |||
| 5867 | } | |||
| 5868 | ||||
| 5869 | static int sanitize_ns_cmd(int argc, char **argv, struct command *acmd, | |||
| 5870 | struct plugin *plugin) | |||
| 5871 | { | |||
| 5872 | const char *desc = "Send a sanitize namespace command."; | |||
| 5873 | const char *emvs_desc = "Enter media verification state."; | |||
| 5874 | const char *ause_desc = "Allow unrestricted sanitize exit."; | |||
| 5875 | const char *sanact_desc = "Sanitize action: 1 = Exit failure mode,\n" | |||
| 5876 | "4 = Start a crypto erase namespace sanitize operation,\n" | |||
| 5877 | "5 = Exit media verification state"; | |||
| 5878 | ||||
| 5879 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = | |||
| 5880 | NULL((void*)0); | |||
| 5881 | ||||
| 5882 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 5883 | struct libnvme_passthru_cmd cmd; | |||
| 5884 | nvme_print_flags_t flags; | |||
| 5885 | int err; | |||
| 5886 | ||||
| 5887 | struct config { | |||
| 5888 | bool_Bool ish; | |||
| 5889 | bool_Bool ause; | |||
| 5890 | __u8 sanact; | |||
| 5891 | bool_Bool emvs; | |||
| 5892 | }; | |||
| 5893 | ||||
| 5894 | struct config cfg = { | |||
| 5895 | .ish = false0, | |||
| 5896 | .ause = false0, | |||
| 5897 | .sanact = 0, | |||
| 5898 | .emvs = false0, | |||
| 5899 | }; | |||
| 5900 | ||||
| 5901 | OPT_VALS(sanact)struct argconfig_opt_val sanact[] = { | |||
| 5902 | VAL_BYTE("exit-failure", NVME_SANITIZE_SANACT_EXIT_FAILURE){"exit-failure", CFG_BYTE, .val.byte = NVME_SANITIZE_SANACT_EXIT_FAILURE }, | |||
| 5903 | VAL_BYTE("start-crypto-erase",{"start-crypto-erase", CFG_BYTE, .val.byte = NVME_SANITIZE_SANACT_START_CRYPTO_ERASE } | |||
| 5904 | NVME_SANITIZE_SANACT_START_CRYPTO_ERASE){"start-crypto-erase", CFG_BYTE, .val.byte = NVME_SANITIZE_SANACT_START_CRYPTO_ERASE }, | |||
| 5905 | VAL_BYTE("exit-media-verification",{"exit-media-verification", CFG_BYTE, .val.byte = NVME_SANITIZE_SANACT_EXIT_MEDIA_VERIF } | |||
| 5906 | NVME_SANITIZE_SANACT_EXIT_MEDIA_VERIF){"exit-media-verification", CFG_BYTE, .val.byte = NVME_SANITIZE_SANACT_EXIT_MEDIA_VERIF }, | |||
| 5907 | VAL_END(){ ((void*)0) } | |||
| 5908 | }; | |||
| 5909 | ||||
| 5910 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"ause", 'u', ((void*)0), CFG_FLAG, &cfg.ause, 0, ause_desc, 0, }, {"sanact", 'a', "NUM", CFG_BYTE, &cfg.sanact , 1, sanact_desc, 0, sanact}, {"emvs", 'e', ((void*)0), CFG_FLAG , &cfg.emvs, 0, emvs_desc, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5911 | OPT_FLAG("ish", 'I', &cfg.ish, ish),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"ause", 'u', ((void*)0), CFG_FLAG, &cfg.ause, 0, ause_desc, 0, }, {"sanact", 'a', "NUM", CFG_BYTE, &cfg.sanact , 1, sanact_desc, 0, sanact}, {"emvs", 'e', ((void*)0), CFG_FLAG , &cfg.emvs, 0, emvs_desc, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5912 | OPT_FLAG("ause", 'u', &cfg.ause, ause_desc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"ause", 'u', ((void*)0), CFG_FLAG, &cfg.ause, 0, ause_desc, 0, }, {"sanact", 'a', "NUM", CFG_BYTE, &cfg.sanact , 1, sanact_desc, 0, sanact}, {"emvs", 'e', ((void*)0), CFG_FLAG , &cfg.emvs, 0, emvs_desc, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5913 | OPT_BYTE("sanact", 'a', &cfg.sanact, sanact_desc, sanact),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"ause", 'u', ((void*)0), CFG_FLAG, &cfg.ause, 0, ause_desc, 0, }, {"sanact", 'a', "NUM", CFG_BYTE, &cfg.sanact , 1, sanact_desc, 0, sanact}, {"emvs", 'e', ((void*)0), CFG_FLAG , &cfg.emvs, 0, emvs_desc, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 5914 | OPT_FLAG("emvs", 'e', &cfg.emvs, emvs_desc))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"ause", 'u', ((void*)0), CFG_FLAG, &cfg.ause, 0, ause_desc, 0, }, {"sanact", 'a', "NUM", CFG_BYTE, &cfg.sanact , 1, sanact_desc, 0, sanact}, {"emvs", 'e', ((void*)0), CFG_FLAG , &cfg.emvs, 0, emvs_desc, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 5915 | ||||
| 5916 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 5917 | if (err) | |||
| 5918 | return err; | |||
| 5919 | ||||
| 5920 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 5921 | if (err < 0) { | |||
| 5922 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 5923 | return err; | |||
| 5924 | } | |||
| 5925 | ||||
| 5926 | switch (cfg.sanact) { | |||
| 5927 | case NVME_SANITIZE_SANACT_EXIT_FAILURE: | |||
| 5928 | case NVME_SANITIZE_SANACT_START_CRYPTO_ERASE: | |||
| 5929 | case NVME_SANITIZE_SANACT_EXIT_MEDIA_VERIF: | |||
| 5930 | break; | |||
| 5931 | default: | |||
| 5932 | nvme_show_error("Invalid Sanitize Action")nvme_show_message(1, "Invalid Sanitize Action"); | |||
| 5933 | return -EINVAL22; | |||
| 5934 | } | |||
| 5935 | ||||
| 5936 | if (cfg.ause) { | |||
| 5937 | if (cfg.sanact == NVME_SANITIZE_SANACT_EXIT_FAILURE) { | |||
| 5938 | nvme_show_error("SANACT is Exit Failure Mode")nvme_show_message(1, "SANACT is Exit Failure Mode"); | |||
| 5939 | return -EINVAL22; | |||
| 5940 | } else if (cfg.sanact == | |||
| 5941 | NVME_SANITIZE_SANACT_EXIT_MEDIA_VERIF) { | |||
| 5942 | nvme_show_error(nvme_show_message(1, "SANACT is Exit Media Verification State" ) | |||
| 5943 | "SANACT is Exit Media Verification State")nvme_show_message(1, "SANACT is Exit Media Verification State" ); | |||
| 5944 | return -EINVAL22; | |||
| 5945 | } | |||
| 5946 | } | |||
| 5947 | ||||
| 5948 | nvme_init_sanitize_ns(&cmd, cfg.sanact, cfg.ause, cfg.emvs); | |||
| 5949 | if (cfg.ish) { | |||
| 5950 | if (libnvme_transport_handle_is_mi(hdl)) | |||
| 5951 | nvme_init_mi_cmd_flags(&cmd, ish); | |||
| 5952 | else | |||
| 5953 | printf("ISH is supported only for NVMe-MI\n"); | |||
| 5954 | } | |||
| 5955 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 5956 | if (err) { | |||
| 5957 | nvme_show_admin_cmd_err("sanitize ns", cmd.opcode, err); | |||
| 5958 | return err; | |||
| 5959 | } | |||
| 5960 | ||||
| 5961 | return err; | |||
| 5962 | } | |||
| 5963 | ||||
| 5964 | static int nvme_get_single_property(struct libnvme_transport_handle *hdl, | |||
| 5965 | struct get_reg_config *cfg, __u64 *value) | |||
| 5966 | { | |||
| 5967 | struct libnvme_passthru_cmd cmd; | |||
| 5968 | int err; | |||
| 5969 | ||||
| 5970 | nvme_init_get_property(&cmd, cfg->offset); | |||
| 5971 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 5972 | if (!err) { | |||
| 5973 | *value = cmd.result; | |||
| 5974 | return 0; | |||
| 5975 | } | |||
| 5976 | ||||
| 5977 | if (cfg->fabrics && nvme_is_fabrics_optional_reg(cfg->offset)) { | |||
| 5978 | *value = -1; | |||
| 5979 | return 0; | |||
| 5980 | } | |||
| 5981 | ||||
| 5982 | if (!cfg->fabrics && | |||
| 5983 | nvme_status_equals(err, NVME_STATUS_TYPE_NVME, | |||
| 5984 | NVME_SC_INVALID_FIELD)) { | |||
| 5985 | *value = -1; | |||
| 5986 | return 0; | |||
| 5987 | } | |||
| 5988 | ||||
| 5989 | nvme_show_err(err, "get-property"); | |||
| 5990 | return err; | |||
| 5991 | } | |||
| 5992 | ||||
| 5993 | static int nvme_get_properties(struct libnvme_transport_handle *hdl, void **pbar, | |||
| 5994 | struct get_reg_config *cfg) | |||
| 5995 | { | |||
| 5996 | int err, size = getpagesize(); | |||
| 5997 | bool_Bool is_64bit = false0; | |||
| 5998 | __u64 value; | |||
| 5999 | void *bar; | |||
| 6000 | int offset; | |||
| 6001 | ||||
| 6002 | bar = malloc(size); | |||
| 6003 | if (!bar) | |||
| 6004 | return -ENOMEM12; | |||
| 6005 | ||||
| 6006 | memset(bar, 0xff, size); | |||
| 6007 | for (offset = NVME_REG_CAP; offset <= NVME_REG_CMBSZ; | |||
| 6008 | offset += is_64bit ? sizeof(uint64_t) : sizeof(uint32_t)) { | |||
| 6009 | if (!nvme_is_fabrics_reg(offset)) | |||
| 6010 | continue; | |||
| 6011 | ||||
| 6012 | cfg->offset = offset; | |||
| 6013 | err = nvme_get_single_property(hdl, cfg, &value); | |||
| 6014 | if (err) | |||
| 6015 | break; | |||
| 6016 | ||||
| 6017 | is_64bit = nvme_is_64bit_reg(cfg->offset); | |||
| 6018 | if (is_64bit) | |||
| 6019 | *(uint64_t *)(bar + cfg->offset) = value; | |||
| 6020 | else | |||
| 6021 | *(uint32_t *)(bar + cfg->offset) = value; | |||
| 6022 | } | |||
| 6023 | ||||
| 6024 | if (err) | |||
| 6025 | free(bar); | |||
| 6026 | else | |||
| 6027 | *pbar = bar; | |||
| 6028 | ||||
| 6029 | return err; | |||
| 6030 | } | |||
| 6031 | ||||
| 6032 | static void *mmap_registers(struct libnvme_transport_handle *hdl, bool_Bool writable) | |||
| 6033 | { | |||
| 6034 | void *membase = NULL((void*)0); | |||
| 6035 | #ifdef NVME_HAVE_MMAP | |||
| 6036 | char path[512]; | |||
| 6037 | int fd; | |||
| 6038 | int prot = PROT_READ0x1; | |||
| 6039 | ||||
| 6040 | if (writable) | |||
| 6041 | prot |= PROT_WRITE0x2; | |||
| 6042 | ||||
| 6043 | sprintf(path, "/sys/class/nvme/%s/device/resource0", libnvme_transport_handle_get_name(hdl)); | |||
| 6044 | fd = open(path, writable ? O_RDWR02 : O_RDONLY00); | |||
| 6045 | if (fd < 0) { | |||
| 6046 | if (log_level >= LIBNVME_LOG_INFO) | |||
| 6047 | nvme_show_error("%s did not find a pci resource, open failed %s",nvme_show_message(1, "%s did not find a pci resource, open failed %s" , libnvme_transport_handle_get_name(hdl), libnvme_strerror((* __errno_location ()))) | |||
| 6048 | libnvme_transport_handle_get_name(hdl), libnvme_strerror(errno))nvme_show_message(1, "%s did not find a pci resource, open failed %s" , libnvme_transport_handle_get_name(hdl), libnvme_strerror((* __errno_location ()))); | |||
| 6049 | return NULL((void*)0); | |||
| 6050 | } | |||
| 6051 | ||||
| 6052 | membase = mmap(NULL((void*)0), getpagesize(), prot, MAP_SHARED0x01, fd, 0); | |||
| 6053 | if (membase == MAP_FAILED((void *) -1)) { | |||
| 6054 | if (log_level >= LIBNVME_LOG_INFO) { | |||
| 6055 | fprintf(stderrstderr, "Failed to map registers to userspace.\n\n" | |||
| 6056 | "Did your kernel enable CONFIG_IO_STRICT_DEVMEM?\n" | |||
| 6057 | "You can disable this feature with command line argument\n\n" | |||
| 6058 | "\tio_memory=relaxed\n\n" | |||
| 6059 | "Also ensure secure boot is disabled.\n\n"); | |||
| 6060 | } | |||
| 6061 | membase = NULL((void*)0); | |||
| 6062 | } | |||
| 6063 | ||||
| 6064 | close(fd); | |||
| 6065 | #endif | |||
| 6066 | return membase; | |||
| 6067 | } | |||
| 6068 | ||||
| 6069 | static int munmap_registers(void *addr) | |||
| 6070 | { | |||
| 6071 | #ifdef NVME_HAVE_MMAP | |||
| 6072 | return munmap(addr, getpagesize()); | |||
| 6073 | #else | |||
| 6074 | return 0; | |||
| 6075 | #endif | |||
| 6076 | } | |||
| 6077 | ||||
| 6078 | static int show_registers(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 6079 | { | |||
| 6080 | const char *desc = "Reads and shows the defined NVMe controller registers\n" | |||
| 6081 | "in binary or human-readable format"; | |||
| 6082 | ||||
| 6083 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 6084 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 6085 | nvme_print_flags_t flags; | |||
| 6086 | void *bar; | |||
| 6087 | int err; | |||
| 6088 | ||||
| 6089 | struct get_reg_config cfg = { | |||
| 6090 | .fabrics = false0, | |||
| 6091 | }; | |||
| 6092 | ||||
| 6093 | NVME_ARGS(opts)struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 6094 | ||||
| 6095 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 6096 | if (err) | |||
| 6097 | return err; | |||
| 6098 | ||||
| 6099 | if (libnvme_transport_handle_is_ns(hdl)) { | |||
| 6100 | nvme_show_error(only_ctrl_dev)nvme_show_message(1, only_ctrl_dev); | |||
| 6101 | return -EINVAL22; | |||
| 6102 | } | |||
| 6103 | ||||
| 6104 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 6105 | if (err < 0) { | |||
| 6106 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 6107 | return err; | |||
| 6108 | } | |||
| 6109 | ||||
| 6110 | if (nvme_args.verbose) | |||
| 6111 | flags |= VERBOSE; | |||
| 6112 | ||||
| 6113 | bar = mmap_registers(hdl, false0); | |||
| 6114 | if (!bar) { | |||
| 6115 | cfg.fabrics = true1; | |||
| 6116 | err = nvme_get_properties(hdl, &bar, &cfg); | |||
| 6117 | if (err) | |||
| 6118 | return err; | |||
| 6119 | } | |||
| 6120 | ||||
| 6121 | nvme_show_ctrl_registers(bar, cfg.fabrics, flags); | |||
| 6122 | if (cfg.fabrics) | |||
| 6123 | free(bar); | |||
| 6124 | else | |||
| 6125 | munmap_registers(bar); | |||
| 6126 | ||||
| 6127 | return 0; | |||
| 6128 | } | |||
| 6129 | ||||
| 6130 | int get_reg_size(int offset) | |||
| 6131 | { | |||
| 6132 | return nvme_is_64bit_reg(offset) ? sizeof(uint64_t) : sizeof(uint32_t); | |||
| 6133 | } | |||
| 6134 | ||||
| 6135 | static bool_Bool is_reg_selected(struct get_reg_config *cfg, int offset) | |||
| 6136 | { | |||
| 6137 | switch (offset) { | |||
| 6138 | case NVME_REG_CAP: | |||
| 6139 | return cfg->cap; | |||
| 6140 | case NVME_REG_VS: | |||
| 6141 | return cfg->vs; | |||
| 6142 | case NVME_REG_INTMS: | |||
| 6143 | return cfg->intms; | |||
| 6144 | case NVME_REG_INTMC: | |||
| 6145 | return cfg->intmc; | |||
| 6146 | case NVME_REG_CC: | |||
| 6147 | return cfg->cc; | |||
| 6148 | case NVME_REG_CSTS: | |||
| 6149 | return cfg->csts; | |||
| 6150 | case NVME_REG_NSSR: | |||
| 6151 | return cfg->nssr; | |||
| 6152 | case NVME_REG_AQA: | |||
| 6153 | return cfg->aqa; | |||
| 6154 | case NVME_REG_ASQ: | |||
| 6155 | return cfg->asq; | |||
| 6156 | case NVME_REG_ACQ: | |||
| 6157 | return cfg->acq; | |||
| 6158 | case NVME_REG_CMBLOC: | |||
| 6159 | return cfg->cmbloc; | |||
| 6160 | case NVME_REG_CMBSZ: | |||
| 6161 | return cfg->cmbsz; | |||
| 6162 | case NVME_REG_BPINFO: | |||
| 6163 | return cfg->bpinfo; | |||
| 6164 | case NVME_REG_BPRSEL: | |||
| 6165 | return cfg->bprsel; | |||
| 6166 | case NVME_REG_BPMBL: | |||
| 6167 | return cfg->bpmbl; | |||
| 6168 | case NVME_REG_CMBMSC: | |||
| 6169 | return cfg->cmbmsc; | |||
| 6170 | case NVME_REG_CMBSTS: | |||
| 6171 | return cfg->cmbsts; | |||
| 6172 | case NVME_REG_CMBEBS: | |||
| 6173 | return cfg->cmbebs; | |||
| 6174 | case NVME_REG_CMBSWTP: | |||
| 6175 | return cfg->cmbswtp; | |||
| 6176 | case NVME_REG_NSSD: | |||
| 6177 | return cfg->nssd; | |||
| 6178 | case NVME_REG_CRTO: | |||
| 6179 | return cfg->crto; | |||
| 6180 | case NVME_REG_PMRCAP: | |||
| 6181 | return cfg->pmrcap; | |||
| 6182 | case NVME_REG_PMRCTL: | |||
| 6183 | return cfg->pmrctl; | |||
| 6184 | case NVME_REG_PMRSTS: | |||
| 6185 | return cfg->pmrsts; | |||
| 6186 | case NVME_REG_PMREBS: | |||
| 6187 | return cfg->pmrebs; | |||
| 6188 | case NVME_REG_PMRSWTP: | |||
| 6189 | return cfg->pmrswtp; | |||
| 6190 | case NVME_REG_PMRMSCL: | |||
| 6191 | return cfg->pmrmscl; | |||
| 6192 | case NVME_REG_PMRMSCU: | |||
| 6193 | return cfg->pmrmscu; | |||
| 6194 | default: | |||
| 6195 | break; | |||
| 6196 | } | |||
| 6197 | ||||
| 6198 | return false0; | |||
| 6199 | } | |||
| 6200 | ||||
| 6201 | static int get_register_properties(struct libnvme_transport_handle *hdl, void **pbar, struct get_reg_config *cfg) | |||
| 6202 | { | |||
| 6203 | struct libnvme_passthru_cmd cmd; | |||
| 6204 | int offset = NVME_REG_CRTO; | |||
| 6205 | __u64 value; | |||
| 6206 | int size; | |||
| 6207 | int err; | |||
| 6208 | void *bar; | |||
| 6209 | ||||
| 6210 | size = offset + get_reg_size(offset); | |||
| 6211 | bar = malloc(size); | |||
| 6212 | if (!bar) | |||
| 6213 | return -ENOMEM12; | |||
| 6214 | ||||
| 6215 | for (offset = NVME_REG_CAP; offset <= NVME_REG_CRTO; offset += get_reg_size(offset)) { | |||
| 6216 | if ((cfg->offset != offset && !is_reg_selected(cfg, offset)) || | |||
| 6217 | !nvme_is_fabrics_reg(offset)) | |||
| 6218 | continue; | |||
| 6219 | ||||
| 6220 | nvme_init_get_property(&cmd, offset); | |||
| 6221 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 6222 | if (nvme_status_equals(err, NVME_STATUS_TYPE_NVME, NVME_SC_INVALID_FIELD)) { | |||
| 6223 | value = -1; | |||
| 6224 | } else if (err) { | |||
| 6225 | nvme_show_error("get-property: %s", libnvme_strerror(err))nvme_show_message(1, "get-property: %s", libnvme_strerror(err )); | |||
| 6226 | free(bar); | |||
| 6227 | return err; | |||
| 6228 | } else { | |||
| 6229 | value = cmd.result; | |||
| 6230 | } | |||
| 6231 | ||||
| 6232 | if (nvme_is_64bit_reg(offset)) | |||
| 6233 | *(uint64_t *)(bar + offset) = value; | |||
| 6234 | else | |||
| 6235 | *(uint32_t *)(bar + offset) = value; | |||
| 6236 | } | |||
| 6237 | ||||
| 6238 | *pbar = bar; | |||
| 6239 | ||||
| 6240 | return 0; | |||
| 6241 | } | |||
| 6242 | ||||
| 6243 | bool_Bool nvme_is_ctrl_reg(int offset) | |||
| 6244 | { | |||
| 6245 | switch (offset) { | |||
| 6246 | case NVME_REG_CAP: | |||
| 6247 | case NVME_REG_VS: | |||
| 6248 | case NVME_REG_INTMS: | |||
| 6249 | case NVME_REG_INTMC: | |||
| 6250 | case NVME_REG_CC: | |||
| 6251 | case NVME_REG_CSTS: | |||
| 6252 | case NVME_REG_NSSR: | |||
| 6253 | case NVME_REG_AQA: | |||
| 6254 | case NVME_REG_ASQ: | |||
| 6255 | case NVME_REG_ACQ: | |||
| 6256 | case NVME_REG_CMBLOC: | |||
| 6257 | case NVME_REG_CMBSZ: | |||
| 6258 | case NVME_REG_BPINFO: | |||
| 6259 | case NVME_REG_BPRSEL: | |||
| 6260 | case NVME_REG_BPMBL: | |||
| 6261 | case NVME_REG_CMBMSC: | |||
| 6262 | case NVME_REG_CMBSTS: | |||
| 6263 | case NVME_REG_CMBEBS: | |||
| 6264 | case NVME_REG_CMBSWTP: | |||
| 6265 | case NVME_REG_NSSD: | |||
| 6266 | case NVME_REG_CRTO: | |||
| 6267 | case NVME_REG_PMRCAP: | |||
| 6268 | case NVME_REG_PMRCTL: | |||
| 6269 | case NVME_REG_PMRSTS: | |||
| 6270 | case NVME_REG_PMREBS: | |||
| 6271 | case NVME_REG_PMRSWTP: | |||
| 6272 | case NVME_REG_PMRMSCL: | |||
| 6273 | case NVME_REG_PMRMSCU: | |||
| 6274 | return true1; | |||
| 6275 | default: | |||
| 6276 | break; | |||
| 6277 | } | |||
| 6278 | ||||
| 6279 | return false0; | |||
| 6280 | } | |||
| 6281 | ||||
| 6282 | static bool_Bool get_register_offset(void *bar, bool_Bool fabrics, struct get_reg_config *cfg, | |||
| 6283 | nvme_print_flags_t flags) | |||
| 6284 | { | |||
| 6285 | bool_Bool offset_matched = cfg->offset >= 0; | |||
| 6286 | int offset; | |||
| 6287 | ||||
| 6288 | if (offset_matched) | |||
| 6289 | nvme_show_ctrl_register(bar, fabrics, cfg->offset, flags); | |||
| 6290 | ||||
| 6291 | for (offset = NVME_REG_CAP; offset <= NVME_REG_PMRMSCU; offset += get_reg_size(offset)) { | |||
| 6292 | if (!nvme_is_ctrl_reg(offset) || offset == cfg->offset || !is_reg_selected(cfg, offset)) | |||
| 6293 | continue; | |||
| 6294 | nvme_show_ctrl_register(bar, fabrics, offset, flags); | |||
| 6295 | if (!offset_matched) | |||
| 6296 | offset_matched = true1; | |||
| 6297 | } | |||
| 6298 | ||||
| 6299 | return offset_matched; | |||
| 6300 | } | |||
| 6301 | ||||
| 6302 | static int get_register(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 6303 | { | |||
| 6304 | const char *desc = "Reads and shows the defined NVMe controller register.\n" | |||
| 6305 | "Register offset must be one of:\n" | |||
| 6306 | "CAP=0x0, VS=0x8, INTMS=0xc, INTMC=0x10, CC=0x14, CSTS=0x1c,\n" | |||
| 6307 | "NSSR=0x20, AQA=0x24, ASQ=0x28, ACQ=0x30, CMBLOC=0x38,\n" | |||
| 6308 | "CMBSZ=0x3c, BPINFO=0x40, BPRSEL=0x44, BPMBL=0x48, CMBMSC=0x50,\n" | |||
| 6309 | "CMBSTS=0x58, CRTO=0x68, PMRCAP=0xe00, PMRCTL=0xe04,\n" | |||
| 6310 | "PMRSTS=0xe08, PMREBS=0xe0c, PMRSWTP=0xe10, PMRMSCL=0xe14, PMRMSCU=0xe18"; | |||
| 6311 | const char *cap = "CAP=0x0 register offset"; | |||
| 6312 | const char *vs = "VS=0x8 register offset"; | |||
| 6313 | const char *cmbloc = "CMBLOC=0x38 register offset"; | |||
| 6314 | const char *cmbsz = "CMBSZ=0x3c register offset"; | |||
| 6315 | const char *bpinfo = "BPINFO=0x40 register offset"; | |||
| 6316 | const char *cmbsts = "CMBSTS=0x58 register offset"; | |||
| 6317 | const char *cmbebs = "CMBEBS=0x5c register offset"; | |||
| 6318 | const char *cmbswtp = "CMBSWTP=0x60 register offset"; | |||
| 6319 | const char *crto = "CRTO=0x68 register offset"; | |||
| 6320 | const char *pmrcap = "PMRCAP=0xe00 register offset"; | |||
| 6321 | const char *pmrsts = "PMRSTS=0xe08 register offset"; | |||
| 6322 | const char *pmrebs = "PMREBS=0xe0c register offset"; | |||
| 6323 | const char *pmrswtp = "PMRSWTP=0xe10 register offset"; | |||
| 6324 | const char *pmrmscl = "PMRMSCL=0xe14 register offset"; | |||
| 6325 | const char *pmrmscu = "PMRMSCU=0xe18 register offset"; | |||
| 6326 | ||||
| 6327 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 6328 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 6329 | int err; | |||
| 6330 | nvme_print_flags_t flags; | |||
| 6331 | bool_Bool fabrics = false0; | |||
| 6332 | ||||
| 6333 | void *bar; | |||
| 6334 | ||||
| 6335 | struct get_reg_config cfg = { | |||
| 6336 | .offset = -1, | |||
| 6337 | }; | |||
| 6338 | ||||
| 6339 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6340 | OPT_UINT("offset", 'O', &cfg.offset, offset),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6341 | OPT_FLAG("cap", 0, &cfg.cap, cap),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6342 | OPT_FLAG("vs", 0, &cfg.vs, vs),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6343 | OPT_FLAG("cmbloc", 0, &cfg.cmbloc, cmbloc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6344 | OPT_FLAG("cmbsz", 0, &cfg.cmbsz, cmbsz),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6345 | OPT_FLAG("bpinfo", 0, &cfg.bpinfo, bpinfo),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6346 | OPT_FLAG("cmbsts", 0, &cfg.cmbsts, cmbsts),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6347 | OPT_FLAG("cmbebs", 0, &cfg.cmbebs, cmbebs),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6348 | OPT_FLAG("cmbswtp", 0, &cfg.cmbswtp, cmbswtp),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6349 | OPT_FLAG("crto", 0, &cfg.crto, crto),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6350 | OPT_FLAG("pmrcap", 0, &cfg.pmrcap, pmrcap),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6351 | OPT_FLAG("pmrsts", 0, &cfg.pmrsts, pmrsts),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6352 | OPT_FLAG("pmrebs", 0, &cfg.pmrebs, pmrebs),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6353 | OPT_FLAG("pmrswtp", 0, &cfg.pmrswtp, pmrswtp),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6354 | OPT_FLAG("intms", 0, &cfg.intms, intms),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6355 | OPT_FLAG("intmc", 0, &cfg.intmc, intmc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6356 | OPT_FLAG("cc", 0, &cfg.cc, cc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6357 | OPT_FLAG("csts", 0, &cfg.csts, csts),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6358 | OPT_FLAG("nssr", 0, &cfg.nssr, nssr),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6359 | OPT_FLAG("aqa", 0, &cfg.aqa, aqa),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6360 | OPT_FLAG("asq", 0, &cfg.asq, asq),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6361 | OPT_FLAG("acq", 0, &cfg.acq, acq),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6362 | OPT_FLAG("bprsel", 0, &cfg.bprsel, bprsel),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6363 | OPT_FLAG("bpmbl", 0, &cfg.bpmbl, bpmbl),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6364 | OPT_FLAG("cmbmsc", 0, &cfg.cmbmsc, cmbmsc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6365 | OPT_FLAG("nssd", 0, &cfg.nssd, nssd),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6366 | OPT_FLAG("pmrctl", 0, &cfg.pmrctl, pmrctl),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6367 | OPT_FLAG("pmrmscl", 0, &cfg.pmrmscl, pmrmscl),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6368 | OPT_FLAG("pmrmscu", 0, &cfg.pmrmscu, pmrmscu))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"cap", 0, ((void*)0), CFG_FLAG, &cfg.cap , 0, cap, 0, }, {"vs", 0, ((void*)0), CFG_FLAG, &cfg.vs, 0 , vs, 0, }, {"cmbloc", 0, ((void*)0), CFG_FLAG, &cfg.cmbloc , 0, cmbloc, 0, }, {"cmbsz", 0, ((void*)0), CFG_FLAG, &cfg .cmbsz, 0, cmbsz, 0, }, {"bpinfo", 0, ((void*)0), CFG_FLAG, & cfg.bpinfo, 0, bpinfo, 0, }, {"cmbsts", 0, ((void*)0), CFG_FLAG , &cfg.cmbsts, 0, cmbsts, 0, }, {"cmbebs", 0, ((void*)0), CFG_FLAG, &cfg.cmbebs, 0, cmbebs, 0, }, {"cmbswtp", 0, ( (void*)0), CFG_FLAG, &cfg.cmbswtp, 0, cmbswtp, 0, }, {"crto" , 0, ((void*)0), CFG_FLAG, &cfg.crto, 0, crto, 0, }, {"pmrcap" , 0, ((void*)0), CFG_FLAG, &cfg.pmrcap, 0, pmrcap, 0, }, { "pmrsts", 0, ((void*)0), CFG_FLAG, &cfg.pmrsts, 0, pmrsts , 0, }, {"pmrebs", 0, ((void*)0), CFG_FLAG, &cfg.pmrebs, 0 , pmrebs, 0, }, {"pmrswtp", 0, ((void*)0), CFG_FLAG, &cfg .pmrswtp, 0, pmrswtp, 0, }, {"intms", 0, ((void*)0), CFG_FLAG , &cfg.intms, 0, intms, 0, }, {"intmc", 0, ((void*)0), CFG_FLAG , &cfg.intmc, 0, intmc, 0, }, {"cc", 0, ((void*)0), CFG_FLAG , &cfg.cc, 0, cc, 0, }, {"csts", 0, ((void*)0), CFG_FLAG, &cfg.csts, 0, csts, 0, }, {"nssr", 0, ((void*)0), CFG_FLAG , &cfg.nssr, 0, nssr, 0, }, {"aqa", 0, ((void*)0), CFG_FLAG , &cfg.aqa, 0, aqa, 0, }, {"asq", 0, ((void*)0), CFG_FLAG , &cfg.asq, 0, asq, 0, }, {"acq", 0, ((void*)0), CFG_FLAG , &cfg.acq, 0, acq, 0, }, {"bprsel", 0, ((void*)0), CFG_FLAG , &cfg.bprsel, 0, bprsel, 0, }, {"bpmbl", 0, ((void*)0), CFG_FLAG , &cfg.bpmbl, 0, bpmbl, 0, }, {"cmbmsc", 0, ((void*)0), CFG_FLAG , &cfg.cmbmsc, 0, cmbmsc, 0, }, {"nssd", 0, ((void*)0), CFG_FLAG , &cfg.nssd, 0, nssd, 0, }, {"pmrctl", 0, ((void*)0), CFG_FLAG , &cfg.pmrctl, 0, pmrctl, 0, }, {"pmrmscl", 0, ((void*)0) , CFG_FLAG, &cfg.pmrmscl, 0, pmrmscl, 0, }, {"pmrmscu", 0 , ((void*)0), CFG_FLAG, &cfg.pmrmscu, 0, pmrmscu, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 6369 | ||||
| 6370 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 6371 | if (err) | |||
| 6372 | return err; | |||
| 6373 | ||||
| 6374 | if (libnvme_transport_handle_is_ns(hdl)) { | |||
| 6375 | nvme_show_error(only_ctrl_dev)nvme_show_message(1, only_ctrl_dev); | |||
| 6376 | return -EINVAL22; | |||
| 6377 | } | |||
| 6378 | ||||
| 6379 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 6380 | if (err < 0) { | |||
| 6381 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 6382 | return err; | |||
| 6383 | } | |||
| 6384 | ||||
| 6385 | if (nvme_args.verbose) | |||
| 6386 | flags |= VERBOSE; | |||
| 6387 | ||||
| 6388 | bar = mmap_registers(hdl, false0); | |||
| 6389 | if (!bar) { | |||
| 6390 | err = get_register_properties(hdl, &bar, &cfg); | |||
| 6391 | if (err) | |||
| 6392 | return err; | |||
| 6393 | fabrics = true1; | |||
| 6394 | } | |||
| 6395 | ||||
| 6396 | nvme_show_init(); | |||
| 6397 | ||||
| 6398 | if (!get_register_offset(bar, fabrics, &cfg, flags)) { | |||
| 6399 | nvme_show_error("offset required param")nvme_show_message(1, "offset required param"); | |||
| 6400 | err = -EINVAL22; | |||
| 6401 | } | |||
| 6402 | ||||
| 6403 | nvme_show_finish(); | |||
| 6404 | ||||
| 6405 | if (fabrics) | |||
| 6406 | free(bar); | |||
| 6407 | else | |||
| 6408 | munmap_registers(bar); | |||
| 6409 | ||||
| 6410 | return err; | |||
| 6411 | } | |||
| 6412 | ||||
| 6413 | static int nvme_set_single_property(struct libnvme_transport_handle *hdl, int offset, uint64_t value) | |||
| 6414 | { | |||
| 6415 | struct libnvme_passthru_cmd cmd; | |||
| 6416 | int err; | |||
| 6417 | ||||
| 6418 | nvme_init_set_property(&cmd, offset, value); | |||
| 6419 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 6420 | if (err) { | |||
| 6421 | nvme_show_err(err, "set-property"); | |||
| 6422 | return err; | |||
| 6423 | } | |||
| 6424 | ||||
| 6425 | printf("set-property: %#02x (%s), value: %#"PRIx64"l" "x""\n", offset, | |||
| 6426 | nvme_register_to_string(offset), value); | |||
| 6427 | ||||
| 6428 | return err; | |||
| 6429 | } | |||
| 6430 | ||||
| 6431 | static int set_register_property(struct libnvme_transport_handle *hdl, int offset, uint64_t value) | |||
| 6432 | { | |||
| 6433 | if (!nvme_is_fabrics_reg(offset)) { | |||
| 6434 | printf("register: %#04x (%s) not fabrics\n", offset, | |||
| 6435 | nvme_register_to_string(offset)); | |||
| 6436 | return -EINVAL22; | |||
| 6437 | } | |||
| 6438 | ||||
| 6439 | return nvme_set_single_property(hdl, offset, value); | |||
| 6440 | } | |||
| 6441 | ||||
| 6442 | static int nvme_set_register(struct libnvme_transport_handle *hdl, void *bar, int offset, uint64_t value, bool_Bool mmio32) | |||
| 6443 | { | |||
| 6444 | if (!bar) | |||
| 6445 | return set_register_property(hdl, offset, value); | |||
| 6446 | ||||
| 6447 | if (nvme_is_64bit_reg(offset)) | |||
| 6448 | mmio_write64(bar + offset, value, mmio32); | |||
| 6449 | else | |||
| 6450 | mmio_write32(bar + offset, value); | |||
| 6451 | ||||
| 6452 | printf("set-register: %#02x (%s), value: %#"PRIx64"l" "x""\n", offset, | |||
| 6453 | nvme_register_to_string(offset), value); | |||
| 6454 | ||||
| 6455 | return 0; | |||
| 6456 | } | |||
| 6457 | ||||
| 6458 | static inline int set_register_names_check(struct argconfig_commandline_options *opts, int offset) | |||
| 6459 | { | |||
| 6460 | switch (offset) { | |||
| 6461 | case NVME_REG_INTMS: | |||
| 6462 | if (argconfig_parse_seen(opts, "intms")) | |||
| 6463 | return -EINVAL22; | |||
| 6464 | break; | |||
| 6465 | case NVME_REG_INTMC: | |||
| 6466 | if (argconfig_parse_seen(opts, "intmc")) | |||
| 6467 | return -EINVAL22; | |||
| 6468 | break; | |||
| 6469 | case NVME_REG_CC: | |||
| 6470 | if (argconfig_parse_seen(opts, "cc")) | |||
| 6471 | return -EINVAL22; | |||
| 6472 | break; | |||
| 6473 | case NVME_REG_CSTS: | |||
| 6474 | if (argconfig_parse_seen(opts, "csts")) | |||
| 6475 | return -EINVAL22; | |||
| 6476 | break; | |||
| 6477 | case NVME_REG_NSSR: | |||
| 6478 | if (argconfig_parse_seen(opts, "nssr")) | |||
| 6479 | return -EINVAL22; | |||
| 6480 | break; | |||
| 6481 | case NVME_REG_AQA: | |||
| 6482 | if (argconfig_parse_seen(opts, "aqa")) | |||
| 6483 | return -EINVAL22; | |||
| 6484 | break; | |||
| 6485 | case NVME_REG_ASQ: | |||
| 6486 | if (argconfig_parse_seen(opts, "asq")) | |||
| 6487 | return -EINVAL22; | |||
| 6488 | break; | |||
| 6489 | case NVME_REG_ACQ: | |||
| 6490 | if (argconfig_parse_seen(opts, "acq")) | |||
| 6491 | return -EINVAL22; | |||
| 6492 | break; | |||
| 6493 | case NVME_REG_BPRSEL: | |||
| 6494 | if (argconfig_parse_seen(opts, "bprsel")) | |||
| 6495 | return -EINVAL22; | |||
| 6496 | break; | |||
| 6497 | case NVME_REG_CMBMSC: | |||
| 6498 | if (argconfig_parse_seen(opts, "cmbmsc")) | |||
| 6499 | return -EINVAL22; | |||
| 6500 | break; | |||
| 6501 | case NVME_REG_NSSD: | |||
| 6502 | if (argconfig_parse_seen(opts, "nssd")) | |||
| 6503 | return -EINVAL22; | |||
| 6504 | break; | |||
| 6505 | case NVME_REG_PMRCTL: | |||
| 6506 | if (argconfig_parse_seen(opts, "pmrctl")) | |||
| 6507 | return -EINVAL22; | |||
| 6508 | break; | |||
| 6509 | case NVME_REG_PMRMSCL: | |||
| 6510 | if (argconfig_parse_seen(opts, "pmrmscl")) | |||
| 6511 | return -EINVAL22; | |||
| 6512 | break; | |||
| 6513 | case NVME_REG_PMRMSCU: | |||
| 6514 | if (argconfig_parse_seen(opts, "pmrmscu")) | |||
| 6515 | return -EINVAL22; | |||
| 6516 | break; | |||
| 6517 | default: | |||
| 6518 | break; | |||
| 6519 | } | |||
| 6520 | ||||
| 6521 | return 0; | |||
| 6522 | } | |||
| 6523 | ||||
| 6524 | static int set_register_offset(struct libnvme_transport_handle *hdl, void *bar, struct argconfig_commandline_options *opts, | |||
| 6525 | struct set_reg_config *cfg) | |||
| 6526 | { | |||
| 6527 | int err; | |||
| 6528 | ||||
| 6529 | if (!argconfig_parse_seen(opts, "value")) { | |||
| 6530 | nvme_show_error("value required param")nvme_show_message(1, "value required param"); | |||
| 6531 | return -EINVAL22; | |||
| 6532 | } | |||
| 6533 | ||||
| 6534 | err = set_register_names_check(opts, cfg->offset); | |||
| 6535 | if (err) { | |||
| 6536 | nvme_show_error("offset duplicated param")nvme_show_message(1, "offset duplicated param"); | |||
| 6537 | return err; | |||
| 6538 | } | |||
| 6539 | ||||
| 6540 | err = nvme_set_register(hdl, bar, cfg->offset, cfg->value, cfg->mmio32); | |||
| 6541 | if (err) | |||
| 6542 | return err; | |||
| 6543 | ||||
| 6544 | return 0; | |||
| 6545 | } | |||
| 6546 | ||||
| 6547 | static int set_register_names(struct libnvme_transport_handle *hdl, void *bar, struct argconfig_commandline_options *opts, | |||
| 6548 | struct set_reg_config *cfg) | |||
| 6549 | { | |||
| 6550 | int err; | |||
| 6551 | ||||
| 6552 | if (argconfig_parse_seen(opts, "intms")) { | |||
| 6553 | err = nvme_set_register(hdl, bar, NVME_REG_INTMS, cfg->intms, cfg->mmio32); | |||
| 6554 | if (err) | |||
| 6555 | return err; | |||
| 6556 | } | |||
| 6557 | ||||
| 6558 | if (argconfig_parse_seen(opts, "intmc")) { | |||
| 6559 | err = nvme_set_register(hdl, bar, NVME_REG_INTMC, cfg->intmc, cfg->mmio32); | |||
| 6560 | if (err) | |||
| 6561 | return err; | |||
| 6562 | } | |||
| 6563 | ||||
| 6564 | if (argconfig_parse_seen(opts, "cc")) { | |||
| 6565 | err = nvme_set_register(hdl, bar, NVME_REG_CC, cfg->cc, cfg->mmio32); | |||
| 6566 | if (err) | |||
| 6567 | return err; | |||
| 6568 | } | |||
| 6569 | ||||
| 6570 | if (argconfig_parse_seen(opts, "csts")) { | |||
| 6571 | err = nvme_set_register(hdl, bar, NVME_REG_CSTS, cfg->csts, cfg->mmio32); | |||
| 6572 | if (err) | |||
| 6573 | return err; | |||
| 6574 | } | |||
| 6575 | ||||
| 6576 | if (argconfig_parse_seen(opts, "nssr")) { | |||
| 6577 | err = nvme_set_register(hdl, bar, NVME_REG_NSSR, cfg->nssr, cfg->mmio32); | |||
| 6578 | if (err) | |||
| 6579 | return err; | |||
| 6580 | } | |||
| 6581 | ||||
| 6582 | if (argconfig_parse_seen(opts, "aqa")) { | |||
| 6583 | err = nvme_set_register(hdl, bar, NVME_REG_AQA, cfg->aqa, cfg->mmio32); | |||
| 6584 | if (err) | |||
| 6585 | return err; | |||
| 6586 | } | |||
| 6587 | ||||
| 6588 | if (argconfig_parse_seen(opts, "asq")) { | |||
| 6589 | err = nvme_set_register(hdl, bar, NVME_REG_ASQ, cfg->asq, cfg->mmio32); | |||
| 6590 | if (err) | |||
| 6591 | return err; | |||
| 6592 | } | |||
| 6593 | ||||
| 6594 | if (argconfig_parse_seen(opts, "acq")) { | |||
| 6595 | err = nvme_set_register(hdl, bar, NVME_REG_ACQ, cfg->acq, cfg->mmio32); | |||
| 6596 | if (err) | |||
| 6597 | return err; | |||
| 6598 | } | |||
| 6599 | ||||
| 6600 | if (argconfig_parse_seen(opts, "bprsel")) { | |||
| 6601 | err = nvme_set_register(hdl, bar, NVME_REG_BPRSEL, cfg->bprsel, cfg->mmio32); | |||
| 6602 | if (err) | |||
| 6603 | return err; | |||
| 6604 | } | |||
| 6605 | ||||
| 6606 | if (argconfig_parse_seen(opts, "cmbmsc")) { | |||
| 6607 | err = nvme_set_register(hdl, bar, NVME_REG_CMBMSC, cfg->cmbmsc, cfg->mmio32); | |||
| 6608 | if (err) | |||
| 6609 | return err; | |||
| 6610 | } | |||
| 6611 | ||||
| 6612 | if (argconfig_parse_seen(opts, "nssd")) { | |||
| 6613 | err = nvme_set_register(hdl, bar, NVME_REG_NSSD, cfg->nssd, cfg->mmio32); | |||
| 6614 | if (err) | |||
| 6615 | return err; | |||
| 6616 | } | |||
| 6617 | ||||
| 6618 | if (argconfig_parse_seen(opts, "pmrctl")) { | |||
| 6619 | err = nvme_set_register(hdl, bar, NVME_REG_PMRCTL, cfg->pmrctl, cfg->mmio32); | |||
| 6620 | if (err) | |||
| 6621 | return err; | |||
| 6622 | } | |||
| 6623 | ||||
| 6624 | if (argconfig_parse_seen(opts, "pmrmscl")) { | |||
| 6625 | err = nvme_set_register(hdl, bar, NVME_REG_PMRMSCL, cfg->pmrmscl, cfg->mmio32); | |||
| 6626 | if (err) | |||
| 6627 | return err; | |||
| 6628 | } | |||
| 6629 | ||||
| 6630 | if (argconfig_parse_seen(opts, "pmrmscu")) { | |||
| 6631 | err = nvme_set_register(hdl, bar, NVME_REG_PMRMSCU, cfg->pmrmscu, cfg->mmio32); | |||
| 6632 | if (err) | |||
| 6633 | return err; | |||
| 6634 | } | |||
| 6635 | ||||
| 6636 | return 0; | |||
| 6637 | } | |||
| 6638 | ||||
| 6639 | static int set_register(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 6640 | { | |||
| 6641 | const char *desc = "Writes and shows the defined NVMe controller register"; | |||
| 6642 | const char *value = "the value of the register to be set"; | |||
| 6643 | const char *mmio32 = "Access 64-bit registers as 2 32-bit"; | |||
| 6644 | ||||
| 6645 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 6646 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 6647 | int err; | |||
| 6648 | void *bar; | |||
| 6649 | ||||
| 6650 | struct set_reg_config cfg = { | |||
| 6651 | .offset = -1, | |||
| 6652 | }; | |||
| 6653 | ||||
| 6654 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6655 | OPT_UINT("offset", 'O', &cfg.offset, offset),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6656 | OPT_SUFFIX("value", 'V', &cfg.value, value),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6657 | OPT_FLAG("mmio32", 'm', &cfg.mmio32, mmio32),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6658 | OPT_UINT("intms", 0, &cfg.intms, intms),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6659 | OPT_UINT("intmc", 0, &cfg.intmc, intmc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6660 | OPT_UINT("cc", 0, &cfg.cc, cc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6661 | OPT_UINT("csts", 0, &cfg.csts, csts),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6662 | OPT_UINT("nssr", 0, &cfg.nssr, nssr),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6663 | OPT_UINT("aqa", 0, &cfg.aqa, aqa),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6664 | OPT_SUFFIX("asq", 0, &cfg.asq, asq),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6665 | OPT_SUFFIX("acq", 0, &cfg.acq, acq),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6666 | OPT_UINT("bprsel", 0, &cfg.bprsel, bprsel),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6667 | OPT_SUFFIX("bpmbl", 0, &cfg.bpmbl, bpmbl),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6668 | OPT_SUFFIX("cmbmsc", 0, &cfg.cmbmsc, cmbmsc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6669 | OPT_UINT("nssd", 0, &cfg.nssd, nssd),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6670 | OPT_UINT("pmrctl", 0, &cfg.pmrctl, pmrctl),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6671 | OPT_UINT("pmrmscl", 0, &cfg.pmrmscl, pmrmscl),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6672 | OPT_UINT("pmrmscu", 0, &cfg.pmrmscu, pmrmscu))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "IONUM", CFG_LONG_SUFFIX, & cfg.value, 1, value, 0, }, {"mmio32", 'm', ((void*)0), CFG_FLAG , &cfg.mmio32, 0, mmio32, 0, }, {"intms", 0, "NUM", CFG_POSITIVE , &cfg.intms, 1, intms, 0, }, {"intmc", 0, "NUM", CFG_POSITIVE , &cfg.intmc, 1, intmc, 0, }, {"cc", 0, "NUM", CFG_POSITIVE , &cfg.cc, 1, cc, 0, }, {"csts", 0, "NUM", CFG_POSITIVE, & cfg.csts, 1, csts, 0, }, {"nssr", 0, "NUM", CFG_POSITIVE, & cfg.nssr, 1, nssr, 0, }, {"aqa", 0, "NUM", CFG_POSITIVE, & cfg.aqa, 1, aqa, 0, }, {"asq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.asq, 1, asq, 0, }, {"acq", 0, "IONUM", CFG_LONG_SUFFIX, & cfg.acq, 1, acq, 0, }, {"bprsel", 0, "NUM", CFG_POSITIVE, & cfg.bprsel, 1, bprsel, 0, }, {"bpmbl", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.bpmbl, 1, bpmbl, 0, }, {"cmbmsc", 0, "IONUM", CFG_LONG_SUFFIX , &cfg.cmbmsc, 1, cmbmsc, 0, }, {"nssd", 0, "NUM", CFG_POSITIVE , &cfg.nssd, 1, nssd, 0, }, {"pmrctl", 0, "NUM", CFG_POSITIVE , &cfg.pmrctl, 1, pmrctl, 0, }, {"pmrmscl", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscl, 1, pmrmscl, 0, }, {"pmrmscu", 0, "NUM", CFG_POSITIVE , &cfg.pmrmscu, 1, pmrmscu, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 6673 | ||||
| 6674 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 6675 | if (err) | |||
| 6676 | return err; | |||
| 6677 | ||||
| 6678 | if (libnvme_transport_handle_is_ns(hdl)) { | |||
| 6679 | nvme_show_error(only_ctrl_dev)nvme_show_message(1, only_ctrl_dev); | |||
| 6680 | return -EINVAL22; | |||
| 6681 | } | |||
| 6682 | ||||
| 6683 | bar = mmap_registers(hdl, true1); | |||
| 6684 | ||||
| 6685 | if (argconfig_parse_seen(opts, "offset")) | |||
| 6686 | err = set_register_offset(hdl, bar, opts, &cfg); | |||
| 6687 | ||||
| 6688 | if (!err) | |||
| 6689 | err = set_register_names(hdl, bar, opts, &cfg); | |||
| 6690 | ||||
| 6691 | if (bar) | |||
| 6692 | munmap_registers(bar); | |||
| 6693 | ||||
| 6694 | return err; | |||
| 6695 | } | |||
| 6696 | ||||
| 6697 | static int get_property(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 6698 | { | |||
| 6699 | const char *desc = "Reads and shows the defined NVMe controller property\n" | |||
| 6700 | "for NVMe over Fabric. Property offset must be one of:\n" | |||
| 6701 | "CAP=0x0, VS=0x8, CC=0x14, CSTS=0x1c, NSSR=0x20, NSSD=0x64, CRTO=0x68"; | |||
| 6702 | const char *offset = "offset of the requested property"; | |||
| 6703 | ||||
| 6704 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 6705 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 6706 | __u64 value; | |||
| 6707 | int err; | |||
| 6708 | nvme_print_flags_t flags = NORMAL; | |||
| 6709 | ||||
| 6710 | struct get_reg_config cfg = { | |||
| 6711 | .offset = -1, | |||
| 6712 | .fabrics = true1, | |||
| 6713 | }; | |||
| 6714 | ||||
| 6715 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6716 | OPT_UINT("offset", 'O', &cfg.offset, offset))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 6717 | ||||
| 6718 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 6719 | if (err) | |||
| 6720 | return err; | |||
| 6721 | ||||
| 6722 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 6723 | if (err < 0) { | |||
| 6724 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 6725 | return err; | |||
| 6726 | } | |||
| 6727 | ||||
| 6728 | if (cfg.offset == -1) { | |||
| 6729 | nvme_show_error("offset required param")nvme_show_message(1, "offset required param"); | |||
| 6730 | return -EINVAL22; | |||
| 6731 | } | |||
| 6732 | ||||
| 6733 | if (nvme_args.verbose) | |||
| 6734 | flags |= VERBOSE; | |||
| 6735 | ||||
| 6736 | err = nvme_get_single_property(hdl, &cfg, &value); | |||
| 6737 | if (!err) | |||
| 6738 | nvme_show_single_property(cfg.offset, value, flags); | |||
| 6739 | ||||
| 6740 | return err; | |||
| 6741 | } | |||
| 6742 | ||||
| 6743 | static int set_property(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 6744 | { | |||
| 6745 | const char *desc = | |||
| 6746 | "Writes and shows the defined NVMe controller property for NVMe over Fabric"; | |||
| 6747 | const char *offset = "the offset of the property"; | |||
| 6748 | const char *value = "the value of the property to be set"; | |||
| 6749 | ||||
| 6750 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 6751 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 6752 | int err; | |||
| 6753 | nvme_print_flags_t flags; | |||
| 6754 | ||||
| 6755 | struct set_reg_config cfg = { | |||
| 6756 | .offset = -1, | |||
| 6757 | .value = -1, | |||
| 6758 | }; | |||
| 6759 | ||||
| 6760 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "NUM", CFG_POSITIVE, &cfg. value, 1, value, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6761 | OPT_UINT("offset", 'O', &cfg.offset, offset),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "NUM", CFG_POSITIVE, &cfg. value, 1, value, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6762 | OPT_UINT("value", 'V', &cfg.value, value))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"offset", 'O', "NUM", CFG_POSITIVE, &cfg.offset, 1 , offset, 0, }, {"value", 'V', "NUM", CFG_POSITIVE, &cfg. value, 1, value, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 6763 | ||||
| 6764 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 6765 | if (err) | |||
| 6766 | return err; | |||
| 6767 | ||||
| 6768 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 6769 | if (err < 0) { | |||
| 6770 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 6771 | return err; | |||
| 6772 | } | |||
| 6773 | ||||
| 6774 | if (cfg.offset == -1) { | |||
| 6775 | nvme_show_error("offset required param")nvme_show_message(1, "offset required param"); | |||
| 6776 | return -EINVAL22; | |||
| 6777 | } | |||
| 6778 | if (cfg.value == -1) { | |||
| 6779 | nvme_show_error("value required param")nvme_show_message(1, "value required param"); | |||
| 6780 | return -EINVAL22; | |||
| 6781 | } | |||
| 6782 | ||||
| 6783 | return nvme_set_single_property(hdl, cfg.offset, cfg.value); | |||
| 6784 | } | |||
| 6785 | ||||
| 6786 | static void show_relatives(const char *name, nvme_print_flags_t flags) | |||
| 6787 | { | |||
| 6788 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx; | |||
| 6789 | int err; | |||
| 6790 | ||||
| 6791 | ctx = libnvme_create_global_ctx(stderrstderr, log_level); | |||
| 6792 | if (!ctx) { | |||
| 6793 | nvme_show_error("Failed to create global context")nvme_show_message(1, "Failed to create global context"); | |||
| 6794 | return; | |||
| 6795 | } | |||
| 6796 | ||||
| 6797 | err = libnvme_scan_topology(ctx, NULL((void*)0), NULL((void*)0)); | |||
| 6798 | if (err < 0) { | |||
| 6799 | handle_scan_topology_error(err); | |||
| 6800 | return; | |||
| 6801 | } | |||
| 6802 | ||||
| 6803 | nvme_show_relatives(ctx, name, flags); | |||
| 6804 | } | |||
| 6805 | ||||
| 6806 | static int format_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 6807 | { | |||
| 6808 | const char *desc = "Re-format a specified namespace on the\n" | |||
| 6809 | "given device. Can erase all data in namespace (user\n" | |||
| 6810 | "data erase) or delete data encryption key if specified.\n" | |||
| 6811 | "Can also be used to change LBAF to change the namespaces reported physical block format."; | |||
| 6812 | const char *lbaf = "LBA format to apply (required)"; | |||
| 6813 | const char *ses = "[0-2]: secure erase"; | |||
| 6814 | const char *pil = "[0-1]: protection info location last/first bytes of metadata"; | |||
| 6815 | const char *pi = "[0-3]: protection info off/Type 1/Type 2/Type 3"; | |||
| 6816 | const char *mset = "[0-1]: extended format off/on"; | |||
| 6817 | const char *reset = "Automatically reset the controller after successful format"; | |||
| 6818 | const char *bs = "target block size"; | |||
| 6819 | const char *force = "The \"I know what I'm doing\" flag, skip confirmation before sending command"; | |||
| 6820 | ||||
| 6821 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 6822 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 6823 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ctrl *ctrl = NULL((void*)0); | |||
| 6824 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ns *ns = NULL((void*)0); | |||
| 6825 | nvme_print_flags_t flags = NORMAL; | |||
| 6826 | struct libnvme_passthru_cmd cmd; | |||
| 6827 | __u8 prev_lbaf = 0; | |||
| 6828 | int block_size; | |||
| 6829 | int err, i; | |||
| 6830 | ||||
| 6831 | struct config { | |||
| 6832 | bool_Bool ish; | |||
| 6833 | __u32 namespace_id; | |||
| 6834 | __u8 lbaf; | |||
| 6835 | __u8 ses; | |||
| 6836 | __u8 pi; | |||
| 6837 | __u8 pil; | |||
| 6838 | __u8 mset; | |||
| 6839 | bool_Bool reset; | |||
| 6840 | bool_Bool force; | |||
| 6841 | __u64 bs; | |||
| 6842 | }; | |||
| 6843 | ||||
| 6844 | struct config cfg = { | |||
| 6845 | .ish = false0, | |||
| 6846 | .namespace_id = 0, | |||
| 6847 | .lbaf = 0xff, | |||
| 6848 | .ses = 0, | |||
| 6849 | .pi = 0, | |||
| 6850 | .pil = 0, | |||
| 6851 | .mset = 0, | |||
| 6852 | .reset = false0, | |||
| 6853 | .force = false0, | |||
| 6854 | .bs = 0, | |||
| 6855 | }; | |||
| 6856 | ||||
| 6857 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"lbaf", 'l', "NUM", CFG_BYTE , &cfg.lbaf, 1, lbaf, 0, }, {"ses", 's', "NUM", CFG_BYTE, &cfg.ses, 1, ses, 0, }, {"pi", 'i', "NUM", CFG_BYTE, & cfg.pi, 1, pi, 0, }, {"pil", 'p', "NUM", CFG_BYTE, &cfg.pil , 1, pil, 0, }, {"ms", 'm', "NUM", CFG_BYTE, &cfg.mset, 1 , mset, 0, }, {"reset", 'r', ((void*)0), CFG_FLAG, &cfg.reset , 0, reset, 0, }, {"force", 0, ((void*)0), CFG_FLAG, &cfg .force, 0, force, 0, }, {"block-size", 'b', "IONUM", CFG_LONG_SUFFIX , &cfg.bs, 1, bs, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6858 | OPT_FLAG("ish", 'I', &cfg.ish, ish),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"lbaf", 'l', "NUM", CFG_BYTE , &cfg.lbaf, 1, lbaf, 0, }, {"ses", 's', "NUM", CFG_BYTE, &cfg.ses, 1, ses, 0, }, {"pi", 'i', "NUM", CFG_BYTE, & cfg.pi, 1, pi, 0, }, {"pil", 'p', "NUM", CFG_BYTE, &cfg.pil , 1, pil, 0, }, {"ms", 'm', "NUM", CFG_BYTE, &cfg.mset, 1 , mset, 0, }, {"reset", 'r', ((void*)0), CFG_FLAG, &cfg.reset , 0, reset, 0, }, {"force", 0, ((void*)0), CFG_FLAG, &cfg .force, 0, force, 0, }, {"block-size", 'b', "IONUM", CFG_LONG_SUFFIX , &cfg.bs, 1, bs, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6859 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"lbaf", 'l', "NUM", CFG_BYTE , &cfg.lbaf, 1, lbaf, 0, }, {"ses", 's', "NUM", CFG_BYTE, &cfg.ses, 1, ses, 0, }, {"pi", 'i', "NUM", CFG_BYTE, & cfg.pi, 1, pi, 0, }, {"pil", 'p', "NUM", CFG_BYTE, &cfg.pil , 1, pil, 0, }, {"ms", 'm', "NUM", CFG_BYTE, &cfg.mset, 1 , mset, 0, }, {"reset", 'r', ((void*)0), CFG_FLAG, &cfg.reset , 0, reset, 0, }, {"force", 0, ((void*)0), CFG_FLAG, &cfg .force, 0, force, 0, }, {"block-size", 'b', "IONUM", CFG_LONG_SUFFIX , &cfg.bs, 1, bs, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6860 | OPT_BYTE("lbaf", 'l', &cfg.lbaf, lbaf),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"lbaf", 'l', "NUM", CFG_BYTE , &cfg.lbaf, 1, lbaf, 0, }, {"ses", 's', "NUM", CFG_BYTE, &cfg.ses, 1, ses, 0, }, {"pi", 'i', "NUM", CFG_BYTE, & cfg.pi, 1, pi, 0, }, {"pil", 'p', "NUM", CFG_BYTE, &cfg.pil , 1, pil, 0, }, {"ms", 'm', "NUM", CFG_BYTE, &cfg.mset, 1 , mset, 0, }, {"reset", 'r', ((void*)0), CFG_FLAG, &cfg.reset , 0, reset, 0, }, {"force", 0, ((void*)0), CFG_FLAG, &cfg .force, 0, force, 0, }, {"block-size", 'b', "IONUM", CFG_LONG_SUFFIX , &cfg.bs, 1, bs, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6861 | OPT_BYTE("ses", 's', &cfg.ses, ses),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"lbaf", 'l', "NUM", CFG_BYTE , &cfg.lbaf, 1, lbaf, 0, }, {"ses", 's', "NUM", CFG_BYTE, &cfg.ses, 1, ses, 0, }, {"pi", 'i', "NUM", CFG_BYTE, & cfg.pi, 1, pi, 0, }, {"pil", 'p', "NUM", CFG_BYTE, &cfg.pil , 1, pil, 0, }, {"ms", 'm', "NUM", CFG_BYTE, &cfg.mset, 1 , mset, 0, }, {"reset", 'r', ((void*)0), CFG_FLAG, &cfg.reset , 0, reset, 0, }, {"force", 0, ((void*)0), CFG_FLAG, &cfg .force, 0, force, 0, }, {"block-size", 'b', "IONUM", CFG_LONG_SUFFIX , &cfg.bs, 1, bs, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6862 | OPT_BYTE("pi", 'i', &cfg.pi, pi),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"lbaf", 'l', "NUM", CFG_BYTE , &cfg.lbaf, 1, lbaf, 0, }, {"ses", 's', "NUM", CFG_BYTE, &cfg.ses, 1, ses, 0, }, {"pi", 'i', "NUM", CFG_BYTE, & cfg.pi, 1, pi, 0, }, {"pil", 'p', "NUM", CFG_BYTE, &cfg.pil , 1, pil, 0, }, {"ms", 'm', "NUM", CFG_BYTE, &cfg.mset, 1 , mset, 0, }, {"reset", 'r', ((void*)0), CFG_FLAG, &cfg.reset , 0, reset, 0, }, {"force", 0, ((void*)0), CFG_FLAG, &cfg .force, 0, force, 0, }, {"block-size", 'b', "IONUM", CFG_LONG_SUFFIX , &cfg.bs, 1, bs, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6863 | OPT_BYTE("pil", 'p', &cfg.pil, pil),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"lbaf", 'l', "NUM", CFG_BYTE , &cfg.lbaf, 1, lbaf, 0, }, {"ses", 's', "NUM", CFG_BYTE, &cfg.ses, 1, ses, 0, }, {"pi", 'i', "NUM", CFG_BYTE, & cfg.pi, 1, pi, 0, }, {"pil", 'p', "NUM", CFG_BYTE, &cfg.pil , 1, pil, 0, }, {"ms", 'm', "NUM", CFG_BYTE, &cfg.mset, 1 , mset, 0, }, {"reset", 'r', ((void*)0), CFG_FLAG, &cfg.reset , 0, reset, 0, }, {"force", 0, ((void*)0), CFG_FLAG, &cfg .force, 0, force, 0, }, {"block-size", 'b', "IONUM", CFG_LONG_SUFFIX , &cfg.bs, 1, bs, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6864 | OPT_BYTE("ms", 'm', &cfg.mset, mset),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"lbaf", 'l', "NUM", CFG_BYTE , &cfg.lbaf, 1, lbaf, 0, }, {"ses", 's', "NUM", CFG_BYTE, &cfg.ses, 1, ses, 0, }, {"pi", 'i', "NUM", CFG_BYTE, & cfg.pi, 1, pi, 0, }, {"pil", 'p', "NUM", CFG_BYTE, &cfg.pil , 1, pil, 0, }, {"ms", 'm', "NUM", CFG_BYTE, &cfg.mset, 1 , mset, 0, }, {"reset", 'r', ((void*)0), CFG_FLAG, &cfg.reset , 0, reset, 0, }, {"force", 0, ((void*)0), CFG_FLAG, &cfg .force, 0, force, 0, }, {"block-size", 'b', "IONUM", CFG_LONG_SUFFIX , &cfg.bs, 1, bs, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6865 | OPT_FLAG("reset", 'r', &cfg.reset, reset),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"lbaf", 'l', "NUM", CFG_BYTE , &cfg.lbaf, 1, lbaf, 0, }, {"ses", 's', "NUM", CFG_BYTE, &cfg.ses, 1, ses, 0, }, {"pi", 'i', "NUM", CFG_BYTE, & cfg.pi, 1, pi, 0, }, {"pil", 'p', "NUM", CFG_BYTE, &cfg.pil , 1, pil, 0, }, {"ms", 'm', "NUM", CFG_BYTE, &cfg.mset, 1 , mset, 0, }, {"reset", 'r', ((void*)0), CFG_FLAG, &cfg.reset , 0, reset, 0, }, {"force", 0, ((void*)0), CFG_FLAG, &cfg .force, 0, force, 0, }, {"block-size", 'b', "IONUM", CFG_LONG_SUFFIX , &cfg.bs, 1, bs, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6866 | OPT_FLAG("force", 0, &cfg.force, force),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"lbaf", 'l', "NUM", CFG_BYTE , &cfg.lbaf, 1, lbaf, 0, }, {"ses", 's', "NUM", CFG_BYTE, &cfg.ses, 1, ses, 0, }, {"pi", 'i', "NUM", CFG_BYTE, & cfg.pi, 1, pi, 0, }, {"pil", 'p', "NUM", CFG_BYTE, &cfg.pil , 1, pil, 0, }, {"ms", 'm', "NUM", CFG_BYTE, &cfg.mset, 1 , mset, 0, }, {"reset", 'r', ((void*)0), CFG_FLAG, &cfg.reset , 0, reset, 0, }, {"force", 0, ((void*)0), CFG_FLAG, &cfg .force, 0, force, 0, }, {"block-size", 'b', "IONUM", CFG_LONG_SUFFIX , &cfg.bs, 1, bs, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 6867 | OPT_SUFFIX("block-size", 'b', &cfg.bs, bs))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"lbaf", 'l', "NUM", CFG_BYTE , &cfg.lbaf, 1, lbaf, 0, }, {"ses", 's', "NUM", CFG_BYTE, &cfg.ses, 1, ses, 0, }, {"pi", 'i', "NUM", CFG_BYTE, & cfg.pi, 1, pi, 0, }, {"pil", 'p', "NUM", CFG_BYTE, &cfg.pil , 1, pil, 0, }, {"ms", 'm', "NUM", CFG_BYTE, &cfg.mset, 1 , mset, 0, }, {"reset", 'r', ((void*)0), CFG_FLAG, &cfg.reset , 0, reset, 0, }, {"force", 0, ((void*)0), CFG_FLAG, &cfg .force, 0, force, 0, }, {"block-size", 'b', "IONUM", CFG_LONG_SUFFIX , &cfg.bs, 1, bs, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 6868 | ||||
| 6869 | /* set default timeout for format to 60 seconds */ | |||
| 6870 | nvme_args.timeout = 600000; | |||
| 6871 | ||||
| 6872 | err = parse_args(argc, argv, desc, opts); | |||
| 6873 | if (err) | |||
| 6874 | return err; | |||
| 6875 | ||||
| 6876 | err = open_exclusive(&ctx, &hdl, argc, argv, cfg.force, opts); | |||
| 6877 | if (err) { | |||
| 6878 | if (-err == EBUSY16) { | |||
| 6879 | fprintf(stderrstderr, "Failed to open %s.\n", basename__xpg_basename(argv[optind])); | |||
| 6880 | fprintf(stderrstderr, "Namespace is currently busy.\n"); | |||
| 6881 | if (!cfg.force) | |||
| 6882 | fprintf(stderrstderr, "Use the force [--force] option to ignore that.\n"); | |||
| 6883 | } else { | |||
| 6884 | argconfig_print_help(desc, opts); | |||
| 6885 | } | |||
| 6886 | return err; | |||
| 6887 | } | |||
| 6888 | ||||
| 6889 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 6890 | if (err < 0) { | |||
| 6891 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 6892 | return err; | |||
| 6893 | } | |||
| 6894 | ||||
| 6895 | if (cfg.lbaf != 0xff && cfg.bs != 0) { | |||
| 6896 | nvme_show_error(nvme_show_message(1, "Invalid specification of both LBAF and Block Size, please specify only one" ) | |||
| 6897 | "Invalid specification of both LBAF and Block Size, please specify only one")nvme_show_message(1, "Invalid specification of both LBAF and Block Size, please specify only one" ); | |||
| 6898 | return -EINVAL22; | |||
| 6899 | } | |||
| 6900 | if (cfg.bs) { | |||
| 6901 | if ((cfg.bs & (~cfg.bs + 1)) != cfg.bs) { | |||
| 6902 | nvme_show_error(nvme_show_message(1, "Invalid value for block size (%""l" "u" "), must be a power of two", (uint64_t) cfg.bs) | |||
| 6903 | "Invalid value for block size (%"PRIu64"), must be a power of two",nvme_show_message(1, "Invalid value for block size (%""l" "u" "), must be a power of two", (uint64_t) cfg.bs) | |||
| 6904 | (uint64_t) cfg.bs)nvme_show_message(1, "Invalid value for block size (%""l" "u" "), must be a power of two", (uint64_t) cfg.bs); | |||
| 6905 | return -EINVAL22; | |||
| 6906 | } | |||
| 6907 | } | |||
| 6908 | ||||
| 6909 | ctrl = libnvme_alloc(sizeof(*ctrl)); | |||
| 6910 | if (!ctrl) | |||
| 6911 | return -ENOMEM12; | |||
| 6912 | ||||
| 6913 | err = nvme_identify_ctrl(hdl, ctrl); | |||
| 6914 | if (err) { | |||
| 6915 | nvme_show_error("identify-ctrl: %s", libnvme_strerror(err))nvme_show_message(1, "identify-ctrl: %s", libnvme_strerror(err )); | |||
| 6916 | return -errno(*__errno_location ()); | |||
| 6917 | } | |||
| 6918 | ||||
| 6919 | if (ctrl->fna & NVME_CTRL_FNA_FMT_ALL_NAMESPACES) { | |||
| 6920 | /* | |||
| 6921 | * FNA bit 0 set to 1: all namespaces ... shall be configured with the same | |||
| 6922 | * attributes and a format (excluding secure erase) of any namespace results in a | |||
| 6923 | * format of all namespaces. | |||
| 6924 | */ | |||
| 6925 | cfg.namespace_id = NVME_NSID_ALL; | |||
| 6926 | } else if (!cfg.namespace_id) { | |||
| 6927 | err = libnvme_get_nsid(hdl, &cfg.namespace_id); | |||
| 6928 | if (err < 0) { | |||
| 6929 | nvme_show_error("get-namespace-id: %s", libnvme_strerror(-err))nvme_show_message(1, "get-namespace-id: %s", libnvme_strerror (-err)); | |||
| 6930 | return -errno(*__errno_location ()); | |||
| 6931 | } | |||
| 6932 | } | |||
| 6933 | ||||
| 6934 | if (cfg.namespace_id == 0) { | |||
| 6935 | nvme_show_error(nvme_show_message(1, "Invalid namespace ID, specify a namespace to format or use\n" "'-n 0xffffffff' to format all namespaces on this controller." ) | |||
| 6936 | "Invalid namespace ID, specify a namespace to format or use\n"nvme_show_message(1, "Invalid namespace ID, specify a namespace to format or use\n" "'-n 0xffffffff' to format all namespaces on this controller." ) | |||
| 6937 | "'-n 0xffffffff' to format all namespaces on this controller.")nvme_show_message(1, "Invalid namespace ID, specify a namespace to format or use\n" "'-n 0xffffffff' to format all namespaces on this controller." ); | |||
| 6938 | return -EINVAL22; | |||
| 6939 | } | |||
| 6940 | ||||
| 6941 | if (cfg.namespace_id != NVME_NSID_ALL) { | |||
| 6942 | ns = libnvme_alloc(sizeof(*ns)); | |||
| 6943 | if (!ns) | |||
| 6944 | return -ENOMEM12; | |||
| 6945 | ||||
| 6946 | err = nvme_identify_ns(hdl, cfg.namespace_id, ns); | |||
| 6947 | if (err) { | |||
| 6948 | if (err > 0) | |||
| 6949 | fprintf(stderrstderr, "identify failed\n"); | |||
| 6950 | nvme_show_err(err, "identify-namespace"); | |||
| 6951 | return err; | |||
| 6952 | } | |||
| 6953 | ||||
| 6954 | nvme_id_ns_flbas_to_lbaf_inuse(ns->flbas, &prev_lbaf); | |||
| 6955 | ||||
| 6956 | if (cfg.bs) { | |||
| 6957 | for (i = 0; i <= ns->nlbaf; ++i) { | |||
| 6958 | if ((1ULL << ns->lbaf[i].ds) == cfg.bs && ns->lbaf[i].ms == 0) { | |||
| 6959 | cfg.lbaf = i; | |||
| 6960 | break; | |||
| 6961 | } | |||
| 6962 | } | |||
| 6963 | if (cfg.lbaf == 0xff) { | |||
| 6964 | fprintf(stderrstderr, | |||
| 6965 | "LBAF corresponding to given block size %"PRIu64"l" "u"" not found\n", | |||
| 6966 | (uint64_t)cfg.bs); | |||
| 6967 | fprintf(stderrstderr, | |||
| 6968 | "Please correct block size, or specify LBAF directly\n"); | |||
| 6969 | return -EINVAL22; | |||
| 6970 | } | |||
| 6971 | } else if (cfg.lbaf == 0xff) { | |||
| 6972 | cfg.lbaf = prev_lbaf; | |||
| 6973 | } | |||
| 6974 | } else { | |||
| 6975 | if (cfg.lbaf == 0xff) | |||
| 6976 | cfg.lbaf = 0; | |||
| 6977 | } | |||
| 6978 | ||||
| 6979 | /* ses & pi checks set to 7 for forward-compatibility */ | |||
| 6980 | if (cfg.ses > 7) { | |||
| 6981 | nvme_show_error("invalid secure erase settings:%d", cfg.ses)nvme_show_message(1, "invalid secure erase settings:%d", cfg. ses); | |||
| 6982 | return -EINVAL22; | |||
| 6983 | } | |||
| 6984 | if (cfg.lbaf > 63) { | |||
| 6985 | nvme_show_error("invalid lbaf:%d", cfg.lbaf)nvme_show_message(1, "invalid lbaf:%d", cfg.lbaf); | |||
| 6986 | return -EINVAL22; | |||
| 6987 | } | |||
| 6988 | if (cfg.pi > 7) { | |||
| 6989 | nvme_show_error("invalid pi:%d", cfg.pi)nvme_show_message(1, "invalid pi:%d", cfg.pi); | |||
| 6990 | return -EINVAL22; | |||
| 6991 | } | |||
| 6992 | if (cfg.pil > 1) { | |||
| 6993 | nvme_show_error("invalid pil:%d", cfg.pil)nvme_show_message(1, "invalid pil:%d", cfg.pil); | |||
| 6994 | return -EINVAL22; | |||
| 6995 | } | |||
| 6996 | if (cfg.mset > 1) { | |||
| 6997 | nvme_show_error("invalid mset:%d", cfg.mset)nvme_show_message(1, "invalid mset:%d", cfg.mset); | |||
| 6998 | return -EINVAL22; | |||
| 6999 | } | |||
| 7000 | ||||
| 7001 | if (!cfg.force) { | |||
| 7002 | fprintf(stderrstderr, "You are about to format %s, namespace %#x%s.\n", | |||
| 7003 | libnvme_transport_handle_get_name(hdl), cfg.namespace_id, | |||
| 7004 | cfg.namespace_id == NVME_NSID_ALL ? "(ALL namespaces)" : ""); | |||
| 7005 | show_relatives(libnvme_transport_handle_get_name(hdl), flags); | |||
| 7006 | fprintf(stderrstderr, | |||
| 7007 | "WARNING: Format may irrevocably delete this device's data.\n" | |||
| 7008 | "You have 10 seconds to press Ctrl-C to cancel this operation.\n\n" | |||
| 7009 | "Use the force [--force] option to suppress this warning.\n"); | |||
| 7010 | nvme_sigint_received = false0; | |||
| 7011 | sleep(10); | |||
| 7012 | if (nvme_sigint_received) | |||
| 7013 | return -EINTR4; | |||
| 7014 | fprintf(stderrstderr, "Sending format operation ...\n"); | |||
| 7015 | } | |||
| 7016 | ||||
| 7017 | nvme_init_format_nvm(&cmd, cfg.namespace_id, cfg.lbaf, cfg.mset, | |||
| 7018 | cfg.pi, cfg.pil, cfg.ses); | |||
| 7019 | if (cfg.ish) { | |||
| 7020 | if (libnvme_transport_handle_is_mi(hdl)) | |||
| 7021 | nvme_init_mi_cmd_flags(&cmd, ish); | |||
| 7022 | else | |||
| 7023 | printf("ISH is supported only for NVMe-MI\n"); | |||
| 7024 | } | |||
| 7025 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 7026 | if (err) { | |||
| 7027 | nvme_show_err(err, "format"); | |||
| 7028 | return err; | |||
| 7029 | } | |||
| 7030 | ||||
| 7031 | printf("Success formatting namespace:%x\n", cfg.namespace_id); | |||
| 7032 | if (libnvme_transport_handle_is_direct(hdl) && cfg.lbaf != prev_lbaf) { | |||
| 7033 | if (libnvme_transport_handle_is_ctrl(hdl)) { | |||
| 7034 | if (libnvme_rescan_ns(hdl) < 0) { | |||
| 7035 | nvme_show_error("failed to rescan namespaces")nvme_show_message(1, "failed to rescan namespaces"); | |||
| 7036 | return -errno(*__errno_location ()); | |||
| 7037 | } | |||
| 7038 | } else if (cfg.namespace_id != NVME_NSID_ALL) { | |||
| 7039 | block_size = 1 << ns->lbaf[cfg.lbaf].ds; | |||
| 7040 | ||||
| 7041 | /* | |||
| 7042 | * If block size has been changed by the format | |||
| 7043 | * command up there, we should notify it to | |||
| 7044 | * kernel blkdev to update its own block size | |||
| 7045 | * to the given one because blkdev will not | |||
| 7046 | * update by itself without re-opening fd. | |||
| 7047 | */ | |||
| 7048 | err = libnvme_update_block_size(hdl, block_size); | |||
| 7049 | if (err < 0) { | |||
| 7050 | nvme_show_error(nvme_show_message(1, "failed to set block size to %d", block_size ) | |||
| 7051 | "failed to set block size to %d",nvme_show_message(1, "failed to set block size to %d", block_size ) | |||
| 7052 | block_size)nvme_show_message(1, "failed to set block size to %d", block_size ); | |||
| 7053 | return err; | |||
| 7054 | } | |||
| 7055 | } | |||
| 7056 | } | |||
| 7057 | if (libnvme_transport_handle_is_direct(hdl) && cfg.reset && | |||
| 7058 | libnvme_transport_handle_is_ctrl(hdl)) | |||
| 7059 | libnvme_reset_ctrl(hdl); | |||
| 7060 | ||||
| 7061 | return err; | |||
| 7062 | } | |||
| 7063 | ||||
| 7064 | #define STRTOUL_AUTO_BASE(0) (0) | |||
| 7065 | #define NVME_FEAT_TIMESTAMP_DATA_SIZE(6) (6) | |||
| 7066 | ||||
| 7067 | static int set_feature(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 7068 | { | |||
| 7069 | const char *desc = "Modify the saveable or changeable " | |||
| 7070 | "current operating parameters of the controller. " | |||
| 7071 | "Operating parameters are grouped and identified by Feature" | |||
| 7072 | "Identifiers. Feature settings can be applied to the entire" | |||
| 7073 | "controller and all associated namespaces, or to only a few" | |||
| 7074 | "namespace(s) associated with the controller. Default values" | |||
| 7075 | "for each Feature are vendor-specific and may not be modified." | |||
| 7076 | "Use get-feature to determine which Features are supported by" | |||
| 7077 | "the controller and are saveable/changeable."; | |||
| 7078 | const char *fid = "feature identifier (required)"; | |||
| 7079 | const char *data = "optional file for feature data (default stdin)"; | |||
| 7080 | const char *value = "new value of feature (required)"; | |||
| 7081 | const char *cdw12 = "feature cdw12, if used"; | |||
| 7082 | const char *sv = "specifies that the controller shall save the attribute"; | |||
| 7083 | ||||
| 7084 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 7085 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 7086 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) void *buf = NULL((void*)0); | |||
| 7087 | __cleanup_fd__attribute__((cleanup(cleanup_fd))) int ffd = STDIN_FILENO0; | |||
| 7088 | int err; | |||
| 7089 | __u64 result; | |||
| 7090 | nvme_print_flags_t flags; | |||
| 7091 | ||||
| 7092 | struct config { | |||
| 7093 | __u32 nsid; | |||
| 7094 | __u8 fid; | |||
| 7095 | __u64 value; | |||
| 7096 | __u32 cdw12; | |||
| 7097 | __u8 uidx; | |||
| 7098 | __u32 data_len; | |||
| 7099 | char *file; | |||
| 7100 | bool_Bool sv; | |||
| 7101 | }; | |||
| 7102 | ||||
| 7103 | struct config cfg = { | |||
| 7104 | .nsid = 0, | |||
| 7105 | .fid = 0, | |||
| 7106 | .value = 0, | |||
| 7107 | .uidx = 0, | |||
| 7108 | .data_len = 0, | |||
| 7109 | .file = "", | |||
| 7110 | .sv = false0, | |||
| 7111 | }; | |||
| 7112 | ||||
| 7113 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"feature-id", 'f', "NUM", CFG_BYTE , &cfg.fid, 1, fid, 0, feature_name}, {"value", 'V', "IONUM" , CFG_LONG_SUFFIX, &cfg.value, 1, value, 0, }, {"cdw12", 'c' , "NUM", CFG_POSITIVE, &cfg.cdw12, 1, cdw12, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uidx, 1, uuid_index_specify, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"save", 's', ((void*)0), CFG_FLAG, & cfg.sv, 0, sv, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7114 | OPT_UINT("namespace-id", 'n', &cfg.nsid, namespace_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"feature-id", 'f', "NUM", CFG_BYTE , &cfg.fid, 1, fid, 0, feature_name}, {"value", 'V', "IONUM" , CFG_LONG_SUFFIX, &cfg.value, 1, value, 0, }, {"cdw12", 'c' , "NUM", CFG_POSITIVE, &cfg.cdw12, 1, cdw12, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uidx, 1, uuid_index_specify, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"save", 's', ((void*)0), CFG_FLAG, & cfg.sv, 0, sv, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7115 | OPT_BYTE("feature-id", 'f', &cfg.fid, fid, feature_name),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"feature-id", 'f', "NUM", CFG_BYTE , &cfg.fid, 1, fid, 0, feature_name}, {"value", 'V', "IONUM" , CFG_LONG_SUFFIX, &cfg.value, 1, value, 0, }, {"cdw12", 'c' , "NUM", CFG_POSITIVE, &cfg.cdw12, 1, cdw12, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uidx, 1, uuid_index_specify, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"save", 's', ((void*)0), CFG_FLAG, & cfg.sv, 0, sv, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7116 | OPT_SUFFIX("value", 'V', &cfg.value, value),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"feature-id", 'f', "NUM", CFG_BYTE , &cfg.fid, 1, fid, 0, feature_name}, {"value", 'V', "IONUM" , CFG_LONG_SUFFIX, &cfg.value, 1, value, 0, }, {"cdw12", 'c' , "NUM", CFG_POSITIVE, &cfg.cdw12, 1, cdw12, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uidx, 1, uuid_index_specify, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"save", 's', ((void*)0), CFG_FLAG, & cfg.sv, 0, sv, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7117 | OPT_UINT("cdw12", 'c', &cfg.cdw12, cdw12),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"feature-id", 'f', "NUM", CFG_BYTE , &cfg.fid, 1, fid, 0, feature_name}, {"value", 'V', "IONUM" , CFG_LONG_SUFFIX, &cfg.value, 1, value, 0, }, {"cdw12", 'c' , "NUM", CFG_POSITIVE, &cfg.cdw12, 1, cdw12, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uidx, 1, uuid_index_specify, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"save", 's', ((void*)0), CFG_FLAG, & cfg.sv, 0, sv, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7118 | OPT_BYTE("uuid-index", 'U', &cfg.uidx, uuid_index_specify),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"feature-id", 'f', "NUM", CFG_BYTE , &cfg.fid, 1, fid, 0, feature_name}, {"value", 'V', "IONUM" , CFG_LONG_SUFFIX, &cfg.value, 1, value, 0, }, {"cdw12", 'c' , "NUM", CFG_POSITIVE, &cfg.cdw12, 1, cdw12, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uidx, 1, uuid_index_specify, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"save", 's', ((void*)0), CFG_FLAG, & cfg.sv, 0, sv, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7119 | OPT_UINT("data-len", 'l', &cfg.data_len, buf_len),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"feature-id", 'f', "NUM", CFG_BYTE , &cfg.fid, 1, fid, 0, feature_name}, {"value", 'V', "IONUM" , CFG_LONG_SUFFIX, &cfg.value, 1, value, 0, }, {"cdw12", 'c' , "NUM", CFG_POSITIVE, &cfg.cdw12, 1, cdw12, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uidx, 1, uuid_index_specify, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"save", 's', ((void*)0), CFG_FLAG, & cfg.sv, 0, sv, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7120 | OPT_FILE("data", 'd', &cfg.file, data),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"feature-id", 'f', "NUM", CFG_BYTE , &cfg.fid, 1, fid, 0, feature_name}, {"value", 'V', "IONUM" , CFG_LONG_SUFFIX, &cfg.value, 1, value, 0, }, {"cdw12", 'c' , "NUM", CFG_POSITIVE, &cfg.cdw12, 1, cdw12, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uidx, 1, uuid_index_specify, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"save", 's', ((void*)0), CFG_FLAG, & cfg.sv, 0, sv, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7121 | OPT_FLAG("save", 's', &cfg.sv, sv))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"feature-id", 'f', "NUM", CFG_BYTE , &cfg.fid, 1, fid, 0, feature_name}, {"value", 'V', "IONUM" , CFG_LONG_SUFFIX, &cfg.value, 1, value, 0, }, {"cdw12", 'c' , "NUM", CFG_POSITIVE, &cfg.cdw12, 1, cdw12, 0, }, {"uuid-index" , 'U', "NUM", CFG_BYTE, &cfg.uidx, 1, uuid_index_specify, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len , 1, buf_len, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg .file, 1, data, 0, }, {"save", 's', ((void*)0), CFG_FLAG, & cfg.sv, 0, sv, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 7122 | ||||
| 7123 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 7124 | if (err) | |||
| 7125 | return err; | |||
| 7126 | ||||
| 7127 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 7128 | if (err < 0) { | |||
| 7129 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 7130 | return err; | |||
| 7131 | } | |||
| 7132 | ||||
| 7133 | if (!argconfig_parse_seen(opts, "namespace-id")) { | |||
| 7134 | err = libnvme_get_nsid(hdl, &cfg.nsid); | |||
| 7135 | if (err < 0) { | |||
| 7136 | if (errno(*__errno_location ()) != ENOTTY25) { | |||
| 7137 | nvme_show_error("get-namespace-id: %s", libnvme_strerror(-err))nvme_show_message(1, "get-namespace-id: %s", libnvme_strerror (-err)); | |||
| 7138 | return -errno(*__errno_location ()); | |||
| 7139 | } | |||
| 7140 | cfg.nsid = NVME_NSID_ALL; | |||
| 7141 | } | |||
| 7142 | } | |||
| 7143 | ||||
| 7144 | if (!cfg.fid) { | |||
| 7145 | nvme_show_error("feature-id required param")nvme_show_message(1, "feature-id required param"); | |||
| 7146 | return -EINVAL22; | |||
| 7147 | } | |||
| 7148 | ||||
| 7149 | if (cfg.uidx > 127) { | |||
| 7150 | nvme_show_error("invalid uuid index param: %u", cfg.uidx)nvme_show_message(1, "invalid uuid index param: %u", cfg.uidx ); | |||
| 7151 | return -1; | |||
| 7152 | } | |||
| 7153 | ||||
| 7154 | if (!cfg.data_len) | |||
| 7155 | libnvme_get_feature_length(cfg.fid, cfg.value, | |||
| 7156 | NVME_DATA_TFR_HOST_TO_CTRL, | |||
| 7157 | &cfg.data_len); | |||
| 7158 | ||||
| 7159 | if (cfg.data_len) { | |||
| 7160 | buf = libnvme_alloc(cfg.data_len); | |||
| 7161 | if (!buf) | |||
| 7162 | return -ENOMEM12; | |||
| 7163 | } | |||
| 7164 | ||||
| 7165 | if (buf) { | |||
| 7166 | /* | |||
| 7167 | * Use the '-v' value for the timestamp feature if provided as | |||
| 7168 | * a convenience since it can often fit in 4-bytes. The user | |||
| 7169 | * should use the buffer method if the value exceeds this | |||
| 7170 | * length. | |||
| 7171 | */ | |||
| 7172 | if (cfg.fid == NVME_FEAT_FID_TIMESTAMP && | |||
| 7173 | argconfig_parse_seen(opts, "value")) { | |||
| 7174 | memcpy(buf, &cfg.value, NVME_FEAT_TIMESTAMP_DATA_SIZE(6)); | |||
| 7175 | } else { | |||
| 7176 | if (strlen(cfg.file)) | |||
| 7177 | ffd = open(cfg.file, O_RDONLY00); | |||
| 7178 | ||||
| 7179 | if (ffd < 0) { | |||
| 7180 | nvme_show_error("Failed to open file %s: %s",nvme_show_message(1, "Failed to open file %s: %s", cfg.file, libnvme_strerror ((*__errno_location ()))) | |||
| 7181 | cfg.file, libnvme_strerror(errno))nvme_show_message(1, "Failed to open file %s: %s", cfg.file, libnvme_strerror ((*__errno_location ()))); | |||
| 7182 | return -EINVAL22; | |||
| 7183 | } | |||
| 7184 | ||||
| 7185 | err = read(ffd, buf, cfg.data_len); | |||
| 7186 | if (err < 0) { | |||
| 7187 | nvme_show_error("failed to read data buffer from input file: %s",nvme_show_message(1, "failed to read data buffer from input file: %s" , libnvme_strerror((*__errno_location ()))) | |||
| 7188 | libnvme_strerror(errno))nvme_show_message(1, "failed to read data buffer from input file: %s" , libnvme_strerror((*__errno_location ()))); | |||
| 7189 | return -errno(*__errno_location ()); | |||
| 7190 | } | |||
| 7191 | } | |||
| 7192 | } | |||
| 7193 | ||||
| 7194 | err = nvme_set_features(hdl, cfg.nsid, cfg.fid, cfg.sv, cfg.value, cfg.cdw12, | |||
| 7195 | 0, cfg.uidx, 0, buf, cfg.data_len, &result); | |||
| 7196 | if (err) { | |||
| 7197 | nvme_show_admin_cmd_err("set-feature", nvme_admin_set_features, | |||
| 7198 | err); | |||
| 7199 | return err; | |||
| 7200 | } | |||
| 7201 | ||||
| 7202 | printf("set-feature:%#0*x (%s), value:%#0*" PRIx64"l" "x" | |||
| 7203 | ", cdw12:%#0*x, save:%#x\n", cfg.fid ? 4 : 2, cfg.fid, | |||
| 7204 | nvme_feature_to_string(cfg.fid), cfg.value ? 10 : 8, | |||
| 7205 | (uint64_t)cfg.value, cfg.cdw12 ? 10 : 8, cfg.cdw12, cfg.sv); | |||
| 7206 | if (cfg.fid == NVME_FEAT_FID_LBA_STS_INTERVAL) | |||
| 7207 | nvme_show_lba_status_info(result); | |||
| 7208 | if (buf) { | |||
| 7209 | if (cfg.fid == NVME_FEAT_FID_LBA_RANGE) | |||
| 7210 | nvme_show_lba_range((struct nvme_lba_range_type *)buf, | |||
| 7211 | result, 0); | |||
| 7212 | else | |||
| 7213 | d(buf, cfg.data_len, 16, 1); | |||
| 7214 | } | |||
| 7215 | ||||
| 7216 | return err; | |||
| 7217 | } | |||
| 7218 | ||||
| 7219 | static int sec_send(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 7220 | { | |||
| 7221 | struct stat sb; | |||
| 7222 | const char *desc = "Transfer security protocol data to\n" | |||
| 7223 | "a controller. Security Receives for the same protocol should be\n" | |||
| 7224 | "performed after Security Sends. The security protocol field\n" | |||
| 7225 | "associates Security Sends (security-send) and Security Receives (security-recv)."; | |||
| 7226 | const char *file = "transfer payload"; | |||
| 7227 | const char *tl = "transfer length (cf. SPC-4)"; | |||
| 7228 | ||||
| 7229 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 7230 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 7231 | struct libnvme_passthru_cmd cmd; | |||
| 7232 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) void *sec_buf = NULL((void*)0); | |||
| 7233 | __cleanup_fd__attribute__((cleanup(cleanup_fd))) int sec_fd = -1; | |||
| 7234 | unsigned int sec_size; | |||
| 7235 | int err; | |||
| 7236 | nvme_print_flags_t flags; | |||
| 7237 | ||||
| 7238 | struct config { | |||
| 7239 | bool_Bool ish; | |||
| 7240 | __u32 namespace_id; | |||
| 7241 | char *file; | |||
| 7242 | __u8 nssf; | |||
| 7243 | __u8 secp; | |||
| 7244 | __u16 spsp; | |||
| 7245 | __u32 tl; | |||
| 7246 | }; | |||
| 7247 | ||||
| 7248 | struct config cfg = { | |||
| 7249 | .ish = false0, | |||
| 7250 | .namespace_id = 0, | |||
| 7251 | .file = "", | |||
| 7252 | .nssf = 0, | |||
| 7253 | .secp = 0, | |||
| 7254 | .spsp = 0, | |||
| 7255 | .tl = 0, | |||
| 7256 | }; | |||
| 7257 | ||||
| 7258 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"file", 'f', "FILE", CFG_STRING , &cfg.file, 1, file, 0, }, {"nssf", 'N', "NUM", CFG_BYTE , &cfg.nssf, 1, nssf, 0, }, {"secp", 'p', "NUM", CFG_BYTE , &cfg.secp, 1, secp, 0, }, {"spsp", 's', "NUM", CFG_SHORT , &cfg.spsp, 1, spsp, 0, }, {"tl", 't', "NUM", CFG_POSITIVE , &cfg.tl, 1, tl, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7259 | OPT_FLAG("ish", 'I', &cfg.ish, ish),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"file", 'f', "FILE", CFG_STRING , &cfg.file, 1, file, 0, }, {"nssf", 'N', "NUM", CFG_BYTE , &cfg.nssf, 1, nssf, 0, }, {"secp", 'p', "NUM", CFG_BYTE , &cfg.secp, 1, secp, 0, }, {"spsp", 's', "NUM", CFG_SHORT , &cfg.spsp, 1, spsp, 0, }, {"tl", 't', "NUM", CFG_POSITIVE , &cfg.tl, 1, tl, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7260 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"file", 'f', "FILE", CFG_STRING , &cfg.file, 1, file, 0, }, {"nssf", 'N', "NUM", CFG_BYTE , &cfg.nssf, 1, nssf, 0, }, {"secp", 'p', "NUM", CFG_BYTE , &cfg.secp, 1, secp, 0, }, {"spsp", 's', "NUM", CFG_SHORT , &cfg.spsp, 1, spsp, 0, }, {"tl", 't', "NUM", CFG_POSITIVE , &cfg.tl, 1, tl, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7261 | OPT_FILE("file", 'f', &cfg.file, file),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"file", 'f', "FILE", CFG_STRING , &cfg.file, 1, file, 0, }, {"nssf", 'N', "NUM", CFG_BYTE , &cfg.nssf, 1, nssf, 0, }, {"secp", 'p', "NUM", CFG_BYTE , &cfg.secp, 1, secp, 0, }, {"spsp", 's', "NUM", CFG_SHORT , &cfg.spsp, 1, spsp, 0, }, {"tl", 't', "NUM", CFG_POSITIVE , &cfg.tl, 1, tl, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7262 | OPT_BYTE("nssf", 'N', &cfg.nssf, nssf),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"file", 'f', "FILE", CFG_STRING , &cfg.file, 1, file, 0, }, {"nssf", 'N', "NUM", CFG_BYTE , &cfg.nssf, 1, nssf, 0, }, {"secp", 'p', "NUM", CFG_BYTE , &cfg.secp, 1, secp, 0, }, {"spsp", 's', "NUM", CFG_SHORT , &cfg.spsp, 1, spsp, 0, }, {"tl", 't', "NUM", CFG_POSITIVE , &cfg.tl, 1, tl, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7263 | OPT_BYTE("secp", 'p', &cfg.secp, secp),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"file", 'f', "FILE", CFG_STRING , &cfg.file, 1, file, 0, }, {"nssf", 'N', "NUM", CFG_BYTE , &cfg.nssf, 1, nssf, 0, }, {"secp", 'p', "NUM", CFG_BYTE , &cfg.secp, 1, secp, 0, }, {"spsp", 's', "NUM", CFG_SHORT , &cfg.spsp, 1, spsp, 0, }, {"tl", 't', "NUM", CFG_POSITIVE , &cfg.tl, 1, tl, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7264 | OPT_SHRT("spsp", 's', &cfg.spsp, spsp),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"file", 'f', "FILE", CFG_STRING , &cfg.file, 1, file, 0, }, {"nssf", 'N', "NUM", CFG_BYTE , &cfg.nssf, 1, nssf, 0, }, {"secp", 'p', "NUM", CFG_BYTE , &cfg.secp, 1, secp, 0, }, {"spsp", 's', "NUM", CFG_SHORT , &cfg.spsp, 1, spsp, 0, }, {"tl", 't', "NUM", CFG_POSITIVE , &cfg.tl, 1, tl, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7265 | OPT_UINT("tl", 't', &cfg.tl, tl))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"file", 'f', "FILE", CFG_STRING , &cfg.file, 1, file, 0, }, {"nssf", 'N', "NUM", CFG_BYTE , &cfg.nssf, 1, nssf, 0, }, {"secp", 'p', "NUM", CFG_BYTE , &cfg.secp, 1, secp, 0, }, {"spsp", 's', "NUM", CFG_SHORT , &cfg.spsp, 1, spsp, 0, }, {"tl", 't', "NUM", CFG_POSITIVE , &cfg.tl, 1, tl, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 7266 | ||||
| 7267 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 7268 | if (err) | |||
| 7269 | return err; | |||
| 7270 | ||||
| 7271 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 7272 | if (err < 0) { | |||
| 7273 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 7274 | return err; | |||
| 7275 | } | |||
| 7276 | ||||
| 7277 | if (cfg.tl == 0) { | |||
| 7278 | nvme_show_error("--tl unspecified or zero")nvme_show_message(1, "--tl unspecified or zero"); | |||
| 7279 | return -EINVAL22; | |||
| 7280 | } | |||
| 7281 | if ((cfg.tl & 3) != 0) | |||
| 7282 | nvme_show_error(nvme_show_message(1, "WARNING: --tl not dword aligned; unaligned bytes may be truncated" ) | |||
| 7283 | "WARNING: --tl not dword aligned; unaligned bytes may be truncated")nvme_show_message(1, "WARNING: --tl not dword aligned; unaligned bytes may be truncated" ); | |||
| 7284 | ||||
| 7285 | if (strlen(cfg.file) == 0) { | |||
| 7286 | sec_fd = STDIN_FILENO0; | |||
| 7287 | sec_size = cfg.tl; | |||
| 7288 | } else { | |||
| 7289 | sec_fd = open(cfg.file, O_RDONLY00); | |||
| 7290 | if (sec_fd < 0) { | |||
| 7291 | nvme_show_error("Failed to open %s: %s", cfg.file, libnvme_strerror(errno))nvme_show_message(1, "Failed to open %s: %s", cfg.file, libnvme_strerror ((*__errno_location ()))); | |||
| 7292 | return -EINVAL22; | |||
| 7293 | } | |||
| 7294 | ||||
| 7295 | err = fstat(sec_fd, &sb); | |||
| 7296 | if (err < 0) { | |||
| 7297 | nvme_show_perror("fstat"); | |||
| 7298 | return err; | |||
| 7299 | } | |||
| 7300 | ||||
| 7301 | sec_size = cfg.tl > sb.st_size ? cfg.tl : sb.st_size; | |||
| 7302 | } | |||
| 7303 | ||||
| 7304 | sec_buf = libnvme_alloc(cfg.tl); | |||
| 7305 | if (!sec_buf) | |||
| 7306 | return -ENOMEM12; | |||
| 7307 | ||||
| 7308 | err = read(sec_fd, sec_buf, sec_size); | |||
| 7309 | if (err < 0) { | |||
| 7310 | nvme_show_error("Failed to read data from security file %s with %s", cfg.file,nvme_show_message(1, "Failed to read data from security file %s with %s" , cfg.file, libnvme_strerror((*__errno_location ()))) | |||
| 7311 | libnvme_strerror(errno))nvme_show_message(1, "Failed to read data from security file %s with %s" , cfg.file, libnvme_strerror((*__errno_location ()))); | |||
| 7312 | return -errno(*__errno_location ()); | |||
| 7313 | } | |||
| 7314 | ||||
| 7315 | nvme_init_security_send(&cmd, cfg.namespace_id, cfg.nssf, cfg.spsp, | |||
| 7316 | cfg.secp, cfg.tl, sec_buf, cfg.tl); | |||
| 7317 | if (cfg.ish) { | |||
| 7318 | if (libnvme_transport_handle_is_mi(hdl)) | |||
| 7319 | nvme_init_mi_cmd_flags(&cmd, ish); | |||
| 7320 | else | |||
| 7321 | printf("ISH is supported only for NVMe-MI\n"); | |||
| 7322 | } | |||
| 7323 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 7324 | if (err) { | |||
| 7325 | nvme_show_err(err, "security-send"); | |||
| 7326 | return err; | |||
| 7327 | } | |||
| 7328 | ||||
| 7329 | printf("NVME Security Send Command Success\n"); | |||
| 7330 | ||||
| 7331 | return err; | |||
| 7332 | } | |||
| 7333 | ||||
| 7334 | static int dir_send(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 7335 | { | |||
| 7336 | const char *desc = "Set directive parameters of the specified directive type."; | |||
| 7337 | const char *endir = "directive enable"; | |||
| 7338 | const char *ttype = "target directive type to be enabled/disabled"; | |||
| 7339 | const char *input = "write/send file (default stdin)"; | |||
| 7340 | ||||
| 7341 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 7342 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 7343 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) void *buf = NULL((void*)0); | |||
| 7344 | struct libnvme_passthru_cmd cmd; | |||
| 7345 | __u32 dw12 = 0; | |||
| 7346 | __cleanup_fd__attribute__((cleanup(cleanup_fd))) int ffd = STDIN_FILENO0; | |||
| 7347 | int err; | |||
| 7348 | ||||
| 7349 | struct config { | |||
| 7350 | __u32 namespace_id; | |||
| 7351 | __u32 data_len; | |||
| 7352 | __u8 dtype; | |||
| 7353 | __u8 ttype; | |||
| 7354 | __u16 dspec; | |||
| 7355 | __u8 doper; | |||
| 7356 | __u16 endir; | |||
| 7357 | bool_Bool raw_binary; | |||
| 7358 | char *file; | |||
| 7359 | }; | |||
| 7360 | ||||
| 7361 | struct config cfg = { | |||
| 7362 | .namespace_id = 1, | |||
| 7363 | .data_len = 0, | |||
| 7364 | .dtype = 0, | |||
| 7365 | .ttype = 0, | |||
| 7366 | .dspec = 0, | |||
| 7367 | .doper = 0, | |||
| 7368 | .endir = 1, | |||
| 7369 | .raw_binary = false0, | |||
| 7370 | .file = "", | |||
| 7371 | }; | |||
| 7372 | ||||
| 7373 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"dir-type", 'D', "NUM" , CFG_BYTE, &cfg.dtype, 1, dtype, 0, }, {"target-dir", 'T' , "NUM", CFG_BYTE, &cfg.ttype, 1, ttype, 0, }, {"dir-spec" , 'S', "NUM", CFG_SHORT, &cfg.dspec, 1, dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, &cfg.doper, 1, doper , 0, }, {"endir", 'e', "NUM", CFG_SHORT, &cfg.endir, 1, endir , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_directive, 0, }, {"input-file", 'i', "FILE", CFG_STRING , &cfg.file, 1, input, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7374 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"dir-type", 'D', "NUM" , CFG_BYTE, &cfg.dtype, 1, dtype, 0, }, {"target-dir", 'T' , "NUM", CFG_BYTE, &cfg.ttype, 1, ttype, 0, }, {"dir-spec" , 'S', "NUM", CFG_SHORT, &cfg.dspec, 1, dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, &cfg.doper, 1, doper , 0, }, {"endir", 'e', "NUM", CFG_SHORT, &cfg.endir, 1, endir , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_directive, 0, }, {"input-file", 'i', "FILE", CFG_STRING , &cfg.file, 1, input, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7375 | OPT_UINT("data-len", 'l', &cfg.data_len, buf_len),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"dir-type", 'D', "NUM" , CFG_BYTE, &cfg.dtype, 1, dtype, 0, }, {"target-dir", 'T' , "NUM", CFG_BYTE, &cfg.ttype, 1, ttype, 0, }, {"dir-spec" , 'S', "NUM", CFG_SHORT, &cfg.dspec, 1, dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, &cfg.doper, 1, doper , 0, }, {"endir", 'e', "NUM", CFG_SHORT, &cfg.endir, 1, endir , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_directive, 0, }, {"input-file", 'i', "FILE", CFG_STRING , &cfg.file, 1, input, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7376 | OPT_BYTE("dir-type", 'D', &cfg.dtype, dtype),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"dir-type", 'D', "NUM" , CFG_BYTE, &cfg.dtype, 1, dtype, 0, }, {"target-dir", 'T' , "NUM", CFG_BYTE, &cfg.ttype, 1, ttype, 0, }, {"dir-spec" , 'S', "NUM", CFG_SHORT, &cfg.dspec, 1, dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, &cfg.doper, 1, doper , 0, }, {"endir", 'e', "NUM", CFG_SHORT, &cfg.endir, 1, endir , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_directive, 0, }, {"input-file", 'i', "FILE", CFG_STRING , &cfg.file, 1, input, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7377 | OPT_BYTE("target-dir", 'T', &cfg.ttype, ttype),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"dir-type", 'D', "NUM" , CFG_BYTE, &cfg.dtype, 1, dtype, 0, }, {"target-dir", 'T' , "NUM", CFG_BYTE, &cfg.ttype, 1, ttype, 0, }, {"dir-spec" , 'S', "NUM", CFG_SHORT, &cfg.dspec, 1, dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, &cfg.doper, 1, doper , 0, }, {"endir", 'e', "NUM", CFG_SHORT, &cfg.endir, 1, endir , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_directive, 0, }, {"input-file", 'i', "FILE", CFG_STRING , &cfg.file, 1, input, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7378 | OPT_SHRT("dir-spec", 'S', &cfg.dspec, dspec_w_dtype),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"dir-type", 'D', "NUM" , CFG_BYTE, &cfg.dtype, 1, dtype, 0, }, {"target-dir", 'T' , "NUM", CFG_BYTE, &cfg.ttype, 1, ttype, 0, }, {"dir-spec" , 'S', "NUM", CFG_SHORT, &cfg.dspec, 1, dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, &cfg.doper, 1, doper , 0, }, {"endir", 'e', "NUM", CFG_SHORT, &cfg.endir, 1, endir , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_directive, 0, }, {"input-file", 'i', "FILE", CFG_STRING , &cfg.file, 1, input, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7379 | OPT_BYTE("dir-oper", 'O', &cfg.doper, doper),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"dir-type", 'D', "NUM" , CFG_BYTE, &cfg.dtype, 1, dtype, 0, }, {"target-dir", 'T' , "NUM", CFG_BYTE, &cfg.ttype, 1, ttype, 0, }, {"dir-spec" , 'S', "NUM", CFG_SHORT, &cfg.dspec, 1, dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, &cfg.doper, 1, doper , 0, }, {"endir", 'e', "NUM", CFG_SHORT, &cfg.endir, 1, endir , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_directive, 0, }, {"input-file", 'i', "FILE", CFG_STRING , &cfg.file, 1, input, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7380 | OPT_SHRT("endir", 'e', &cfg.endir, endir),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"dir-type", 'D', "NUM" , CFG_BYTE, &cfg.dtype, 1, dtype, 0, }, {"target-dir", 'T' , "NUM", CFG_BYTE, &cfg.ttype, 1, ttype, 0, }, {"dir-spec" , 'S', "NUM", CFG_SHORT, &cfg.dspec, 1, dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, &cfg.doper, 1, doper , 0, }, {"endir", 'e', "NUM", CFG_SHORT, &cfg.endir, 1, endir , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_directive, 0, }, {"input-file", 'i', "FILE", CFG_STRING , &cfg.file, 1, input, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7381 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_directive),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"dir-type", 'D', "NUM" , CFG_BYTE, &cfg.dtype, 1, dtype, 0, }, {"target-dir", 'T' , "NUM", CFG_BYTE, &cfg.ttype, 1, ttype, 0, }, {"dir-spec" , 'S', "NUM", CFG_SHORT, &cfg.dspec, 1, dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, &cfg.doper, 1, doper , 0, }, {"endir", 'e', "NUM", CFG_SHORT, &cfg.endir, 1, endir , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_directive, 0, }, {"input-file", 'i', "FILE", CFG_STRING , &cfg.file, 1, input, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7382 | OPT_FILE("input-file", 'i', &cfg.file, input))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"dir-type", 'D', "NUM" , CFG_BYTE, &cfg.dtype, 1, dtype, 0, }, {"target-dir", 'T' , "NUM", CFG_BYTE, &cfg.ttype, 1, ttype, 0, }, {"dir-spec" , 'S', "NUM", CFG_SHORT, &cfg.dspec, 1, dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, &cfg.doper, 1, doper , 0, }, {"endir", 'e', "NUM", CFG_SHORT, &cfg.endir, 1, endir , 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_directive, 0, }, {"input-file", 'i', "FILE", CFG_STRING , &cfg.file, 1, input, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 7383 | ||||
| 7384 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 7385 | if (err) | |||
| 7386 | return err; | |||
| 7387 | ||||
| 7388 | switch (cfg.dtype) { | |||
| 7389 | case NVME_DIRECTIVE_DTYPE_IDENTIFY: | |||
| 7390 | switch (cfg.doper) { | |||
| 7391 | case NVME_DIRECTIVE_SEND_IDENTIFY_DOPER_ENDIR: | |||
| 7392 | if (!cfg.ttype) { | |||
| 7393 | nvme_show_error("target-dir required param\n")nvme_show_message(1, "target-dir required param\n"); | |||
| 7394 | return -EINVAL22; | |||
| 7395 | } | |||
| 7396 | dw12 = cfg.ttype << 8 | cfg.endir; | |||
| 7397 | break; | |||
| 7398 | default: | |||
| 7399 | nvme_show_error("invalid directive operations for Identify Directives")nvme_show_message(1, "invalid directive operations for Identify Directives" ); | |||
| 7400 | return -EINVAL22; | |||
| 7401 | } | |||
| 7402 | break; | |||
| 7403 | case NVME_DIRECTIVE_DTYPE_STREAMS: | |||
| 7404 | switch (cfg.doper) { | |||
| 7405 | case NVME_DIRECTIVE_SEND_STREAMS_DOPER_RELEASE_IDENTIFIER: | |||
| 7406 | case NVME_DIRECTIVE_SEND_STREAMS_DOPER_RELEASE_RESOURCE: | |||
| 7407 | break; | |||
| 7408 | default: | |||
| 7409 | nvme_show_error("invalid directive operations for Streams Directives")nvme_show_message(1, "invalid directive operations for Streams Directives" ); | |||
| 7410 | return -EINVAL22; | |||
| 7411 | } | |||
| 7412 | break; | |||
| 7413 | default: | |||
| 7414 | nvme_show_error("invalid directive type")nvme_show_message(1, "invalid directive type"); | |||
| 7415 | return -EINVAL22; | |||
| 7416 | } | |||
| 7417 | ||||
| 7418 | if (cfg.data_len) { | |||
| 7419 | buf = libnvme_alloc(cfg.data_len); | |||
| 7420 | if (!buf) | |||
| 7421 | return -ENOMEM12; | |||
| 7422 | } | |||
| 7423 | ||||
| 7424 | if (buf) { | |||
| 7425 | if (strlen(cfg.file)) { | |||
| 7426 | ffd = open(cfg.file, O_RDONLY00); | |||
| 7427 | if (ffd <= 0) { | |||
| 7428 | nvme_show_error("Failed to open file %s: %s",nvme_show_message(1, "Failed to open file %s: %s", cfg.file, libnvme_strerror ((*__errno_location ()))) | |||
| 7429 | cfg.file, libnvme_strerror(errno))nvme_show_message(1, "Failed to open file %s: %s", cfg.file, libnvme_strerror ((*__errno_location ()))); | |||
| 7430 | return -EINVAL22; | |||
| 7431 | } | |||
| 7432 | } | |||
| 7433 | err = read(ffd, (void *)buf, cfg.data_len); | |||
| 7434 | if (err < 0) { | |||
| 7435 | nvme_show_error(nvme_show_message(1, "failed to read data buffer from input file %s" , libnvme_strerror((*__errno_location ()))) | |||
| 7436 | "failed to read data buffer from input file %s",nvme_show_message(1, "failed to read data buffer from input file %s" , libnvme_strerror((*__errno_location ()))) | |||
| 7437 | libnvme_strerror(errno))nvme_show_message(1, "failed to read data buffer from input file %s" , libnvme_strerror((*__errno_location ()))); | |||
| 7438 | return -errno(*__errno_location ()); | |||
| 7439 | } | |||
| 7440 | } | |||
| 7441 | ||||
| 7442 | nvme_init_directive_send(&cmd, cfg.namespace_id, cfg.doper, cfg.dtype, | |||
| 7443 | cfg.dspec, buf, cfg.data_len); | |||
| 7444 | cmd.cdw12 = dw12; | |||
| 7445 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 7446 | if (err) { | |||
| 7447 | nvme_show_err(err, "dir-send"); | |||
| 7448 | return err; | |||
| 7449 | } | |||
| 7450 | ||||
| 7451 | printf( | |||
| 7452 | "%s: type %#x, operation %#x, spec_val %#x, nsid %#x, result %#" | |||
| 7453 | PRIx64"l" "x" "\n", __func__, cfg.dtype, cfg.doper, cfg.dspec, | |||
| 7454 | cfg.namespace_id, (uint64_t)cmd.result); | |||
| 7455 | ||||
| 7456 | if (buf) { | |||
| 7457 | if (!cfg.raw_binary) | |||
| 7458 | d(buf, cfg.data_len, 16, 1); | |||
| 7459 | else | |||
| 7460 | d_raw(buf, cfg.data_len); | |||
| 7461 | } | |||
| 7462 | ||||
| 7463 | return err; | |||
| 7464 | } | |||
| 7465 | ||||
| 7466 | static int write_uncor(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 7467 | { | |||
| 7468 | const char *desc = | |||
| 7469 | "The Write Uncorrectable command is used to set a range of logical blocks to invalid."; | |||
| 7470 | ||||
| 7471 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 7472 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 7473 | struct libnvme_passthru_cmd cmd; | |||
| 7474 | int err; | |||
| 7475 | ||||
| 7476 | struct config { | |||
| 7477 | __u32 namespace_id; | |||
| 7478 | __u64 start_block; | |||
| 7479 | __u16 block_count; | |||
| 7480 | __u8 dtype; | |||
| 7481 | __u16 dspec; | |||
| 7482 | }; | |||
| 7483 | ||||
| 7484 | struct config cfg = { | |||
| 7485 | .namespace_id = 0, | |||
| 7486 | .start_block = 0, | |||
| 7487 | .block_count = 0, | |||
| 7488 | .dtype = 0, | |||
| 7489 | .dspec = 0, | |||
| 7490 | }; | |||
| 7491 | ||||
| 7492 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7493 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7494 | OPT_SUFFIX("start-block", 's', &cfg.start_block, start_block),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7495 | OPT_SHRT("block-count", 'c', &cfg.block_count, block_count),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7496 | OPT_BYTE("dir-type", 'T', &cfg.dtype, dtype),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7497 | OPT_SHRT("dir-spec", 'S', &cfg.dspec, dspec_w_dtype))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 7498 | ||||
| 7499 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 7500 | if (err) | |||
| 7501 | return err; | |||
| 7502 | ||||
| 7503 | if (!cfg.namespace_id) { | |||
| 7504 | err = libnvme_get_nsid(hdl, &cfg.namespace_id); | |||
| 7505 | if (err < 0) { | |||
| 7506 | nvme_show_error("get-namespace-id: %s", libnvme_strerror(-err))nvme_show_message(1, "get-namespace-id: %s", libnvme_strerror (-err)); | |||
| 7507 | return err; | |||
| 7508 | } | |||
| 7509 | } | |||
| 7510 | ||||
| 7511 | if (cfg.dtype > 0xf) { | |||
| 7512 | nvme_show_error("Invalid directive type, %x", cfg.dtype)nvme_show_message(1, "Invalid directive type, %x", cfg.dtype); | |||
| 7513 | return -EINVAL22; | |||
| 7514 | } | |||
| 7515 | ||||
| 7516 | nvme_init_write_uncorrectable(&cmd, cfg.namespace_id, cfg.start_block, | |||
| 7517 | cfg.block_count, cfg.dtype << 4, cfg.dspec); | |||
| 7518 | err = libnvme_exec_io_passthru(hdl, &cmd); | |||
| 7519 | if (err) { | |||
| 7520 | nvme_show_err(err, "write uncorrectable"); | |||
| 7521 | return err; | |||
| 7522 | } | |||
| 7523 | ||||
| 7524 | printf("NVME Write Uncorrectable Success\n"); | |||
| 7525 | ||||
| 7526 | return err; | |||
| 7527 | } | |||
| 7528 | ||||
| 7529 | static int invalid_tags(__u64 storage_tag, __u64 ref_tag, __u8 sts, __u8 pif) | |||
| 7530 | { | |||
| 7531 | int result = 0; | |||
| 7532 | ||||
| 7533 | if (sts < 64 && storage_tag >= (1LL << sts)) { | |||
| 7534 | nvme_show_error("Storage tag larger than storage tag size")nvme_show_message(1, "Storage tag larger than storage tag size" ); | |||
| 7535 | return 1; | |||
| 7536 | } | |||
| 7537 | ||||
| 7538 | switch (pif) { | |||
| 7539 | case NVME_NVM_PIF_16B_GUARD: | |||
| 7540 | if (ref_tag >= (1LL << (32 - sts))) | |||
| 7541 | result = 1; | |||
| 7542 | break; | |||
| 7543 | case NVME_NVM_PIF_32B_GUARD: | |||
| 7544 | if (sts > 16 && ref_tag >= (1LL << (80 - sts))) | |||
| 7545 | result = 1; | |||
| 7546 | break; | |||
| 7547 | case NVME_NVM_PIF_64B_GUARD: | |||
| 7548 | if (sts > 0 && ref_tag >= (1LL << (48 - sts))) | |||
| 7549 | result = 1; | |||
| 7550 | break; | |||
| 7551 | default: | |||
| 7552 | nvme_show_error("Invalid PIF")nvme_show_message(1, "Invalid PIF"); | |||
| 7553 | result = 1; | |||
| 7554 | break; | |||
| 7555 | } | |||
| 7556 | ||||
| 7557 | if (result) | |||
| 7558 | nvme_show_error("Reference tag larger than allowed by PIF")nvme_show_message(1, "Reference tag larger than allowed by PIF" ); | |||
| 7559 | ||||
| 7560 | return result; | |||
| 7561 | } | |||
| 7562 | ||||
| 7563 | static int check_lbstm_byte_granularity(__u64 lbstm, __u8 sts) | |||
| 7564 | { | |||
| 7565 | __u8 nr_full_bytes = sts / 8; | |||
| 7566 | __u8 nr_rem_bits = sts % 8; | |||
| 7567 | __u8 rem_mask, byte; | |||
| 7568 | __u8 i; | |||
| 7569 | ||||
| 7570 | if (sts > 64) | |||
| 7571 | return -EINVAL22; | |||
| 7572 | ||||
| 7573 | if (sts < 64) | |||
| 7574 | lbstm &= (1ULL << sts) - 1; | |||
| 7575 | ||||
| 7576 | for (i = 0; i < nr_full_bytes; i++) { | |||
| 7577 | byte = (lbstm >> (i * 8)) & 0xff; | |||
| 7578 | if (byte != 0x00 && byte != 0xff) | |||
| 7579 | return -EINVAL22; | |||
| 7580 | } | |||
| 7581 | ||||
| 7582 | if (nr_rem_bits) { | |||
| 7583 | rem_mask = (1u << nr_rem_bits) - 1; | |||
| 7584 | byte = (lbstm >> (nr_full_bytes * 8)) & rem_mask; | |||
| 7585 | if (byte != 0x00 && byte != rem_mask) | |||
| 7586 | return -EINVAL22; | |||
| 7587 | } | |||
| 7588 | ||||
| 7589 | return 0; | |||
| 7590 | } | |||
| 7591 | ||||
| 7592 | static int check_lbstm_masking_not_supported(__u64 lbstm, __u8 sts) | |||
| 7593 | { | |||
| 7594 | __u64 stm_mask; | |||
| 7595 | ||||
| 7596 | if (sts > 64) | |||
| 7597 | return -EINVAL22; | |||
| 7598 | ||||
| 7599 | stm_mask = (sts < 64) ? ((1ULL << sts) - 1) : ~0ULL; | |||
| 7600 | if ((lbstm & stm_mask) != stm_mask) | |||
| 7601 | return -EINVAL22; | |||
| 7602 | ||||
| 7603 | return 0; | |||
| 7604 | } | |||
| 7605 | ||||
| 7606 | static int get_pif_sts_via_qpif(struct nvme_nvm_id_ns *nvm_ns, __u32 elbaf, | |||
| 7607 | __u8 sts, __u8 *pif) | |||
| 7608 | { | |||
| 7609 | __u64 lbstm; | |||
| 7610 | int err = 0; | |||
| 7611 | ||||
| 7612 | *pif = NVME_NVM_ELBAF_QPIF(elbaf)(((elbaf) >> NVME_NVM_ELBAF_QPIF_SHIFT) & NVME_NVM_ELBAF_QPIF_MASK ); | |||
| 7613 | ||||
| 7614 | lbstm = le64_to_cpu(nvm_ns->lbstm); | |||
| 7615 | switch (NVME_NVM_PIFA_STMLA(nvm_ns->pifa)(((nvm_ns->pifa) >> NVME_NVM_PIFA_STMLA_SHIFT) & NVME_NVM_PIFA_STMLA_MASK)) { | |||
| 7616 | case NVME_NVM_PIFA_BIT_GRANULARITY_MASKING: | |||
| 7617 | break; | |||
| 7618 | case NVME_NVM_PIFA_BYTE_GRANULARITY_MASKING: | |||
| 7619 | err = check_lbstm_byte_granularity(lbstm, sts); | |||
| 7620 | break; | |||
| 7621 | case NVME_NVM_PIFA_MASKING_NOT_SUPPORTED: | |||
| 7622 | err = check_lbstm_masking_not_supported(lbstm, sts); | |||
| 7623 | break; | |||
| 7624 | default: | |||
| 7625 | err = -EINVAL22; | |||
| 7626 | break; | |||
| 7627 | } | |||
| 7628 | ||||
| 7629 | if (err) | |||
| 7630 | nvme_show_error("Logical Block Storage Tag Mask is inconsistent with the Storage Tag Masking Level Attribute")nvme_show_message(1, "Logical Block Storage Tag Mask is inconsistent with the Storage Tag Masking Level Attribute" ); | |||
| 7631 | ||||
| 7632 | return err; | |||
| 7633 | } | |||
| 7634 | ||||
| 7635 | static int get_pif_sts(struct nvme_id_ns *ns, struct nvme_nvm_id_ns *nvm_ns, | |||
| 7636 | __u8 *pif, __u8 *sts) | |||
| 7637 | { | |||
| 7638 | __u8 lba_index; | |||
| 7639 | __u32 elbaf; | |||
| 7640 | ||||
| 7641 | nvme_id_ns_flbas_to_lbaf_inuse(ns->flbas, &lba_index); | |||
| 7642 | elbaf = le32_to_cpu(nvm_ns->elbaf[lba_index]); | |||
| 7643 | *sts = NVME_NVM_ELBAF_STS(elbaf)(((elbaf) >> NVME_NVM_ELBAF_STS_SHIFT) & NVME_NVM_ELBAF_STS_MASK ); | |||
| 7644 | *pif = NVME_NVM_ELBAF_PIF(elbaf)(((elbaf) >> NVME_NVM_ELBAF_PIF_SHIFT) & NVME_NVM_ELBAF_PIF_MASK ); | |||
| 7645 | ||||
| 7646 | if (*pif == NVME_NVM_PIF_QTYPE && NVME_NVM_PIC_QPIFS(nvm_ns->pic)(((nvm_ns->pic) >> NVME_NVM_PIC_QPIFS_SHIFT) & NVME_NVM_PIC_QPIFS_MASK )) | |||
| 7647 | return get_pif_sts_via_qpif(nvm_ns, elbaf, *sts, pif); | |||
| 7648 | ||||
| 7649 | return 0; | |||
| 7650 | } | |||
| 7651 | ||||
| 7652 | static int get_pi_info(struct libnvme_transport_handle *hdl, | |||
| 7653 | __u32 nsid, __u8 prinfo, __u64 ilbrt, __u64 lbst, | |||
| 7654 | unsigned int *logical_block_size, __u16 *metadata_size) | |||
| 7655 | { | |||
| 7656 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_nvm_id_ns *nvm_ns = NULL((void*)0); | |||
| 7657 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ns *ns = NULL((void*)0); | |||
| 7658 | __u8 sts = 0, pif = 0; | |||
| 7659 | unsigned int lbs = 0; | |||
| 7660 | __u8 lba_index; | |||
| 7661 | int pi_size; | |||
| 7662 | __u16 ms; | |||
| 7663 | int err; | |||
| 7664 | ||||
| 7665 | ns = libnvme_alloc(sizeof(*ns)); | |||
| 7666 | if (!ns) | |||
| 7667 | return -ENOMEM12; | |||
| 7668 | ||||
| 7669 | err = nvme_identify_ns(hdl, nsid, ns); | |||
| 7670 | if (err) { | |||
| 7671 | nvme_show_err(err, "identify namespace"); | |||
| 7672 | return err; | |||
| 7673 | } | |||
| 7674 | ||||
| 7675 | nvme_id_ns_flbas_to_lbaf_inuse(ns->flbas, &lba_index); | |||
| 7676 | lbs = 1 << ns->lbaf[lba_index].ds; | |||
| 7677 | ms = le16_to_cpu(ns->lbaf[lba_index].ms); | |||
| 7678 | ||||
| 7679 | nvm_ns = libnvme_alloc(sizeof(*nvm_ns)); | |||
| 7680 | if (!nvm_ns) | |||
| 7681 | return -ENOMEM12; | |||
| 7682 | ||||
| 7683 | err = nvme_identify_csi_ns(hdl, nsid, NVME_CSI_NVM, 0, nvm_ns); | |||
| 7684 | if (!err) { | |||
| 7685 | err = get_pif_sts(ns, nvm_ns, &pif, &sts); | |||
| 7686 | if (err) | |||
| 7687 | return err; | |||
| 7688 | } else if (!nvme_status_equals(err, NVME_STATUS_TYPE_NVME, | |||
| 7689 | NVME_SC_INVALID_FIELD)) { | |||
| 7690 | /* | |||
| 7691 | * Ignore the invalid field error and skip get_pif_sts(). | |||
| 7692 | * Keep the I/O commands behavior same as before. | |||
| 7693 | * Since the error returned by drives unsupported. | |||
| 7694 | */ | |||
| 7695 | return NVME_SC_INVALID_FIELD; | |||
| 7696 | } | |||
| 7697 | ||||
| 7698 | pi_size = (pif == NVME_NVM_PIF_16B_GUARD) ? 8 : 16; | |||
| 7699 | if (NVME_FLBAS_META_EXT(ns->flbas)(((ns->flbas) >> NVME_FLBAS_META_EXT_SHIFT) & NVME_FLBAS_META_EXT_MASK )) { | |||
| 7700 | /* | |||
| 7701 | * No meta data is transferred for PRACT=1 and MD=PI size: | |||
| 7702 | * 5.2.2.1 Protection Information and Write Commands | |||
| 7703 | * 5.2.2.2 Protection Information and Read Commands | |||
| 7704 | */ | |||
| 7705 | if (!((prinfo & 0x8) != 0 && ms == pi_size)) | |||
| 7706 | lbs += ms; | |||
| 7707 | } | |||
| 7708 | ||||
| 7709 | if (invalid_tags(lbst, ilbrt, sts, pif)) | |||
| 7710 | return -EINVAL22; | |||
| 7711 | ||||
| 7712 | *logical_block_size = lbs; | |||
| 7713 | *metadata_size = ms; | |||
| 7714 | ||||
| 7715 | return 0; | |||
| 7716 | } | |||
| 7717 | ||||
| 7718 | static int init_pi_tags(struct libnvme_transport_handle *hdl, | |||
| 7719 | struct libnvme_passthru_cmd *cmd, __u32 nsid, __u64 ilbrt, __u64 lbst, | |||
| 7720 | __u16 lbat, __u16 lbatm) | |||
| 7721 | { | |||
| 7722 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_nvm_id_ns *nvm_ns = NULL((void*)0); | |||
| 7723 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ns *ns = NULL((void*)0); | |||
| 7724 | __u8 sts = 0, pif = 0; | |||
| 7725 | int err = 0; | |||
| 7726 | ||||
| 7727 | ns = libnvme_alloc(sizeof(*ns)); | |||
| 7728 | if (!ns) | |||
| 7729 | return -ENOMEM12; | |||
| 7730 | ||||
| 7731 | err = nvme_identify_ns(hdl, nsid, ns); | |||
| 7732 | if (err) { | |||
| 7733 | nvme_show_err(err, "identify namespace"); | |||
| 7734 | return err; | |||
| 7735 | } | |||
| 7736 | ||||
| 7737 | nvm_ns = libnvme_alloc(sizeof(*nvm_ns)); | |||
| 7738 | if (!nvm_ns) | |||
| 7739 | return -ENOMEM12; | |||
| 7740 | ||||
| 7741 | err = nvme_identify_csi_ns(hdl, nsid, NVME_CSI_NVM, 0, nvm_ns); | |||
| 7742 | if (!err) { | |||
| 7743 | err = get_pif_sts(ns, nvm_ns, &pif, &sts); | |||
| 7744 | if (err) | |||
| 7745 | return err; | |||
| 7746 | } else if (!nvme_status_equals(err, NVME_STATUS_TYPE_NVME, | |||
| 7747 | NVME_SC_INVALID_FIELD)) { | |||
| 7748 | /* | |||
| 7749 | * Ignore the invalid field error and skip get_pif_sts(). | |||
| 7750 | * Keep the I/O commands behavior same as before. | |||
| 7751 | * Since the error returned by drives unsupported. | |||
| 7752 | */ | |||
| 7753 | return NVME_SC_INVALID_FIELD; | |||
| 7754 | } | |||
| 7755 | ||||
| 7756 | if (invalid_tags(lbst, ilbrt, sts, pif)) | |||
| 7757 | return -EINVAL22; | |||
| 7758 | ||||
| 7759 | nvme_init_var_size_tags(cmd, pif, sts, ilbrt, lbst); | |||
| 7760 | nvme_init_app_tag(cmd, lbat, lbatm); | |||
| 7761 | ||||
| 7762 | return 0; | |||
| 7763 | } | |||
| 7764 | ||||
| 7765 | static int write_zeroes(int argc, char **argv, | |||
| 7766 | struct command *acmd, struct plugin *plugin) | |||
| 7767 | { | |||
| 7768 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 7769 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 7770 | struct libnvme_passthru_cmd cmd; | |||
| 7771 | __u16 control = 0; | |||
| 7772 | int err; | |||
| 7773 | ||||
| 7774 | const char *desc = | |||
| 7775 | "The Write Zeroes command is used to set a range of logical blocks to zero."; | |||
| 7776 | const char *deac = | |||
| 7777 | "Set DEAC bit, requesting controller to deallocate specified logical blocks"; | |||
| 7778 | const char *nsz = "Clear all logical blocks to zero in the entire namespace"; | |||
| 7779 | ||||
| 7780 | struct config { | |||
| 7781 | __u32 nsid; | |||
| 7782 | __u64 start_block; | |||
| 7783 | __u16 block_count; | |||
| 7784 | __u8 dtype; | |||
| 7785 | bool_Bool deac; | |||
| 7786 | bool_Bool limited_retry; | |||
| 7787 | bool_Bool force_unit_access; | |||
| 7788 | __u8 prinfo; | |||
| 7789 | __u64 ilbrt; | |||
| 7790 | __u16 lbatm; | |||
| 7791 | __u16 lbat; | |||
| 7792 | __u64 lbst; | |||
| 7793 | bool_Bool stc; | |||
| 7794 | __u16 dspec; | |||
| 7795 | bool_Bool nsz; | |||
| 7796 | }; | |||
| 7797 | ||||
| 7798 | struct config cfg = { | |||
| 7799 | .nsid = 0, | |||
| 7800 | .start_block = 0, | |||
| 7801 | .block_count = 0, | |||
| 7802 | .dtype = 0, | |||
| 7803 | .deac = false0, | |||
| 7804 | .limited_retry = false0, | |||
| 7805 | .force_unit_access = false0, | |||
| 7806 | .prinfo = 0, | |||
| 7807 | .ilbrt = 0, | |||
| 7808 | .lbatm = 0, | |||
| 7809 | .lbat = 0, | |||
| 7810 | .lbst = 0, | |||
| 7811 | .stc = false0, | |||
| 7812 | .dspec = 0, | |||
| 7813 | .nsz = false0, | |||
| 7814 | }; | |||
| 7815 | ||||
| 7816 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"deac", 'd', ((void*)0), CFG_FLAG, &cfg.deac, 0, deac, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, & cfg.limited_retry, 0, limited_retry, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, & cfg.lbatm, 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT , &cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'S', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-spec", 'D', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"namespace-zeroes", 'Z', ((void*)0), CFG_FLAG , &cfg.nsz, 0, nsz, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7817 | OPT_UINT("namespace-id", 'n', &cfg.nsid, namespace_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"deac", 'd', ((void*)0), CFG_FLAG, &cfg.deac, 0, deac, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, & cfg.limited_retry, 0, limited_retry, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, & cfg.lbatm, 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT , &cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'S', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-spec", 'D', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"namespace-zeroes", 'Z', ((void*)0), CFG_FLAG , &cfg.nsz, 0, nsz, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7818 | OPT_SUFFIX("start-block", 's', &cfg.start_block, start_block),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"deac", 'd', ((void*)0), CFG_FLAG, &cfg.deac, 0, deac, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, & cfg.limited_retry, 0, limited_retry, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, & cfg.lbatm, 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT , &cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'S', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-spec", 'D', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"namespace-zeroes", 'Z', ((void*)0), CFG_FLAG , &cfg.nsz, 0, nsz, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7819 | OPT_SHRT("block-count", 'c', &cfg.block_count, block_count),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"deac", 'd', ((void*)0), CFG_FLAG, &cfg.deac, 0, deac, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, & cfg.limited_retry, 0, limited_retry, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, & cfg.lbatm, 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT , &cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'S', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-spec", 'D', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"namespace-zeroes", 'Z', ((void*)0), CFG_FLAG , &cfg.nsz, 0, nsz, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7820 | OPT_BYTE("dir-type", 'T', &cfg.dtype, dtype),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"deac", 'd', ((void*)0), CFG_FLAG, &cfg.deac, 0, deac, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, & cfg.limited_retry, 0, limited_retry, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, & cfg.lbatm, 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT , &cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'S', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-spec", 'D', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"namespace-zeroes", 'Z', ((void*)0), CFG_FLAG , &cfg.nsz, 0, nsz, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7821 | OPT_FLAG("deac", 'd', &cfg.deac, deac),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"deac", 'd', ((void*)0), CFG_FLAG, &cfg.deac, 0, deac, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, & cfg.limited_retry, 0, limited_retry, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, & cfg.lbatm, 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT , &cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'S', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-spec", 'D', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"namespace-zeroes", 'Z', ((void*)0), CFG_FLAG , &cfg.nsz, 0, nsz, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7822 | OPT_FLAG("limited-retry", 'l', &cfg.limited_retry, limited_retry),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"deac", 'd', ((void*)0), CFG_FLAG, &cfg.deac, 0, deac, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, & cfg.limited_retry, 0, limited_retry, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, & cfg.lbatm, 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT , &cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'S', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-spec", 'D', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"namespace-zeroes", 'Z', ((void*)0), CFG_FLAG , &cfg.nsz, 0, nsz, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7823 | OPT_FLAG("force-unit-access", 'f', &cfg.force_unit_access, force_unit_access),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"deac", 'd', ((void*)0), CFG_FLAG, &cfg.deac, 0, deac, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, & cfg.limited_retry, 0, limited_retry, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, & cfg.lbatm, 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT , &cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'S', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-spec", 'D', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"namespace-zeroes", 'Z', ((void*)0), CFG_FLAG , &cfg.nsz, 0, nsz, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7824 | OPT_BYTE("prinfo", 'p', &cfg.prinfo, prinfo),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"deac", 'd', ((void*)0), CFG_FLAG, &cfg.deac, 0, deac, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, & cfg.limited_retry, 0, limited_retry, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, & cfg.lbatm, 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT , &cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'S', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-spec", 'D', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"namespace-zeroes", 'Z', ((void*)0), CFG_FLAG , &cfg.nsz, 0, nsz, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7825 | OPT_SUFFIX("ref-tag", 'r', &cfg.ilbrt, ref_tag),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"deac", 'd', ((void*)0), CFG_FLAG, &cfg.deac, 0, deac, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, & cfg.limited_retry, 0, limited_retry, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, & cfg.lbatm, 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT , &cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'S', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-spec", 'D', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"namespace-zeroes", 'Z', ((void*)0), CFG_FLAG , &cfg.nsz, 0, nsz, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7826 | OPT_SHRT("app-tag-mask", 'm', &cfg.lbatm, app_tag_mask),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"deac", 'd', ((void*)0), CFG_FLAG, &cfg.deac, 0, deac, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, & cfg.limited_retry, 0, limited_retry, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, & cfg.lbatm, 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT , &cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'S', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-spec", 'D', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"namespace-zeroes", 'Z', ((void*)0), CFG_FLAG , &cfg.nsz, 0, nsz, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7827 | OPT_SHRT("app-tag", 'a', &cfg.lbat, app_tag),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"deac", 'd', ((void*)0), CFG_FLAG, &cfg.deac, 0, deac, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, & cfg.limited_retry, 0, limited_retry, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, & cfg.lbatm, 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT , &cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'S', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-spec", 'D', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"namespace-zeroes", 'Z', ((void*)0), CFG_FLAG , &cfg.nsz, 0, nsz, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7828 | OPT_SUFFIX("storage-tag", 'S', &cfg.lbst, storage_tag),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"deac", 'd', ((void*)0), CFG_FLAG, &cfg.deac, 0, deac, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, & cfg.limited_retry, 0, limited_retry, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, & cfg.lbatm, 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT , &cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'S', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-spec", 'D', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"namespace-zeroes", 'Z', ((void*)0), CFG_FLAG , &cfg.nsz, 0, nsz, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7829 | OPT_FLAG("storage-tag-check", 'C', &cfg.stc, storage_tag_check),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"deac", 'd', ((void*)0), CFG_FLAG, &cfg.deac, 0, deac, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, & cfg.limited_retry, 0, limited_retry, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, & cfg.lbatm, 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT , &cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'S', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-spec", 'D', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"namespace-zeroes", 'Z', ((void*)0), CFG_FLAG , &cfg.nsz, 0, nsz, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7830 | OPT_SHRT("dir-spec", 'D', &cfg.dspec, dspec_w_dtype),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"deac", 'd', ((void*)0), CFG_FLAG, &cfg.deac, 0, deac, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, & cfg.limited_retry, 0, limited_retry, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, & cfg.lbatm, 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT , &cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'S', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-spec", 'D', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"namespace-zeroes", 'Z', ((void*)0), CFG_FLAG , &cfg.nsz, 0, nsz, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7831 | OPT_FLAG("namespace-zeroes", 'Z', &cfg.nsz, nsz))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"deac", 'd', ((void*)0), CFG_FLAG, &cfg.deac, 0, deac, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, & cfg.limited_retry, 0, limited_retry, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, & cfg.lbatm, 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT , &cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'S', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-spec", 'D', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"namespace-zeroes", 'Z', ((void*)0), CFG_FLAG , &cfg.nsz, 0, nsz, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 7832 | ||||
| 7833 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 7834 | if (err) | |||
| 7835 | return err; | |||
| 7836 | ||||
| 7837 | if (cfg.prinfo > 0xf) | |||
| 7838 | return -EINVAL22; | |||
| 7839 | ||||
| 7840 | if (cfg.dtype > 0x7) { | |||
| 7841 | nvme_show_error("Invalid directive type, %x", cfg.dtype)nvme_show_message(1, "Invalid directive type, %x", cfg.dtype); | |||
| 7842 | return -EINVAL22; | |||
| 7843 | } | |||
| 7844 | ||||
| 7845 | control |= (cfg.prinfo << 10); | |||
| 7846 | if (cfg.limited_retry) | |||
| 7847 | control |= NVME_IO_LR; | |||
| 7848 | if (cfg.force_unit_access) | |||
| 7849 | control |= NVME_IO_FUA; | |||
| 7850 | if (cfg.deac) | |||
| 7851 | control |= NVME_IO_DEAC; | |||
| 7852 | if (cfg.stc) | |||
| 7853 | control |= NVME_IO_STC; | |||
| 7854 | if (cfg.nsz) | |||
| 7855 | control |= NVME_IO_NSZ; | |||
| 7856 | control |= (cfg.dtype << 4); | |||
| 7857 | if (!cfg.nsid) { | |||
| 7858 | err = libnvme_get_nsid(hdl, &cfg.nsid); | |||
| 7859 | if (err < 0) { | |||
| 7860 | nvme_show_error("get-namespace-id: %s", libnvme_strerror(-err))nvme_show_message(1, "get-namespace-id: %s", libnvme_strerror (-err)); | |||
| 7861 | return err; | |||
| 7862 | } | |||
| 7863 | } | |||
| 7864 | ||||
| 7865 | nvme_init_write_zeros(&cmd, cfg.nsid, cfg.start_block, cfg.block_count, | |||
| 7866 | control, cfg.dspec, 0, 0); | |||
| 7867 | ||||
| 7868 | err = init_pi_tags(hdl, &cmd, cfg.nsid, cfg.ilbrt, cfg.lbst, cfg.lbat, | |||
| 7869 | cfg.lbatm); | |||
| 7870 | if (err && err != NVME_SC_INVALID_FIELD) | |||
| 7871 | return err; | |||
| 7872 | ||||
| 7873 | err = libnvme_exec_io_passthru(hdl, &cmd); | |||
| 7874 | if (err) { | |||
| 7875 | nvme_show_err(err, "write-zeroes"); | |||
| 7876 | return err; | |||
| 7877 | } | |||
| 7878 | ||||
| 7879 | printf("NVME Write Zeroes Success\n"); | |||
| 7880 | ||||
| 7881 | if (!cfg.nsz || !nvme_args.verbose) | |||
| 7882 | return err; | |||
| 7883 | ||||
| 7884 | if (cmd.result & 0x1) | |||
| 7885 | printf( | |||
| 7886 | "All logical blocks in the entire namespace cleared to zero\n"); | |||
| 7887 | else | |||
| 7888 | printf("%d logical blocks cleared to zero\n", cfg.block_count); | |||
| 7889 | ||||
| 7890 | return err; | |||
| 7891 | } | |||
| 7892 | ||||
| 7893 | static int dsm(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 7894 | { | |||
| 7895 | const char *desc = "The Dataset Management command is used by the host to\n" | |||
| 7896 | "indicate attributes for ranges of logical blocks. This includes attributes\n" | |||
| 7897 | "for discarding unused blocks, data read and write frequency, access size, and other\n" | |||
| 7898 | "information that may be used to optimize performance and reliability."; | |||
| 7899 | const char *blocks = "Comma separated list of the number of blocks in each range"; | |||
| 7900 | const char *starting_blocks = "Comma separated list of the starting block in each range"; | |||
| 7901 | const char *context_attrs = "Comma separated list of the context attributes in each range"; | |||
| 7902 | const char *ad = "Attribute Deallocate"; | |||
| 7903 | const char *idw = "Attribute Integral Dataset for Write"; | |||
| 7904 | const char *idr = "Attribute Integral Dataset for Read"; | |||
| 7905 | const char *cdw11 = "All the command DWORD 11 attributes. Use instead of specifying individual attributes"; | |||
| 7906 | ||||
| 7907 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 7908 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 7909 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_dsm_range *dsm = NULL((void*)0); | |||
| 7910 | struct libnvme_passthru_cmd cmd; | |||
| 7911 | __u32 ctx_attrs[NVME_DSM_MAX_RANGES] = {0,}; | |||
| 7912 | __u32 nlbs[NVME_DSM_MAX_RANGES] = {0,}; | |||
| 7913 | __u64 slbas[NVME_DSM_MAX_RANGES] = {0,}; | |||
| 7914 | nvme_print_flags_t flags; | |||
| 7915 | uint16_t nc, nb, ns; | |||
| 7916 | int err; | |||
| 7917 | ||||
| 7918 | struct config { | |||
| 7919 | __u32 namespace_id; | |||
| 7920 | char *ctx_attrs; | |||
| 7921 | char *blocks; | |||
| 7922 | char *slbas; | |||
| 7923 | bool_Bool ad; | |||
| 7924 | bool_Bool idw; | |||
| 7925 | bool_Bool idr; | |||
| 7926 | __u32 cdw11; | |||
| 7927 | }; | |||
| 7928 | ||||
| 7929 | struct config cfg = { | |||
| 7930 | .namespace_id = 0, | |||
| 7931 | .ctx_attrs = "", | |||
| 7932 | .blocks = "", | |||
| 7933 | .slbas = "", | |||
| 7934 | .ad = false0, | |||
| 7935 | .idw = false0, | |||
| 7936 | .idr = false0, | |||
| 7937 | .cdw11 = 0, | |||
| 7938 | }; | |||
| 7939 | ||||
| 7940 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"ctx-attrs", 'a', "LIST", CFG_STRING , &cfg.ctx_attrs, 1, context_attrs, 0, }, {"blocks", 'b', "LIST", CFG_STRING, &cfg.blocks, 1, blocks, 0, }, {"slbs" , 's', "LIST", CFG_STRING, &cfg.slbas, 1, starting_blocks , 0, }, {"ad", 'd', ((void*)0), CFG_FLAG, &cfg.ad, 0, ad, 0, }, {"idw", 'w', ((void*)0), CFG_FLAG, &cfg.idw, 0, idw , 0, }, {"idr", 'r', ((void*)0), CFG_FLAG, &cfg.idr, 0, idr , 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE, &cfg.cdw11, 1 , cdw11, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7941 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"ctx-attrs", 'a', "LIST", CFG_STRING , &cfg.ctx_attrs, 1, context_attrs, 0, }, {"blocks", 'b', "LIST", CFG_STRING, &cfg.blocks, 1, blocks, 0, }, {"slbs" , 's', "LIST", CFG_STRING, &cfg.slbas, 1, starting_blocks , 0, }, {"ad", 'd', ((void*)0), CFG_FLAG, &cfg.ad, 0, ad, 0, }, {"idw", 'w', ((void*)0), CFG_FLAG, &cfg.idw, 0, idw , 0, }, {"idr", 'r', ((void*)0), CFG_FLAG, &cfg.idr, 0, idr , 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE, &cfg.cdw11, 1 , cdw11, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7942 | OPT_LIST("ctx-attrs", 'a', &cfg.ctx_attrs, context_attrs),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"ctx-attrs", 'a', "LIST", CFG_STRING , &cfg.ctx_attrs, 1, context_attrs, 0, }, {"blocks", 'b', "LIST", CFG_STRING, &cfg.blocks, 1, blocks, 0, }, {"slbs" , 's', "LIST", CFG_STRING, &cfg.slbas, 1, starting_blocks , 0, }, {"ad", 'd', ((void*)0), CFG_FLAG, &cfg.ad, 0, ad, 0, }, {"idw", 'w', ((void*)0), CFG_FLAG, &cfg.idw, 0, idw , 0, }, {"idr", 'r', ((void*)0), CFG_FLAG, &cfg.idr, 0, idr , 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE, &cfg.cdw11, 1 , cdw11, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7943 | OPT_LIST("blocks", 'b', &cfg.blocks, blocks),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"ctx-attrs", 'a', "LIST", CFG_STRING , &cfg.ctx_attrs, 1, context_attrs, 0, }, {"blocks", 'b', "LIST", CFG_STRING, &cfg.blocks, 1, blocks, 0, }, {"slbs" , 's', "LIST", CFG_STRING, &cfg.slbas, 1, starting_blocks , 0, }, {"ad", 'd', ((void*)0), CFG_FLAG, &cfg.ad, 0, ad, 0, }, {"idw", 'w', ((void*)0), CFG_FLAG, &cfg.idw, 0, idw , 0, }, {"idr", 'r', ((void*)0), CFG_FLAG, &cfg.idr, 0, idr , 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE, &cfg.cdw11, 1 , cdw11, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7944 | OPT_LIST("slbs", 's', &cfg.slbas, starting_blocks),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"ctx-attrs", 'a', "LIST", CFG_STRING , &cfg.ctx_attrs, 1, context_attrs, 0, }, {"blocks", 'b', "LIST", CFG_STRING, &cfg.blocks, 1, blocks, 0, }, {"slbs" , 's', "LIST", CFG_STRING, &cfg.slbas, 1, starting_blocks , 0, }, {"ad", 'd', ((void*)0), CFG_FLAG, &cfg.ad, 0, ad, 0, }, {"idw", 'w', ((void*)0), CFG_FLAG, &cfg.idw, 0, idw , 0, }, {"idr", 'r', ((void*)0), CFG_FLAG, &cfg.idr, 0, idr , 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE, &cfg.cdw11, 1 , cdw11, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7945 | OPT_FLAG("ad", 'd', &cfg.ad, ad),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"ctx-attrs", 'a', "LIST", CFG_STRING , &cfg.ctx_attrs, 1, context_attrs, 0, }, {"blocks", 'b', "LIST", CFG_STRING, &cfg.blocks, 1, blocks, 0, }, {"slbs" , 's', "LIST", CFG_STRING, &cfg.slbas, 1, starting_blocks , 0, }, {"ad", 'd', ((void*)0), CFG_FLAG, &cfg.ad, 0, ad, 0, }, {"idw", 'w', ((void*)0), CFG_FLAG, &cfg.idw, 0, idw , 0, }, {"idr", 'r', ((void*)0), CFG_FLAG, &cfg.idr, 0, idr , 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE, &cfg.cdw11, 1 , cdw11, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7946 | OPT_FLAG("idw", 'w', &cfg.idw, idw),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"ctx-attrs", 'a', "LIST", CFG_STRING , &cfg.ctx_attrs, 1, context_attrs, 0, }, {"blocks", 'b', "LIST", CFG_STRING, &cfg.blocks, 1, blocks, 0, }, {"slbs" , 's', "LIST", CFG_STRING, &cfg.slbas, 1, starting_blocks , 0, }, {"ad", 'd', ((void*)0), CFG_FLAG, &cfg.ad, 0, ad, 0, }, {"idw", 'w', ((void*)0), CFG_FLAG, &cfg.idw, 0, idw , 0, }, {"idr", 'r', ((void*)0), CFG_FLAG, &cfg.idr, 0, idr , 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE, &cfg.cdw11, 1 , cdw11, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7947 | OPT_FLAG("idr", 'r', &cfg.idr, idr),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"ctx-attrs", 'a', "LIST", CFG_STRING , &cfg.ctx_attrs, 1, context_attrs, 0, }, {"blocks", 'b', "LIST", CFG_STRING, &cfg.blocks, 1, blocks, 0, }, {"slbs" , 's', "LIST", CFG_STRING, &cfg.slbas, 1, starting_blocks , 0, }, {"ad", 'd', ((void*)0), CFG_FLAG, &cfg.ad, 0, ad, 0, }, {"idw", 'w', ((void*)0), CFG_FLAG, &cfg.idw, 0, idw , 0, }, {"idr", 'r', ((void*)0), CFG_FLAG, &cfg.idr, 0, idr , 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE, &cfg.cdw11, 1 , cdw11, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 7948 | OPT_UINT("cdw11", 'c', &cfg.cdw11, cdw11))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"ctx-attrs", 'a', "LIST", CFG_STRING , &cfg.ctx_attrs, 1, context_attrs, 0, }, {"blocks", 'b', "LIST", CFG_STRING, &cfg.blocks, 1, blocks, 0, }, {"slbs" , 's', "LIST", CFG_STRING, &cfg.slbas, 1, starting_blocks , 0, }, {"ad", 'd', ((void*)0), CFG_FLAG, &cfg.ad, 0, ad, 0, }, {"idw", 'w', ((void*)0), CFG_FLAG, &cfg.idw, 0, idw , 0, }, {"idr", 'r', ((void*)0), CFG_FLAG, &cfg.idr, 0, idr , 0, }, {"cdw11", 'c', "NUM", CFG_POSITIVE, &cfg.cdw11, 1 , cdw11, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 7949 | ||||
| 7950 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 7951 | if (err) | |||
| 7952 | return err; | |||
| 7953 | ||||
| 7954 | err = open_fallback_chardev(ctx, cfg.namespace_id, &hdl); | |||
| 7955 | if (err) | |||
| 7956 | return err; | |||
| 7957 | ||||
| 7958 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 7959 | if (err < 0) { | |||
| 7960 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 7961 | return err; | |||
| 7962 | } | |||
| 7963 | ||||
| 7964 | nc = argconfig_parse_comma_sep_array_u32(cfg.ctx_attrs, ctx_attrs, ARRAY_SIZE(ctx_attrs)(sizeof(ctx_attrs) / sizeof((ctx_attrs)[0]))); | |||
| 7965 | nb = argconfig_parse_comma_sep_array_u32(cfg.blocks, nlbs, ARRAY_SIZE(nlbs)(sizeof(nlbs) / sizeof((nlbs)[0]))); | |||
| 7966 | ns = argconfig_parse_comma_sep_array_u64(cfg.slbas, slbas, ARRAY_SIZE(slbas)(sizeof(slbas) / sizeof((slbas)[0]))); | |||
| 7967 | if ((nb != ns) || | |||
| 7968 | (argconfig_parse_seen(opts, "ctx-attrs") && nb != nc)) { | |||
| 7969 | nvme_show_error("No valid range definition provided")nvme_show_message(1, "No valid range definition provided"); | |||
| 7970 | return -EINVAL22; | |||
| 7971 | } | |||
| 7972 | if (!nb || nb > NVME_DSM_MAX_RANGES) { | |||
| 7973 | nvme_show_error("No range definition provided")nvme_show_message(1, "No range definition provided"); | |||
| 7974 | return -EINVAL22; | |||
| 7975 | } | |||
| 7976 | ||||
| 7977 | if (!cfg.namespace_id) { | |||
| 7978 | err = libnvme_get_nsid(hdl, &cfg.namespace_id); | |||
| 7979 | if (err < 0) { | |||
| 7980 | nvme_show_error("get-namespace-id: %s", libnvme_strerror(-err))nvme_show_message(1, "get-namespace-id: %s", libnvme_strerror (-err)); | |||
| 7981 | return err; | |||
| 7982 | } | |||
| 7983 | } | |||
| 7984 | if (cfg.cdw11) { | |||
| 7985 | cfg.ad = NVME_GET(cfg.cdw11, DSM_CDW11_AD)(((cfg.cdw11) >> NVME_DSM_CDW11_AD_SHIFT) & NVME_DSM_CDW11_AD_MASK ); | |||
| 7986 | cfg.idw = NVME_GET(cfg.cdw11, DSM_CDW11_IDW)(((cfg.cdw11) >> NVME_DSM_CDW11_IDW_SHIFT) & NVME_DSM_CDW11_IDW_MASK ); | |||
| 7987 | cfg.idr = NVME_GET(cfg.cdw11, DSM_CDW11_IDR)(((cfg.cdw11) >> NVME_DSM_CDW11_IDR_SHIFT) & NVME_DSM_CDW11_IDR_MASK ); | |||
| 7988 | } | |||
| 7989 | ||||
| 7990 | dsm = libnvme_alloc(sizeof(*dsm) * nb); | |||
| 7991 | if (!dsm) | |||
| 7992 | return -ENOMEM12; | |||
| 7993 | ||||
| 7994 | nvme_init_dsm_range(dsm, ctx_attrs, nlbs, slbas, nb); | |||
| 7995 | nvme_init_dsm(&cmd, cfg.namespace_id, nb, cfg.idr, cfg.idw, cfg.ad, dsm, | |||
| 7996 | sizeof(*dsm) * nb); | |||
| 7997 | err = libnvme_exec_io_passthru(hdl, &cmd); | |||
| 7998 | if (err) { | |||
| 7999 | nvme_show_err(err, "data-set management"); | |||
| 8000 | return err; | |||
| 8001 | } | |||
| 8002 | ||||
| 8003 | printf("NVMe DSM: success\n"); | |||
| 8004 | ||||
| 8005 | return err; | |||
| 8006 | } | |||
| 8007 | ||||
| 8008 | static int copy_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 8009 | { | |||
| 8010 | const char *desc = "The Copy command is used by the host to copy data\n" | |||
| 8011 | "from one or more source logical block ranges to a\n" | |||
| 8012 | "single consecutive destination logical block range."; | |||
| 8013 | const char *d_sdlba = "64-bit addr of first destination logical block"; | |||
| 8014 | const char *d_slbas = "64-bit addr of first block per range (comma-separated list)"; | |||
| 8015 | const char *d_nlbs = "number of blocks per range (comma-separated list, zeroes-based values)"; | |||
| 8016 | const char *d_snsids = "source namespace identifier per range (comma-separated list)"; | |||
| 8017 | const char *d_sopts = "source options per range (comma-separated list)"; | |||
| 8018 | const char *d_lr = "limited retry"; | |||
| 8019 | const char *d_fua = "force unit access"; | |||
| 8020 | const char *d_prinfor = "protection information and check field (read part)"; | |||
| 8021 | const char *d_prinfow = "protection information and check field (write part)"; | |||
| 8022 | const char *d_ilbrt = "initial lba reference tag (write part)"; | |||
| 8023 | const char *d_eilbrts = "expected lba reference tags (read part, comma-separated list)"; | |||
| 8024 | const char *d_lbat = "lba application tag (write part)"; | |||
| 8025 | const char *d_elbats = "expected lba application tags (read part, comma-separated list)"; | |||
| 8026 | const char *d_lbatm = "lba application tag mask (write part)"; | |||
| 8027 | const char *d_elbatms = "expected lba application tag masks (read part, comma-separated list)"; | |||
| 8028 | const char *d_dtype = "directive type (write part)"; | |||
| 8029 | const char *d_dspec = "directive specific (write part)"; | |||
| 8030 | const char *d_format = "source range entry format"; | |||
| 8031 | ||||
| 8032 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 8033 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 8034 | __u16 nr, nb, ns, nrts, natms, nats, nids; | |||
| 8035 | struct libnvme_passthru_cmd cmd; | |||
| 8036 | __u16 nlbs[256] = { 0 }; | |||
| 8037 | __u64 slbas[256] = { 0 }; | |||
| 8038 | __u32 snsids[256] = { 0 }; | |||
| 8039 | __u16 sopts[256] = { 0 }; | |||
| 8040 | int err; | |||
| 8041 | ||||
| 8042 | union { | |||
| 8043 | __u32 short_pi[256]; | |||
| 8044 | __u64 long_pi[256]; | |||
| 8045 | } eilbrts; | |||
| 8046 | ||||
| 8047 | __u16 elbatms[256] = { 0 }; | |||
| 8048 | __u16 elbats[256] = { 0 }; | |||
| 8049 | ||||
| 8050 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) union { | |||
| 8051 | struct nvme_copy_range_f0 f0[256]; | |||
| 8052 | struct nvme_copy_range_f1 f1[256]; | |||
| 8053 | struct nvme_copy_range_f2 f2[256]; | |||
| 8054 | struct nvme_copy_range_f3 f3[256]; | |||
| 8055 | } *copy = NULL((void*)0); | |||
| 8056 | ||||
| 8057 | struct config { | |||
| 8058 | __u32 nsid; | |||
| 8059 | __u64 sdlba; | |||
| 8060 | char *slbas; | |||
| 8061 | char *nlbs; | |||
| 8062 | char *snsids; | |||
| 8063 | char *sopts; | |||
| 8064 | bool_Bool lr; | |||
| 8065 | bool_Bool fua; | |||
| 8066 | __u8 prinfow; | |||
| 8067 | __u8 prinfor; | |||
| 8068 | __u64 ilbrt; | |||
| 8069 | char *eilbrts; | |||
| 8070 | __u16 lbat; | |||
| 8071 | char *elbats; | |||
| 8072 | __u16 lbatm; | |||
| 8073 | char *elbatms; | |||
| 8074 | __u8 dtype; | |||
| 8075 | __u16 dspec; | |||
| 8076 | __u8 format; | |||
| 8077 | __u64 lbst; | |||
| 8078 | bool_Bool stc; | |||
| 8079 | }; | |||
| 8080 | ||||
| 8081 | struct config cfg = { | |||
| 8082 | .nsid = 0, | |||
| 8083 | .sdlba = 0, | |||
| 8084 | .slbas = "", | |||
| 8085 | .nlbs = "", | |||
| 8086 | .snsids = "", | |||
| 8087 | .sopts = "", | |||
| 8088 | .lr = false0, | |||
| 8089 | .fua = false0, | |||
| 8090 | .prinfow = 0, | |||
| 8091 | .prinfor = 0, | |||
| 8092 | .ilbrt = 0, | |||
| 8093 | .eilbrts = "", | |||
| 8094 | .lbat = 0, | |||
| 8095 | .elbats = "", | |||
| 8096 | .lbatm = 0, | |||
| 8097 | .elbatms = "", | |||
| 8098 | .dtype = 0, | |||
| 8099 | .dspec = 0, | |||
| 8100 | .format = 0, | |||
| 8101 | .lbst = 0, | |||
| 8102 | .stc = false0, | |||
| 8103 | }; | |||
| 8104 | ||||
| 8105 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8106 | OPT_UINT("namespace-id", 'n', &cfg.nsid, namespace_id_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8107 | OPT_SUFFIX("sdlba", 'd', &cfg.sdlba, d_sdlba),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8108 | OPT_LIST("slbs", 's', &cfg.slbas, d_slbas),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8109 | OPT_LIST("blocks", 'b', &cfg.nlbs, d_nlbs),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8110 | OPT_LIST("snsids", 'N', &cfg.snsids, d_snsids),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8111 | OPT_LIST("sopts", 'O', &cfg.sopts, d_sopts),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8112 | OPT_FLAG("limited-retry", 'l', &cfg.lr, d_lr),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8113 | OPT_FLAG("force-unit-access", 'f', &cfg.fua, d_fua),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8114 | OPT_BYTE("prinfow", 'p', &cfg.prinfow, d_prinfow),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8115 | OPT_BYTE("prinfor", 'P', &cfg.prinfor, d_prinfor),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8116 | OPT_SUFFIX("ref-tag", 'r', &cfg.ilbrt, d_ilbrt),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8117 | OPT_LIST("expected-ref-tags", 'R', &cfg.eilbrts, d_eilbrts),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8118 | OPT_SHRT("app-tag", 'a', &cfg.lbat, d_lbat),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8119 | OPT_LIST("expected-app-tags", 'A', &cfg.elbats, d_elbats),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8120 | OPT_SHRT("app-tag-mask", 'm', &cfg.lbatm, d_lbatm),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8121 | OPT_LIST("expected-app-tag-masks", 'M', &cfg.elbatms, d_elbatms),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8122 | OPT_BYTE("dir-type", 'T', &cfg.dtype, d_dtype),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8123 | OPT_SHRT("dir-spec", 'S', &cfg.dspec, d_dspec),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8124 | OPT_BYTE("format", 'F', &cfg.format, d_format),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8125 | OPT_SUFFIX("storage-tag", 't', &cfg.lbst, storage_tag),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 8126 | OPT_FLAG("storage-tag-check", 'c', &cfg.stc, storage_tag_check))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"sdlba", 'd', "IONUM", CFG_LONG_SUFFIX , &cfg.sdlba, 1, d_sdlba, 0, }, {"slbs", 's', "LIST", CFG_STRING , &cfg.slbas, 1, d_slbas, 0, }, {"blocks", 'b', "LIST", CFG_STRING , &cfg.nlbs, 1, d_nlbs, 0, }, {"snsids", 'N', "LIST", CFG_STRING , &cfg.snsids, 1, d_snsids, 0, }, {"sopts", 'O', "LIST", CFG_STRING , &cfg.sopts, 1, d_sopts, 0, }, {"limited-retry", 'l', (( void*)0), CFG_FLAG, &cfg.lr, 0, d_lr, 0, }, {"force-unit-access" , 'f', ((void*)0), CFG_FLAG, &cfg.fua, 0, d_fua, 0, }, {"prinfow" , 'p', "NUM", CFG_BYTE, &cfg.prinfow, 1, d_prinfow, 0, }, {"prinfor", 'P', "NUM", CFG_BYTE, &cfg.prinfor, 1, d_prinfor , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, d_ilbrt, 0, }, {"expected-ref-tags", 'R', "LIST", CFG_STRING , &cfg.eilbrts, 1, d_eilbrts, 0, }, {"app-tag", 'a', "NUM" , CFG_SHORT, &cfg.lbat, 1, d_lbat, 0, }, {"expected-app-tags" , 'A', "LIST", CFG_STRING, &cfg.elbats, 1, d_elbats, 0, } , {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm, 1, d_lbatm , 0, }, {"expected-app-tag-masks", 'M', "LIST", CFG_STRING, & cfg.elbatms, 1, d_elbatms, 0, }, {"dir-type", 'T', "NUM", CFG_BYTE , &cfg.dtype, 1, d_dtype, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT , &cfg.dspec, 1, d_dspec, 0, }, {"format", 'F', "NUM", CFG_BYTE , &cfg.format, 1, d_format, 0, }, {"storage-tag", 't', "IONUM" , CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, }, {"storage-tag-check" , 'c', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 8127 | ||||
| 8128 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 8129 | if (err) | |||
| 8130 | return err; | |||
| 8131 | ||||
| 8132 | nb = argconfig_parse_comma_sep_array_u16(cfg.nlbs, nlbs, | |||
| 8133 | ARRAY_SIZE(nlbs)(sizeof(nlbs) / sizeof((nlbs)[0]))); | |||
| 8134 | ns = argconfig_parse_comma_sep_array_u64(cfg.slbas, slbas, | |||
| 8135 | ARRAY_SIZE(slbas)(sizeof(slbas) / sizeof((slbas)[0]))); | |||
| 8136 | nids = argconfig_parse_comma_sep_array_u32(cfg.snsids, snsids, | |||
| 8137 | ARRAY_SIZE(snsids)(sizeof(snsids) / sizeof((snsids)[0]))); | |||
| 8138 | argconfig_parse_comma_sep_array_u16(cfg.sopts, sopts, | |||
| 8139 | ARRAY_SIZE(sopts)(sizeof(sopts) / sizeof((sopts)[0]))); | |||
| 8140 | ||||
| 8141 | switch (cfg.format) { | |||
| 8142 | case 0: | |||
| 8143 | case 2: | |||
| 8144 | nrts = argconfig_parse_comma_sep_array_u32(cfg.eilbrts, | |||
| 8145 | eilbrts.short_pi, ARRAY_SIZE(eilbrts.short_pi)(sizeof(eilbrts.short_pi) / sizeof((eilbrts.short_pi)[0]))); | |||
| 8146 | break; | |||
| 8147 | case 1: | |||
| 8148 | case 3: | |||
| 8149 | nrts = argconfig_parse_comma_sep_array_u64(cfg.eilbrts, | |||
| 8150 | eilbrts.long_pi, ARRAY_SIZE(eilbrts.long_pi)(sizeof(eilbrts.long_pi) / sizeof((eilbrts.long_pi)[0]))); | |||
| 8151 | break; | |||
| 8152 | default: | |||
| 8153 | nvme_show_error("invalid format")nvme_show_message(1, "invalid format"); | |||
| 8154 | return -EINVAL22; | |||
| 8155 | } | |||
| 8156 | ||||
| 8157 | natms = argconfig_parse_comma_sep_array_u16(cfg.elbatms, elbatms, | |||
| 8158 | ARRAY_SIZE(elbatms)(sizeof(elbatms) / sizeof((elbatms)[0]))); | |||
| 8159 | nats = argconfig_parse_comma_sep_array_u16(cfg.elbats, elbats, | |||
| 8160 | ARRAY_SIZE(elbats)(sizeof(elbats) / sizeof((elbats)[0]))); | |||
| 8161 | ||||
| 8162 | nr = max(nb, max(ns, max(nrts, max(natms, nats))))((nb) > (((ns) > (((nrts) > (((natms) > (nats) ? ( natms) : (nats))) ? (nrts) : (((natms) > (nats) ? (natms) : (nats))))) ? (ns) : (((nrts) > (((natms) > (nats) ? (natms ) : (nats))) ? (nrts) : (((natms) > (nats) ? (natms) : (nats ))))))) ? (nb) : (((ns) > (((nrts) > (((natms) > (nats ) ? (natms) : (nats))) ? (nrts) : (((natms) > (nats) ? (natms ) : (nats))))) ? (ns) : (((nrts) > (((natms) > (nats) ? (natms) : (nats))) ? (nrts) : (((natms) > (nats) ? (natms ) : (nats)))))))); | |||
| 8163 | if (cfg.format == 2 || cfg.format == 3) { | |||
| 8164 | if (nr != nids) { | |||
| 8165 | nvme_show_error("formats 2 and 3 require source namespace ids for each source range")nvme_show_message(1, "formats 2 and 3 require source namespace ids for each source range" ); | |||
| 8166 | return -EINVAL22; | |||
| 8167 | } | |||
| 8168 | } else if (nids) { | |||
| 8169 | nvme_show_error("formats 0 and 1 do not support cross-namespace copy")nvme_show_message(1, "formats 0 and 1 do not support cross-namespace copy" ); | |||
| 8170 | return -EINVAL22; | |||
| 8171 | } | |||
| 8172 | if (!nr || nr > 256) { | |||
| 8173 | nvme_show_error("invalid range")nvme_show_message(1, "invalid range"); | |||
| 8174 | return -EINVAL22; | |||
| 8175 | } | |||
| 8176 | ||||
| 8177 | if (!cfg.nsid) { | |||
| 8178 | err = libnvme_get_nsid(hdl, &cfg.nsid); | |||
| 8179 | if (err < 0) { | |||
| 8180 | nvme_show_error("get-namespace-id: %s", libnvme_strerror(-err))nvme_show_message(1, "get-namespace-id: %s", libnvme_strerror (-err)); | |||
| 8181 | return err; | |||
| 8182 | } | |||
| 8183 | } | |||
| 8184 | ||||
| 8185 | copy = libnvme_alloc(sizeof(*copy)); | |||
| 8186 | if (!copy) | |||
| 8187 | return -ENOMEM12; | |||
| 8188 | ||||
| 8189 | switch (cfg.format) { | |||
| 8190 | case 1: | |||
| 8191 | nvme_init_copy_range_f1(copy->f1, nlbs, slbas, eilbrts.long_pi, | |||
| 8192 | elbatms, elbats, nr); | |||
| 8193 | break; | |||
| 8194 | case 2: | |||
| 8195 | nvme_init_copy_range_f2(copy->f2, snsids, nlbs, slbas, sopts, | |||
| 8196 | eilbrts.short_pi, elbatms, elbats, nr); | |||
| 8197 | break; | |||
| 8198 | case 3: | |||
| 8199 | nvme_init_copy_range_f3(copy->f3, snsids, nlbs, slbas, sopts, | |||
| 8200 | eilbrts.long_pi, elbatms, elbats, nr); | |||
| 8201 | break; | |||
| 8202 | default: | |||
| 8203 | nvme_init_copy_range_f0(copy->f0, nlbs, slbas, eilbrts.short_pi, | |||
| 8204 | elbatms, elbats, nr); | |||
| 8205 | break; | |||
| 8206 | } | |||
| 8207 | ||||
| 8208 | nvme_init_copy(&cmd, cfg.nsid, cfg.sdlba, nr, cfg.format, | |||
| 8209 | cfg.prinfor, cfg.prinfow, 0, cfg.dtype, cfg.stc, cfg.stc, | |||
| 8210 | cfg.fua, cfg.lr, 0, cfg.dspec, copy->f0); | |||
| 8211 | err = init_pi_tags(hdl, &cmd, cfg.nsid, cfg.ilbrt, cfg.lbst, cfg.lbat, | |||
| 8212 | cfg.lbatm); | |||
| 8213 | if (err != 0 && err != NVME_SC_INVALID_FIELD) | |||
| 8214 | return err; | |||
| 8215 | err = libnvme_exec_io_passthru(hdl, &cmd); | |||
| 8216 | if (err) { | |||
| 8217 | nvme_show_err(err, "NVMe Copy"); | |||
| 8218 | return err; | |||
| 8219 | } | |||
| 8220 | ||||
| 8221 | nvme_show_key_value("NVMe Copy", "success"); | |||
| 8222 | ||||
| 8223 | return err; | |||
| 8224 | } | |||
| 8225 | ||||
| 8226 | static int flush_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 8227 | { | |||
| 8228 | const char *desc = "Commit data and metadata associated with\n" | |||
| 8229 | "given namespaces to nonvolatile media. Applies to all commands\n" | |||
| 8230 | "finished before the flush was submitted. Additional data may also be\n" | |||
| 8231 | "flushed by the controller, from any namespace, depending on controller and\n" | |||
| 8232 | "associated namespace status."; | |||
| 8233 | ||||
| 8234 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 8235 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 8236 | int err; | |||
| 8237 | ||||
| 8238 | struct config { | |||
| 8239 | __u32 namespace_id; | |||
| 8240 | }; | |||
| 8241 | ||||
| 8242 | struct config cfg = { | |||
| 8243 | .namespace_id = 0, | |||
| 8244 | }; | |||
| 8245 | ||||
| 8246 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8247 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 8248 | ||||
| 8249 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 8250 | if (err) | |||
| 8251 | return err; | |||
| 8252 | ||||
| 8253 | err = open_fallback_chardev(ctx, cfg.namespace_id, &hdl); | |||
| 8254 | if (err) | |||
| 8255 | return err; | |||
| 8256 | ||||
| 8257 | if (!cfg.namespace_id) { | |||
| 8258 | err = libnvme_get_nsid(hdl, &cfg.namespace_id); | |||
| 8259 | if (err < 0) { | |||
| 8260 | nvme_show_error("get-namespace-id: %s", libnvme_strerror(-err))nvme_show_message(1, "get-namespace-id: %s", libnvme_strerror (-err)); | |||
| 8261 | return err; | |||
| 8262 | } | |||
| 8263 | } | |||
| 8264 | ||||
| 8265 | err = nvme_flush(hdl, cfg.namespace_id); | |||
| 8266 | if (err) { | |||
| 8267 | nvme_show_err(err, "flush"); | |||
| 8268 | return err; | |||
| 8269 | } | |||
| 8270 | ||||
| 8271 | printf("NVMe Flush: success\n"); | |||
| 8272 | ||||
| 8273 | return err; | |||
| 8274 | } | |||
| 8275 | ||||
| 8276 | static int resv_acquire(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 8277 | { | |||
| 8278 | const char *desc = "Obtain a reservation on a given\n" | |||
| 8279 | "namespace. Only one reservation is allowed at a time on a\n" | |||
| 8280 | "given namespace, though multiple controllers may register\n" | |||
| 8281 | "with that namespace. Namespace reservation will abort with\n" | |||
| 8282 | "status Reservation Conflict if the given namespace is already reserved."; | |||
| 8283 | const char *prkey = "pre-empt reservation key"; | |||
| 8284 | const char *racqa = "reservation acquire action"; | |||
| 8285 | ||||
| 8286 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 8287 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 8288 | struct libnvme_passthru_cmd cmd; | |||
| 8289 | nvme_print_flags_t flags; | |||
| 8290 | __le64 payload[2]; | |||
| 8291 | int err; | |||
| 8292 | ||||
| 8293 | struct config { | |||
| 8294 | __u32 namespace_id; | |||
| 8295 | __u64 crkey; | |||
| 8296 | __u64 prkey; | |||
| 8297 | __u8 rtype; | |||
| 8298 | __u8 racqa; | |||
| 8299 | bool_Bool iekey; | |||
| 8300 | }; | |||
| 8301 | ||||
| 8302 | struct config cfg = { | |||
| 8303 | .namespace_id = 0, | |||
| 8304 | .crkey = 0, | |||
| 8305 | .prkey = 0, | |||
| 8306 | .rtype = 0, | |||
| 8307 | .racqa = 0, | |||
| 8308 | .iekey = false0, | |||
| 8309 | }; | |||
| 8310 | ||||
| 8311 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"prkey", 'p', "IONUM", CFG_LONG_SUFFIX , &cfg.prkey, 1, prkey, 0, }, {"rtype", 't', "NUM", CFG_BYTE , &cfg.rtype, 1, rtype, 0, }, {"racqa", 'a', "NUM", CFG_BYTE , &cfg.racqa, 1, racqa, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8312 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"prkey", 'p', "IONUM", CFG_LONG_SUFFIX , &cfg.prkey, 1, prkey, 0, }, {"rtype", 't', "NUM", CFG_BYTE , &cfg.rtype, 1, rtype, 0, }, {"racqa", 'a', "NUM", CFG_BYTE , &cfg.racqa, 1, racqa, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8313 | OPT_SUFFIX("crkey", 'c', &cfg.crkey, crkey),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"prkey", 'p', "IONUM", CFG_LONG_SUFFIX , &cfg.prkey, 1, prkey, 0, }, {"rtype", 't', "NUM", CFG_BYTE , &cfg.rtype, 1, rtype, 0, }, {"racqa", 'a', "NUM", CFG_BYTE , &cfg.racqa, 1, racqa, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8314 | OPT_SUFFIX("prkey", 'p', &cfg.prkey, prkey),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"prkey", 'p', "IONUM", CFG_LONG_SUFFIX , &cfg.prkey, 1, prkey, 0, }, {"rtype", 't', "NUM", CFG_BYTE , &cfg.rtype, 1, rtype, 0, }, {"racqa", 'a', "NUM", CFG_BYTE , &cfg.racqa, 1, racqa, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8315 | OPT_BYTE("rtype", 't', &cfg.rtype, rtype),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"prkey", 'p', "IONUM", CFG_LONG_SUFFIX , &cfg.prkey, 1, prkey, 0, }, {"rtype", 't', "NUM", CFG_BYTE , &cfg.rtype, 1, rtype, 0, }, {"racqa", 'a', "NUM", CFG_BYTE , &cfg.racqa, 1, racqa, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8316 | OPT_BYTE("racqa", 'a', &cfg.racqa, racqa),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"prkey", 'p', "IONUM", CFG_LONG_SUFFIX , &cfg.prkey, 1, prkey, 0, }, {"rtype", 't', "NUM", CFG_BYTE , &cfg.rtype, 1, rtype, 0, }, {"racqa", 'a', "NUM", CFG_BYTE , &cfg.racqa, 1, racqa, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8317 | OPT_FLAG("iekey", 'i', &cfg.iekey, iekey))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"prkey", 'p', "IONUM", CFG_LONG_SUFFIX , &cfg.prkey, 1, prkey, 0, }, {"rtype", 't', "NUM", CFG_BYTE , &cfg.rtype, 1, rtype, 0, }, {"racqa", 'a', "NUM", CFG_BYTE , &cfg.racqa, 1, racqa, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 8318 | ||||
| 8319 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 8320 | if (err) | |||
| 8321 | return err; | |||
| 8322 | ||||
| 8323 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 8324 | if (err < 0) { | |||
| 8325 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 8326 | return err; | |||
| 8327 | } | |||
| 8328 | ||||
| 8329 | if (!cfg.namespace_id) { | |||
| 8330 | err = libnvme_get_nsid(hdl, &cfg.namespace_id); | |||
| 8331 | if (err < 0) { | |||
| 8332 | nvme_show_error("get-namespace-id: %s", libnvme_strerror(-err))nvme_show_message(1, "get-namespace-id: %s", libnvme_strerror (-err)); | |||
| 8333 | return err; | |||
| 8334 | } | |||
| 8335 | } | |||
| 8336 | if (cfg.racqa > 7) { | |||
| 8337 | nvme_show_error("invalid racqa:%d", cfg.racqa)nvme_show_message(1, "invalid racqa:%d", cfg.racqa); | |||
| 8338 | return -EINVAL22; | |||
| 8339 | } | |||
| 8340 | ||||
| 8341 | nvme_init_resv_acquire(&cmd, cfg.namespace_id, cfg.racqa, cfg.iekey, | |||
| 8342 | false0, cfg.rtype, cfg.crkey, cfg.prkey, payload); | |||
| 8343 | err = libnvme_exec_io_passthru(hdl, &cmd); | |||
| 8344 | if (err) { | |||
| 8345 | nvme_show_err(err, "reservation acquire"); | |||
| 8346 | return err; | |||
| 8347 | } | |||
| 8348 | ||||
| 8349 | printf("NVME Reservation Acquire success\n"); | |||
| 8350 | ||||
| 8351 | return err; | |||
| 8352 | } | |||
| 8353 | ||||
| 8354 | static int resv_register(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 8355 | { | |||
| 8356 | const char *desc = "Register, de-register, or\n" | |||
| 8357 | "replace a controller's reservation on a given namespace.\n" | |||
| 8358 | "Only one reservation at a time is allowed on any namespace."; | |||
| 8359 | const char *nrkey = "new reservation key"; | |||
| 8360 | const char *rrega = "reservation registration action"; | |||
| 8361 | const char *cptpl = "change persistence through power loss setting"; | |||
| 8362 | ||||
| 8363 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 8364 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 8365 | struct libnvme_passthru_cmd cmd; | |||
| 8366 | nvme_print_flags_t flags; | |||
| 8367 | __le64 payload[2]; | |||
| 8368 | int err; | |||
| 8369 | ||||
| 8370 | struct config { | |||
| 8371 | __u32 namespace_id; | |||
| 8372 | __u64 crkey; | |||
| 8373 | __u64 nrkey; | |||
| 8374 | __u8 rrega; | |||
| 8375 | __u8 cptpl; | |||
| 8376 | bool_Bool iekey; | |||
| 8377 | }; | |||
| 8378 | ||||
| 8379 | struct config cfg = { | |||
| 8380 | .namespace_id = 0, | |||
| 8381 | .crkey = 0, | |||
| 8382 | .nrkey = 0, | |||
| 8383 | .rrega = 0, | |||
| 8384 | .cptpl = false0, | |||
| 8385 | }; | |||
| 8386 | ||||
| 8387 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"nrkey", 'k', "IONUM", CFG_LONG_SUFFIX , &cfg.nrkey, 1, nrkey, 0, }, {"rrega", 'r', "NUM", CFG_BYTE , &cfg.rrega, 1, rrega, 0, }, {"cptpl", 'p', "NUM", CFG_BYTE , &cfg.cptpl, 1, cptpl, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8388 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"nrkey", 'k', "IONUM", CFG_LONG_SUFFIX , &cfg.nrkey, 1, nrkey, 0, }, {"rrega", 'r', "NUM", CFG_BYTE , &cfg.rrega, 1, rrega, 0, }, {"cptpl", 'p', "NUM", CFG_BYTE , &cfg.cptpl, 1, cptpl, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8389 | OPT_SUFFIX("crkey", 'c', &cfg.crkey, crkey),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"nrkey", 'k', "IONUM", CFG_LONG_SUFFIX , &cfg.nrkey, 1, nrkey, 0, }, {"rrega", 'r', "NUM", CFG_BYTE , &cfg.rrega, 1, rrega, 0, }, {"cptpl", 'p', "NUM", CFG_BYTE , &cfg.cptpl, 1, cptpl, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8390 | OPT_SUFFIX("nrkey", 'k', &cfg.nrkey, nrkey),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"nrkey", 'k', "IONUM", CFG_LONG_SUFFIX , &cfg.nrkey, 1, nrkey, 0, }, {"rrega", 'r', "NUM", CFG_BYTE , &cfg.rrega, 1, rrega, 0, }, {"cptpl", 'p', "NUM", CFG_BYTE , &cfg.cptpl, 1, cptpl, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8391 | OPT_BYTE("rrega", 'r', &cfg.rrega, rrega),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"nrkey", 'k', "IONUM", CFG_LONG_SUFFIX , &cfg.nrkey, 1, nrkey, 0, }, {"rrega", 'r', "NUM", CFG_BYTE , &cfg.rrega, 1, rrega, 0, }, {"cptpl", 'p', "NUM", CFG_BYTE , &cfg.cptpl, 1, cptpl, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8392 | OPT_BYTE("cptpl", 'p', &cfg.cptpl, cptpl),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"nrkey", 'k', "IONUM", CFG_LONG_SUFFIX , &cfg.nrkey, 1, nrkey, 0, }, {"rrega", 'r', "NUM", CFG_BYTE , &cfg.rrega, 1, rrega, 0, }, {"cptpl", 'p', "NUM", CFG_BYTE , &cfg.cptpl, 1, cptpl, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8393 | OPT_FLAG("iekey", 'i', &cfg.iekey, iekey))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"nrkey", 'k', "IONUM", CFG_LONG_SUFFIX , &cfg.nrkey, 1, nrkey, 0, }, {"rrega", 'r', "NUM", CFG_BYTE , &cfg.rrega, 1, rrega, 0, }, {"cptpl", 'p', "NUM", CFG_BYTE , &cfg.cptpl, 1, cptpl, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 8394 | ||||
| 8395 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 8396 | if (err) | |||
| 8397 | return err; | |||
| 8398 | ||||
| 8399 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 8400 | if (err < 0) { | |||
| 8401 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 8402 | return err; | |||
| 8403 | } | |||
| 8404 | ||||
| 8405 | if (!cfg.namespace_id) { | |||
| 8406 | err = libnvme_get_nsid(hdl, &cfg.namespace_id); | |||
| 8407 | if (err < 0) { | |||
| 8408 | nvme_show_error("get-namespace-id: %s", libnvme_strerror(-err))nvme_show_message(1, "get-namespace-id: %s", libnvme_strerror (-err)); | |||
| 8409 | return err; | |||
| 8410 | } | |||
| 8411 | } | |||
| 8412 | if (cfg.cptpl > 3) { | |||
| 8413 | nvme_show_error("invalid cptpl:%d", cfg.cptpl)nvme_show_message(1, "invalid cptpl:%d", cfg.cptpl); | |||
| 8414 | return -EINVAL22; | |||
| 8415 | } | |||
| 8416 | ||||
| 8417 | if (cfg.rrega > 7) { | |||
| 8418 | nvme_show_error("invalid rrega:%d", cfg.rrega)nvme_show_message(1, "invalid rrega:%d", cfg.rrega); | |||
| 8419 | return -EINVAL22; | |||
| 8420 | } | |||
| 8421 | ||||
| 8422 | nvme_init_resv_register(&cmd, cfg.namespace_id, cfg.rrega, cfg.iekey, | |||
| 8423 | false0, cfg.cptpl, cfg.crkey, cfg.nrkey, | |||
| 8424 | payload); | |||
| 8425 | err = libnvme_exec_io_passthru(hdl, &cmd); | |||
| 8426 | if (err) { | |||
| 8427 | nvme_show_err(err, "reservation register"); | |||
| 8428 | return err; | |||
| 8429 | } | |||
| 8430 | ||||
| 8431 | printf("NVME Reservation success\n"); | |||
| 8432 | ||||
| 8433 | return err; | |||
| 8434 | } | |||
| 8435 | ||||
| 8436 | static int resv_release(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 8437 | { | |||
| 8438 | const char *desc = "Releases reservation held on a\n" | |||
| 8439 | "namespace by the given controller. If rtype != current reservation\n" | |||
| 8440 | "type, release will fails. If the given controller holds no\n" | |||
| 8441 | "reservation on the namespace or is not the namespace's current\n" | |||
| 8442 | "reservation holder, the release command completes with no\n" | |||
| 8443 | "effect. If the reservation type is not Write Exclusive or\n" | |||
| 8444 | "Exclusive Access, all registrants on the namespace except\n" | |||
| 8445 | "the issuing controller are notified."; | |||
| 8446 | const char *rrela = "reservation release action"; | |||
| 8447 | ||||
| 8448 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 8449 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 8450 | struct libnvme_passthru_cmd cmd; | |||
| 8451 | nvme_print_flags_t flags; | |||
| 8452 | __le64 payload[1]; | |||
| 8453 | int err; | |||
| 8454 | ||||
| 8455 | struct config { | |||
| 8456 | __u32 nsid; | |||
| 8457 | __u64 crkey; | |||
| 8458 | __u8 rtype; | |||
| 8459 | __u8 rrela; | |||
| 8460 | __u8 iekey; | |||
| 8461 | }; | |||
| 8462 | ||||
| 8463 | struct config cfg = { | |||
| 8464 | .nsid = 0, | |||
| 8465 | .crkey = 0, | |||
| 8466 | .rtype = 0, | |||
| 8467 | .rrela = 0, | |||
| 8468 | .iekey = 0, | |||
| 8469 | }; | |||
| 8470 | ||||
| 8471 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"rtype", 't', "NUM", CFG_BYTE , &cfg.rtype, 1, rtype, 0, }, {"rrela", 'a', "NUM", CFG_BYTE , &cfg.rrela, 1, rrela, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8472 | OPT_UINT("namespace-id", 'n', &cfg.nsid, namespace_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"rtype", 't', "NUM", CFG_BYTE , &cfg.rtype, 1, rtype, 0, }, {"rrela", 'a', "NUM", CFG_BYTE , &cfg.rrela, 1, rrela, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8473 | OPT_SUFFIX("crkey", 'c', &cfg.crkey, crkey),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"rtype", 't', "NUM", CFG_BYTE , &cfg.rtype, 1, rtype, 0, }, {"rrela", 'a', "NUM", CFG_BYTE , &cfg.rrela, 1, rrela, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8474 | OPT_BYTE("rtype", 't', &cfg.rtype, rtype),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"rtype", 't', "NUM", CFG_BYTE , &cfg.rtype, 1, rtype, 0, }, {"rrela", 'a', "NUM", CFG_BYTE , &cfg.rrela, 1, rrela, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8475 | OPT_BYTE("rrela", 'a', &cfg.rrela, rrela),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"rtype", 't', "NUM", CFG_BYTE , &cfg.rtype, 1, rtype, 0, }, {"rrela", 'a', "NUM", CFG_BYTE , &cfg.rrela, 1, rrela, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8476 | OPT_FLAG("iekey", 'i', &cfg.iekey, iekey))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"crkey", 'c', "IONUM", CFG_LONG_SUFFIX , &cfg.crkey, 1, crkey, 0, }, {"rtype", 't', "NUM", CFG_BYTE , &cfg.rtype, 1, rtype, 0, }, {"rrela", 'a', "NUM", CFG_BYTE , &cfg.rrela, 1, rrela, 0, }, {"iekey", 'i', ((void*)0), CFG_FLAG , &cfg.iekey, 0, iekey, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 8477 | ||||
| 8478 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 8479 | if (err) | |||
| 8480 | return err; | |||
| 8481 | ||||
| 8482 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 8483 | if (err < 0) { | |||
| 8484 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 8485 | return err; | |||
| 8486 | } | |||
| 8487 | ||||
| 8488 | if (!cfg.nsid) { | |||
| 8489 | err = libnvme_get_nsid(hdl, &cfg.nsid); | |||
| 8490 | if (err < 0) { | |||
| 8491 | nvme_show_error("get-namespace-id: %s", libnvme_strerror(-err))nvme_show_message(1, "get-namespace-id: %s", libnvme_strerror (-err)); | |||
| 8492 | return err; | |||
| 8493 | } | |||
| 8494 | } | |||
| 8495 | if (cfg.rrela > 7) { | |||
| 8496 | nvme_show_error("invalid rrela:%d", cfg.rrela)nvme_show_message(1, "invalid rrela:%d", cfg.rrela); | |||
| 8497 | return -EINVAL22; | |||
| 8498 | } | |||
| 8499 | ||||
| 8500 | nvme_init_resv_release(&cmd, cfg.nsid, cfg.rrela, cfg.iekey, false0, | |||
| 8501 | cfg.rtype, cfg.crkey, payload); | |||
| 8502 | err = libnvme_exec_io_passthru(hdl, &cmd); | |||
| 8503 | if (err) { | |||
| 8504 | nvme_show_err(err, "reservation release"); | |||
| 8505 | return err; | |||
| 8506 | } | |||
| 8507 | ||||
| 8508 | printf("NVME Reservation Release success\n"); | |||
| 8509 | ||||
| 8510 | return err; | |||
| 8511 | } | |||
| 8512 | ||||
| 8513 | static int resv_report(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 8514 | { | |||
| 8515 | const char *desc = "Returns Reservation Status data\n" | |||
| 8516 | "structure describing any existing reservations on and the\n" | |||
| 8517 | "status of a given namespace. Namespace Reservation Status\n" | |||
| 8518 | "depends on the number of controllers registered for that namespace."; | |||
| 8519 | const char *numd = "number of dwords to transfer"; | |||
| 8520 | const char *eds = "request extended data structure"; | |||
| 8521 | ||||
| 8522 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 8523 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 8524 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_resv_status *status = NULL((void*)0); | |||
| 8525 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_id_ctrl *ctrl = NULL((void*)0); | |||
| 8526 | struct libnvme_passthru_cmd cmd; | |||
| 8527 | nvme_print_flags_t flags; | |||
| 8528 | int err, size; | |||
| 8529 | ||||
| 8530 | struct config { | |||
| 8531 | __u32 nsid; | |||
| 8532 | __u32 numd; | |||
| 8533 | __u8 eds; | |||
| 8534 | bool_Bool raw_binary; | |||
| 8535 | }; | |||
| 8536 | ||||
| 8537 | struct config cfg = { | |||
| 8538 | .nsid = 0, | |||
| 8539 | .numd = 0, | |||
| 8540 | .eds = false0, | |||
| 8541 | .raw_binary = false0, | |||
| 8542 | }; | |||
| 8543 | ||||
| 8544 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"numd", 'd', "NUM", CFG_POSITIVE , &cfg.numd, 1, numd, 0, }, {"eds", 'e', ((void*)0), CFG_FLAG , &cfg.eds, 0, eds, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_dump, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8545 | OPT_UINT("namespace-id", 'n', &cfg.nsid, namespace_id_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"numd", 'd', "NUM", CFG_POSITIVE , &cfg.numd, 1, numd, 0, }, {"eds", 'e', ((void*)0), CFG_FLAG , &cfg.eds, 0, eds, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_dump, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8546 | OPT_UINT("numd", 'd', &cfg.numd, numd),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"numd", 'd', "NUM", CFG_POSITIVE , &cfg.numd, 1, numd, 0, }, {"eds", 'e', ((void*)0), CFG_FLAG , &cfg.eds, 0, eds, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_dump, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8547 | OPT_FLAG("eds", 'e', &cfg.eds, eds),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"numd", 'd', "NUM", CFG_POSITIVE , &cfg.numd, 1, numd, 0, }, {"eds", 'e', ((void*)0), CFG_FLAG , &cfg.eds, 0, eds, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_dump, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8548 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_dump))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"numd", 'd', "NUM", CFG_POSITIVE , &cfg.numd, 1, numd, 0, }, {"eds", 'e', ((void*)0), CFG_FLAG , &cfg.eds, 0, eds, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_dump, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 8549 | ||||
| 8550 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 8551 | if (err) | |||
| 8552 | return err; | |||
| 8553 | ||||
| 8554 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 8555 | if (err < 0) { | |||
| 8556 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 8557 | return err; | |||
| 8558 | } | |||
| 8559 | ||||
| 8560 | if (cfg.raw_binary) | |||
| 8561 | flags = BINARY; | |||
| 8562 | ||||
| 8563 | if (!cfg.nsid) { | |||
| 8564 | err = libnvme_get_nsid(hdl, &cfg.nsid); | |||
| 8565 | if (err < 0) { | |||
| 8566 | nvme_show_error("get-namespace-id: %s", libnvme_strerror(-err))nvme_show_message(1, "get-namespace-id: %s", libnvme_strerror (-err)); | |||
| 8567 | return err; | |||
| 8568 | } | |||
| 8569 | } | |||
| 8570 | ||||
| 8571 | if (!cfg.numd || cfg.numd >= (0x1000 >> 2)) | |||
| 8572 | cfg.numd = (0x1000 >> 2) - 1; | |||
| 8573 | if (cfg.numd < 3) | |||
| 8574 | cfg.numd = 3; | |||
| 8575 | ||||
| 8576 | size = (cfg.numd + 1) << 2; | |||
| 8577 | ||||
| 8578 | ctrl = libnvme_alloc(sizeof(*ctrl)); | |||
| 8579 | if (!ctrl) | |||
| 8580 | return -ENOMEM12; | |||
| 8581 | ||||
| 8582 | err = nvme_identify_ctrl(hdl, ctrl); | |||
| 8583 | if (err) { | |||
| 8584 | nvme_show_error("identify-ctrl: %s", libnvme_strerror(err))nvme_show_message(1, "identify-ctrl: %s", libnvme_strerror(err )); | |||
| 8585 | return -errno(*__errno_location ()); | |||
| 8586 | } | |||
| 8587 | ||||
| 8588 | if (ctrl->ctratt & NVME_CTRL_CTRATT_128_ID) | |||
| 8589 | cfg.eds = true1; | |||
| 8590 | ||||
| 8591 | status = libnvme_alloc(size); | |||
| 8592 | if (!status) | |||
| 8593 | return -ENOMEM12; | |||
| 8594 | ||||
| 8595 | nvme_init_resv_report(&cmd, cfg.nsid, cfg.eds, false0, status, size); | |||
| 8596 | err = libnvme_exec_io_passthru(hdl, &cmd); | |||
| 8597 | if (err) { | |||
| 8598 | nvme_show_err(err, "reservation report"); | |||
| 8599 | return err; | |||
| 8600 | } | |||
| 8601 | ||||
| 8602 | nvme_show_resv_report(status, size, cfg.eds, flags); | |||
| 8603 | ||||
| 8604 | return err; | |||
| 8605 | } | |||
| 8606 | ||||
| 8607 | unsigned long long elapsed_utime(struct timeval start_time, | |||
| 8608 | struct timeval end_time) | |||
| 8609 | { | |||
| 8610 | unsigned long long err = (end_time.tv_sec - start_time.tv_sec) * 1000000 + | |||
| 8611 | (end_time.tv_usec - start_time.tv_usec); | |||
| 8612 | return err; | |||
| 8613 | } | |||
| 8614 | ||||
| 8615 | static int submit_io(int opcode, char *command, const char *desc, int argc, char **argv) | |||
| 8616 | { | |||
| 8617 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 8618 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 8619 | unsigned long long buffer_size = 0, mbuffer_size = 0; | |||
| 8620 | __cleanup_free__attribute__((cleanup(freep))) struct nvme_nvm_id_ns *nvm_ns = NULL((void*)0); | |||
| 8621 | __cleanup_huge__attribute__((cleanup(libnvme_free_huge))) struct libnvme_mem_huge mh = { 0, }; | |||
| 8622 | __cleanup_free__attribute__((cleanup(freep))) struct nvme_id_ns *ns = NULL((void*)0); | |||
| 8623 | unsigned int logical_block_size = 0; | |||
| 8624 | struct timeval start_time, end_time; | |||
| 8625 | __cleanup_free__attribute__((cleanup(freep))) void *mbuffer = NULL((void*)0); | |||
| 8626 | __cleanup_fd__attribute__((cleanup(cleanup_fd))) int dfd = -1, mfd = -1; | |||
| 8627 | __u16 control = 0, nblocks = 0; | |||
| 8628 | struct libnvme_passthru_cmd cmd; | |||
| 8629 | __u8 sts = 0, pif = 0; | |||
| 8630 | bool_Bool pi_available; | |||
| 8631 | __u32 dsmgmt = 0; | |||
| 8632 | int mode = 0644; | |||
| 8633 | void *buffer; | |||
| 8634 | __u16 ms = 0; | |||
| 8635 | int err = 0; | |||
| 8636 | int flags; | |||
| 8637 | ||||
| 8638 | const char *start_block_addr = "64-bit addr of first block to access"; | |||
| 8639 | const char *block_size = "if specified, logical block size in bytes;\n" | |||
| 8640 | "discovered by identify namespace otherwise"; | |||
| 8641 | const char *data_size = "size of data in bytes"; | |||
| 8642 | const char *metadata_size = "size of metadata in bytes"; | |||
| 8643 | const char *data = "data file"; | |||
| 8644 | const char *metadata = "metadata file"; | |||
| 8645 | const char *limited_retry_num = "limit num. media access attempts"; | |||
| 8646 | const char *show = "show command before sending"; | |||
| 8647 | const char *dtype_for_write = "directive type (for write-only)"; | |||
| 8648 | const char *dspec = "directive specific (for write-only)"; | |||
| 8649 | const char *dsm = "dataset management attributes (lower 8 bits)"; | |||
| 8650 | const char *force = "The \"I know what I'm doing\" flag, do not enforce exclusive access for write"; | |||
| 8651 | ||||
| 8652 | struct config { | |||
| 8653 | __u32 nsid; | |||
| 8654 | __u64 start_block; | |||
| 8655 | __u16 block_count; | |||
| 8656 | __u16 block_size; | |||
| 8657 | __u64 data_size; | |||
| 8658 | __u64 metadata_size; | |||
| 8659 | __u64 ilbrt; | |||
| 8660 | char *data; | |||
| 8661 | char *metadata; | |||
| 8662 | __u8 prinfo; | |||
| 8663 | __u16 lbatm; | |||
| 8664 | __u16 lbat; | |||
| 8665 | __u64 lbst; | |||
| 8666 | bool_Bool limited_retry; | |||
| 8667 | bool_Bool force_unit_access; | |||
| 8668 | bool_Bool stc; | |||
| 8669 | __u8 dtype; | |||
| 8670 | __u16 dspec; | |||
| 8671 | __u8 dsmgmt; | |||
| 8672 | bool_Bool show; | |||
| 8673 | bool_Bool latency; | |||
| 8674 | bool_Bool force; | |||
| 8675 | }; | |||
| 8676 | ||||
| 8677 | struct config cfg = { | |||
| 8678 | .nsid = 0, | |||
| 8679 | .start_block = 0, | |||
| 8680 | .block_count = 0, | |||
| 8681 | .block_size = 0, | |||
| 8682 | .data_size = 0, | |||
| 8683 | .metadata_size = 0, | |||
| 8684 | .ilbrt = 0, | |||
| 8685 | .data = "", | |||
| 8686 | .metadata = "", | |||
| 8687 | .prinfo = 0, | |||
| 8688 | .lbatm = 0, | |||
| 8689 | .lbat = 0, | |||
| 8690 | .lbst = 0, | |||
| 8691 | .limited_retry = false0, | |||
| 8692 | .force_unit_access = false0, | |||
| 8693 | .stc = false0, | |||
| 8694 | .dtype = 0, | |||
| 8695 | .dspec = 0, | |||
| 8696 | .dsmgmt = 0, | |||
| 8697 | .show = false0, | |||
| 8698 | .latency = false0, | |||
| 8699 | .force = false0, | |||
| 8700 | }; | |||
| 8701 | ||||
| 8702 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8703 | OPT_UINT("namespace-id", 'n', &cfg.nsid, namespace_id_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8704 | OPT_SUFFIX("start-block", 's', &cfg.start_block, start_block_addr),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8705 | OPT_SHRT("block-count", 'c', &cfg.block_count, block_count),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8706 | OPT_SHRT("block-size", 'b', &cfg.block_size, block_size),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8707 | OPT_SUFFIX("data-size", 'z', &cfg.data_size, data_size),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8708 | OPT_SUFFIX("metadata-size", 'y', &cfg.metadata_size, metadata_size),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8709 | OPT_SUFFIX("ref-tag", 'r', &cfg.ilbrt, ref_tag),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8710 | OPT_FILE("data", 'd', &cfg.data, data),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8711 | OPT_FILE("metadata", 'M', &cfg.metadata, metadata),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8712 | OPT_BYTE("prinfo", 'p', &cfg.prinfo, prinfo),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8713 | OPT_SHRT("app-tag-mask", 'm', &cfg.lbatm, app_tag_mask),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8714 | OPT_SHRT("app-tag", 'a', &cfg.lbat, app_tag),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8715 | OPT_SUFFIX("storage-tag", 'g', &cfg.lbst, storage_tag),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8716 | OPT_FLAG("limited-retry", 'l', &cfg.limited_retry, limited_retry_num),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8717 | OPT_FLAG("force-unit-access", 'f', &cfg.force_unit_access, force_unit_access),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8718 | OPT_FLAG("storage-tag-check", 'C', &cfg.stc, storage_tag_check),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8719 | OPT_BYTE("dir-type", 'T', &cfg.dtype, dtype_for_write),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8720 | OPT_SHRT("dir-spec", 'S', &cfg.dspec, dspec),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8721 | OPT_BYTE("dsm", 'D', &cfg.dsmgmt, dsm),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8722 | OPT_FLAG("show-command", 'V', &cfg.show, show),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8723 | OPT_FLAG("latency", 't', &cfg.latency, latency),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 8724 | OPT_FLAG("force", 0, &cfg.force, force))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_id_desired, 0, }, {"start-block", 's', "IONUM" , CFG_LONG_SUFFIX, &cfg.start_block, 1, start_block_addr, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count , 1, block_count, 0, }, {"block-size", 'b', "NUM", CFG_SHORT, &cfg.block_size, 1, block_size, 0, }, {"data-size", 'z', "IONUM", CFG_LONG_SUFFIX, &cfg.data_size, 1, data_size, 0 , }, {"metadata-size", 'y', "IONUM", CFG_LONG_SUFFIX, &cfg .metadata_size, 1, metadata_size, 0, }, {"ref-tag", 'r', "IONUM" , CFG_LONG_SUFFIX, &cfg.ilbrt, 1, ref_tag, 0, }, {"data", 'd', "FILE", CFG_STRING, &cfg.data, 1, data, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT, &cfg.lbatm , 1, app_tag_mask, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, & cfg.lbat, 1, app_tag, 0, }, {"storage-tag", 'g', "IONUM", CFG_LONG_SUFFIX , &cfg.lbst, 1, storage_tag, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg.limited_retry, 0, limited_retry_num , 0, }, {"force-unit-access", 'f', ((void*)0), CFG_FLAG, & cfg.force_unit_access, 0, force_unit_access, 0, }, {"storage-tag-check" , 'C', ((void*)0), CFG_FLAG, &cfg.stc, 0, storage_tag_check , 0, }, {"dir-type", 'T', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype_for_write, 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, & cfg.dspec, 1, dspec, 0, }, {"dsm", 'D', "NUM", CFG_BYTE, & cfg.dsmgmt, 1, dsm, 0, }, {"show-command", 'V', ((void*)0), CFG_FLAG , &cfg.show, 0, show, 0, }, {"latency", 't', ((void*)0), CFG_FLAG , &cfg.latency, 0, latency, 0, }, {"force", 0, ((void*)0) , CFG_FLAG, &cfg.force, 0, force, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 8725 | ||||
| 8726 | if (opcode != nvme_cmd_write) { | |||
| 8727 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 8728 | if (err) | |||
| 8729 | return err; | |||
| 8730 | } else { | |||
| 8731 | err = parse_args(argc, argv, desc, opts); | |||
| 8732 | if (err) | |||
| 8733 | return err; | |||
| 8734 | err = open_exclusive(&ctx, &hdl, argc, argv, cfg.force, opts); | |||
| 8735 | if (err) { | |||
| 8736 | if (err == -EBUSY16) { | |||
| 8737 | fprintf(stderrstderr, "Failed to open %s.\n", basename__xpg_basename(argv[optind])); | |||
| 8738 | fprintf(stderrstderr, "Namespace is currently busy.\n"); | |||
| 8739 | if (!cfg.force) | |||
| 8740 | fprintf(stderrstderr, | |||
| 8741 | "Use the force [--force] option to ignore that.\n"); | |||
| 8742 | } else { | |||
| 8743 | argconfig_print_help(desc, opts); | |||
| 8744 | } | |||
| 8745 | return err; | |||
| 8746 | } | |||
| 8747 | } | |||
| 8748 | ||||
| 8749 | if (!cfg.nsid) { | |||
| 8750 | err = libnvme_get_nsid(hdl, &cfg.nsid); | |||
| 8751 | if (err < 0) { | |||
| 8752 | nvme_show_error("get-namespace-id: %s", libnvme_strerror(-err))nvme_show_message(1, "get-namespace-id: %s", libnvme_strerror (-err)); | |||
| 8753 | return err; | |||
| 8754 | } | |||
| 8755 | } | |||
| 8756 | ||||
| 8757 | if (cfg.prinfo > 0xf) | |||
| 8758 | return err; | |||
| 8759 | ||||
| 8760 | dsmgmt = cfg.dsmgmt; | |||
| 8761 | control |= (cfg.prinfo << 10); | |||
| 8762 | if (cfg.limited_retry) | |||
| 8763 | control |= NVME_IO_LR; | |||
| 8764 | if (cfg.force_unit_access) | |||
| 8765 | control |= NVME_IO_FUA; | |||
| 8766 | if (cfg.stc) | |||
| 8767 | control |= NVME_IO_STC; | |||
| 8768 | if (cfg.dtype) { | |||
| 8769 | if (cfg.dtype > 0xf) { | |||
| 8770 | nvme_show_error("Invalid directive type, %x", cfg.dtype)nvme_show_message(1, "Invalid directive type, %x", cfg.dtype); | |||
| 8771 | return -EINVAL22; | |||
| 8772 | } | |||
| 8773 | control |= cfg.dtype << 4; | |||
| 8774 | dsmgmt |= ((__u32)cfg.dspec) << 16; | |||
| 8775 | } | |||
| 8776 | ||||
| 8777 | if (opcode & 1) { | |||
| 8778 | dfd = mfd = STDIN_FILENO0; | |||
| 8779 | flags = O_RDONLY00; | |||
| 8780 | } else { | |||
| 8781 | dfd = mfd = STDOUT_FILENO1; | |||
| 8782 | flags = O_WRONLY01 | O_CREAT0100 | O_TRUNC01000; | |||
| 8783 | } | |||
| 8784 | ||||
| 8785 | if (strlen(cfg.data)) { | |||
| 8786 | dfd = nvme_open_rawdata(cfg.data, flags, mode)open((cfg.data), (flags), mode); | |||
| 8787 | if (dfd < 0) { | |||
| 8788 | nvme_show_perror(cfg.data); | |||
| 8789 | return -EINVAL22; | |||
| 8790 | } | |||
| 8791 | } | |||
| 8792 | ||||
| 8793 | if (strlen(cfg.metadata)) { | |||
| 8794 | mfd = nvme_open_rawdata(cfg.metadata, flags, mode)open((cfg.metadata), (flags), mode); | |||
| 8795 | if (mfd < 0) { | |||
| 8796 | nvme_show_perror(cfg.metadata); | |||
| 8797 | return -EINVAL22; | |||
| 8798 | } | |||
| 8799 | } | |||
| 8800 | ||||
| 8801 | if (!cfg.data_size) { | |||
| 8802 | nvme_show_error("data size not provided")nvme_show_message(1, "data size not provided"); | |||
| 8803 | return -EINVAL22; | |||
| 8804 | } | |||
| 8805 | ||||
| 8806 | if (cfg.block_size) { | |||
| 8807 | logical_block_size = cfg.block_size; | |||
| 8808 | ms = cfg.metadata_size; | |||
| 8809 | pi_available = true1; | |||
| 8810 | } else { | |||
| 8811 | err = get_pi_info(hdl, cfg.nsid, cfg.prinfo, | |||
| 8812 | cfg.ilbrt, cfg.lbst, &logical_block_size, &ms); | |||
| 8813 | pi_available = err == 0; | |||
| 8814 | } | |||
| 8815 | ||||
| 8816 | buffer_size = ((long long)cfg.block_count + 1) * logical_block_size; | |||
| 8817 | if (cfg.data_size < buffer_size) | |||
| 8818 | nvme_show_error("Rounding data size to fit block count (%lld bytes)", buffer_size)nvme_show_message(1, "Rounding data size to fit block count (%lld bytes)" , buffer_size); | |||
| 8819 | else | |||
| 8820 | buffer_size = cfg.data_size; | |||
| 8821 | ||||
| 8822 | if (argconfig_parse_seen(opts, "block-count")) { | |||
| 8823 | /* Use the value provided */ | |||
| 8824 | nblocks = cfg.block_count; | |||
| 8825 | } else { | |||
| 8826 | /* Get the required block count. Note this is a zeroes based value. */ | |||
| 8827 | nblocks = ((buffer_size + (logical_block_size - 1)) / logical_block_size) - 1; | |||
| 8828 | ||||
| 8829 | /* Update the data size based on the required block count */ | |||
| 8830 | buffer_size = ((unsigned long long)nblocks + 1) * logical_block_size; | |||
| 8831 | } | |||
| 8832 | ||||
| 8833 | buffer = libnvme_alloc_huge(buffer_size, &mh); | |||
| 8834 | if (!buffer) { | |||
| 8835 | nvme_show_error("failed to allocate huge memory")nvme_show_message(1, "failed to allocate huge memory"); | |||
| 8836 | return -ENOMEM12; | |||
| 8837 | } | |||
| 8838 | ||||
| 8839 | if (cfg.metadata_size) { | |||
| 8840 | mbuffer_size = ((unsigned long long)cfg.block_count + 1) * ms; | |||
| 8841 | if (ms && cfg.metadata_size < mbuffer_size) | |||
| 8842 | nvme_show_error("Rounding metadata size to fit block count (%lld bytes)",nvme_show_message(1, "Rounding metadata size to fit block count (%lld bytes)" , mbuffer_size) | |||
| 8843 | mbuffer_size)nvme_show_message(1, "Rounding metadata size to fit block count (%lld bytes)" , mbuffer_size); | |||
| 8844 | else | |||
| 8845 | mbuffer_size = cfg.metadata_size; | |||
| 8846 | ||||
| 8847 | mbuffer = malloc(mbuffer_size); | |||
| 8848 | if (!mbuffer) | |||
| 8849 | return -ENOMEM12; | |||
| 8850 | memset(mbuffer, 0, mbuffer_size); | |||
| 8851 | } | |||
| 8852 | ||||
| 8853 | if (opcode & 1) { | |||
| 8854 | err = read(dfd, (void *)buffer, cfg.data_size); | |||
| 8855 | if (err < 0) { | |||
| 8856 | err = -errno(*__errno_location ()); | |||
| 8857 | nvme_show_error("failed to read data buffer from input file %s", libnvme_strerror(errno))nvme_show_message(1, "failed to read data buffer from input file %s" , libnvme_strerror((*__errno_location ()))); | |||
| 8858 | return err; | |||
| 8859 | } | |||
| 8860 | } | |||
| 8861 | ||||
| 8862 | if ((opcode & 1) && cfg.metadata_size) { | |||
| 8863 | err = read(mfd, (void *)mbuffer, mbuffer_size); | |||
| 8864 | if (err < 0) { | |||
| 8865 | err = -errno(*__errno_location ()); | |||
| 8866 | nvme_show_error("failed to read meta-data buffer from input file %s", libnvme_strerror(errno))nvme_show_message(1, "failed to read meta-data buffer from input file %s" , libnvme_strerror((*__errno_location ()))); | |||
| 8867 | return err; | |||
| 8868 | } | |||
| 8869 | } | |||
| 8870 | ||||
| 8871 | if (cfg.show || nvme_args.dry_run) { | |||
| 8872 | printf("opcode : %02x\n", opcode); | |||
| 8873 | printf("nsid : %02x\n", cfg.nsid); | |||
| 8874 | printf("flags : %02x\n", 0); | |||
| 8875 | printf("control : %04x\n", control); | |||
| 8876 | printf("nblocks : %04x\n", nblocks); | |||
| 8877 | printf("metadata : %"PRIx64"l" "x""\n", (uint64_t)(uintptr_t)mbuffer); | |||
| 8878 | printf("addr : %"PRIx64"l" "x""\n", (uint64_t)(uintptr_t)buffer); | |||
| 8879 | printf("slba : %"PRIx64"l" "x""\n", (uint64_t)cfg.start_block); | |||
| 8880 | printf("dsmgmt : %08x\n", dsmgmt); | |||
| 8881 | printf("reftag : %"PRIx64"l" "x""\n", (uint64_t)cfg.ilbrt); | |||
| 8882 | printf("apptag : %04x\n", cfg.lbat); | |||
| 8883 | printf("appmask : %04x\n", cfg.lbatm); | |||
| 8884 | printf("storagetagcheck : %04x\n", cfg.stc); | |||
| 8885 | printf("storagetag : %"PRIx64"l" "x""\n", (uint64_t)cfg.lbst); | |||
| 8886 | printf("pif : %02x\n", pif); | |||
| 8887 | printf("sts : %02x\n", sts); | |||
| 8888 | } | |||
| 8889 | if (nvme_args.dry_run) | |||
| 8890 | return 0; | |||
| 8891 | ||||
| 8892 | nvme_init_io(&cmd, opcode, cfg.nsid, cfg.start_block, buffer, | |||
| 8893 | buffer_size, mbuffer, mbuffer_size); | |||
| 8894 | cmd.cdw12 = NVME_FIELD_ENCODE(nblocks,(((__u32)(nblocks) & (NVME_IOCS_COMMON_CDW12_NLB_MASK)) << (NVME_IOCS_COMMON_CDW12_NLB_SHIFT)) | |||
| 8895 | NVME_IOCS_COMMON_CDW12_NLB_SHIFT,(((__u32)(nblocks) & (NVME_IOCS_COMMON_CDW12_NLB_MASK)) << (NVME_IOCS_COMMON_CDW12_NLB_SHIFT)) | |||
| 8896 | NVME_IOCS_COMMON_CDW12_NLB_MASK)(((__u32)(nblocks) & (NVME_IOCS_COMMON_CDW12_NLB_MASK)) << (NVME_IOCS_COMMON_CDW12_NLB_SHIFT)) | | |||
| 8897 | NVME_FIELD_ENCODE(control,(((__u32)(control) & (NVME_IOCS_COMMON_CDW12_CONTROL_MASK )) << (NVME_IOCS_COMMON_CDW12_CONTROL_SHIFT)) | |||
| 8898 | NVME_IOCS_COMMON_CDW12_CONTROL_SHIFT,(((__u32)(control) & (NVME_IOCS_COMMON_CDW12_CONTROL_MASK )) << (NVME_IOCS_COMMON_CDW12_CONTROL_SHIFT)) | |||
| 8899 | NVME_IOCS_COMMON_CDW12_CONTROL_MASK)(((__u32)(control) & (NVME_IOCS_COMMON_CDW12_CONTROL_MASK )) << (NVME_IOCS_COMMON_CDW12_CONTROL_SHIFT)); | |||
| 8900 | cmd.cdw13 = NVME_FIELD_ENCODE(cfg.dspec,(((__u32)(cfg.dspec) & (NVME_IOCS_COMMON_CDW13_DSPEC_MASK )) << (NVME_IOCS_COMMON_CDW13_DSPEC_SHIFT)) | |||
| 8901 | NVME_IOCS_COMMON_CDW13_DSPEC_SHIFT,(((__u32)(cfg.dspec) & (NVME_IOCS_COMMON_CDW13_DSPEC_MASK )) << (NVME_IOCS_COMMON_CDW13_DSPEC_SHIFT)) | |||
| 8902 | NVME_IOCS_COMMON_CDW13_DSPEC_MASK)(((__u32)(cfg.dspec) & (NVME_IOCS_COMMON_CDW13_DSPEC_MASK )) << (NVME_IOCS_COMMON_CDW13_DSPEC_SHIFT)) | | |||
| 8903 | NVME_FIELD_ENCODE(cfg.dsmgmt,(((__u32)(cfg.dsmgmt) & (NVME_IOCS_COMMON_CDW13_DSM_MASK) ) << (NVME_IOCS_COMMON_CDW13_DSM_SHIFT)) | |||
| 8904 | NVME_IOCS_COMMON_CDW13_DSM_SHIFT,(((__u32)(cfg.dsmgmt) & (NVME_IOCS_COMMON_CDW13_DSM_MASK) ) << (NVME_IOCS_COMMON_CDW13_DSM_SHIFT)) | |||
| 8905 | NVME_IOCS_COMMON_CDW13_DSM_MASK)(((__u32)(cfg.dsmgmt) & (NVME_IOCS_COMMON_CDW13_DSM_MASK) ) << (NVME_IOCS_COMMON_CDW13_DSM_SHIFT)); | |||
| 8906 | if (pi_available) { | |||
| 8907 | err = init_pi_tags(hdl, &cmd, cfg.nsid, cfg.ilbrt, cfg.lbst, | |||
| 8908 | cfg.lbat, cfg.lbatm); | |||
| 8909 | if (err) | |||
| 8910 | return err; | |||
| 8911 | } | |||
| 8912 | gettimeofday(&start_time, NULL((void*)0)); | |||
| 8913 | err = libnvme_exec_io_passthru(hdl, &cmd); | |||
| 8914 | gettimeofday(&end_time, NULL((void*)0)); | |||
| 8915 | if (cfg.latency) | |||
| 8916 | printf(" latency: %s: %llu us\n", command, elapsed_utime(start_time, end_time)); | |||
| 8917 | if (err) { | |||
| 8918 | nvme_show_err(err, "submit-io"); | |||
| 8919 | return err; | |||
| 8920 | } | |||
| 8921 | ||||
| 8922 | if (!(opcode & 1) && write(dfd, (void *)buffer, buffer_size) < 0) { | |||
| 8923 | nvme_show_error(nvme_show_message(1, "write: %s: failed to write buffer to output file" , libnvme_strerror((*__errno_location ()))) | |||
| 8924 | "write: %s: failed to write buffer to output file",nvme_show_message(1, "write: %s: failed to write buffer to output file" , libnvme_strerror((*__errno_location ()))) | |||
| 8925 | libnvme_strerror(errno))nvme_show_message(1, "write: %s: failed to write buffer to output file" , libnvme_strerror((*__errno_location ()))); | |||
| 8926 | err = -EINVAL22; | |||
| 8927 | } else if (!(opcode & 1) && cfg.metadata_size && | |||
| 8928 | write(mfd, (void *)mbuffer, mbuffer_size) < 0) { | |||
| 8929 | nvme_show_error(nvme_show_message(1, "write: %s: failed to write meta-data buffer to output file" , libnvme_strerror((*__errno_location ()))) | |||
| 8930 | "write: %s: failed to write meta-data buffer to output file",nvme_show_message(1, "write: %s: failed to write meta-data buffer to output file" , libnvme_strerror((*__errno_location ()))) | |||
| 8931 | libnvme_strerror(errno))nvme_show_message(1, "write: %s: failed to write meta-data buffer to output file" , libnvme_strerror((*__errno_location ()))); | |||
| 8932 | err = -EINVAL22; | |||
| 8933 | } else { | |||
| 8934 | fprintf(stderrstderr, "%s: Success\n", command); | |||
| 8935 | } | |||
| 8936 | ||||
| 8937 | return err; | |||
| 8938 | } | |||
| 8939 | ||||
| 8940 | static int compare(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 8941 | { | |||
| 8942 | const char *desc = "Compare specified logical blocks on\n" | |||
| 8943 | "device with specified data buffer; return failure if buffer\n" | |||
| 8944 | "and block(s) are dissimilar"; | |||
| 8945 | ||||
| 8946 | return submit_io(nvme_cmd_compare, "compare", desc, argc, argv); | |||
| 8947 | } | |||
| 8948 | ||||
| 8949 | static int read_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 8950 | { | |||
| 8951 | const char *desc = "Copy specified logical blocks on the given\n" | |||
| 8952 | "device to specified data buffer (default buffer is stdout)."; | |||
| 8953 | ||||
| 8954 | return submit_io(nvme_cmd_read, "read", desc, argc, argv); | |||
| 8955 | } | |||
| 8956 | ||||
| 8957 | static int write_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 8958 | { | |||
| 8959 | const char *desc = "Copy from provided data buffer (default\n" | |||
| 8960 | "buffer is stdin) to specified logical blocks on the given device."; | |||
| 8961 | ||||
| 8962 | return submit_io(nvme_cmd_write, "write", desc, argc, argv); | |||
| 8963 | } | |||
| 8964 | ||||
| 8965 | static int verify_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 8966 | { | |||
| 8967 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 8968 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 8969 | struct libnvme_passthru_cmd cmd; | |||
| 8970 | __u16 control = 0; | |||
| 8971 | int err; | |||
| 8972 | ||||
| 8973 | const char *desc = "Verify specified logical blocks on the given device."; | |||
| 8974 | const char *force_unit_access_verify = | |||
| 8975 | "force device to commit cached data before performing the verify operation"; | |||
| 8976 | const char *storage_tag_check = | |||
| 8977 | "This bit specifies the Storage Tag field shall be checked as part of Verify operation"; | |||
| 8978 | ||||
| 8979 | struct config { | |||
| 8980 | __u32 nsid; | |||
| 8981 | __u64 start_block; | |||
| 8982 | __u16 block_count; | |||
| 8983 | bool_Bool limited_retry; | |||
| 8984 | bool_Bool force_unit_access; | |||
| 8985 | __u8 prinfo; | |||
| 8986 | __u32 ilbrt; | |||
| 8987 | __u16 lbat; | |||
| 8988 | __u16 lbatm; | |||
| 8989 | __u64 lbst; | |||
| 8990 | bool_Bool stc; | |||
| 8991 | }; | |||
| 8992 | ||||
| 8993 | struct config cfg = { | |||
| 8994 | .nsid = 0, | |||
| 8995 | .start_block = 0, | |||
| 8996 | .block_count = 0, | |||
| 8997 | .limited_retry = false0, | |||
| 8998 | .force_unit_access = false0, | |||
| 8999 | .prinfo = 0, | |||
| 9000 | .ilbrt = 0, | |||
| 9001 | .lbat = 0, | |||
| 9002 | .lbatm = 0, | |||
| 9003 | .lbst = 0, | |||
| 9004 | .stc = false0, | |||
| 9005 | }; | |||
| 9006 | ||||
| 9007 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg. limited_retry, 0, limited_retry, 0, }, {"force-unit-access", 'f' , ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access_verify , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, &cfg .lbat, 1, app_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT , &cfg.lbatm, 1, app_tag_mask, 0, }, {"storage-tag", 'S', "IONUM", CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, } , {"storage-tag-check", 'C', ((void*)0), CFG_FLAG, &cfg.stc , 0, storage_tag_check, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9008 | OPT_UINT("namespace-id", 'n', &cfg.nsid, namespace_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg. limited_retry, 0, limited_retry, 0, }, {"force-unit-access", 'f' , ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access_verify , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, &cfg .lbat, 1, app_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT , &cfg.lbatm, 1, app_tag_mask, 0, }, {"storage-tag", 'S', "IONUM", CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, } , {"storage-tag-check", 'C', ((void*)0), CFG_FLAG, &cfg.stc , 0, storage_tag_check, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9009 | OPT_SUFFIX("start-block", 's', &cfg.start_block, start_block),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg. limited_retry, 0, limited_retry, 0, }, {"force-unit-access", 'f' , ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access_verify , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, &cfg .lbat, 1, app_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT , &cfg.lbatm, 1, app_tag_mask, 0, }, {"storage-tag", 'S', "IONUM", CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, } , {"storage-tag-check", 'C', ((void*)0), CFG_FLAG, &cfg.stc , 0, storage_tag_check, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9010 | OPT_SHRT("block-count", 'c', &cfg.block_count, block_count),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg. limited_retry, 0, limited_retry, 0, }, {"force-unit-access", 'f' , ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access_verify , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, &cfg .lbat, 1, app_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT , &cfg.lbatm, 1, app_tag_mask, 0, }, {"storage-tag", 'S', "IONUM", CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, } , {"storage-tag-check", 'C', ((void*)0), CFG_FLAG, &cfg.stc , 0, storage_tag_check, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9011 | OPT_FLAG("limited-retry", 'l', &cfg.limited_retry, limited_retry),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg. limited_retry, 0, limited_retry, 0, }, {"force-unit-access", 'f' , ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access_verify , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, &cfg .lbat, 1, app_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT , &cfg.lbatm, 1, app_tag_mask, 0, }, {"storage-tag", 'S', "IONUM", CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, } , {"storage-tag-check", 'C', ((void*)0), CFG_FLAG, &cfg.stc , 0, storage_tag_check, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9012 | OPT_FLAG("force-unit-access", 'f', &cfg.force_unit_access, force_unit_access_verify),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg. limited_retry, 0, limited_retry, 0, }, {"force-unit-access", 'f' , ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access_verify , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, &cfg .lbat, 1, app_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT , &cfg.lbatm, 1, app_tag_mask, 0, }, {"storage-tag", 'S', "IONUM", CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, } , {"storage-tag-check", 'C', ((void*)0), CFG_FLAG, &cfg.stc , 0, storage_tag_check, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9013 | OPT_BYTE("prinfo", 'p', &cfg.prinfo, prinfo),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg. limited_retry, 0, limited_retry, 0, }, {"force-unit-access", 'f' , ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access_verify , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, &cfg .lbat, 1, app_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT , &cfg.lbatm, 1, app_tag_mask, 0, }, {"storage-tag", 'S', "IONUM", CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, } , {"storage-tag-check", 'C', ((void*)0), CFG_FLAG, &cfg.stc , 0, storage_tag_check, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9014 | OPT_SUFFIX("ref-tag", 'r', &cfg.ilbrt, ref_tag),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg. limited_retry, 0, limited_retry, 0, }, {"force-unit-access", 'f' , ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access_verify , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, &cfg .lbat, 1, app_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT , &cfg.lbatm, 1, app_tag_mask, 0, }, {"storage-tag", 'S', "IONUM", CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, } , {"storage-tag-check", 'C', ((void*)0), CFG_FLAG, &cfg.stc , 0, storage_tag_check, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9015 | OPT_SHRT("app-tag", 'a', &cfg.lbat, app_tag),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg. limited_retry, 0, limited_retry, 0, }, {"force-unit-access", 'f' , ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access_verify , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, &cfg .lbat, 1, app_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT , &cfg.lbatm, 1, app_tag_mask, 0, }, {"storage-tag", 'S', "IONUM", CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, } , {"storage-tag-check", 'C', ((void*)0), CFG_FLAG, &cfg.stc , 0, storage_tag_check, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9016 | OPT_SHRT("app-tag-mask", 'm', &cfg.lbatm, app_tag_mask),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg. limited_retry, 0, limited_retry, 0, }, {"force-unit-access", 'f' , ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access_verify , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, &cfg .lbat, 1, app_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT , &cfg.lbatm, 1, app_tag_mask, 0, }, {"storage-tag", 'S', "IONUM", CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, } , {"storage-tag-check", 'C', ((void*)0), CFG_FLAG, &cfg.stc , 0, storage_tag_check, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9017 | OPT_SUFFIX("storage-tag", 'S', &cfg.lbst, storage_tag),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg. limited_retry, 0, limited_retry, 0, }, {"force-unit-access", 'f' , ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access_verify , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, &cfg .lbat, 1, app_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT , &cfg.lbatm, 1, app_tag_mask, 0, }, {"storage-tag", 'S', "IONUM", CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, } , {"storage-tag-check", 'C', ((void*)0), CFG_FLAG, &cfg.stc , 0, storage_tag_check, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9018 | OPT_FLAG("storage-tag-check", 'C', &cfg.stc, storage_tag_check))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.nsid , 1, namespace_desired, 0, }, {"start-block", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.start_block, 1, start_block, 0, }, {"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, 1, block_count, 0, }, {"limited-retry", 'l', ((void*)0), CFG_FLAG, &cfg. limited_retry, 0, limited_retry, 0, }, {"force-unit-access", 'f' , ((void*)0), CFG_FLAG, &cfg.force_unit_access, 0, force_unit_access_verify , 0, }, {"prinfo", 'p', "NUM", CFG_BYTE, &cfg.prinfo, 1, prinfo , 0, }, {"ref-tag", 'r', "IONUM", CFG_LONG_SUFFIX, &cfg.ilbrt , 1, ref_tag, 0, }, {"app-tag", 'a', "NUM", CFG_SHORT, &cfg .lbat, 1, app_tag, 0, }, {"app-tag-mask", 'm', "NUM", CFG_SHORT , &cfg.lbatm, 1, app_tag_mask, 0, }, {"storage-tag", 'S', "IONUM", CFG_LONG_SUFFIX, &cfg.lbst, 1, storage_tag, 0, } , {"storage-tag-check", 'C', ((void*)0), CFG_FLAG, &cfg.stc , 0, storage_tag_check, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 9019 | ||||
| 9020 | ||||
| 9021 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 9022 | if (err) | |||
| 9023 | return err; | |||
| 9024 | ||||
| 9025 | err = open_fallback_chardev(ctx, cfg.nsid, &hdl); | |||
| 9026 | if (err) | |||
| 9027 | return err; | |||
| 9028 | ||||
| 9029 | if (cfg.prinfo > 0xf) | |||
| 9030 | return -EINVAL22; | |||
| 9031 | ||||
| 9032 | control |= (cfg.prinfo << 10); | |||
| 9033 | if (cfg.limited_retry) | |||
| 9034 | control |= NVME_IO_LR; | |||
| 9035 | if (cfg.force_unit_access) | |||
| 9036 | control |= NVME_IO_FUA; | |||
| 9037 | if (cfg.stc) | |||
| 9038 | control |= NVME_IO_STC; | |||
| 9039 | ||||
| 9040 | if (!cfg.nsid) { | |||
| 9041 | err = libnvme_get_nsid(hdl, &cfg.nsid); | |||
| 9042 | if (err < 0) { | |||
| 9043 | nvme_show_error("get-namespace-id: %s", libnvme_strerror(-err))nvme_show_message(1, "get-namespace-id: %s", libnvme_strerror (-err)); | |||
| 9044 | return err; | |||
| 9045 | } | |||
| 9046 | } | |||
| 9047 | ||||
| 9048 | nvme_init_verify(&cmd, cfg.nsid, cfg.start_block, | |||
| 9049 | cfg.block_count, control, 0, NULL((void*)0), 0, NULL((void*)0), 0); | |||
| 9050 | err = init_pi_tags(hdl, &cmd, cfg.nsid, cfg.ilbrt, cfg.lbst, | |||
| 9051 | cfg.lbat, cfg.lbatm); | |||
| 9052 | if (err != 0 && err != NVME_SC_INVALID_FIELD) | |||
| 9053 | return err; | |||
| 9054 | err = libnvme_exec_io_passthru(hdl, &cmd); | |||
| 9055 | if (err) { | |||
| 9056 | nvme_show_err(err, "verify"); | |||
| 9057 | return err; | |||
| 9058 | } | |||
| 9059 | ||||
| 9060 | printf("NVME Verify Success\n"); | |||
| 9061 | ||||
| 9062 | return err; | |||
| 9063 | } | |||
| 9064 | ||||
| 9065 | static int sec_recv(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 9066 | { | |||
| 9067 | const char *desc = "Obtain results of one or more\n" | |||
| 9068 | "previously submitted security-sends. Results, and association\n" | |||
| 9069 | "between Security Send and Receive, depend on the security\n" | |||
| 9070 | "protocol field as they are defined by the security protocol\n" | |||
| 9071 | "used. A Security Receive must follow a Security Send made with\n" | |||
| 9072 | "the same security protocol."; | |||
| 9073 | const char *size = "size of buffer (prints to stdout on success)"; | |||
| 9074 | const char *al = "allocation length (cf. SPC-4)"; | |||
| 9075 | ||||
| 9076 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 9077 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 9078 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) void *sec_buf = NULL((void*)0); | |||
| 9079 | struct libnvme_passthru_cmd cmd; | |||
| 9080 | nvme_print_flags_t flags; | |||
| 9081 | int err; | |||
| 9082 | ||||
| 9083 | struct config { | |||
| 9084 | bool_Bool ish; | |||
| 9085 | __u32 namespace_id; | |||
| 9086 | __u32 size; | |||
| 9087 | __u8 nssf; | |||
| 9088 | __u8 secp; | |||
| 9089 | __u16 spsp; | |||
| 9090 | __u32 al; | |||
| 9091 | bool_Bool raw_binary; | |||
| 9092 | }; | |||
| 9093 | ||||
| 9094 | struct config cfg = { | |||
| 9095 | .ish = false0, | |||
| 9096 | .namespace_id = 0, | |||
| 9097 | .size = 0, | |||
| 9098 | .nssf = 0, | |||
| 9099 | .secp = 0, | |||
| 9100 | .spsp = 0, | |||
| 9101 | .al = 0, | |||
| 9102 | .raw_binary = false0, | |||
| 9103 | }; | |||
| 9104 | ||||
| 9105 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"size", 'x', "NUM", CFG_POSITIVE , &cfg.size, 1, size, 0, }, {"nssf", 'N', "NUM", CFG_BYTE , &cfg.nssf, 1, nssf, 0, }, {"secp", 'p', "NUM", CFG_BYTE , &cfg.secp, 1, secp, 0, }, {"spsp", 's', "NUM", CFG_SHORT , &cfg.spsp, 1, spsp, 0, }, {"al", 't', "NUM", CFG_POSITIVE , &cfg.al, 1, al, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_dump, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9106 | OPT_FLAG("ish", 'I', &cfg.ish, ish),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"size", 'x', "NUM", CFG_POSITIVE , &cfg.size, 1, size, 0, }, {"nssf", 'N', "NUM", CFG_BYTE , &cfg.nssf, 1, nssf, 0, }, {"secp", 'p', "NUM", CFG_BYTE , &cfg.secp, 1, secp, 0, }, {"spsp", 's', "NUM", CFG_SHORT , &cfg.spsp, 1, spsp, 0, }, {"al", 't', "NUM", CFG_POSITIVE , &cfg.al, 1, al, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_dump, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9107 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"size", 'x', "NUM", CFG_POSITIVE , &cfg.size, 1, size, 0, }, {"nssf", 'N', "NUM", CFG_BYTE , &cfg.nssf, 1, nssf, 0, }, {"secp", 'p', "NUM", CFG_BYTE , &cfg.secp, 1, secp, 0, }, {"spsp", 's', "NUM", CFG_SHORT , &cfg.spsp, 1, spsp, 0, }, {"al", 't', "NUM", CFG_POSITIVE , &cfg.al, 1, al, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_dump, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9108 | OPT_UINT("size", 'x', &cfg.size, size),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"size", 'x', "NUM", CFG_POSITIVE , &cfg.size, 1, size, 0, }, {"nssf", 'N', "NUM", CFG_BYTE , &cfg.nssf, 1, nssf, 0, }, {"secp", 'p', "NUM", CFG_BYTE , &cfg.secp, 1, secp, 0, }, {"spsp", 's', "NUM", CFG_SHORT , &cfg.spsp, 1, spsp, 0, }, {"al", 't', "NUM", CFG_POSITIVE , &cfg.al, 1, al, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_dump, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9109 | OPT_BYTE("nssf", 'N', &cfg.nssf, nssf),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"size", 'x', "NUM", CFG_POSITIVE , &cfg.size, 1, size, 0, }, {"nssf", 'N', "NUM", CFG_BYTE , &cfg.nssf, 1, nssf, 0, }, {"secp", 'p', "NUM", CFG_BYTE , &cfg.secp, 1, secp, 0, }, {"spsp", 's', "NUM", CFG_SHORT , &cfg.spsp, 1, spsp, 0, }, {"al", 't', "NUM", CFG_POSITIVE , &cfg.al, 1, al, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_dump, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9110 | OPT_BYTE("secp", 'p', &cfg.secp, secp),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"size", 'x', "NUM", CFG_POSITIVE , &cfg.size, 1, size, 0, }, {"nssf", 'N', "NUM", CFG_BYTE , &cfg.nssf, 1, nssf, 0, }, {"secp", 'p', "NUM", CFG_BYTE , &cfg.secp, 1, secp, 0, }, {"spsp", 's', "NUM", CFG_SHORT , &cfg.spsp, 1, spsp, 0, }, {"al", 't', "NUM", CFG_POSITIVE , &cfg.al, 1, al, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_dump, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9111 | OPT_SHRT("spsp", 's', &cfg.spsp, spsp),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"size", 'x', "NUM", CFG_POSITIVE , &cfg.size, 1, size, 0, }, {"nssf", 'N', "NUM", CFG_BYTE , &cfg.nssf, 1, nssf, 0, }, {"secp", 'p', "NUM", CFG_BYTE , &cfg.secp, 1, secp, 0, }, {"spsp", 's', "NUM", CFG_SHORT , &cfg.spsp, 1, spsp, 0, }, {"al", 't', "NUM", CFG_POSITIVE , &cfg.al, 1, al, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_dump, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9112 | OPT_UINT("al", 't', &cfg.al, al),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"size", 'x', "NUM", CFG_POSITIVE , &cfg.size, 1, size, 0, }, {"nssf", 'N', "NUM", CFG_BYTE , &cfg.nssf, 1, nssf, 0, }, {"secp", 'p', "NUM", CFG_BYTE , &cfg.secp, 1, secp, 0, }, {"spsp", 's', "NUM", CFG_SHORT , &cfg.spsp, 1, spsp, 0, }, {"al", 't', "NUM", CFG_POSITIVE , &cfg.al, 1, al, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_dump, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9113 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_dump))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"size", 'x', "NUM", CFG_POSITIVE , &cfg.size, 1, size, 0, }, {"nssf", 'N', "NUM", CFG_BYTE , &cfg.nssf, 1, nssf, 0, }, {"secp", 'p', "NUM", CFG_BYTE , &cfg.secp, 1, secp, 0, }, {"spsp", 's', "NUM", CFG_SHORT , &cfg.spsp, 1, spsp, 0, }, {"al", 't', "NUM", CFG_POSITIVE , &cfg.al, 1, al, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG , &cfg.raw_binary, 0, raw_dump, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 9114 | ||||
| 9115 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 9116 | if (err) | |||
| 9117 | return err; | |||
| 9118 | ||||
| 9119 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 9120 | if (err < 0) { | |||
| 9121 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 9122 | return err; | |||
| 9123 | } | |||
| 9124 | ||||
| 9125 | if (cfg.size) { | |||
| 9126 | sec_buf = libnvme_alloc(cfg.size); | |||
| 9127 | if (!sec_buf) | |||
| 9128 | return -ENOMEM12; | |||
| 9129 | } | |||
| 9130 | ||||
| 9131 | if (cfg.ish) { | |||
| 9132 | if (libnvme_transport_handle_is_mi(hdl)) | |||
| 9133 | nvme_init_mi_cmd_flags(&cmd, ish); | |||
| 9134 | else | |||
| 9135 | printf("ISH is supported only for NVMe-MI\n"); | |||
| 9136 | } | |||
| 9137 | ||||
| 9138 | nvme_init_security_receive(&cmd, cfg.namespace_id, cfg.nssf, cfg.spsp, | |||
| 9139 | cfg.secp, cfg.al, sec_buf, cfg.size); | |||
| 9140 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 9141 | if (err) { | |||
| 9142 | nvme_show_err(err, "security receive"); | |||
| 9143 | return err; | |||
| 9144 | } | |||
| 9145 | ||||
| 9146 | printf("NVME Security Receive Command Success\n"); | |||
| 9147 | if (!cfg.raw_binary) | |||
| 9148 | d(sec_buf, cfg.size, 16, 1); | |||
| 9149 | else if (cfg.size) | |||
| 9150 | d_raw((unsigned char *)sec_buf, cfg.size); | |||
| 9151 | ||||
| 9152 | return err; | |||
| 9153 | } | |||
| 9154 | ||||
| 9155 | static int get_lba_status(int argc, char **argv, struct command *acmd, | |||
| 9156 | struct plugin *plugin) | |||
| 9157 | { | |||
| 9158 | const char *desc = "Information about potentially unrecoverable LBAs."; | |||
| 9159 | const char *slba = | |||
| 9160 | "Starting LBA(SLBA) in 64-bit address of the first logical block addressed by this command"; | |||
| 9161 | const char *mndw = | |||
| 9162 | "Maximum Number of Dwords(MNDW) specifies maximum number of dwords to return"; | |||
| 9163 | const char *atype = "Action Type(ATYPE) specifies the mechanism\n" | |||
| 9164 | "the controller uses in determining the LBA Status Descriptors to return."; | |||
| 9165 | const char *rl = | |||
| 9166 | "Range Length(RL) specifies the length of the range of contiguous LBAs beginning at SLBA"; | |||
| 9167 | ||||
| 9168 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 9169 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 9170 | struct libnvme_passthru_cmd cmd; | |||
| 9171 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) void *buf = NULL((void*)0); | |||
| 9172 | nvme_print_flags_t flags; | |||
| 9173 | unsigned long buf_len; | |||
| 9174 | int err; | |||
| 9175 | ||||
| 9176 | struct config { | |||
| 9177 | bool_Bool ish; | |||
| 9178 | __u32 namespace_id; | |||
| 9179 | __u64 slba; | |||
| 9180 | __u32 mndw; | |||
| 9181 | __u8 atype; | |||
| 9182 | __u16 rl; | |||
| 9183 | }; | |||
| 9184 | ||||
| 9185 | struct config cfg = { | |||
| 9186 | .ish = false0, | |||
| 9187 | .namespace_id = 0, | |||
| 9188 | .slba = 0, | |||
| 9189 | .mndw = 0, | |||
| 9190 | .atype = 0, | |||
| 9191 | .rl = 0, | |||
| 9192 | }; | |||
| 9193 | ||||
| 9194 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"start-lba", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.slba, 1, slba, 0, }, {"max-dw", 'm', "NUM", CFG_POSITIVE , &cfg.mndw, 1, mndw, 0, }, {"action", 'a', "NUM", CFG_BYTE , &cfg.atype, 1, atype, 0, }, {"range-len", 'l', "NUM", CFG_SHORT , &cfg.rl, 1, rl, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9195 | OPT_FLAG("ish", 'I', &cfg.ish, ish),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"start-lba", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.slba, 1, slba, 0, }, {"max-dw", 'm', "NUM", CFG_POSITIVE , &cfg.mndw, 1, mndw, 0, }, {"action", 'a', "NUM", CFG_BYTE , &cfg.atype, 1, atype, 0, }, {"range-len", 'l', "NUM", CFG_SHORT , &cfg.rl, 1, rl, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9196 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"start-lba", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.slba, 1, slba, 0, }, {"max-dw", 'm', "NUM", CFG_POSITIVE , &cfg.mndw, 1, mndw, 0, }, {"action", 'a', "NUM", CFG_BYTE , &cfg.atype, 1, atype, 0, }, {"range-len", 'l', "NUM", CFG_SHORT , &cfg.rl, 1, rl, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9197 | OPT_SUFFIX("start-lba", 's', &cfg.slba, slba),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"start-lba", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.slba, 1, slba, 0, }, {"max-dw", 'm', "NUM", CFG_POSITIVE , &cfg.mndw, 1, mndw, 0, }, {"action", 'a', "NUM", CFG_BYTE , &cfg.atype, 1, atype, 0, }, {"range-len", 'l', "NUM", CFG_SHORT , &cfg.rl, 1, rl, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9198 | OPT_UINT("max-dw", 'm', &cfg.mndw, mndw),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"start-lba", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.slba, 1, slba, 0, }, {"max-dw", 'm', "NUM", CFG_POSITIVE , &cfg.mndw, 1, mndw, 0, }, {"action", 'a', "NUM", CFG_BYTE , &cfg.atype, 1, atype, 0, }, {"range-len", 'l', "NUM", CFG_SHORT , &cfg.rl, 1, rl, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9199 | OPT_BYTE("action", 'a', &cfg.atype, atype),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"start-lba", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.slba, 1, slba, 0, }, {"max-dw", 'm', "NUM", CFG_POSITIVE , &cfg.mndw, 1, mndw, 0, }, {"action", 'a', "NUM", CFG_BYTE , &cfg.atype, 1, atype, 0, }, {"range-len", 'l', "NUM", CFG_SHORT , &cfg.rl, 1, rl, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9200 | OPT_SHRT("range-len", 'l', &cfg.rl, rl))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"start-lba", 's', "IONUM", CFG_LONG_SUFFIX , &cfg.slba, 1, slba, 0, }, {"max-dw", 'm', "NUM", CFG_POSITIVE , &cfg.mndw, 1, mndw, 0, }, {"action", 'a', "NUM", CFG_BYTE , &cfg.atype, 1, atype, 0, }, {"range-len", 'l', "NUM", CFG_SHORT , &cfg.rl, 1, rl, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 9201 | ||||
| 9202 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 9203 | if (err) | |||
| 9204 | return err; | |||
| 9205 | ||||
| 9206 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 9207 | if (err < 0) { | |||
| 9208 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 9209 | return err; | |||
| 9210 | } | |||
| 9211 | ||||
| 9212 | if (!cfg.atype) { | |||
| 9213 | nvme_show_error("action type (--action) has to be given")nvme_show_message(1, "action type (--action) has to be given" ); | |||
| 9214 | return -EINVAL22; | |||
| 9215 | } | |||
| 9216 | ||||
| 9217 | buf_len = (cfg.mndw + 1) * 4; | |||
| 9218 | buf = libnvme_alloc(buf_len); | |||
| 9219 | if (!buf) | |||
| 9220 | return -ENOMEM12; | |||
| 9221 | ||||
| 9222 | nvme_init_get_lba_status(&cmd, cfg.namespace_id, cfg.slba, cfg.mndw, | |||
| 9223 | cfg.atype, cfg.rl, buf); | |||
| 9224 | if (cfg.ish) { | |||
| 9225 | if (libnvme_transport_handle_is_mi(hdl)) | |||
| 9226 | nvme_init_mi_cmd_flags(&cmd, ish); | |||
| 9227 | else | |||
| 9228 | printf("ISH is supported only for NVMe-MI\n"); | |||
| 9229 | } | |||
| 9230 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 9231 | if (err) { | |||
| 9232 | nvme_show_err(err, "get lba status"); | |||
| 9233 | return err; | |||
| 9234 | } | |||
| 9235 | ||||
| 9236 | nvme_show_lba_status(buf, buf_len, flags); | |||
| 9237 | ||||
| 9238 | return err; | |||
| 9239 | } | |||
| 9240 | ||||
| 9241 | static int capacity_mgmt(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 9242 | { | |||
| 9243 | const char *desc = "Host software uses the Capacity Management command to\n" | |||
| 9244 | "configure Endurance Groups and NVM Sets in an NVM subsystem by either\n" | |||
| 9245 | "selecting one of a set of supported configurations or by specifying the\n" | |||
| 9246 | "capacity of the Endurance Group or NVM Set to be created"; | |||
| 9247 | const char *operation = "Operation to be performed by the controller"; | |||
| 9248 | const char *element_id = "Value specific to the value of the Operation field."; | |||
| 9249 | const char *cap_lower = | |||
| 9250 | "Least significant 32 bits of the capacity in bytes of the Endurance Group or NVM Set to be created"; | |||
| 9251 | const char *cap_upper = | |||
| 9252 | "Most significant 32 bits of the capacity in bytes of the Endurance Group or NVM Set to be created"; | |||
| 9253 | ||||
| 9254 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 9255 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 9256 | struct libnvme_passthru_cmd cmd; | |||
| 9257 | int err = -1; | |||
| 9258 | nvme_print_flags_t flags; | |||
| 9259 | ||||
| 9260 | struct config { | |||
| 9261 | bool_Bool ish; | |||
| 9262 | __u8 operation; | |||
| 9263 | __u16 element_id; | |||
| 9264 | __u32 dw11; | |||
| 9265 | __u32 dw12; | |||
| 9266 | }; | |||
| 9267 | ||||
| 9268 | struct config cfg = { | |||
| 9269 | .ish = false0, | |||
| 9270 | .operation = 0xff, | |||
| 9271 | .element_id = 0xffff, | |||
| 9272 | .dw11 = 0, | |||
| 9273 | .dw12 = 0, | |||
| 9274 | }; | |||
| 9275 | ||||
| 9276 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"operation", 'O', "NUM", CFG_BYTE, &cfg.operation , 1, operation, 0, }, {"element-id", 'i', "NUM", CFG_SHORT, & cfg.element_id, 1, element_id, 0, }, {"cap-lower", 'l', "NUM" , CFG_POSITIVE, &cfg.dw11, 1, cap_lower, 0, }, {"cap-upper" , 'u', "NUM", CFG_POSITIVE, &cfg.dw12, 1, cap_upper, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9277 | OPT_FLAG("ish", 'I', &cfg.ish, ish),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"operation", 'O', "NUM", CFG_BYTE, &cfg.operation , 1, operation, 0, }, {"element-id", 'i', "NUM", CFG_SHORT, & cfg.element_id, 1, element_id, 0, }, {"cap-lower", 'l', "NUM" , CFG_POSITIVE, &cfg.dw11, 1, cap_lower, 0, }, {"cap-upper" , 'u', "NUM", CFG_POSITIVE, &cfg.dw12, 1, cap_upper, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9278 | OPT_BYTE("operation", 'O', &cfg.operation, operation),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"operation", 'O', "NUM", CFG_BYTE, &cfg.operation , 1, operation, 0, }, {"element-id", 'i', "NUM", CFG_SHORT, & cfg.element_id, 1, element_id, 0, }, {"cap-lower", 'l', "NUM" , CFG_POSITIVE, &cfg.dw11, 1, cap_lower, 0, }, {"cap-upper" , 'u', "NUM", CFG_POSITIVE, &cfg.dw12, 1, cap_upper, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9279 | OPT_SHRT("element-id", 'i', &cfg.element_id, element_id),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"operation", 'O', "NUM", CFG_BYTE, &cfg.operation , 1, operation, 0, }, {"element-id", 'i', "NUM", CFG_SHORT, & cfg.element_id, 1, element_id, 0, }, {"cap-lower", 'l', "NUM" , CFG_POSITIVE, &cfg.dw11, 1, cap_lower, 0, }, {"cap-upper" , 'u', "NUM", CFG_POSITIVE, &cfg.dw12, 1, cap_upper, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9280 | OPT_UINT("cap-lower", 'l', &cfg.dw11, cap_lower),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"operation", 'O', "NUM", CFG_BYTE, &cfg.operation , 1, operation, 0, }, {"element-id", 'i', "NUM", CFG_SHORT, & cfg.element_id, 1, element_id, 0, }, {"cap-lower", 'l', "NUM" , CFG_POSITIVE, &cfg.dw11, 1, cap_lower, 0, }, {"cap-upper" , 'u', "NUM", CFG_POSITIVE, &cfg.dw12, 1, cap_upper, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9281 | OPT_UINT("cap-upper", 'u', &cfg.dw12, cap_upper))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ish", 'I', ((void*)0), CFG_FLAG, &cfg.ish, 0, ish , 0, }, {"operation", 'O', "NUM", CFG_BYTE, &cfg.operation , 1, operation, 0, }, {"element-id", 'i', "NUM", CFG_SHORT, & cfg.element_id, 1, element_id, 0, }, {"cap-lower", 'l', "NUM" , CFG_POSITIVE, &cfg.dw11, 1, cap_lower, 0, }, {"cap-upper" , 'u', "NUM", CFG_POSITIVE, &cfg.dw12, 1, cap_upper, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 9282 | ||||
| 9283 | ||||
| 9284 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 9285 | if (err) | |||
| 9286 | return err; | |||
| 9287 | ||||
| 9288 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 9289 | if (err < 0) { | |||
| 9290 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 9291 | return err; | |||
| 9292 | } | |||
| 9293 | ||||
| 9294 | if (cfg.operation > 0xf) { | |||
| 9295 | nvme_show_error("invalid operation field: %u", cfg.operation)nvme_show_message(1, "invalid operation field: %u", cfg.operation ); | |||
| 9296 | return -1; | |||
| 9297 | } | |||
| 9298 | ||||
| 9299 | nvme_init_capacity_mgmt(&cmd, cfg.operation, cfg.element_id, | |||
| 9300 | (__u64)cfg.dw12 << 32 | cfg.dw11); | |||
| 9301 | if (cfg.ish) { | |||
| 9302 | if (libnvme_transport_handle_is_mi(hdl)) | |||
| 9303 | nvme_init_mi_cmd_flags(&cmd, ish); | |||
| 9304 | else | |||
| 9305 | printf("ISH is supported only for NVMe-MI\n"); | |||
| 9306 | } | |||
| 9307 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 9308 | if (err) { | |||
| 9309 | nvme_show_err(err, "capacity management"); | |||
| 9310 | return err; | |||
| 9311 | } | |||
| 9312 | ||||
| 9313 | printf("Capacity Management Command is Success\n"); | |||
| 9314 | ||||
| 9315 | if (cfg.operation == 1) | |||
| 9316 | printf("Created Element Identifier for Endurance Group is: %" | |||
| 9317 | PRIu64"l" "u" "\n", (uint64_t)cmd.result); | |||
| 9318 | else if (cfg.operation == 3) | |||
| 9319 | printf( | |||
| 9320 | "Created Element Identifier for NVM Set is: %" PRIu64"l" "u" "\n", | |||
| 9321 | (uint64_t)cmd.result); | |||
| 9322 | ||||
| 9323 | return err; | |||
| 9324 | } | |||
| 9325 | ||||
| 9326 | static int dir_receive(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 9327 | { | |||
| 9328 | const char *desc = "Read directive parameters of the specified directive type."; | |||
| 9329 | const char *nsr = "namespace stream requested"; | |||
| 9330 | ||||
| 9331 | nvme_print_flags_t flags = NORMAL; | |||
| 9332 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 9333 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 9334 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) void *buf = NULL((void*)0); | |||
| 9335 | struct libnvme_passthru_cmd cmd; | |||
| 9336 | __u32 dw12 = 0; | |||
| 9337 | int err; | |||
| 9338 | ||||
| 9339 | struct config { | |||
| 9340 | __u32 namespace_id; | |||
| 9341 | __u32 data_len; | |||
| 9342 | bool_Bool raw_binary; | |||
| 9343 | __u8 dtype; | |||
| 9344 | __u16 dspec; | |||
| 9345 | __u8 doper; | |||
| 9346 | __u16 nsr; /* dw12 for NVME_DIR_ST_RCVOP_STATUS */ | |||
| 9347 | }; | |||
| 9348 | ||||
| 9349 | struct config cfg = { | |||
| 9350 | .namespace_id = 1, | |||
| 9351 | .data_len = 0, | |||
| 9352 | .raw_binary = false0, | |||
| 9353 | .dtype = 0, | |||
| 9354 | .dspec = 0, | |||
| 9355 | .doper = 0, | |||
| 9356 | .nsr = 0, | |||
| 9357 | }; | |||
| 9358 | ||||
| 9359 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"raw-binary", 'b', (( void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_directive, 0, }, {"dir-type", 'D', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, & cfg.doper, 1, doper, 0, }, {"req-resource", 'r', "NUM", CFG_SHORT , &cfg.nsr, 1, nsr, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9360 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"raw-binary", 'b', (( void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_directive, 0, }, {"dir-type", 'D', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, & cfg.doper, 1, doper, 0, }, {"req-resource", 'r', "NUM", CFG_SHORT , &cfg.nsr, 1, nsr, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9361 | OPT_UINT("data-len", 'l', &cfg.data_len, buf_len),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"raw-binary", 'b', (( void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_directive, 0, }, {"dir-type", 'D', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, & cfg.doper, 1, doper, 0, }, {"req-resource", 'r', "NUM", CFG_SHORT , &cfg.nsr, 1, nsr, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9362 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_directive),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"raw-binary", 'b', (( void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_directive, 0, }, {"dir-type", 'D', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, & cfg.doper, 1, doper, 0, }, {"req-resource", 'r', "NUM", CFG_SHORT , &cfg.nsr, 1, nsr, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9363 | OPT_BYTE("dir-type", 'D', &cfg.dtype, dtype),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"raw-binary", 'b', (( void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_directive, 0, }, {"dir-type", 'D', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, & cfg.doper, 1, doper, 0, }, {"req-resource", 'r', "NUM", CFG_SHORT , &cfg.nsr, 1, nsr, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9364 | OPT_SHRT("dir-spec", 'S', &cfg.dspec, dspec_w_dtype),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"raw-binary", 'b', (( void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_directive, 0, }, {"dir-type", 'D', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, & cfg.doper, 1, doper, 0, }, {"req-resource", 'r', "NUM", CFG_SHORT , &cfg.nsr, 1, nsr, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9365 | OPT_BYTE("dir-oper", 'O', &cfg.doper, doper),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"raw-binary", 'b', (( void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_directive, 0, }, {"dir-type", 'D', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, & cfg.doper, 1, doper, 0, }, {"req-resource", 'r', "NUM", CFG_SHORT , &cfg.nsr, 1, nsr, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9366 | OPT_SHRT("req-resource", 'r', &cfg.nsr, nsr))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, buf_len, 0, }, {"raw-binary", 'b', (( void*)0), CFG_FLAG, &cfg.raw_binary, 0, raw_directive, 0, }, {"dir-type", 'D', "NUM", CFG_BYTE, &cfg.dtype, 1, dtype , 0, }, {"dir-spec", 'S', "NUM", CFG_SHORT, &cfg.dspec, 1 , dspec_w_dtype, 0, }, {"dir-oper", 'O', "NUM", CFG_BYTE, & cfg.doper, 1, doper, 0, }, {"req-resource", 'r', "NUM", CFG_SHORT , &cfg.nsr, 1, nsr, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 9367 | ||||
| 9368 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 9369 | if (err) | |||
| 9370 | return err; | |||
| 9371 | ||||
| 9372 | if (nvme_args.verbose) | |||
| 9373 | flags |= VERBOSE; | |||
| 9374 | if (cfg.raw_binary) | |||
| 9375 | flags = BINARY; | |||
| 9376 | ||||
| 9377 | switch (cfg.dtype) { | |||
| 9378 | case NVME_DIRECTIVE_DTYPE_IDENTIFY: | |||
| 9379 | switch (cfg.doper) { | |||
| 9380 | case NVME_DIRECTIVE_RECEIVE_IDENTIFY_DOPER_PARAM: | |||
| 9381 | if (!cfg.data_len) | |||
| 9382 | cfg.data_len = 4096; | |||
| 9383 | break; | |||
| 9384 | default: | |||
| 9385 | nvme_show_error("invalid directive operations for Identify Directives")nvme_show_message(1, "invalid directive operations for Identify Directives" ); | |||
| 9386 | return -EINVAL22; | |||
| 9387 | } | |||
| 9388 | break; | |||
| 9389 | case NVME_DIRECTIVE_DTYPE_STREAMS: | |||
| 9390 | switch (cfg.doper) { | |||
| 9391 | case NVME_DIRECTIVE_RECEIVE_STREAMS_DOPER_PARAM: | |||
| 9392 | if (!cfg.data_len) | |||
| 9393 | cfg.data_len = 32; | |||
| 9394 | break; | |||
| 9395 | case NVME_DIRECTIVE_RECEIVE_STREAMS_DOPER_STATUS: | |||
| 9396 | if (!cfg.data_len) | |||
| 9397 | cfg.data_len = 128 * 1024; | |||
| 9398 | break; | |||
| 9399 | case NVME_DIRECTIVE_RECEIVE_STREAMS_DOPER_RESOURCE: | |||
| 9400 | dw12 = cfg.nsr; | |||
| 9401 | break; | |||
| 9402 | default: | |||
| 9403 | nvme_show_error("invalid directive operations for Streams Directives")nvme_show_message(1, "invalid directive operations for Streams Directives" ); | |||
| 9404 | return -EINVAL22; | |||
| 9405 | } | |||
| 9406 | break; | |||
| 9407 | default: | |||
| 9408 | nvme_show_error("invalid directive type")nvme_show_message(1, "invalid directive type"); | |||
| 9409 | return -EINVAL22; | |||
| 9410 | } | |||
| 9411 | ||||
| 9412 | if (cfg.data_len) { | |||
| 9413 | buf = libnvme_alloc(cfg.data_len); | |||
| 9414 | if (!buf) | |||
| 9415 | return -ENOMEM12; | |||
| 9416 | } | |||
| 9417 | ||||
| 9418 | nvme_init_directive_recv(&cmd, cfg.namespace_id, cfg.doper, cfg.dtype, | |||
| 9419 | cfg.dspec, buf, cfg.data_len); | |||
| 9420 | cmd.cdw12 = dw12; | |||
| 9421 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 9422 | if (err) { | |||
| 9423 | nvme_show_err(err, "dir-receive"); | |||
| 9424 | return err; | |||
| 9425 | } | |||
| 9426 | ||||
| 9427 | nvme_directive_show(cfg.dtype, cfg.doper, cfg.dspec, cfg.namespace_id, | |||
| 9428 | cmd.result, buf, cfg.data_len, flags); | |||
| 9429 | ||||
| 9430 | return err; | |||
| 9431 | } | |||
| 9432 | ||||
| 9433 | /* rpmb_cmd_option is defined in nvme-rpmb.c */ | |||
| 9434 | extern int rpmb_cmd_option(int, char **, struct command *, struct plugin *); | |||
| 9435 | static int rpmb_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 9436 | { | |||
| 9437 | return rpmb_cmd_option(argc, argv, acmd, plugin); | |||
| 9438 | } | |||
| 9439 | ||||
| 9440 | static int lockdown_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 9441 | { | |||
| 9442 | const char *desc = "The Lockdown command is used to control the\n" | |||
| 9443 | "Command and Feature Lockdown capability which configures the\n" | |||
| 9444 | "prohibition or allowance of execution of the specified command\n" | |||
| 9445 | "or Set Features command targeting a specific Feature Identifier."; | |||
| 9446 | const char *ofi_desc = "Opcode or Feature Identifier (OFI)\n" | |||
| 9447 | "specifies the command opcode or Set Features Feature Identifier\n" | |||
| 9448 | "identified by the Scope field."; | |||
| 9449 | const char *ifc_desc = | |||
| 9450 | "[0-3] Interface (INF) field identifies the interfaces affected by this command."; | |||
| 9451 | const char *prhbt_desc = "[0-1]Prohibit(PRHBT) bit specifies whether\n" | |||
| 9452 | "to prohibit or allow the command opcode or Set Features Feature\n" | |||
| 9453 | "Identifier specified by this command."; | |||
| 9454 | const char *scp_desc = | |||
| 9455 | "[0-15]Scope(SCP) field specifies the contents of the Opcode or Feature Identifier field."; | |||
| 9456 | const char *uuid_desc = "UUID Index - If this field is set to a non-zero\n" | |||
| 9457 | "value, then the value of this field is the index of a UUID in the UUID\n" | |||
| 9458 | "List that is used by the command.If this field is cleared to 0h,\n" | |||
| 9459 | "then no UUID index is specified"; | |||
| 9460 | ||||
| 9461 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 9462 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 9463 | struct libnvme_passthru_cmd cmd; | |||
| 9464 | int err = -1; | |||
| 9465 | ||||
| 9466 | struct config { | |||
| 9467 | __u8 ofi; | |||
| 9468 | __u8 ifc; | |||
| 9469 | __u8 prhbt; | |||
| 9470 | __u8 scp; | |||
| 9471 | __u8 uuid; | |||
| 9472 | }; | |||
| 9473 | ||||
| 9474 | struct config cfg = { | |||
| 9475 | .ofi = 0, | |||
| 9476 | .ifc = 0, | |||
| 9477 | .prhbt = 0, | |||
| 9478 | .scp = 0, | |||
| 9479 | .uuid = 0, | |||
| 9480 | }; | |||
| 9481 | ||||
| 9482 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ofi", 'O', "NUM", CFG_BYTE, &cfg.ofi, 1, ofi_desc , 0, }, {"ifc", 'f', "NUM", CFG_BYTE, &cfg.ifc, 1, ifc_desc , 0, }, {"prhbt", 'p', "NUM", CFG_BYTE, &cfg.prhbt, 1, prhbt_desc , 0, }, {"scp", 's', "NUM", CFG_BYTE, &cfg.scp, 1, scp_desc , 0, }, {"uuid", 'U', "NUM", CFG_BYTE, &cfg.uuid, 1, uuid_desc , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 9483 | OPT_BYTE("ofi", 'O', &cfg.ofi, ofi_desc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ofi", 'O', "NUM", CFG_BYTE, &cfg.ofi, 1, ofi_desc , 0, }, {"ifc", 'f', "NUM", CFG_BYTE, &cfg.ifc, 1, ifc_desc , 0, }, {"prhbt", 'p', "NUM", CFG_BYTE, &cfg.prhbt, 1, prhbt_desc , 0, }, {"scp", 's', "NUM", CFG_BYTE, &cfg.scp, 1, scp_desc , 0, }, {"uuid", 'U', "NUM", CFG_BYTE, &cfg.uuid, 1, uuid_desc , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 9484 | OPT_BYTE("ifc", 'f', &cfg.ifc, ifc_desc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ofi", 'O', "NUM", CFG_BYTE, &cfg.ofi, 1, ofi_desc , 0, }, {"ifc", 'f', "NUM", CFG_BYTE, &cfg.ifc, 1, ifc_desc , 0, }, {"prhbt", 'p', "NUM", CFG_BYTE, &cfg.prhbt, 1, prhbt_desc , 0, }, {"scp", 's', "NUM", CFG_BYTE, &cfg.scp, 1, scp_desc , 0, }, {"uuid", 'U', "NUM", CFG_BYTE, &cfg.uuid, 1, uuid_desc , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 9485 | OPT_BYTE("prhbt", 'p', &cfg.prhbt, prhbt_desc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ofi", 'O', "NUM", CFG_BYTE, &cfg.ofi, 1, ofi_desc , 0, }, {"ifc", 'f', "NUM", CFG_BYTE, &cfg.ifc, 1, ifc_desc , 0, }, {"prhbt", 'p', "NUM", CFG_BYTE, &cfg.prhbt, 1, prhbt_desc , 0, }, {"scp", 's', "NUM", CFG_BYTE, &cfg.scp, 1, scp_desc , 0, }, {"uuid", 'U', "NUM", CFG_BYTE, &cfg.uuid, 1, uuid_desc , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 9486 | OPT_BYTE("scp", 's', &cfg.scp, scp_desc),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ofi", 'O', "NUM", CFG_BYTE, &cfg.ofi, 1, ofi_desc , 0, }, {"ifc", 'f', "NUM", CFG_BYTE, &cfg.ifc, 1, ifc_desc , 0, }, {"prhbt", 'p', "NUM", CFG_BYTE, &cfg.prhbt, 1, prhbt_desc , 0, }, {"scp", 's', "NUM", CFG_BYTE, &cfg.scp, 1, scp_desc , 0, }, {"uuid", 'U', "NUM", CFG_BYTE, &cfg.uuid, 1, uuid_desc , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 9487 | OPT_BYTE("uuid", 'U', &cfg.uuid, uuid_desc))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ofi", 'O', "NUM", CFG_BYTE, &cfg.ofi, 1, ofi_desc , 0, }, {"ifc", 'f', "NUM", CFG_BYTE, &cfg.ifc, 1, ifc_desc , 0, }, {"prhbt", 'p', "NUM", CFG_BYTE, &cfg.prhbt, 1, prhbt_desc , 0, }, {"scp", 's', "NUM", CFG_BYTE, &cfg.scp, 1, scp_desc , 0, }, {"uuid", 'U', "NUM", CFG_BYTE, &cfg.uuid, 1, uuid_desc , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 9488 | ||||
| 9489 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 9490 | if (err) | |||
| 9491 | return err; | |||
| 9492 | ||||
| 9493 | /* check for input argument limit */ | |||
| 9494 | if (cfg.ifc > 3) { | |||
| 9495 | nvme_show_error("invalid interface settings:%d", cfg.ifc)nvme_show_message(1, "invalid interface settings:%d", cfg.ifc ); | |||
| 9496 | return -1; | |||
| 9497 | } | |||
| 9498 | if (cfg.prhbt > 1) { | |||
| 9499 | nvme_show_error("invalid prohibit settings:%d", cfg.prhbt)nvme_show_message(1, "invalid prohibit settings:%d", cfg.prhbt ); | |||
| 9500 | return -1; | |||
| 9501 | } | |||
| 9502 | if (cfg.scp > 15) { | |||
| 9503 | nvme_show_error("invalid scope settings:%d", cfg.scp)nvme_show_message(1, "invalid scope settings:%d", cfg.scp); | |||
| 9504 | return -1; | |||
| 9505 | } | |||
| 9506 | if (cfg.uuid > 127) { | |||
| 9507 | nvme_show_error("invalid UUID index settings:%d", cfg.uuid)nvme_show_message(1, "invalid UUID index settings:%d", cfg.uuid ); | |||
| 9508 | return -1; | |||
| 9509 | } | |||
| 9510 | ||||
| 9511 | nvme_init_lockdown(&cmd, cfg.scp, cfg.prhbt, cfg.ifc, cfg.ofi, | |||
| 9512 | cfg.uuid); | |||
| 9513 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 9514 | if (err) { | |||
| 9515 | nvme_show_err(err, "lockdown"); | |||
| 9516 | return err; | |||
| 9517 | } | |||
| 9518 | ||||
| 9519 | printf("Lockdown Command is Successful\n"); | |||
| 9520 | ||||
| 9521 | return err; | |||
| 9522 | } | |||
| 9523 | ||||
| 9524 | static void passthru_print_read_output(struct passthru_config cfg, void *data, int dfd, void *mdata, | |||
| 9525 | int mfd, int err) | |||
| 9526 | { | |||
| 9527 | if (strlen(cfg.input_file)) { | |||
| 9528 | if (write(dfd, (void *)data, cfg.data_len) < 0) | |||
| 9529 | perror("failed to write data buffer"); | |||
| 9530 | } else if (data) { | |||
| 9531 | if (cfg.raw_binary) | |||
| 9532 | d_raw((unsigned char *)data, cfg.data_len); | |||
| 9533 | else if (!err) | |||
| 9534 | d((unsigned char *)data, cfg.data_len, 16, 1); | |||
| 9535 | } | |||
| 9536 | if (cfg.metadata_len && cfg.metadata) { | |||
| 9537 | if (strlen(cfg.metadata)) { | |||
| 9538 | if (write(mfd, (void *)mdata, cfg.metadata_len) < 0) | |||
| 9539 | perror("failed to write metadata buffer"); | |||
| 9540 | } else { | |||
| 9541 | if (cfg.raw_binary) | |||
| 9542 | d_raw((unsigned char *)mdata, cfg.metadata_len); | |||
| 9543 | else if (!err) | |||
| 9544 | d((unsigned char *)mdata, cfg.metadata_len, 16, 1); | |||
| 9545 | } | |||
| 9546 | } | |||
| 9547 | } | |||
| 9548 | ||||
| 9549 | static int passthru(int argc, char **argv, bool_Bool admin, | |||
| 9550 | const char *desc, struct command *acmd) | |||
| 9551 | { | |||
| 9552 | const char *opcode = "opcode (required)"; | |||
| 9553 | const char *cflags = "command flags"; | |||
| 9554 | const char *rsvd = "value for reserved field"; | |||
| 9555 | const char *data_len = "data I/O length (bytes)"; | |||
| 9556 | const char *metadata_len = "metadata seg. length (bytes)"; | |||
| 9557 | const char *metadata = "metadata input or output file"; | |||
| 9558 | const char *cdw2 = "command dword 2 value"; | |||
| 9559 | const char *cdw3 = "command dword 3 value"; | |||
| 9560 | const char *cdw10 = "command dword 10 value"; | |||
| 9561 | const char *cdw11 = "command dword 11 value"; | |||
| 9562 | const char *cdw12 = "command dword 12 value"; | |||
| 9563 | const char *cdw13 = "command dword 13 value"; | |||
| 9564 | const char *cdw14 = "command dword 14 value"; | |||
| 9565 | const char *cdw15 = "command dword 15 value"; | |||
| 9566 | const char *input = "data input or output file"; | |||
| 9567 | const char *show = "print command before sending"; | |||
| 9568 | const char *re = "set dataflow direction to receive"; | |||
| 9569 | const char *wr = "set dataflow direction to send"; | |||
| 9570 | const char *prefill = "prefill buffers with known byte-value, default 0"; | |||
| 9571 | ||||
| 9572 | __cleanup_huge__attribute__((cleanup(libnvme_free_huge))) struct libnvme_mem_huge mh = { 0, }; | |||
| 9573 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 9574 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 9575 | __cleanup_fd__attribute__((cleanup(cleanup_fd))) int dfd = -1, mfd = -1; | |||
| 9576 | int flags = 0; | |||
| 9577 | int mode = 0644; | |||
| 9578 | void *data = NULL((void*)0); | |||
| 9579 | __cleanup_free__attribute__((cleanup(freep))) void *mdata = NULL((void*)0); | |||
| 9580 | int err = 0; | |||
| 9581 | const char *cmd_name = NULL((void*)0); | |||
| 9582 | struct timeval start_time, end_time; | |||
| 9583 | nvme_print_flags_t flags_t; | |||
| 9584 | ||||
| 9585 | struct passthru_config cfg = { | |||
| 9586 | .opcode = 0, | |||
| 9587 | .flags = 0, | |||
| 9588 | .prefill = 0, | |||
| 9589 | .rsvd = 0, | |||
| 9590 | .namespace_id = 0, | |||
| 9591 | .data_len = 0, | |||
| 9592 | .metadata_len = 0, | |||
| 9593 | .cdw2 = 0, | |||
| 9594 | .cdw3 = 0, | |||
| 9595 | .cdw10 = 0, | |||
| 9596 | .cdw11 = 0, | |||
| 9597 | .cdw12 = 0, | |||
| 9598 | .cdw13 = 0, | |||
| 9599 | .cdw14 = 0, | |||
| 9600 | .cdw15 = 0, | |||
| 9601 | .input_file = "", | |||
| 9602 | .metadata = "", | |||
| 9603 | .raw_binary = false0, | |||
| 9604 | .show_command = false0, | |||
| 9605 | .read = false0, | |||
| 9606 | .write = false0, | |||
| 9607 | .latency = false0, | |||
| 9608 | }; | |||
| 9609 | ||||
| 9610 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9611 | OPT_BYTE("opcode", 'O', &cfg.opcode, opcode),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9612 | OPT_BYTE("flags", 'f', &cfg.flags, cflags),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9613 | OPT_BYTE("prefill", 'p', &cfg.prefill, prefill),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9614 | OPT_SHRT("rsvd", 'R', &cfg.rsvd, rsvd),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9615 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9616 | OPT_UINT("data-len", 'l', &cfg.data_len, data_len),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9617 | OPT_UINT("metadata-len", 'm', &cfg.metadata_len, metadata_len),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9618 | OPT_UINT("cdw2", '2', &cfg.cdw2, cdw2),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9619 | OPT_UINT("cdw3", '3', &cfg.cdw3, cdw3),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9620 | OPT_UINT("cdw10", '4', &cfg.cdw10, cdw10),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9621 | OPT_UINT("cdw11", '5', &cfg.cdw11, cdw11),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9622 | OPT_UINT("cdw12", '6', &cfg.cdw12, cdw12),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9623 | OPT_UINT("cdw13", '7', &cfg.cdw13, cdw13),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9624 | OPT_UINT("cdw14", '8', &cfg.cdw14, cdw14),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9625 | OPT_UINT("cdw15", '9', &cfg.cdw15, cdw15),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9626 | OPT_FILE("input-file", 'i', &cfg.input_file, input),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9627 | OPT_FILE("metadata", 'M', &cfg.metadata, metadata),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9628 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_dump),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9629 | OPT_FLAG("show-command", 's', &cfg.show_command, show),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9630 | OPT_FLAG("read", 'r', &cfg.read, re),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9631 | OPT_FLAG("write", 'w', &cfg.write, wr),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9632 | OPT_FLAG("latency", 'T', &cfg.latency, latency))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"flags", 'f', "NUM", CFG_BYTE, &cfg.flags, 1, cflags , 0, }, {"prefill", 'p', "NUM", CFG_BYTE, &cfg.prefill, 1 , prefill, 0, }, {"rsvd", 'R', "NUM", CFG_SHORT, &cfg.rsvd , 1, rsvd, 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, & cfg.namespace_id, 1, namespace_desired, 0, }, {"data-len", 'l' , "NUM", CFG_POSITIVE, &cfg.data_len, 1, data_len, 0, }, { "metadata-len", 'm', "NUM", CFG_POSITIVE, &cfg.metadata_len , 1, metadata_len, 0, }, {"cdw2", '2', "NUM", CFG_POSITIVE, & cfg.cdw2, 1, cdw2, 0, }, {"cdw3", '3', "NUM", CFG_POSITIVE, & cfg.cdw3, 1, cdw3, 0, }, {"cdw10", '4', "NUM", CFG_POSITIVE, & cfg.cdw10, 1, cdw10, 0, }, {"cdw11", '5', "NUM", CFG_POSITIVE , &cfg.cdw11, 1, cdw11, 0, }, {"cdw12", '6', "NUM", CFG_POSITIVE , &cfg.cdw12, 1, cdw12, 0, }, {"cdw13", '7', "NUM", CFG_POSITIVE , &cfg.cdw13, 1, cdw13, 0, }, {"cdw14", '8', "NUM", CFG_POSITIVE , &cfg.cdw14, 1, cdw14, 0, }, {"cdw15", '9', "NUM", CFG_POSITIVE , &cfg.cdw15, 1, cdw15, 0, }, {"input-file", 'i', "FILE", CFG_STRING, &cfg.input_file, 1, input, 0, }, {"metadata" , 'M', "FILE", CFG_STRING, &cfg.metadata, 1, metadata, 0, }, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_dump, 0, }, {"show-command", 's', ((void*)0), CFG_FLAG , &cfg.show_command, 0, show, 0, }, {"read", 'r', ((void* )0), CFG_FLAG, &cfg.read, 0, re, 0, }, {"write", 'w', ((void *)0), CFG_FLAG, &cfg.write, 0, wr, 0, }, {"latency", 'T', ((void*)0), CFG_FLAG, &cfg.latency, 0, latency, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 9633 | ||||
| 9634 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 9635 | if (err) | |||
| 9636 | return err; | |||
| 9637 | ||||
| 9638 | err = validate_output_format(nvme_args.output_format, &flags_t); | |||
| 9639 | if (err < 0) { | |||
| 9640 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 9641 | return err; | |||
| 9642 | } | |||
| 9643 | ||||
| 9644 | if (!argconfig_parse_seen(opts, "opcode")) { | |||
| 9645 | nvme_show_error("%s: opcode parameter required", acmd->name)nvme_show_message(1, "%s: opcode parameter required", acmd-> name); | |||
| 9646 | return -EINVAL22; | |||
| 9647 | } | |||
| 9648 | ||||
| 9649 | if (cfg.opcode & 0x01) { | |||
| 9650 | cfg.write = true1; | |||
| 9651 | flags = O_RDONLY00; | |||
| 9652 | dfd = mfd = STDIN_FILENO0; | |||
| 9653 | } | |||
| 9654 | ||||
| 9655 | if (cfg.opcode & 0x02) { | |||
| 9656 | cfg.read = true1; | |||
| 9657 | flags = O_WRONLY01 | O_CREAT0100 | O_TRUNC01000; | |||
| 9658 | dfd = mfd = STDOUT_FILENO1; | |||
| 9659 | } | |||
| 9660 | ||||
| 9661 | if (strlen(cfg.input_file)) { | |||
| 9662 | dfd = nvme_open_rawdata(cfg.input_file, flags, mode)open((cfg.input_file), (flags), mode); | |||
| 9663 | if (dfd < 0) { | |||
| 9664 | nvme_show_perror(cfg.input_file); | |||
| 9665 | return -EINVAL22; | |||
| 9666 | } | |||
| 9667 | } | |||
| 9668 | ||||
| 9669 | if (cfg.metadata && strlen(cfg.metadata)) { | |||
| 9670 | mfd = nvme_open_rawdata(cfg.metadata, flags, mode)open((cfg.metadata), (flags), mode); | |||
| 9671 | if (mfd < 0) { | |||
| 9672 | nvme_show_perror(cfg.metadata); | |||
| 9673 | return -EINVAL22; | |||
| 9674 | } | |||
| 9675 | } | |||
| 9676 | ||||
| 9677 | if (cfg.metadata_len) { | |||
| 9678 | mdata = malloc(cfg.metadata_len); | |||
| 9679 | if (!mdata) | |||
| 9680 | return -ENOMEM12; | |||
| 9681 | ||||
| 9682 | if (cfg.write) { | |||
| 9683 | if (read(mfd, mdata, cfg.metadata_len) < 0) { | |||
| 9684 | err = -errno(*__errno_location ()); | |||
| 9685 | nvme_show_perror("failed to read metadata write buffer"); | |||
| 9686 | return err; | |||
| 9687 | } | |||
| 9688 | } else { | |||
| 9689 | memset(mdata, cfg.prefill, cfg.metadata_len); | |||
| 9690 | } | |||
| 9691 | } | |||
| 9692 | ||||
| 9693 | if (cfg.data_len) { | |||
| 9694 | data = libnvme_alloc_huge(cfg.data_len, &mh); | |||
| 9695 | if (!data) { | |||
| 9696 | nvme_show_error("failed to allocate huge memory")nvme_show_message(1, "failed to allocate huge memory"); | |||
| 9697 | return -ENOMEM12; | |||
| 9698 | } | |||
| 9699 | ||||
| 9700 | memset(data, cfg.prefill, cfg.data_len); | |||
| 9701 | if (!cfg.read && !cfg.write) { | |||
| 9702 | nvme_show_error("data direction not given")nvme_show_message(1, "data direction not given"); | |||
| 9703 | return -EINVAL22; | |||
| 9704 | } else if (cfg.write) { | |||
| 9705 | if (read(dfd, data, cfg.data_len) < 0) { | |||
| 9706 | err = -errno(*__errno_location ()); | |||
| 9707 | nvme_show_error("failed to read write buffer %s", libnvme_strerror(errno))nvme_show_message(1, "failed to read write buffer %s", libnvme_strerror ((*__errno_location ()))); | |||
| 9708 | return err; | |||
| 9709 | } | |||
| 9710 | } | |||
| 9711 | } | |||
| 9712 | ||||
| 9713 | if (cfg.show_command || nvme_args.dry_run) { | |||
| 9714 | printf("opcode : %02x\n", cfg.opcode); | |||
| 9715 | printf("flags : %02x\n", cfg.flags); | |||
| 9716 | printf("rsvd1 : %04x\n", cfg.rsvd); | |||
| 9717 | printf("nsid : %08x\n", cfg.namespace_id); | |||
| 9718 | printf("cdw2 : %08x\n", cfg.cdw2); | |||
| 9719 | printf("cdw3 : %08x\n", cfg.cdw3); | |||
| 9720 | printf("data_len : %08x\n", cfg.data_len); | |||
| 9721 | printf("metadata_len : %08x\n", cfg.metadata_len); | |||
| 9722 | printf("addr : %"PRIx64"l" "x""\n", (uint64_t)(uintptr_t)data); | |||
| 9723 | printf("metadata : %"PRIx64"l" "x""\n", (uint64_t)(uintptr_t)mdata); | |||
| 9724 | printf("cdw10 : %08x\n", cfg.cdw10); | |||
| 9725 | printf("cdw11 : %08x\n", cfg.cdw11); | |||
| 9726 | printf("cdw12 : %08x\n", cfg.cdw12); | |||
| 9727 | printf("cdw13 : %08x\n", cfg.cdw13); | |||
| 9728 | printf("cdw14 : %08x\n", cfg.cdw14); | |||
| 9729 | printf("cdw15 : %08x\n", cfg.cdw15); | |||
| 9730 | printf("timeout_ms : %08x\n", nvme_args.timeout); | |||
| 9731 | } | |||
| 9732 | if (nvme_args.dry_run) | |||
| 9733 | return 0; | |||
| 9734 | ||||
| 9735 | gettimeofday(&start_time, NULL((void*)0)); | |||
| 9736 | ||||
| 9737 | struct libnvme_passthru_cmd cmd = { | |||
| 9738 | .opcode = cfg.opcode, | |||
| 9739 | .flags = cfg.flags, | |||
| 9740 | .nsid = cfg.namespace_id, | |||
| 9741 | .cdw2 = cfg.cdw2, | |||
| 9742 | .cdw3 = cfg.cdw3, | |||
| 9743 | .metadata = (__u64)(uintptr_t)mdata, | |||
| 9744 | .addr = (__u64)(uintptr_t)data, | |||
| 9745 | .metadata_len = cfg.metadata_len, | |||
| 9746 | .data_len = cfg.data_len, | |||
| 9747 | .cdw10 = cfg.cdw10, | |||
| 9748 | .cdw11 = cfg.cdw11, | |||
| 9749 | .cdw12 = cfg.cdw12, | |||
| 9750 | .cdw13 = cfg.cdw13, | |||
| 9751 | .cdw14 = cfg.cdw14, | |||
| 9752 | .cdw15 = cfg.cdw15, | |||
| 9753 | .timeout_ms = nvme_args.timeout, | |||
| 9754 | }; | |||
| 9755 | if (admin) | |||
| 9756 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 9757 | else | |||
| 9758 | err = libnvme_exec_io_passthru(hdl, &cmd); | |||
| 9759 | ||||
| 9760 | gettimeofday(&end_time, NULL((void*)0)); | |||
| 9761 | cmd_name = nvme_cmd_to_string(admin, cfg.opcode); | |||
| 9762 | if (cfg.latency) | |||
| 9763 | printf("%s Command %s latency: %llu us\n", admin ? "Admin" : "IO", | |||
| 9764 | strcmp(cmd_name, "Unknown") ? cmd_name : "Vendor Specific", | |||
| 9765 | elapsed_utime(start_time, end_time)); | |||
| 9766 | ||||
| 9767 | if (err) { | |||
| 9768 | nvme_show_err(err, __func__); | |||
| 9769 | return err; | |||
| 9770 | } | |||
| 9771 | ||||
| 9772 | fprintf(stderrstderr, "%s Command %s is Success and result: 0x%" PRIx64"l" "x" "\n", | |||
| 9773 | admin ? "Admin" : "IO", | |||
| 9774 | strcmp(cmd_name, "Unknown") ? | |||
| 9775 | cmd_name : "Vendor Specific", (uint64_t)cmd.result); | |||
| 9776 | if (cfg.read) | |||
| 9777 | passthru_print_read_output(cfg, data, dfd, mdata, mfd, err); | |||
| 9778 | ||||
| 9779 | return err; | |||
| 9780 | } | |||
| 9781 | ||||
| 9782 | static int io_passthru(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 9783 | { | |||
| 9784 | const char *desc = | |||
| 9785 | "Send a user-defined IO command to the specified device via IOCTL passthrough, return results."; | |||
| 9786 | ||||
| 9787 | return passthru(argc, argv, false0, desc, acmd); | |||
| 9788 | } | |||
| 9789 | ||||
| 9790 | static int admin_passthru(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 9791 | { | |||
| 9792 | const char *desc = | |||
| 9793 | "Send a user-defined Admin command to the specified device via IOCTL passthrough, return results."; | |||
| 9794 | ||||
| 9795 | return passthru(argc, argv, true1, desc, acmd); | |||
| 9796 | } | |||
| 9797 | ||||
| 9798 | static int gen_hostnqn_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 9799 | { | |||
| 9800 | char *hostnqn; | |||
| 9801 | ||||
| 9802 | hostnqn = libnvme_generate_hostnqn(); | |||
| 9803 | if (!hostnqn) { | |||
| 9804 | nvme_show_error("\"%s\" not supported. Install lib uuid and rebuild.",nvme_show_message(1, "\"%s\" not supported. Install lib uuid and rebuild." , acmd->name) | |||
| 9805 | acmd->name)nvme_show_message(1, "\"%s\" not supported. Install lib uuid and rebuild." , acmd->name); | |||
| 9806 | return -ENOTSUP95; | |||
| 9807 | } | |||
| 9808 | printf("%s\n", hostnqn); | |||
| 9809 | free(hostnqn); | |||
| 9810 | return 0; | |||
| 9811 | } | |||
| 9812 | ||||
| 9813 | static int show_hostnqn_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 9814 | { | |||
| 9815 | char *hostnqn; | |||
| 9816 | ||||
| 9817 | hostnqn = libnvme_read_hostnqn(); | |||
| 9818 | if (!hostnqn) | |||
| 9819 | hostnqn = libnvme_generate_hostnqn(); | |||
| 9820 | ||||
| 9821 | if (!hostnqn) { | |||
| 9822 | nvme_show_error("hostnqn is not available -- use nvme gen-hostnqn")nvme_show_message(1, "hostnqn is not available -- use nvme gen-hostnqn" ); | |||
| 9823 | return -ENOENT2; | |||
| 9824 | } | |||
| 9825 | ||||
| 9826 | fprintf(stdoutstdout, "%s\n", hostnqn); | |||
| 9827 | free(hostnqn); | |||
| 9828 | ||||
| 9829 | return 0; | |||
| 9830 | } | |||
| 9831 | ||||
| 9832 | ||||
| 9833 | static int gen_dhchap_key(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 9834 | { | |||
| 9835 | const char *desc = | |||
| 9836 | "Generate a DH-HMAC-CHAP host key usable for NVMe In-Band Authentication."; | |||
| 9837 | const char *secret = | |||
| 9838 | "Optional secret (in hexadecimal characters) to be used to initialize the host key."; | |||
| 9839 | const char *key_len = "Length of the resulting key (32, 48, or 64 bytes)."; | |||
| 9840 | const char *hmac = | |||
| 9841 | "HMAC function to use for key transformation (0 = none, 1 = SHA-256, 2 = SHA-384, 3 = SHA-512)."; | |||
| 9842 | const char *nqn = "Host NQN to use for key transformation."; | |||
| 9843 | ||||
| 9844 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 9845 | __cleanup_free__attribute__((cleanup(freep))) unsigned char *raw_secret = NULL((void*)0); | |||
| 9846 | __cleanup_free__attribute__((cleanup(freep))) char *hnqn = NULL((void*)0); | |||
| 9847 | unsigned char key[68]; | |||
| 9848 | char encoded_key[128]; | |||
| 9849 | unsigned long crc = crc32(0L, NULL((void*)0), 0); | |||
| 9850 | int err = 0; | |||
| 9851 | ||||
| 9852 | struct config { | |||
| 9853 | char *secret; | |||
| 9854 | unsigned int key_len; | |||
| 9855 | char *nqn; | |||
| 9856 | unsigned int hmac; | |||
| 9857 | }; | |||
| 9858 | ||||
| 9859 | struct config cfg = { | |||
| 9860 | .secret = NULL((void*)0), | |||
| 9861 | .key_len = 0, | |||
| 9862 | .nqn = NULL((void*)0), | |||
| 9863 | .hmac = 0, | |||
| 9864 | }; | |||
| 9865 | ||||
| 9866 | NVME_ARGS(opts,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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9867 | OPT_STR("secret", 's', &cfg.secret, secret),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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9868 | OPT_UINT("key-length", 'l', &cfg.key_len, key_len),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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9869 | OPT_STR("nqn", 'n', &cfg.nqn, nqn),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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 9870 | OPT_UINT("hmac", 'm', &cfg.hmac, hmac))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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 9871 | ||||
| 9872 | err = parse_args(argc, argv, desc, opts); | |||
| 9873 | if (err) | |||
| 9874 | return err; | |||
| 9875 | ||||
| 9876 | ctx = libnvme_create_global_ctx(stderrstderr, log_level); | |||
| 9877 | if (!ctx) { | |||
| 9878 | nvme_show_error("Failed to create global context")nvme_show_message(1, "Failed to create global context"); | |||
| 9879 | return -ENOMEM12; | |||
| 9880 | } | |||
| 9881 | ||||
| 9882 | if (cfg.hmac > 3) { | |||
| 9883 | nvme_show_error("Invalid HMAC identifier %u", cfg.hmac)nvme_show_message(1, "Invalid HMAC identifier %u", cfg.hmac); | |||
| 9884 | return -EINVAL22; | |||
| 9885 | } | |||
| 9886 | if (cfg.hmac > 0) { | |||
| 9887 | switch (cfg.hmac) { | |||
| 9888 | case 1: | |||
| 9889 | if (!cfg.key_len) { | |||
| 9890 | cfg.key_len = 32; | |||
| 9891 | } else if (cfg.key_len != 32) { | |||
| 9892 | nvme_show_error("Invalid key length %d for SHA(256)", cfg.key_len)nvme_show_message(1, "Invalid key length %d for SHA(256)", cfg .key_len); | |||
| 9893 | return -EINVAL22; | |||
| 9894 | } | |||
| 9895 | break; | |||
| 9896 | case 2: | |||
| 9897 | if (!cfg.key_len) { | |||
| 9898 | cfg.key_len = 48; | |||
| 9899 | } else if (cfg.key_len != 48) { | |||
| 9900 | nvme_show_error("Invalid key length %d for SHA(384)", cfg.key_len)nvme_show_message(1, "Invalid key length %d for SHA(384)", cfg .key_len); | |||
| 9901 | return -EINVAL22; | |||
| 9902 | } | |||
| 9903 | break; | |||
| 9904 | case 3: | |||
| 9905 | if (!cfg.key_len) { | |||
| 9906 | cfg.key_len = 64; | |||
| 9907 | } else if (cfg.key_len != 64) { | |||
| 9908 | nvme_show_error("Invalid key length %d for SHA(512)", cfg.key_len)nvme_show_message(1, "Invalid key length %d for SHA(512)", cfg .key_len); | |||
| 9909 | return -EINVAL22; | |||
| 9910 | } | |||
| 9911 | break; | |||
| 9912 | default: | |||
| 9913 | break; | |||
| 9914 | } | |||
| 9915 | } else if (!cfg.key_len) { | |||
| 9916 | cfg.key_len = 32; | |||
| 9917 | } | |||
| 9918 | ||||
| 9919 | err = libnvme_create_raw_secret(ctx, cfg.secret, cfg.key_len, &raw_secret); | |||
| 9920 | if (err) | |||
| 9921 | return err; | |||
| 9922 | ||||
| 9923 | if (!cfg.nqn) { | |||
| 9924 | cfg.nqn = hnqn = libnvme_read_hostnqn(); | |||
| 9925 | if (!cfg.nqn) { | |||
| 9926 | nvme_show_error("Could not read host NQN")nvme_show_message(1, "Could not read host NQN"); | |||
| 9927 | return -ENOENT2; | |||
| 9928 | } | |||
| 9929 | } | |||
| 9930 | ||||
| 9931 | err = libnvme_gen_dhchap_key(ctx, cfg.nqn, cfg.hmac, | |||
| 9932 | cfg.key_len, raw_secret, key); | |||
| 9933 | if (err) | |||
| 9934 | return err; | |||
| 9935 | ||||
| 9936 | crc = crc32(crc, key, cfg.key_len); | |||
| 9937 | key[cfg.key_len++] = crc & 0xff; | |||
| 9938 | key[cfg.key_len++] = (crc >> 8) & 0xff; | |||
| 9939 | key[cfg.key_len++] = (crc >> 16) & 0xff; | |||
| 9940 | key[cfg.key_len++] = (crc >> 24) & 0xff; | |||
| 9941 | ||||
| 9942 | memset(encoded_key, 0, sizeof(encoded_key)); | |||
| 9943 | base64_encode(key, cfg.key_len, encoded_key); | |||
| 9944 | ||||
| 9945 | printf("DHHC-1:%02x:%s:\n", cfg.hmac, encoded_key); | |||
| 9946 | return 0; | |||
| 9947 | } | |||
| 9948 | ||||
| 9949 | static int check_dhchap_key(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 9950 | { | |||
| 9951 | const char *desc = | |||
| 9952 | "Check a DH-HMAC-CHAP host key for usability for NVMe In-Band Authentication."; | |||
| 9953 | const char *key = "DH-HMAC-CHAP key (in hexadecimal characters) to be validated."; | |||
| 9954 | ||||
| 9955 | unsigned char decoded_key[128]; | |||
| 9956 | unsigned int decoded_len; | |||
| 9957 | uint32_t crc = crc32(0L, NULL((void*)0), 0); | |||
| 9958 | uint32_t key_crc; | |||
| 9959 | int err = 0, hmac; | |||
| 9960 | struct config { | |||
| 9961 | char *key; | |||
| 9962 | }; | |||
| 9963 | ||||
| 9964 | struct config cfg = { | |||
| 9965 | .key = NULL((void*)0), | |||
| 9966 | }; | |||
| 9967 | ||||
| 9968 | NVME_ARGS(opts,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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } } | |||
| 9969 | OPT_STR("key", 'k', &cfg.key, key))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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 9970 | ||||
| 9971 | err = parse_args(argc, argv, desc, opts); | |||
| 9972 | if (err) | |||
| 9973 | return err; | |||
| 9974 | ||||
| 9975 | if (!cfg.key) { | |||
| 9976 | nvme_show_error("Key not specified")nvme_show_message(1, "Key not specified"); | |||
| 9977 | return -EINVAL22; | |||
| 9978 | } | |||
| 9979 | ||||
| 9980 | if (sscanf(cfg.key, "DHHC-1:%02x:*s", &hmac) != 1) { | |||
| 9981 | nvme_show_error("Invalid key header '%s'", cfg.key)nvme_show_message(1, "Invalid key header '%s'", cfg.key); | |||
| 9982 | return -EINVAL22; | |||
| 9983 | } | |||
| 9984 | switch (hmac) { | |||
| 9985 | case 0: | |||
| 9986 | break; | |||
| 9987 | case 1: | |||
| 9988 | if (strlen(cfg.key) != 59) { | |||
| 9989 | nvme_show_error("Invalid key length for SHA(256)")nvme_show_message(1, "Invalid key length for SHA(256)"); | |||
| 9990 | return -EINVAL22; | |||
| 9991 | } | |||
| 9992 | break; | |||
| 9993 | case 2: | |||
| 9994 | if (strlen(cfg.key) != 83) { | |||
| 9995 | nvme_show_error("Invalid key length for SHA(384)")nvme_show_message(1, "Invalid key length for SHA(384)"); | |||
| 9996 | return -EINVAL22; | |||
| 9997 | } | |||
| 9998 | break; | |||
| 9999 | case 3: | |||
| 10000 | if (strlen(cfg.key) != 103) { | |||
| 10001 | nvme_show_error("Invalid key length for SHA(512)")nvme_show_message(1, "Invalid key length for SHA(512)"); | |||
| 10002 | return -EINVAL22; | |||
| 10003 | } | |||
| 10004 | break; | |||
| 10005 | default: | |||
| 10006 | nvme_show_error("Invalid HMAC identifier %d", hmac)nvme_show_message(1, "Invalid HMAC identifier %d", hmac); | |||
| 10007 | return -EINVAL22; | |||
| 10008 | } | |||
| 10009 | ||||
| 10010 | err = base64_decode(cfg.key + 10, strlen(cfg.key) - 11, decoded_key); | |||
| 10011 | if (err < 0) { | |||
| 10012 | nvme_show_error("Base64 decoding failed, error %d")nvme_show_message(1, "Base64 decoding failed, error %d"); | |||
| 10013 | return err; | |||
| 10014 | } | |||
| 10015 | decoded_len = err; | |||
| 10016 | if (decoded_len < 32) { | |||
| 10017 | nvme_show_error("Base64 decoding failed (%s, size %u)", cfg.key + 10, decoded_len)nvme_show_message(1, "Base64 decoding failed (%s, size %u)", cfg .key + 10, decoded_len); | |||
| 10018 | return -EINVAL22; | |||
| 10019 | } | |||
| 10020 | decoded_len -= 4; | |||
| 10021 | if (decoded_len != 32 && decoded_len != 48 && decoded_len != 64) { | |||
| 10022 | nvme_show_error("Invalid key length %d", decoded_len)nvme_show_message(1, "Invalid key length %d", decoded_len); | |||
| 10023 | return -EINVAL22; | |||
| 10024 | } | |||
| 10025 | crc = crc32(crc, decoded_key, decoded_len); | |||
| 10026 | key_crc = ((uint32_t)decoded_key[decoded_len]) | | |||
| 10027 | ((uint32_t)decoded_key[decoded_len + 1] << 8) | | |||
| 10028 | ((uint32_t)decoded_key[decoded_len + 2] << 16) | | |||
| 10029 | ((uint32_t)decoded_key[decoded_len + 3] << 24); | |||
| 10030 | if (key_crc != crc) { | |||
| 10031 | nvme_show_error("CRC mismatch (key %08x, crc %08x)", key_crc, crc)nvme_show_message(1, "CRC mismatch (key %08x, crc %08x)", key_crc , crc); | |||
| 10032 | return -EINVAL22; | |||
| 10033 | } | |||
| 10034 | printf("Key is valid (HMAC %d, length %d, CRC %08x)\n", hmac, decoded_len, crc); | |||
| 10035 | return 0; | |||
| 10036 | } | |||
| 10037 | ||||
| 10038 | static int append_keyfile(struct libnvme_global_ctx *ctx, const char *keyring, | |||
| 10039 | long id, const char *keyfile) | |||
| 10040 | { | |||
| 10041 | __cleanup_free__attribute__((cleanup(freep))) unsigned char *key_data = NULL((void*)0); | |||
| 10042 | __cleanup_free__attribute__((cleanup(freep))) char *exported_key = NULL((void*)0); | |||
| 10043 | __cleanup_free__attribute__((cleanup(freep))) char *identity = NULL((void*)0); | |||
| 10044 | __cleanup_file__attribute__((cleanup(cleanup_file))) FILE *fd = NULL((void*)0); | |||
| 10045 | int err, ver, hmac, key_len; | |||
| 10046 | mode_t old_umask; | |||
| 10047 | long kr_id; | |||
| 10048 | char type; | |||
| 10049 | ||||
| 10050 | err = libnvme_lookup_keyring(ctx, keyring, &kr_id); | |||
| 10051 | if (err) { | |||
| 10052 | nvme_show_error("Failed to lookup keyring '%s', %s",nvme_show_message(1, "Failed to lookup keyring '%s', %s", keyring , libnvme_strerror(-err)) | |||
| 10053 | keyring, libnvme_strerror(-err))nvme_show_message(1, "Failed to lookup keyring '%s', %s", keyring , libnvme_strerror(-err)); | |||
| 10054 | return err; | |||
| 10055 | } | |||
| 10056 | ||||
| 10057 | identity = libnvme_describe_key_serial(ctx, id); | |||
| 10058 | if (!identity) { | |||
| 10059 | nvme_show_error("Failed to get identity info")nvme_show_message(1, "Failed to get identity info"); | |||
| 10060 | return -EINVAL22; | |||
| 10061 | } | |||
| 10062 | ||||
| 10063 | if (sscanf(identity, "NVMe%01d%c%02d %*s", &ver, &type, &hmac) != 3) { | |||
| 10064 | nvme_show_error("Failed to parse identity\n")nvme_show_message(1, "Failed to parse identity\n"); | |||
| 10065 | return -EINVAL22; | |||
| 10066 | } | |||
| 10067 | ||||
| 10068 | err = libnvme_read_key(ctx, kr_id, id, &key_len, &key_data); | |||
| 10069 | if (err) { | |||
| 10070 | nvme_show_error("Failed to read back derive TLS PSK, %s",nvme_show_message(1, "Failed to read back derive TLS PSK, %s" , libnvme_strerror(-err)) | |||
| 10071 | libnvme_strerror(-err))nvme_show_message(1, "Failed to read back derive TLS PSK, %s" , libnvme_strerror(-err)); | |||
| 10072 | return err; | |||
| 10073 | } | |||
| 10074 | ||||
| 10075 | err = libnvme_export_tls_key_versioned(ctx, ver, hmac, key_data, | |||
| 10076 | key_len, &exported_key); | |||
| 10077 | if (err) { | |||
| 10078 | nvme_show_error("Failed to export key, %s",nvme_show_message(1, "Failed to export key, %s", libnvme_strerror (-err)) | |||
| 10079 | libnvme_strerror(-err))nvme_show_message(1, "Failed to export key, %s", libnvme_strerror (-err)); | |||
| 10080 | return err; | |||
| 10081 | } | |||
| 10082 | ||||
| 10083 | old_umask = umask(0); | |||
| 10084 | ||||
| 10085 | fd = fopen(keyfile, "a"); | |||
| 10086 | if (!fd) { | |||
| 10087 | nvme_show_error("Failed to open '%s', %s",nvme_show_message(1, "Failed to open '%s', %s", keyfile, libnvme_strerror ((*__errno_location ()))) | |||
| 10088 | keyfile, libnvme_strerror(errno))nvme_show_message(1, "Failed to open '%s', %s", keyfile, libnvme_strerror ((*__errno_location ()))); | |||
| 10089 | err = -errno(*__errno_location ()); | |||
| 10090 | goto out; | |||
| 10091 | } | |||
| 10092 | ||||
| 10093 | err = fprintf(fd, "%s %s\n", identity, exported_key); | |||
| 10094 | if (err < 0) { | |||
| 10095 | nvme_show_error("Failed to append key to '%s', %s",nvme_show_message(1, "Failed to append key to '%s', %s", keyfile , libnvme_strerror((*__errno_location ()))) | |||
| 10096 | keyfile, libnvme_strerror(errno))nvme_show_message(1, "Failed to append key to '%s', %s", keyfile , libnvme_strerror((*__errno_location ()))); | |||
| 10097 | err = -errno(*__errno_location ()); | |||
| 10098 | } else { | |||
| 10099 | err = 0; | |||
| 10100 | } | |||
| 10101 | ||||
| 10102 | out: | |||
| 10103 | chmod(keyfile, 0600); | |||
| 10104 | umask(old_umask); | |||
| 10105 | ||||
| 10106 | return err; | |||
| 10107 | } | |||
| 10108 | ||||
| 10109 | static int gen_tls_key(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 10110 | { | |||
| 10111 | const char *desc = "Generate a TLS key in NVMe PSK Interchange format."; | |||
| 10112 | const char *secret = | |||
| 10113 | "Optional secret (in hexadecimal characters) to be used for the TLS key."; | |||
| 10114 | const char *hmac = "HMAC function to use for the retained key (1 = SHA-256, 2 = SHA-384)."; | |||
| 10115 | const char *version = "TLS identity version to use (0 = NVMe TCP 1.0c, 1 = NVMe TCP 2.0"; | |||
| 10116 | const char *hostnqn = "Host NQN for the retained key."; | |||
| 10117 | const char *subsysnqn = "Subsystem NQN for the retained key."; | |||
| 10118 | const char *keyring = "Keyring for the retained key."; | |||
| 10119 | const char *keytype = "Key type of the retained key."; | |||
| 10120 | const char *insert = "Insert retained key into the keyring."; | |||
| 10121 | const char *keyfile = "Update key file with the derive TLS PSK."; | |||
| 10122 | const char *compat = "Use non-RFC 8446 compliant algorithm for deriving TLS PSK for older implementations"; | |||
| 10123 | ||||
| 10124 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 10125 | __cleanup_free__attribute__((cleanup(freep))) unsigned char *raw_secret = NULL((void*)0); | |||
| 10126 | __cleanup_free__attribute__((cleanup(freep))) char *encoded_key = NULL((void*)0); | |||
| 10127 | __cleanup_free__attribute__((cleanup(freep))) char *hnqn = NULL((void*)0); | |||
| 10128 | int key_len = 32; | |||
| 10129 | int err; | |||
| 10130 | long tls_key; | |||
| 10131 | ||||
| 10132 | struct config { | |||
| 10133 | char *keyring; | |||
| 10134 | char *keytype; | |||
| 10135 | char *hostnqn; | |||
| 10136 | char *subsysnqn; | |||
| 10137 | char *secret; | |||
| 10138 | char *keyfile; | |||
| 10139 | unsigned char hmac; | |||
| 10140 | unsigned char version; | |||
| 10141 | bool_Bool insert; | |||
| 10142 | bool_Bool compat; | |||
| 10143 | }; | |||
| 10144 | ||||
| 10145 | struct config cfg = { | |||
| 10146 | .keyring = ".nvme", | |||
| 10147 | .keytype = "psk", | |||
| 10148 | .hostnqn = NULL((void*)0), | |||
| 10149 | .subsysnqn = NULL((void*)0), | |||
| 10150 | .secret = NULL((void*)0), | |||
| 10151 | .keyfile = NULL((void*)0), | |||
| 10152 | .hmac = 1, | |||
| 10153 | .version = 0, | |||
| 10154 | .insert = false0, | |||
| 10155 | .compat = false0, | |||
| 10156 | }; | |||
| 10157 | ||||
| 10158 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"secret" , 's', "STRING", CFG_STRING, &cfg.secret, 1, secret, 0, } , {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1, keyfile, 0, }, {"hmac", 'm', "NUM", CFG_BYTE, &cfg.hmac, 1, hmac, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg.version , 1, version, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG, & cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0), CFG_FLAG , &cfg.compat, 0, compat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10159 | OPT_STR("keyring", 'k', &cfg.keyring, keyring),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"secret" , 's', "STRING", CFG_STRING, &cfg.secret, 1, secret, 0, } , {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1, keyfile, 0, }, {"hmac", 'm', "NUM", CFG_BYTE, &cfg.hmac, 1, hmac, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg.version , 1, version, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG, & cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0), CFG_FLAG , &cfg.compat, 0, compat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10160 | OPT_STR("keytype", 't', &cfg.keytype, keytype),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"secret" , 's', "STRING", CFG_STRING, &cfg.secret, 1, secret, 0, } , {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1, keyfile, 0, }, {"hmac", 'm', "NUM", CFG_BYTE, &cfg.hmac, 1, hmac, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg.version , 1, version, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG, & cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0), CFG_FLAG , &cfg.compat, 0, compat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10161 | OPT_STR("hostnqn", 'n', &cfg.hostnqn, hostnqn),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"secret" , 's', "STRING", CFG_STRING, &cfg.secret, 1, secret, 0, } , {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1, keyfile, 0, }, {"hmac", 'm', "NUM", CFG_BYTE, &cfg.hmac, 1, hmac, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg.version , 1, version, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG, & cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0), CFG_FLAG , &cfg.compat, 0, compat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10162 | OPT_STR("subsysnqn", 'c', &cfg.subsysnqn, subsysnqn),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"secret" , 's', "STRING", CFG_STRING, &cfg.secret, 1, secret, 0, } , {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1, keyfile, 0, }, {"hmac", 'm', "NUM", CFG_BYTE, &cfg.hmac, 1, hmac, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg.version , 1, version, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG, & cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0), CFG_FLAG , &cfg.compat, 0, compat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10163 | OPT_STR("secret", 's', &cfg.secret, secret),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"secret" , 's', "STRING", CFG_STRING, &cfg.secret, 1, secret, 0, } , {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1, keyfile, 0, }, {"hmac", 'm', "NUM", CFG_BYTE, &cfg.hmac, 1, hmac, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg.version , 1, version, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG, & cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0), CFG_FLAG , &cfg.compat, 0, compat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10164 | OPT_STR("keyfile", 'f', &cfg.keyfile, keyfile),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"secret" , 's', "STRING", CFG_STRING, &cfg.secret, 1, secret, 0, } , {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1, keyfile, 0, }, {"hmac", 'm', "NUM", CFG_BYTE, &cfg.hmac, 1, hmac, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg.version , 1, version, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG, & cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0), CFG_FLAG , &cfg.compat, 0, compat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10165 | OPT_BYTE("hmac", 'm', &cfg.hmac, hmac),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"secret" , 's', "STRING", CFG_STRING, &cfg.secret, 1, secret, 0, } , {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1, keyfile, 0, }, {"hmac", 'm', "NUM", CFG_BYTE, &cfg.hmac, 1, hmac, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg.version , 1, version, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG, & cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0), CFG_FLAG , &cfg.compat, 0, compat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10166 | OPT_BYTE("identity", 'I', &cfg.version, version),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"secret" , 's', "STRING", CFG_STRING, &cfg.secret, 1, secret, 0, } , {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1, keyfile, 0, }, {"hmac", 'm', "NUM", CFG_BYTE, &cfg.hmac, 1, hmac, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg.version , 1, version, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG, & cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0), CFG_FLAG , &cfg.compat, 0, compat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10167 | OPT_FLAG("insert", 'i', &cfg.insert, insert),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"secret" , 's', "STRING", CFG_STRING, &cfg.secret, 1, secret, 0, } , {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1, keyfile, 0, }, {"hmac", 'm', "NUM", CFG_BYTE, &cfg.hmac, 1, hmac, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg.version , 1, version, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG, & cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0), CFG_FLAG , &cfg.compat, 0, compat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10168 | OPT_FLAG("compat", 'C', &cfg.compat, compat))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"secret" , 's', "STRING", CFG_STRING, &cfg.secret, 1, secret, 0, } , {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1, keyfile, 0, }, {"hmac", 'm', "NUM", CFG_BYTE, &cfg.hmac, 1, hmac, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg.version , 1, version, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG, & cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0), CFG_FLAG , &cfg.compat, 0, compat, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 10169 | ||||
| 10170 | err = parse_args(argc, argv, desc, opts); | |||
| 10171 | if (err) | |||
| 10172 | return err; | |||
| 10173 | if (cfg.hmac < 1 || cfg.hmac > 2) { | |||
| 10174 | nvme_show_error("Invalid HMAC identifier %u", cfg.hmac)nvme_show_message(1, "Invalid HMAC identifier %u", cfg.hmac); | |||
| 10175 | return -EINVAL22; | |||
| 10176 | } | |||
| 10177 | if (cfg.version > 1) { | |||
| 10178 | nvme_show_error("Invalid TLS identity version %u",nvme_show_message(1, "Invalid TLS identity version %u", cfg.version ) | |||
| 10179 | cfg.version)nvme_show_message(1, "Invalid TLS identity version %u", cfg.version ); | |||
| 10180 | return -EINVAL22; | |||
| 10181 | } | |||
| 10182 | if (cfg.insert) { | |||
| 10183 | if (!cfg.subsysnqn) { | |||
| 10184 | nvme_show_error("No subsystem NQN specified")nvme_show_message(1, "No subsystem NQN specified"); | |||
| 10185 | return -EINVAL22; | |||
| 10186 | } | |||
| 10187 | if (!cfg.hostnqn) { | |||
| 10188 | cfg.hostnqn = hnqn = libnvme_read_hostnqn(); | |||
| 10189 | if (!cfg.hostnqn) { | |||
| 10190 | nvme_show_error("Failed to read host NQN")nvme_show_message(1, "Failed to read host NQN"); | |||
| 10191 | return -EINVAL22; | |||
| 10192 | } | |||
| 10193 | } | |||
| 10194 | } | |||
| 10195 | if (cfg.hmac == 2) | |||
| 10196 | key_len = 48; | |||
| 10197 | ||||
| 10198 | ctx = libnvme_create_global_ctx(stderrstderr, log_level); | |||
| 10199 | if (!ctx) { | |||
| 10200 | nvme_show_error("Failed to create global context")nvme_show_message(1, "Failed to create global context"); | |||
| 10201 | return -ENOMEM12; | |||
| 10202 | } | |||
| 10203 | ||||
| 10204 | err = libnvme_create_raw_secret(ctx, cfg.secret, key_len, &raw_secret); | |||
| 10205 | if (err) | |||
| 10206 | return err; | |||
| 10207 | ||||
| 10208 | err = libnvme_export_tls_key(ctx, raw_secret, key_len, &encoded_key); | |||
| 10209 | if (err) { | |||
| 10210 | nvme_show_error("Failed to export key, %s", libnvme_strerror(-err))nvme_show_message(1, "Failed to export key, %s", libnvme_strerror (-err)); | |||
| 10211 | return err; | |||
| 10212 | } | |||
| 10213 | printf("%s\n", encoded_key); | |||
| 10214 | ||||
| 10215 | if (cfg.insert) { | |||
| 10216 | if (cfg.compat) | |||
| 10217 | err = libnvme_insert_tls_key_compat(ctx, cfg.keyring, | |||
| 10218 | cfg.keytype, cfg.hostnqn, | |||
| 10219 | cfg.subsysnqn, cfg.version, | |||
| 10220 | cfg.hmac, raw_secret, key_len, &tls_key); | |||
| 10221 | else | |||
| 10222 | err = libnvme_insert_tls_key_versioned(ctx, cfg.keyring, | |||
| 10223 | cfg.keytype, cfg.hostnqn, | |||
| 10224 | cfg.subsysnqn, cfg.version, | |||
| 10225 | cfg.hmac, raw_secret, key_len, &tls_key); | |||
| 10226 | if (err) { | |||
| 10227 | nvme_show_error("Failed to insert key, error %d")nvme_show_message(1, "Failed to insert key, error %d"); | |||
| 10228 | return err; | |||
| 10229 | } | |||
| 10230 | ||||
| 10231 | printf("Inserted TLS key %08x\n", (unsigned int)tls_key); | |||
| 10232 | ||||
| 10233 | if (cfg.keyfile) { | |||
| 10234 | err = append_keyfile(ctx, cfg.keyring, | |||
| 10235 | tls_key, cfg.keyfile); | |||
| 10236 | if (err) | |||
| 10237 | return err; | |||
| 10238 | } | |||
| 10239 | } | |||
| 10240 | ||||
| 10241 | return 0; | |||
| 10242 | } | |||
| 10243 | ||||
| 10244 | static int check_tls_key(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 10245 | { | |||
| 10246 | const char *desc = "Check a TLS key for NVMe PSK Interchange format.\n"; | |||
| 10247 | const char *keydata = "TLS key (in PSK Interchange format) to be validated."; | |||
| 10248 | const char *identity = "TLS identity version to use (0 = NVMe TCP 1.0c, 1 = NVMe TCP 2.0)"; | |||
| 10249 | const char *hostnqn = "Host NQN for the retained key."; | |||
| 10250 | const char *subsysnqn = "Subsystem NQN for the retained key."; | |||
| 10251 | const char *keyring = "Keyring for the retained key."; | |||
| 10252 | const char *keytype = "Key type of the retained key."; | |||
| 10253 | const char *insert = "Insert retained key into the keyring."; | |||
| 10254 | const char *keyfile = "Update key file with the derive TLS PSK."; | |||
| 10255 | const char *compat = "Use non-RFC 8446 compliant algorithm for checking TLS PSK for older implementations."; | |||
| 10256 | ||||
| 10257 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 10258 | __cleanup_free__attribute__((cleanup(freep))) unsigned char *decoded_key = NULL((void*)0); | |||
| 10259 | __cleanup_free__attribute__((cleanup(freep))) char *hnqn = NULL((void*)0); | |||
| 10260 | int decoded_len, err = 0; | |||
| 10261 | unsigned int hmac; | |||
| 10262 | long tls_key; | |||
| 10263 | struct config { | |||
| 10264 | char *keyring; | |||
| 10265 | char *keytype; | |||
| 10266 | char *hostnqn; | |||
| 10267 | char *subsysnqn; | |||
| 10268 | char *keydata; | |||
| 10269 | char *keyfile; | |||
| 10270 | unsigned char identity; | |||
| 10271 | bool_Bool insert; | |||
| 10272 | bool_Bool compat; | |||
| 10273 | }; | |||
| 10274 | ||||
| 10275 | struct config cfg = { | |||
| 10276 | .keyring = ".nvme", | |||
| 10277 | .keytype = "psk", | |||
| 10278 | .hostnqn = NULL((void*)0), | |||
| 10279 | .subsysnqn = NULL((void*)0), | |||
| 10280 | .keydata = NULL((void*)0), | |||
| 10281 | .keyfile = NULL((void*)0), | |||
| 10282 | .identity = 0, | |||
| 10283 | .insert = false0, | |||
| 10284 | .compat = false0, | |||
| 10285 | }; | |||
| 10286 | ||||
| 10287 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"keydata" , 'd', "STRING", CFG_STRING, &cfg.keydata, 1, keydata, 0, }, {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1 , keyfile, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg. identity, 1, identity, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG , &cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0 ), CFG_FLAG, &cfg.compat, 0, compat, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10288 | OPT_STR("keyring", 'k', &cfg.keyring, keyring),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"keydata" , 'd', "STRING", CFG_STRING, &cfg.keydata, 1, keydata, 0, }, {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1 , keyfile, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg. identity, 1, identity, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG , &cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0 ), CFG_FLAG, &cfg.compat, 0, compat, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10289 | OPT_STR("keytype", 't', &cfg.keytype, keytype),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"keydata" , 'd', "STRING", CFG_STRING, &cfg.keydata, 1, keydata, 0, }, {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1 , keyfile, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg. identity, 1, identity, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG , &cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0 ), CFG_FLAG, &cfg.compat, 0, compat, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10290 | OPT_STR("hostnqn", 'n', &cfg.hostnqn, hostnqn),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"keydata" , 'd', "STRING", CFG_STRING, &cfg.keydata, 1, keydata, 0, }, {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1 , keyfile, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg. identity, 1, identity, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG , &cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0 ), CFG_FLAG, &cfg.compat, 0, compat, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10291 | OPT_STR("subsysnqn", 'c', &cfg.subsysnqn, subsysnqn),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"keydata" , 'd', "STRING", CFG_STRING, &cfg.keydata, 1, keydata, 0, }, {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1 , keyfile, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg. identity, 1, identity, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG , &cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0 ), CFG_FLAG, &cfg.compat, 0, compat, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10292 | OPT_STR("keydata", 'd', &cfg.keydata, keydata),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"keydata" , 'd', "STRING", CFG_STRING, &cfg.keydata, 1, keydata, 0, }, {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1 , keyfile, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg. identity, 1, identity, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG , &cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0 ), CFG_FLAG, &cfg.compat, 0, compat, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10293 | OPT_STR("keyfile", 'f', &cfg.keyfile, keyfile),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"keydata" , 'd', "STRING", CFG_STRING, &cfg.keydata, 1, keydata, 0, }, {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1 , keyfile, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg. identity, 1, identity, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG , &cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0 ), CFG_FLAG, &cfg.compat, 0, compat, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10294 | OPT_BYTE("identity", 'I', &cfg.identity, identity),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"keydata" , 'd', "STRING", CFG_STRING, &cfg.keydata, 1, keydata, 0, }, {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1 , keyfile, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg. identity, 1, identity, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG , &cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0 ), CFG_FLAG, &cfg.compat, 0, compat, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10295 | OPT_FLAG("insert", 'i', &cfg.insert, insert),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"keydata" , 'd', "STRING", CFG_STRING, &cfg.keydata, 1, keydata, 0, }, {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1 , keyfile, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg. identity, 1, identity, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG , &cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0 ), CFG_FLAG, &cfg.compat, 0, compat, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10296 | OPT_FLAG("compat", 'C', &cfg.compat, compat))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"hostnqn", 'n', "STRING", CFG_STRING , &cfg.hostnqn, 1, hostnqn, 0, }, {"subsysnqn", 'c', "STRING" , CFG_STRING, &cfg.subsysnqn, 1, subsysnqn, 0, }, {"keydata" , 'd', "STRING", CFG_STRING, &cfg.keydata, 1, keydata, 0, }, {"keyfile", 'f', "STRING", CFG_STRING, &cfg.keyfile, 1 , keyfile, 0, }, {"identity", 'I', "NUM", CFG_BYTE, &cfg. identity, 1, identity, 0, }, {"insert", 'i', ((void*)0), CFG_FLAG , &cfg.insert, 0, insert, 0, }, {"compat", 'C', ((void*)0 ), CFG_FLAG, &cfg.compat, 0, compat, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 10297 | ||||
| 10298 | err = parse_args(argc, argv, desc, opts); | |||
| 10299 | if (err) | |||
| 10300 | return err; | |||
| 10301 | ||||
| 10302 | if (!cfg.keydata) { | |||
| 10303 | nvme_show_error("No key data")nvme_show_message(1, "No key data"); | |||
| 10304 | return -EINVAL22; | |||
| 10305 | } | |||
| 10306 | if (cfg.identity > 1) { | |||
| 10307 | nvme_show_error("Invalid TLS identity version %u",nvme_show_message(1, "Invalid TLS identity version %u", cfg.identity ) | |||
| 10308 | cfg.identity)nvme_show_message(1, "Invalid TLS identity version %u", cfg.identity ); | |||
| 10309 | return -EINVAL22; | |||
| 10310 | } | |||
| 10311 | ||||
| 10312 | ctx = libnvme_create_global_ctx(stderrstderr, log_level); | |||
| 10313 | if (!ctx) { | |||
| 10314 | nvme_show_error("Failed to create global context")nvme_show_message(1, "Failed to create global context"); | |||
| 10315 | return -ENOMEM12; | |||
| 10316 | } | |||
| 10317 | ||||
| 10318 | err = libnvme_import_tls_key(ctx, cfg.keydata, &decoded_len, | |||
| 10319 | &hmac, &decoded_key); | |||
| 10320 | if (err) { | |||
| 10321 | nvme_show_error("Key decoding failed, error %d\n")nvme_show_message(1, "Key decoding failed, error %d\n"); | |||
| 10322 | return err; | |||
| 10323 | } | |||
| 10324 | ||||
| 10325 | if (cfg.subsysnqn) { | |||
| 10326 | if (!cfg.hostnqn) { | |||
| 10327 | cfg.hostnqn = hnqn = libnvme_read_hostnqn(); | |||
| 10328 | if (!cfg.hostnqn) { | |||
| 10329 | nvme_show_error("Failed to read host NQN")nvme_show_message(1, "Failed to read host NQN"); | |||
| 10330 | return -EINVAL22; | |||
| 10331 | } | |||
| 10332 | } | |||
| 10333 | } else { | |||
| 10334 | nvme_show_error("Need to specify a subsystem NQN")nvme_show_message(1, "Need to specify a subsystem NQN"); | |||
| 10335 | return -EINVAL22; | |||
| 10336 | } | |||
| 10337 | ||||
| 10338 | if (cfg.insert) { | |||
| 10339 | if (cfg.compat) | |||
| 10340 | err = libnvme_insert_tls_key_compat(ctx, cfg.keyring, | |||
| 10341 | cfg.keytype, cfg.hostnqn, | |||
| 10342 | cfg.subsysnqn, cfg.identity, | |||
| 10343 | hmac, decoded_key, decoded_len, | |||
| 10344 | &tls_key); | |||
| 10345 | else | |||
| 10346 | err = libnvme_insert_tls_key_versioned(ctx, cfg.keyring, | |||
| 10347 | cfg.keytype, cfg.hostnqn, | |||
| 10348 | cfg.subsysnqn, cfg.identity, | |||
| 10349 | hmac, decoded_key, decoded_len, | |||
| 10350 | &tls_key); | |||
| 10351 | if (err) { | |||
| 10352 | nvme_show_error("Failed to insert key, error %d")nvme_show_message(1, "Failed to insert key, error %d"); | |||
| 10353 | return err; | |||
| 10354 | } | |||
| 10355 | printf("Inserted TLS key %08x\n", (unsigned int)tls_key); | |||
| 10356 | ||||
| 10357 | if (cfg.keyfile) { | |||
| 10358 | err = append_keyfile(ctx, cfg.keyring, | |||
| 10359 | tls_key, cfg.keyfile); | |||
| 10360 | if (err) | |||
| 10361 | return err; | |||
| 10362 | } | |||
| 10363 | } else { | |||
| 10364 | __cleanup_free__attribute__((cleanup(freep))) char *tls_id = NULL((void*)0); | |||
| 10365 | ||||
| 10366 | if (cfg.compat) | |||
| 10367 | err = libnvme_generate_tls_key_identity_compat(ctx, | |||
| 10368 | cfg.hostnqn, cfg.subsysnqn, cfg.identity, | |||
| 10369 | hmac, decoded_key, decoded_len, | |||
| 10370 | &tls_id); | |||
| 10371 | else | |||
| 10372 | err = libnvme_generate_tls_key_identity(ctx, | |||
| 10373 | cfg.hostnqn, cfg.subsysnqn, cfg.identity, | |||
| 10374 | hmac, decoded_key, decoded_len, | |||
| 10375 | &tls_id); | |||
| 10376 | if (err) { | |||
| 10377 | nvme_show_error("Failed to generate identity, error %d",nvme_show_message(1, "Failed to generate identity, error %d", err) | |||
| 10378 | err)nvme_show_message(1, "Failed to generate identity, error %d", err); | |||
| 10379 | return err; | |||
| 10380 | } | |||
| 10381 | printf("%s\n", tls_id); | |||
| 10382 | } | |||
| 10383 | return 0; | |||
| 10384 | } | |||
| 10385 | ||||
| 10386 | static void __scan_tls_key(struct libnvme_global_ctx *ctx, long keyring_id, | |||
| 10387 | long key_id, char *desc, int desc_len, void *data) | |||
| 10388 | { | |||
| 10389 | FILE *fd = data; | |||
| 10390 | __cleanup_free__attribute__((cleanup(freep))) unsigned char *key_data = NULL((void*)0); | |||
| 10391 | __cleanup_free__attribute__((cleanup(freep))) char *encoded_key = NULL((void*)0); | |||
| 10392 | int key_len; | |||
| 10393 | int ver, hmac; | |||
| 10394 | char type; | |||
| 10395 | int err; | |||
| 10396 | ||||
| 10397 | err = libnvme_read_key(ctx, keyring_id, key_id, &key_len, &key_data); | |||
| 10398 | if (err) | |||
| 10399 | return; | |||
| 10400 | ||||
| 10401 | if (sscanf(desc, "NVMe%01d%c%02d %*s", &ver, &type, &hmac) != 3) | |||
| 10402 | return; | |||
| 10403 | ||||
| 10404 | err = libnvme_export_tls_key_versioned(ctx, ver, hmac, key_data, key_len, | |||
| 10405 | &encoded_key); | |||
| 10406 | if (err) | |||
| 10407 | return; | |||
| 10408 | fprintf(fd, "%s %s\n", desc, encoded_key); | |||
| 10409 | } | |||
| 10410 | ||||
| 10411 | static int import_key(struct libnvme_global_ctx *ctx, const char *keyring, | |||
| 10412 | FILE *fd) | |||
| 10413 | { | |||
| 10414 | long keyring_id, key; | |||
| 10415 | char tls_str[512]; | |||
| 10416 | char *tls_key; | |||
| 10417 | unsigned char *psk; | |||
| 10418 | unsigned int hmac; | |||
| 10419 | int linenum = -1, key_len; | |||
| 10420 | int err; | |||
| 10421 | ||||
| 10422 | err = libnvme_lookup_keyring(ctx, keyring, &keyring_id); | |||
| 10423 | if (err) { | |||
| 10424 | nvme_show_error("Invalid keyring '%s'", keyring)nvme_show_message(1, "Invalid keyring '%s'", keyring); | |||
| 10425 | return err; | |||
| 10426 | } | |||
| 10427 | ||||
| 10428 | while (fgets(tls_str, 512, fd)) { | |||
| 10429 | linenum++; | |||
| 10430 | tls_key = strrchr(tls_str, ' '); | |||
| 10431 | if (!tls_key) { | |||
| 10432 | nvme_show_error("Parse error in line %d",nvme_show_message(1, "Parse error in line %d", linenum) | |||
| 10433 | linenum)nvme_show_message(1, "Parse error in line %d", linenum); | |||
| 10434 | continue; | |||
| 10435 | } | |||
| 10436 | *tls_key = '\0'; | |||
| 10437 | tls_key++; | |||
| 10438 | tls_key[strcspn(tls_key, "\n")] = 0; | |||
| 10439 | err = libnvme_import_tls_key(ctx, tls_key, &key_len, &hmac, &psk); | |||
| 10440 | if (err) { | |||
| 10441 | nvme_show_error("Failed to import key in line %d",nvme_show_message(1, "Failed to import key in line %d", linenum ) | |||
| 10442 | linenum)nvme_show_message(1, "Failed to import key in line %d", linenum ); | |||
| 10443 | continue; | |||
| 10444 | } | |||
| 10445 | err = libnvme_update_key(ctx, keyring_id, "psk", tls_str, | |||
| 10446 | psk, key_len, &key); | |||
| 10447 | if (err) | |||
| 10448 | continue; | |||
| 10449 | free(psk); | |||
| 10450 | } | |||
| 10451 | ||||
| 10452 | return 0; | |||
| 10453 | } | |||
| 10454 | ||||
| 10455 | ||||
| 10456 | static int tls_key(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 10457 | { | |||
| 10458 | const char *desc = "Manipulation of TLS keys.\n"; | |||
| 10459 | const char *keyring = "Keyring for the retained key."; | |||
| 10460 | const char *keytype = "Key type of the retained key."; | |||
| 10461 | const char *keyfile = "File for list of keys."; | |||
| 10462 | const char *import = "Import all keys into the keyring."; | |||
| 10463 | const char *export = "Export all keys from the keyring."; | |||
| 10464 | const char *revoke = "Revoke key from the keyring."; | |||
| 10465 | ||||
| 10466 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 10467 | __cleanup_file__attribute__((cleanup(cleanup_file))) FILE *fd = NULL((void*)0); | |||
| 10468 | mode_t old_umask = 0; | |||
| 10469 | int cnt, err = 0; | |||
| 10470 | ||||
| 10471 | struct config { | |||
| 10472 | char *keyring; | |||
| 10473 | char *keytype; | |||
| 10474 | char *keyfile; | |||
| 10475 | bool_Bool import; | |||
| 10476 | bool_Bool export; | |||
| 10477 | char *revoke; | |||
| 10478 | }; | |||
| 10479 | ||||
| 10480 | struct config cfg = { | |||
| 10481 | .keyring = ".nvme", | |||
| 10482 | .keytype = "psk", | |||
| 10483 | .keyfile = NULL((void*)0), | |||
| 10484 | .import = false0, | |||
| 10485 | .export = false0, | |||
| 10486 | .revoke = NULL((void*)0), | |||
| 10487 | }; | |||
| 10488 | ||||
| 10489 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"keyfile", 'f', "STRING", CFG_STRING , &cfg.keyfile, 1, keyfile, 0, }, {"import", 'i', ((void* )0), CFG_FLAG, &cfg.import, 0, import, 0, }, {"export", 'e' , ((void*)0), CFG_FLAG, &cfg.export, 0, export, 0, }, {"revoke" , 'r', "STRING", CFG_STRING, &cfg.revoke, 1, revoke, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10490 | OPT_STR("keyring", 'k', &cfg.keyring, keyring),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"keyfile", 'f', "STRING", CFG_STRING , &cfg.keyfile, 1, keyfile, 0, }, {"import", 'i', ((void* )0), CFG_FLAG, &cfg.import, 0, import, 0, }, {"export", 'e' , ((void*)0), CFG_FLAG, &cfg.export, 0, export, 0, }, {"revoke" , 'r', "STRING", CFG_STRING, &cfg.revoke, 1, revoke, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10491 | OPT_STR("keytype", 't', &cfg.keytype, keytype),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"keyfile", 'f', "STRING", CFG_STRING , &cfg.keyfile, 1, keyfile, 0, }, {"import", 'i', ((void* )0), CFG_FLAG, &cfg.import, 0, import, 0, }, {"export", 'e' , ((void*)0), CFG_FLAG, &cfg.export, 0, export, 0, }, {"revoke" , 'r', "STRING", CFG_STRING, &cfg.revoke, 1, revoke, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10492 | OPT_STR("keyfile", 'f', &cfg.keyfile, keyfile),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"keyfile", 'f', "STRING", CFG_STRING , &cfg.keyfile, 1, keyfile, 0, }, {"import", 'i', ((void* )0), CFG_FLAG, &cfg.import, 0, import, 0, }, {"export", 'e' , ((void*)0), CFG_FLAG, &cfg.export, 0, export, 0, }, {"revoke" , 'r', "STRING", CFG_STRING, &cfg.revoke, 1, revoke, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10493 | OPT_FLAG("import", 'i', &cfg.import, import),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"keyfile", 'f', "STRING", CFG_STRING , &cfg.keyfile, 1, keyfile, 0, }, {"import", 'i', ((void* )0), CFG_FLAG, &cfg.import, 0, import, 0, }, {"export", 'e' , ((void*)0), CFG_FLAG, &cfg.export, 0, export, 0, }, {"revoke" , 'r', "STRING", CFG_STRING, &cfg.revoke, 1, revoke, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10494 | OPT_FLAG("export", 'e', &cfg.export, export),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"keyfile", 'f', "STRING", CFG_STRING , &cfg.keyfile, 1, keyfile, 0, }, {"import", 'i', ((void* )0), CFG_FLAG, &cfg.import, 0, import, 0, }, {"export", 'e' , ((void*)0), CFG_FLAG, &cfg.export, 0, export, 0, }, {"revoke" , 'r', "STRING", CFG_STRING, &cfg.revoke, 1, revoke, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10495 | OPT_STR("revoke", 'r', &cfg.revoke, revoke))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"keyring", 'k', "STRING", CFG_STRING, &cfg.keyring , 1, keyring, 0, }, {"keytype", 't', "STRING", CFG_STRING, & cfg.keytype, 1, keytype, 0, }, {"keyfile", 'f', "STRING", CFG_STRING , &cfg.keyfile, 1, keyfile, 0, }, {"import", 'i', ((void* )0), CFG_FLAG, &cfg.import, 0, import, 0, }, {"export", 'e' , ((void*)0), CFG_FLAG, &cfg.export, 0, export, 0, }, {"revoke" , 'r', "STRING", CFG_STRING, &cfg.revoke, 1, revoke, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 10496 | ||||
| 10497 | err = parse_args(argc, argv, desc, opts); | |||
| 10498 | if (err) | |||
| 10499 | return err; | |||
| 10500 | ||||
| 10501 | ctx = libnvme_create_global_ctx(stderrstderr, log_level); | |||
| 10502 | if (!ctx) { | |||
| 10503 | nvme_show_error("Failed to create global context")nvme_show_message(1, "Failed to create global context"); | |||
| 10504 | return -ENOMEM12; | |||
| 10505 | } | |||
| 10506 | ||||
| 10507 | if (cfg.keyfile) { | |||
| 10508 | const char *mode; | |||
| 10509 | ||||
| 10510 | if (cfg.import) | |||
| 10511 | mode = "r"; | |||
| 10512 | else | |||
| 10513 | mode = "w"; | |||
| 10514 | ||||
| 10515 | old_umask = umask(0); | |||
| 10516 | ||||
| 10517 | fd = fopen(cfg.keyfile, mode); | |||
| 10518 | if (!fd) { | |||
| 10519 | nvme_show_error("Cannot open keyfile %s, error %d",nvme_show_message(1, "Cannot open keyfile %s, error %d", cfg. keyfile, (*__errno_location ())) | |||
| 10520 | cfg.keyfile, errno)nvme_show_message(1, "Cannot open keyfile %s, error %d", cfg. keyfile, (*__errno_location ())); | |||
| 10521 | return -errno(*__errno_location ()); | |||
| 10522 | } | |||
| 10523 | } else { | |||
| 10524 | if (cfg.import) | |||
| 10525 | fd = freopen(NULL((void*)0), "r", stdinstdin); | |||
| 10526 | else | |||
| 10527 | fd = freopen(NULL((void*)0), "w", stdoutstdout); | |||
| 10528 | } | |||
| 10529 | ||||
| 10530 | cnt = 0; | |||
| 10531 | if (cfg.export) cnt++; | |||
| 10532 | if (cfg.import) cnt++; | |||
| 10533 | if (cfg.revoke) cnt++; | |||
| 10534 | ||||
| 10535 | if (cnt != 1) { | |||
| 10536 | nvme_show_error("Must specify either --import, --export or --revoke")nvme_show_message(1, "Must specify either --import, --export or --revoke" ); | |||
| 10537 | return -EINVAL22; | |||
| 10538 | } else if (cfg.export) { | |||
| 10539 | err = libnvme_scan_tls_keys(ctx, cfg.keyring, __scan_tls_key, fd); | |||
| 10540 | if (err < 0) { | |||
| 10541 | nvme_show_error("Export of TLS keys failed with '%s'",nvme_show_message(1, "Export of TLS keys failed with '%s'", libnvme_strerror (-err)) | |||
| 10542 | libnvme_strerror(-err))nvme_show_message(1, "Export of TLS keys failed with '%s'", libnvme_strerror (-err)); | |||
| 10543 | return err; | |||
| 10544 | } | |||
| 10545 | ||||
| 10546 | if (nvme_args.verbose) | |||
| 10547 | printf("exporting to %s\n", cfg.keyfile); | |||
| 10548 | ||||
| 10549 | return 0; | |||
| 10550 | } else if (cfg.import) { | |||
| 10551 | err = import_key(ctx, cfg.keyring, fd); | |||
| 10552 | if (err) { | |||
| 10553 | nvme_show_error("Import of TLS keys failed with '%s'",nvme_show_message(1, "Import of TLS keys failed with '%s'", libnvme_strerror (err)) | |||
| 10554 | libnvme_strerror(err))nvme_show_message(1, "Import of TLS keys failed with '%s'", libnvme_strerror (err)); | |||
| 10555 | return err; | |||
| 10556 | } | |||
| 10557 | ||||
| 10558 | if (nvme_args.verbose) | |||
| 10559 | printf("importing from %s\n", cfg.keyfile); | |||
| 10560 | } else { | |||
| 10561 | err = libnvme_revoke_tls_key(ctx, cfg.keyring, cfg.keytype, | |||
| 10562 | cfg.revoke); | |||
| 10563 | if (err) { | |||
| 10564 | nvme_show_error("Failed to revoke key '%s'",nvme_show_message(1, "Failed to revoke key '%s'", libnvme_strerror (err)) | |||
| 10565 | libnvme_strerror(err))nvme_show_message(1, "Failed to revoke key '%s'", libnvme_strerror (err)); | |||
| 10566 | return err; | |||
| 10567 | } | |||
| 10568 | ||||
| 10569 | if (nvme_args.verbose) | |||
| 10570 | printf("revoking key\n"); | |||
| 10571 | } | |||
| 10572 | ||||
| 10573 | if (old_umask != 0 && fd) { | |||
| 10574 | umask(old_umask); | |||
| 10575 | chmod(cfg.keyfile, 0600); | |||
| 10576 | } | |||
| 10577 | ||||
| 10578 | return err; | |||
| 10579 | } | |||
| 10580 | ||||
| 10581 | static int show_topology_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 10582 | { | |||
| 10583 | const char *desc = "Show the topology\n"; | |||
| 10584 | const char *ranking = "Ranking order: namespace|ctrl|multipath"; | |||
| 10585 | nvme_print_flags_t flags; | |||
| 10586 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 10587 | char *devname = NULL((void*)0); | |||
| 10588 | libnvme_scan_filter_t filter = NULL((void*)0); | |||
| 10589 | enum nvme_cli_topo_ranking rank; | |||
| 10590 | int err; | |||
| 10591 | ||||
| 10592 | struct config { | |||
| 10593 | char *ranking; | |||
| 10594 | }; | |||
| 10595 | ||||
| 10596 | struct config cfg = { | |||
| 10597 | .ranking = "namespace", | |||
| 10598 | }; | |||
| 10599 | ||||
| 10600 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ranking", 'r', "FMT", CFG_STRING, &cfg.ranking, 1 , ranking, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10601 | OPT_FMT("ranking", 'r', &cfg.ranking, ranking))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"ranking", 'r', "FMT", CFG_STRING, &cfg.ranking, 1 , ranking, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 10602 | ||||
| 10603 | err = parse_args(argc, argv, desc, opts); | |||
| 10604 | if (err) | |||
| 10605 | return err; | |||
| 10606 | ||||
| 10607 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 10608 | if (err < 0) { | |||
| 10609 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 10610 | return err; | |||
| 10611 | } | |||
| 10612 | ||||
| 10613 | if (nvme_args.verbose) | |||
| 10614 | flags |= VERBOSE; | |||
| 10615 | ||||
| 10616 | if (!strcmp(cfg.ranking, "namespace")) { | |||
| 10617 | rank = NVME_CLI_TOPO_NAMESPACE; | |||
| 10618 | } else if (!strcmp(cfg.ranking, "ctrl")) { | |||
| 10619 | rank = NVME_CLI_TOPO_CTRL; | |||
| 10620 | } else if (!strcmp(cfg.ranking, "multipath")) { | |||
| 10621 | rank = NVME_CLI_TOPO_MULTIPATH; | |||
| 10622 | } else { | |||
| 10623 | nvme_show_error("Invalid ranking argument: %s", cfg.ranking)nvme_show_message(1, "Invalid ranking argument: %s", cfg.ranking ); | |||
| 10624 | return -EINVAL22; | |||
| 10625 | } | |||
| 10626 | ||||
| 10627 | ctx = libnvme_create_global_ctx(stderrstderr, log_level); | |||
| 10628 | if (!ctx) { | |||
| 10629 | nvme_show_error("Failed to create global context")nvme_show_message(1, "Failed to create global context"); | |||
| 10630 | return -ENOMEM12; | |||
| 10631 | } | |||
| 10632 | ||||
| 10633 | if (optind < argc) | |||
| 10634 | devname = basename__xpg_basename(argv[optind++]); | |||
| 10635 | ||||
| 10636 | if (devname) { | |||
| 10637 | int subsys_id, nsid; | |||
| 10638 | ||||
| 10639 | if (sscanf(devname, "nvme%dn%d", &subsys_id, &nsid) < 1 && | |||
| 10640 | sscanf(devname, "ng%dn%d", &subsys_id, &nsid) != 2) { | |||
| 10641 | nvme_show_error("Invalid device name %s\n", devname)nvme_show_message(1, "Invalid device name %s\n", devname); | |||
| 10642 | return -EINVAL22; | |||
| 10643 | } | |||
| 10644 | filter = nvme_match_device_filter; | |||
| 10645 | } | |||
| 10646 | ||||
| 10647 | err = libnvme_scan_topology(ctx, filter, (void *)devname); | |||
| 10648 | if (err < 0) | |||
| 10649 | return handle_scan_topology_error(err); | |||
| 10650 | ||||
| 10651 | if (flags & TABULAR) | |||
| 10652 | nvme_show_topology_tabular(ctx, flags); | |||
| 10653 | else | |||
| 10654 | nvme_show_topology(ctx, rank, flags); | |||
| 10655 | ||||
| 10656 | return err; | |||
| 10657 | } | |||
| 10658 | ||||
| 10659 | #ifdef CONFIG_FABRICS | |||
| 10660 | static int discover_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 10661 | { | |||
| 10662 | const char *desc = "Send Get Log Page request to Discovery Controller."; | |||
| 10663 | ||||
| 10664 | return fabrics_discovery(desc, argc, argv, false0); | |||
| 10665 | } | |||
| 10666 | ||||
| 10667 | static int connect_all_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 10668 | { | |||
| 10669 | const char *desc = "Discover NVMeoF subsystems and connect to them"; | |||
| 10670 | ||||
| 10671 | return fabrics_discovery(desc, argc, argv, true1); | |||
| 10672 | } | |||
| 10673 | ||||
| 10674 | static int connect_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 10675 | { | |||
| 10676 | const char *desc = "Connect to NVMeoF subsystem"; | |||
| 10677 | ||||
| 10678 | return fabrics_connect(desc, argc, argv); | |||
| 10679 | } | |||
| 10680 | ||||
| 10681 | static int disconnect_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 10682 | { | |||
| 10683 | const char *desc = "Disconnect from NVMeoF subsystem"; | |||
| 10684 | ||||
| 10685 | return fabrics_disconnect(desc, argc, argv); | |||
| 10686 | } | |||
| 10687 | ||||
| 10688 | int disconnect_all_cmd(int argc, char **argv, struct command *acmd, | |||
| 10689 | struct plugin *plugin) | |||
| 10690 | { | |||
| 10691 | const char *desc = "Disconnect from all connected NVMeoF subsystems"; | |||
| 10692 | ||||
| 10693 | return fabrics_disconnect_all(desc, argc, argv); | |||
| 10694 | } | |||
| 10695 | ||||
| 10696 | static int config_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 10697 | { | |||
| 10698 | const char *desc = "Configuration of NVMeoF subsystems"; | |||
| 10699 | ||||
| 10700 | return fabrics_config(desc, argc, argv); | |||
| 10701 | } | |||
| 10702 | ||||
| 10703 | static int dim_cmd(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 10704 | { | |||
| 10705 | const char *desc = | |||
| 10706 | "Send Discovery Information Management command to a Discovery Controller (DC)"; | |||
| 10707 | ||||
| 10708 | return fabrics_dim(desc, argc, argv); | |||
| 10709 | } | |||
| 10710 | #endif | |||
| 10711 | ||||
| 10712 | #ifdef CONFIG_MI | |||
| 10713 | static int libnvme_mi(int argc, char **argv, __u8 admin_opcode, const char *desc) | |||
| 10714 | { | |||
| 10715 | const char *opcode = "opcode (required)"; | |||
| 10716 | const char *data_len = "data I/O length (bytes)"; | |||
| 10717 | const char *nmimt = "nvme-mi message type"; | |||
| 10718 | const char *nmd0 = "nvme management dword 0 value"; | |||
| 10719 | const char *nmd1 = "nvme management dword 1 value"; | |||
| 10720 | const char *input = "data input or output file"; | |||
| 10721 | ||||
| 10722 | int mode = 0644; | |||
| 10723 | void *data = NULL((void*)0); | |||
| 10724 | int err = 0; | |||
| 10725 | bool_Bool send; | |||
| 10726 | __cleanup_fd__attribute__((cleanup(cleanup_fd))) int fd = -1; | |||
| 10727 | int flags; | |||
| 10728 | __cleanup_huge__attribute__((cleanup(libnvme_free_huge))) struct libnvme_mem_huge mh = { 0, }; | |||
| 10729 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 10730 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 10731 | __u32 result; | |||
| 10732 | ||||
| 10733 | struct config { | |||
| 10734 | __u8 opcode; | |||
| 10735 | __u32 namespace_id; | |||
| 10736 | __u32 data_len; | |||
| 10737 | __u32 nmimt; | |||
| 10738 | __u32 nmd0; | |||
| 10739 | __u32 nmd1; | |||
| 10740 | char *input_file; | |||
| 10741 | }; | |||
| 10742 | ||||
| 10743 | struct config cfg = { | |||
| 10744 | .opcode = 0, | |||
| 10745 | .namespace_id = 0, | |||
| 10746 | .data_len = 0, | |||
| 10747 | .nmimt = 0, | |||
| 10748 | .nmd0 = 0, | |||
| 10749 | .nmd1 = 0, | |||
| 10750 | .input_file = "", | |||
| 10751 | }; | |||
| 10752 | ||||
| 10753 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, data_len, 0, }, {"nmimt", 'm', "NUM", CFG_POSITIVE, &cfg.nmimt, 1, nmimt, 0, }, {"nmd0", '0', "NUM" , CFG_POSITIVE, &cfg.nmd0, 1, nmd0, 0, }, {"nmd1", '1', "NUM" , CFG_POSITIVE, &cfg.nmd1, 1, nmd1, 0, }, {"input-file", 'i' , "FILE", CFG_STRING, &cfg.input_file, 1, input, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10754 | OPT_BYTE("opcode", 'O', &cfg.opcode, opcode),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, data_len, 0, }, {"nmimt", 'm', "NUM", CFG_POSITIVE, &cfg.nmimt, 1, nmimt, 0, }, {"nmd0", '0', "NUM" , CFG_POSITIVE, &cfg.nmd0, 1, nmd0, 0, }, {"nmd1", '1', "NUM" , CFG_POSITIVE, &cfg.nmd1, 1, nmd1, 0, }, {"input-file", 'i' , "FILE", CFG_STRING, &cfg.input_file, 1, input, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10755 | OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, data_len, 0, }, {"nmimt", 'm', "NUM", CFG_POSITIVE, &cfg.nmimt, 1, nmimt, 0, }, {"nmd0", '0', "NUM" , CFG_POSITIVE, &cfg.nmd0, 1, nmd0, 0, }, {"nmd1", '1', "NUM" , CFG_POSITIVE, &cfg.nmd1, 1, nmd1, 0, }, {"input-file", 'i' , "FILE", CFG_STRING, &cfg.input_file, 1, input, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10756 | OPT_UINT("data-len", 'l', &cfg.data_len, data_len),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, data_len, 0, }, {"nmimt", 'm', "NUM", CFG_POSITIVE, &cfg.nmimt, 1, nmimt, 0, }, {"nmd0", '0', "NUM" , CFG_POSITIVE, &cfg.nmd0, 1, nmd0, 0, }, {"nmd1", '1', "NUM" , CFG_POSITIVE, &cfg.nmd1, 1, nmd1, 0, }, {"input-file", 'i' , "FILE", CFG_STRING, &cfg.input_file, 1, input, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10757 | OPT_UINT("nmimt", 'm', &cfg.nmimt, nmimt),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, data_len, 0, }, {"nmimt", 'm', "NUM", CFG_POSITIVE, &cfg.nmimt, 1, nmimt, 0, }, {"nmd0", '0', "NUM" , CFG_POSITIVE, &cfg.nmd0, 1, nmd0, 0, }, {"nmd1", '1', "NUM" , CFG_POSITIVE, &cfg.nmd1, 1, nmd1, 0, }, {"input-file", 'i' , "FILE", CFG_STRING, &cfg.input_file, 1, input, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10758 | OPT_UINT("nmd0", '0', &cfg.nmd0, nmd0),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, data_len, 0, }, {"nmimt", 'm', "NUM", CFG_POSITIVE, &cfg.nmimt, 1, nmimt, 0, }, {"nmd0", '0', "NUM" , CFG_POSITIVE, &cfg.nmd0, 1, nmd0, 0, }, {"nmd1", '1', "NUM" , CFG_POSITIVE, &cfg.nmd1, 1, nmd1, 0, }, {"input-file", 'i' , "FILE", CFG_STRING, &cfg.input_file, 1, input, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10759 | OPT_UINT("nmd1", '1', &cfg.nmd1, nmd1),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, data_len, 0, }, {"nmimt", 'm', "NUM", CFG_POSITIVE, &cfg.nmimt, 1, nmimt, 0, }, {"nmd0", '0', "NUM" , CFG_POSITIVE, &cfg.nmd0, 1, nmd0, 0, }, {"nmd1", '1', "NUM" , CFG_POSITIVE, &cfg.nmd1, 1, nmd1, 0, }, {"input-file", 'i' , "FILE", CFG_STRING, &cfg.input_file, 1, input, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10760 | OPT_FILE("input-file", 'i', &cfg.input_file, input))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"opcode", 'O', "NUM", CFG_BYTE, &cfg.opcode, 1, opcode , 0, }, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_desired, 0, }, {"data-len", 'l', "NUM", CFG_POSITIVE , &cfg.data_len, 1, data_len, 0, }, {"nmimt", 'm', "NUM", CFG_POSITIVE, &cfg.nmimt, 1, nmimt, 0, }, {"nmd0", '0', "NUM" , CFG_POSITIVE, &cfg.nmd0, 1, nmd0, 0, }, {"nmd1", '1', "NUM" , CFG_POSITIVE, &cfg.nmd1, 1, nmd1, 0, }, {"input-file", 'i' , "FILE", CFG_STRING, &cfg.input_file, 1, input, 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, }, {"output-format" , 'o', "FMT", CFG_STRING, &nvme_args.output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 10761 | ||||
| 10762 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 10763 | if (err) | |||
| 10764 | return err; | |||
| 10765 | ||||
| 10766 | if (!argconfig_parse_seen(opts, "opcode")) { | |||
| 10767 | nvme_show_error("%s: opcode parameter required", *argv)nvme_show_message(1, "%s: opcode parameter required", *argv); | |||
| 10768 | return -EINVAL22; | |||
| 10769 | } | |||
| 10770 | ||||
| 10771 | if (admin_opcode == nvme_admin_nvme_mi_send) { | |||
| 10772 | flags = O_RDONLY00; | |||
| 10773 | fd = STDIN_FILENO0; | |||
| 10774 | send = true1; | |||
| 10775 | } else { | |||
| 10776 | flags = O_WRONLY01 | O_CREAT0100 | O_TRUNC01000; | |||
| 10777 | fd = STDOUT_FILENO1; | |||
| 10778 | send = false0; | |||
| 10779 | } | |||
| 10780 | ||||
| 10781 | if (strlen(cfg.input_file)) { | |||
| 10782 | fd = nvme_open_rawdata(cfg.input_file, flags, mode)open((cfg.input_file), (flags), mode); | |||
| 10783 | if (fd < 0) { | |||
| 10784 | nvme_show_perror(cfg.input_file); | |||
| 10785 | return -EINVAL22; | |||
| 10786 | } | |||
| 10787 | } | |||
| 10788 | ||||
| 10789 | if (cfg.data_len) { | |||
| 10790 | data = libnvme_alloc_huge(cfg.data_len, &mh); | |||
| 10791 | if (!data) { | |||
| 10792 | nvme_show_error("failed to allocate huge memory")nvme_show_message(1, "failed to allocate huge memory"); | |||
| 10793 | return -ENOMEM12; | |||
| 10794 | } | |||
| 10795 | ||||
| 10796 | if (send) { | |||
| 10797 | if (read(fd, data, cfg.data_len) < 0) { | |||
| 10798 | err = -errno(*__errno_location ()); | |||
| 10799 | nvme_show_error("failed to read write buffer %s", libnvme_strerror(errno))nvme_show_message(1, "failed to read write buffer %s", libnvme_strerror ((*__errno_location ()))); | |||
| 10800 | return err; | |||
| 10801 | } | |||
| 10802 | } | |||
| 10803 | } | |||
| 10804 | ||||
| 10805 | struct libnvme_passthru_cmd cmd = { | |||
| 10806 | .opcode = admin_opcode, | |||
| 10807 | .nsid = cfg.namespace_id, | |||
| 10808 | .cdw10 = cfg.nmimt << 11 | 4, | |||
| 10809 | .cdw11 = cfg.opcode, | |||
| 10810 | .cdw12 = cfg.nmd0, | |||
| 10811 | .cdw13 = cfg.nmd1, | |||
| 10812 | .addr = (__u64)(uintptr_t)data, | |||
| 10813 | .data_len = cfg.data_len, | |||
| 10814 | }; | |||
| 10815 | ||||
| 10816 | err = libnvme_exec_admin_passthru(hdl, &cmd); | |||
| 10817 | if (err) { | |||
| 10818 | nvme_show_err(err, "nmi_recv"); | |||
| 10819 | return err; | |||
| 10820 | } | |||
| 10821 | ||||
| 10822 | result = cmd.result; | |||
| 10823 | printf( | |||
| 10824 | "%s Command is Success and result: 0x%08x (status: 0x%02x, response: 0x%06x)\n", | |||
| 10825 | nvme_cmd_to_string(true1, admin_opcode), result, result & 0xff, | |||
| 10826 | result >> 8); | |||
| 10827 | if (result & 0xff) | |||
| 10828 | printf("status: %s\n", libnvme_mi_status_to_string(result & 0xff)); | |||
| 10829 | if (!send && strlen(cfg.input_file)) { | |||
| 10830 | if (write(fd, (void *)data, cfg.data_len) < 0) | |||
| 10831 | perror("failed to write data buffer"); | |||
| 10832 | } else if (data && !send && !err) { | |||
| 10833 | d((unsigned char *)data, cfg.data_len, 16, 1); | |||
| 10834 | } | |||
| 10835 | ||||
| 10836 | return err; | |||
| 10837 | } | |||
| 10838 | ||||
| 10839 | static int nmi_recv(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 10840 | { | |||
| 10841 | const char *desc = | |||
| 10842 | "Send a NVMe-MI Receive command to the specified device, return results."; | |||
| 10843 | ||||
| 10844 | return libnvme_mi(argc, argv, nvme_admin_nvme_mi_recv, desc); | |||
| 10845 | } | |||
| 10846 | ||||
| 10847 | static int nmi_send(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 10848 | { | |||
| 10849 | const char *desc = "Send a NVMe-MI Send command to the specified device, return results."; | |||
| 10850 | ||||
| 10851 | return libnvme_mi(argc, argv, nvme_admin_nvme_mi_send, desc); | |||
| 10852 | } | |||
| 10853 | #endif /* CONFIG_MI */ | |||
| 10854 | ||||
| 10855 | static int get_mgmt_addr_list_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 10856 | { | |||
| 10857 | const char *desc = "Retrieve Management Address List Log, show it"; | |||
| 10858 | nvme_print_flags_t flags; | |||
| 10859 | int err = -1; | |||
| 10860 | ||||
| 10861 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_mgmt_addr_list_log *ma_log = NULL((void*)0); | |||
| 10862 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 10863 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 10864 | ||||
| 10865 | NVME_ARGS(opts)struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 10866 | ||||
| 10867 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 10868 | if (err) | |||
| 10869 | return err; | |||
| 10870 | ||||
| 10871 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 10872 | if (err < 0) { | |||
| 10873 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 10874 | return err; | |||
| 10875 | } | |||
| 10876 | ||||
| 10877 | ma_log = libnvme_alloc(sizeof(*ma_log)); | |||
| 10878 | if (!ma_log) | |||
| 10879 | return -ENOMEM12; | |||
| 10880 | ||||
| 10881 | err = nvme_get_log_mgmt_addr_list(hdl, ma_log, sizeof(*ma_log)); | |||
| 10882 | if (err) { | |||
| 10883 | nvme_show_err(err, "management address list log"); | |||
| 10884 | return err; | |||
| 10885 | } | |||
| 10886 | ||||
| 10887 | nvme_show_mgmt_addr_list_log(ma_log, flags); | |||
| 10888 | ||||
| 10889 | return err; | |||
| 10890 | } | |||
| 10891 | ||||
| 10892 | static int get_rotational_media_info_log(int argc, char **argv, struct command *acmd, | |||
| 10893 | struct plugin *plugin) | |||
| 10894 | { | |||
| 10895 | const char *desc = "Retrieve Rotational Media Information Log, show it"; | |||
| 10896 | nvme_print_flags_t flags; | |||
| 10897 | int err = -1; | |||
| 10898 | ||||
| 10899 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_rotational_media_info_log *info = NULL((void*)0); | |||
| 10900 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 10901 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 10902 | ||||
| 10903 | struct config { | |||
| 10904 | __u16 endgid; | |||
| 10905 | }; | |||
| 10906 | ||||
| 10907 | struct config cfg = { | |||
| 10908 | .endgid = 0, | |||
| 10909 | }; | |||
| 10910 | ||||
| 10911 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"endg-id", 'e', "NUM", CFG_POSITIVE, &cfg.endgid, 1, endgid, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 10912 | OPT_UINT("endg-id", 'e', &cfg.endgid, endgid))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"endg-id", 'e', "NUM", CFG_POSITIVE, &cfg.endgid, 1, endgid, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 10913 | ||||
| 10914 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 10915 | if (err) | |||
| 10916 | return err; | |||
| 10917 | ||||
| 10918 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 10919 | if (err < 0) { | |||
| 10920 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 10921 | return err; | |||
| 10922 | } | |||
| 10923 | ||||
| 10924 | info = libnvme_alloc(sizeof(*info)); | |||
| 10925 | if (!info) | |||
| 10926 | return -ENOMEM12; | |||
| 10927 | ||||
| 10928 | err = nvme_get_log_rotational_media_info(hdl, cfg.endgid, info, sizeof(*info)); | |||
| 10929 | if (err) { | |||
| 10930 | nvme_show_err(err, "rotational media info log"); | |||
| 10931 | return err; | |||
| 10932 | } | |||
| 10933 | ||||
| 10934 | nvme_show_rotational_media_info_log(info, flags); | |||
| 10935 | ||||
| 10936 | return err; | |||
| 10937 | } | |||
| 10938 | ||||
| 10939 | static int get_dispersed_ns_psub(struct libnvme_transport_handle *hdl, __u32 nsid, | |||
| 10940 | struct nvme_dispersed_ns_participating_nss_log **logp) | |||
| 10941 | { | |||
| 10942 | int err; | |||
| 10943 | __u64 header_len = sizeof(**logp); | |||
| 10944 | __u64 psub_list_len; | |||
| 10945 | struct nvme_dispersed_ns_participating_nss_log *log = libnvme_alloc(header_len); | |||
| 10946 | struct libnvme_passthru_cmd cmd; | |||
| 10947 | ||||
| 10948 | if (!log) | |||
| 10949 | return -ENOMEM12; | |||
| 10950 | ||||
| 10951 | err = nvme_get_log_dispersed_ns_participating_nss(hdl, nsid, log, header_len); | |||
| 10952 | if (err) | |||
| 10953 | goto err_free; | |||
| 10954 | ||||
| 10955 | psub_list_len = le64_to_cpu(log->numpsub) * NVME_NQN_LENGTH; | |||
| 10956 | ||||
| 10957 | log = libnvme_realloc(log, header_len + psub_list_len); | |||
| 10958 | if (!log) { | |||
| 10959 | err = -ENOMEM12; | |||
| 10960 | goto err_free; | |||
| 10961 | } | |||
| 10962 | ||||
| 10963 | nvme_init_get_log_dispersed_ns_participating_nss(&cmd, nsid, | |||
| 10964 | (void *)log->participating_nss, psub_list_len); | |||
| 10965 | cmd.cdw12 = header_len & 0xffffffff; | |||
| 10966 | cmd.cdw13 = header_len >> 32; | |||
| 10967 | err = libnvme_get_log(hdl, &cmd, false0, NVME_LOG_PAGE_PDU_SIZE4096); | |||
| 10968 | if (err) | |||
| 10969 | goto err_free; | |||
| 10970 | ||||
| 10971 | *logp = log; | |||
| 10972 | return 0; | |||
| 10973 | ||||
| 10974 | err_free: | |||
| 10975 | libnvme_free(log); | |||
| 10976 | return err; | |||
| 10977 | } | |||
| 10978 | ||||
| 10979 | static int get_dispersed_ns_participating_nss_log(int argc, char **argv, struct command *acmd, | |||
| 10980 | struct plugin *plugin) | |||
| 10981 | { | |||
| 10982 | const char *desc = "Retrieve Dispersed Namespace Participating NVM Subsystems Log, show it"; | |||
| 10983 | nvme_print_flags_t flags; | |||
| 10984 | int err; | |||
| 10985 | ||||
| 10986 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 10987 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 10988 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_dispersed_ns_participating_nss_log *log = NULL((void*)0); | |||
| 10989 | ||||
| 10990 | struct config { | |||
| 10991 | __u32 namespace_id; | |||
| 10992 | }; | |||
| 10993 | ||||
| 10994 | struct config cfg = { | |||
| 10995 | .namespace_id = 1, | |||
| 10996 | }; | |||
| 10997 | ||||
| 10998 | NVME_ARGS(opts, OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id , 1, namespace_id_desired, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 10999 | ||||
| 11000 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 11001 | if (err) | |||
| 11002 | return err; | |||
| 11003 | ||||
| 11004 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 11005 | if (err < 0) { | |||
| 11006 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 11007 | return err; | |||
| 11008 | } | |||
| 11009 | ||||
| 11010 | err = get_dispersed_ns_psub(hdl, cfg.namespace_id, &log); | |||
| 11011 | if (err) { | |||
| 11012 | nvme_show_err(err, "dispersed ns participating nss log"); | |||
| 11013 | return err; | |||
| 11014 | } | |||
| 11015 | ||||
| 11016 | nvme_show_dispersed_ns_psub_log(log, flags); | |||
| 11017 | ||||
| 11018 | return err; | |||
| 11019 | } | |||
| 11020 | ||||
| 11021 | static int get_power_measurement_log(int argc, char **argv, struct command *acmd, | |||
| 11022 | struct plugin *plugin) | |||
| 11023 | { | |||
| 11024 | const char *desc = "Retrieve Power Measurement Log (Log ID 0x25) " | |||
| 11025 | "for the given device in either decoded format (default), " | |||
| 11026 | "json, or binary."; | |||
| 11027 | ||||
| 11028 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 11029 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 11030 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_power_meas_log *log = NULL((void*)0); | |||
| 11031 | nvme_print_flags_t flags; | |||
| 11032 | __u32 min_log_size = sizeof(struct nvme_power_meas_log); | |||
| 11033 | __u32 log_size; | |||
| 11034 | int err = -1; | |||
| 11035 | ||||
| 11036 | struct config { | |||
| 11037 | bool_Bool raw_binary; | |||
| 11038 | }; | |||
| 11039 | ||||
| 11040 | struct config cfg = { | |||
| 11041 | .raw_binary = false0, | |||
| 11042 | }; | |||
| 11043 | ||||
| 11044 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_output, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 11045 | OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_output))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"raw-binary", 'b', ((void*)0), CFG_FLAG, &cfg.raw_binary , 0, raw_output, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 11046 | ||||
| 11047 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 11048 | if (err) | |||
| 11049 | return err; | |||
| 11050 | ||||
| 11051 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 11052 | if (err < 0) { | |||
| 11053 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 11054 | return err; | |||
| 11055 | } | |||
| 11056 | ||||
| 11057 | if (cfg.raw_binary) | |||
| 11058 | flags = BINARY; | |||
| 11059 | ||||
| 11060 | if (nvme_args.verbose) | |||
| 11061 | flags |= VERBOSE; | |||
| 11062 | ||||
| 11063 | /* First read minimum size to discover the full log size */ | |||
| 11064 | log = libnvme_alloc(min_log_size); | |||
| 11065 | if (!log) | |||
| 11066 | return -ENOMEM12; | |||
| 11067 | ||||
| 11068 | err = nvme_get_log_power_measurement(hdl, log, min_log_size); | |||
| 11069 | if (err) { | |||
| 11070 | nvme_show_err(err, "power-measurement-log"); | |||
| 11071 | return err; | |||
| 11072 | } | |||
| 11073 | ||||
| 11074 | log_size = le32_to_cpu(log->sze); | |||
| 11075 | ||||
| 11076 | /* If sze is 0 or smaller than the minimum, just use minimum */ | |||
| 11077 | if (log_size < min_log_size) | |||
| 11078 | log_size = min_log_size; | |||
| 11079 | ||||
| 11080 | /* If the log is larger, re-read with full size */ | |||
| 11081 | if (log_size > min_log_size) { | |||
| 11082 | log = libnvme_realloc(log, log_size); | |||
| 11083 | if (!log) | |||
| 11084 | return -ENOMEM12; | |||
| 11085 | ||||
| 11086 | err = nvme_get_log_power_measurement(hdl, log, log_size); | |||
| 11087 | if (err) { | |||
| 11088 | nvme_show_err(err, "power-measurement-log"); | |||
| 11089 | return err; | |||
| 11090 | } | |||
| 11091 | } | |||
| 11092 | ||||
| 11093 | nvme_show_power_meas_log(log, log_size, flags); | |||
| 11094 | ||||
| 11095 | return err; | |||
| 11096 | } | |||
| 11097 | ||||
| 11098 | static int get_log_offset(struct libnvme_transport_handle *hdl, | |||
| 11099 | struct nvme_get_log_args *args, __u64 *offset, | |||
| 11100 | __u32 len, void **log) | |||
| 11101 | { | |||
| 11102 | struct libnvme_passthru_cmd cmd; | |||
| 11103 | int err; | |||
| 11104 | ||||
| 11105 | args->lpo = *offset, | |||
| 11106 | args->log = *log + *offset, | |||
| 11107 | args->len = len; | |||
| 11108 | *offset += args->len; | |||
| 11109 | ||||
| 11110 | *log = libnvme_realloc(*log, *offset); | |||
| 11111 | if (!*log) | |||
| 11112 | return -ENOMEM12; | |||
| 11113 | ||||
| 11114 | nvme_init_get_log(&cmd, args->nsid, args->lid, | |||
| 11115 | args->csi, args->log, args->len); | |||
| 11116 | cmd.cdw10 |= NVME_FIELD_ENCODE(args->lsp,(((__u32)(args->lsp) & (NVME_LOG_CDW10_LSP_MASK)) << (NVME_LOG_CDW10_LSP_SHIFT)) | |||
| 11117 | NVME_LOG_CDW10_LSP_SHIFT,(((__u32)(args->lsp) & (NVME_LOG_CDW10_LSP_MASK)) << (NVME_LOG_CDW10_LSP_SHIFT)) | |||
| 11118 | NVME_LOG_CDW10_LSP_MASK)(((__u32)(args->lsp) & (NVME_LOG_CDW10_LSP_MASK)) << (NVME_LOG_CDW10_LSP_SHIFT)); | |||
| 11119 | cmd.cdw11 |= NVME_FIELD_ENCODE(args->lsi,(((__u32)(args->lsi) & (NVME_LOG_CDW11_LSI_MASK)) << (NVME_LOG_CDW11_LSI_SHIFT)) | |||
| 11120 | NVME_LOG_CDW11_LSI_SHIFT,(((__u32)(args->lsi) & (NVME_LOG_CDW11_LSI_MASK)) << (NVME_LOG_CDW11_LSI_SHIFT)) | |||
| 11121 | NVME_LOG_CDW11_LSI_MASK)(((__u32)(args->lsi) & (NVME_LOG_CDW11_LSI_MASK)) << (NVME_LOG_CDW11_LSI_SHIFT)); | |||
| 11122 | cmd.cdw12 = args->lpo & 0xffffffff; | |||
| 11123 | cmd.cdw13 = args->lpo >> 32; | |||
| 11124 | cmd.cdw14 |= NVME_FIELD_ENCODE(args->uidx,(((__u32)(args->uidx) & (NVME_LOG_CDW14_UUID_MASK)) << (NVME_LOG_CDW14_UUID_SHIFT)) | |||
| 11125 | NVME_LOG_CDW14_UUID_SHIFT,(((__u32)(args->uidx) & (NVME_LOG_CDW14_UUID_MASK)) << (NVME_LOG_CDW14_UUID_SHIFT)) | |||
| 11126 | NVME_LOG_CDW14_UUID_MASK)(((__u32)(args->uidx) & (NVME_LOG_CDW14_UUID_MASK)) << (NVME_LOG_CDW14_UUID_SHIFT)) | | |||
| 11127 | NVME_FIELD_ENCODE(args->ot,(((__u32)(args->ot) & (NVME_LOG_CDW14_OT_MASK)) << (NVME_LOG_CDW14_OT_SHIFT)) | |||
| 11128 | NVME_LOG_CDW14_OT_SHIFT,(((__u32)(args->ot) & (NVME_LOG_CDW14_OT_MASK)) << (NVME_LOG_CDW14_OT_SHIFT)) | |||
| 11129 | NVME_LOG_CDW14_OT_MASK)(((__u32)(args->ot) & (NVME_LOG_CDW14_OT_MASK)) << (NVME_LOG_CDW14_OT_SHIFT)); | |||
| 11130 | ||||
| 11131 | err = libnvme_get_log(hdl, &cmd, args->rae, NVME_LOG_PAGE_PDU_SIZE4096); | |||
| 11132 | if (*args->result) | |||
| ||||
| 11133 | *args->result = cmd.result; | |||
| 11134 | return err; | |||
| 11135 | } | |||
| 11136 | ||||
| 11137 | static int get_reachability_group_desc(struct libnvme_transport_handle *hdl, struct nvme_get_log_args *args, | |||
| 11138 | __u64 *offset, struct nvme_reachability_groups_log **logp) | |||
| 11139 | { | |||
| 11140 | int err; | |||
| 11141 | struct nvme_reachability_groups_log *log = *logp; | |||
| 11142 | __u16 i; | |||
| 11143 | __u32 len; | |||
| 11144 | ||||
| 11145 | for (i = 0; i < le16_to_cpu(log->nrgd); i++) { | |||
| 11146 | len = sizeof(*log->rgd); | |||
| 11147 | err = get_log_offset(hdl, args, offset, len, (void **)&log); | |||
| 11148 | if (err) | |||
| 11149 | goto err_free; | |||
| 11150 | len = le32_to_cpu(log->rgd[i].nnid) * sizeof(*log->rgd[i].nsid); | |||
| 11151 | err = get_log_offset(hdl, args, offset, len, (void **)&log); | |||
| 11152 | if (err) | |||
| 11153 | goto err_free; | |||
| 11154 | } | |||
| 11155 | ||||
| 11156 | *logp = log; | |||
| 11157 | return 0; | |||
| 11158 | ||||
| 11159 | err_free: | |||
| 11160 | libnvme_free(log); | |||
| 11161 | *logp = NULL((void*)0); | |||
| 11162 | return err; | |||
| 11163 | } | |||
| 11164 | ||||
| 11165 | static int get_reachability_groups(struct libnvme_transport_handle *hdl, bool_Bool rgo, bool_Bool rae, | |||
| 11166 | struct nvme_reachability_groups_log **logp, | |||
| 11167 | __u64 *lenp) | |||
| 11168 | { | |||
| 11169 | int err; | |||
| 11170 | struct nvme_reachability_groups_log *log; | |||
| 11171 | __u64 log_len = sizeof(*log); | |||
| 11172 | struct nvme_get_log_args args = { | |||
| 11173 | .lid = NVME_LOG_LID_REACHABILITY_GROUPS, | |||
| 11174 | .nsid = NVME_NSID_ALL, | |||
| 11175 | .lsp = rgo, | |||
| 11176 | .rae = rae, | |||
| 11177 | }; | |||
| 11178 | ||||
| 11179 | log = libnvme_alloc(log_len); | |||
| 11180 | if (!log) | |||
| 11181 | return -ENOMEM12; | |||
| 11182 | ||||
| 11183 | err = nvme_get_log_reachability_groups(hdl, rgo, rae, log, log_len); | |||
| 11184 | if (err) | |||
| 11185 | goto err_free; | |||
| 11186 | ||||
| 11187 | err = get_reachability_group_desc(hdl, &args, &log_len, &log); | |||
| 11188 | if (err) | |||
| 11189 | goto err_free; | |||
| 11190 | ||||
| 11191 | *logp = log; | |||
| 11192 | *lenp = log_len; | |||
| 11193 | return 0; | |||
| 11194 | ||||
| 11195 | err_free: | |||
| 11196 | libnvme_free(log); | |||
| 11197 | return err; | |||
| 11198 | } | |||
| 11199 | ||||
| 11200 | static int get_reachability_groups_log(int argc, char **argv, struct command *acmd, | |||
| 11201 | struct plugin *plugin) | |||
| 11202 | { | |||
| 11203 | const char *desc = "Retrieve Reachability Groups Log, show it"; | |||
| 11204 | const char *rgo = "Return Groups Only"; | |||
| 11205 | nvme_print_flags_t flags; | |||
| 11206 | int err; | |||
| 11207 | __u64 len = 0; | |||
| 11208 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_reachability_groups_log *log = NULL((void*)0); | |||
| 11209 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 11210 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 11211 | ||||
| 11212 | struct config { | |||
| 11213 | bool_Bool rgo; | |||
| 11214 | bool_Bool rae; | |||
| 11215 | }; | |||
| 11216 | ||||
| 11217 | struct config cfg = { | |||
| 11218 | .rgo = false0, | |||
| 11219 | .rae = false0, | |||
| 11220 | }; | |||
| 11221 | ||||
| 11222 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"groups-only", 'g', ((void*)0), CFG_FLAG, &cfg.rgo , 0, rgo, 0, }, {"rae", 'r', ((void*)0), CFG_FLAG, &cfg.rae , 0, rae, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 11223 | OPT_FLAG("groups-only", 'g', &cfg.rgo, rgo),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"groups-only", 'g', ((void*)0), CFG_FLAG, &cfg.rgo , 0, rgo, 0, }, {"rae", 'r', ((void*)0), CFG_FLAG, &cfg.rae , 0, rae, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 11224 | OPT_FLAG("rae", 'r', &cfg.rae, rae))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"groups-only", 'g', ((void*)0), CFG_FLAG, &cfg.rgo , 0, rgo, 0, }, {"rae", 'r', ((void*)0), CFG_FLAG, &cfg.rae , 0, rae, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 11225 | ||||
| 11226 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 11227 | if (err) | |||
| 11228 | return err; | |||
| 11229 | ||||
| 11230 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 11231 | if (err < 0) { | |||
| 11232 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 11233 | return err; | |||
| 11234 | } | |||
| 11235 | ||||
| 11236 | err = get_reachability_groups(hdl, cfg.rgo, cfg.rae, &log, &len); | |||
| 11237 | if (err) { | |||
| 11238 | nvme_show_err(err, "reachability groups log"); | |||
| 11239 | return err; | |||
| 11240 | } | |||
| 11241 | ||||
| 11242 | nvme_show_reachability_groups_log(log, len, flags); | |||
| 11243 | ||||
| 11244 | return err; | |||
| 11245 | } | |||
| 11246 | ||||
| 11247 | static int get_reachability_association_desc(struct libnvme_transport_handle *hdl, struct nvme_get_log_args *args, | |||
| 11248 | __u64 *offset, | |||
| 11249 | struct nvme_reachability_associations_log **logp) | |||
| 11250 | { | |||
| 11251 | int err; | |||
| 11252 | struct nvme_reachability_associations_log *log = *logp; | |||
| 11253 | __u16 i; | |||
| 11254 | __u32 len; | |||
| 11255 | ||||
| 11256 | for (i = 0; i < le16_to_cpu(log->nrad); i++) { | |||
| 11257 | len = sizeof(*log->rad); | |||
| 11258 | err = get_log_offset(hdl, args, offset, len, (void **)&log); | |||
| 11259 | if (err) | |||
| 11260 | goto err_free; | |||
| 11261 | len = le32_to_cpu(log->rad[i].nrid) * sizeof(*log->rad[i].rgid); | |||
| 11262 | err = get_log_offset(hdl, args, offset, len, (void **)&log); | |||
| 11263 | if (err) | |||
| 11264 | goto err_free; | |||
| 11265 | } | |||
| 11266 | ||||
| 11267 | *logp = log; | |||
| 11268 | return 0; | |||
| 11269 | ||||
| 11270 | err_free: | |||
| 11271 | libnvme_free(log); | |||
| 11272 | *logp = NULL((void*)0); | |||
| 11273 | return err; | |||
| 11274 | } | |||
| 11275 | ||||
| 11276 | static int get_reachability_associations(struct libnvme_transport_handle *hdl, bool_Bool rao, bool_Bool rae, | |||
| 11277 | struct nvme_reachability_associations_log **logp, | |||
| 11278 | __u64 *lenp) | |||
| 11279 | { | |||
| 11280 | int err; | |||
| 11281 | struct nvme_reachability_associations_log *log; | |||
| 11282 | __u64 log_len = sizeof(*log); | |||
| 11283 | struct nvme_get_log_args args = { | |||
| 11284 | .lid = NVME_LOG_LID_REACHABILITY_ASSOCIATIONS, | |||
| 11285 | .nsid = NVME_NSID_ALL, | |||
| 11286 | .lsp = rao, | |||
| 11287 | .rae = rae, | |||
| 11288 | }; | |||
| 11289 | ||||
| 11290 | log = libnvme_alloc(log_len); | |||
| 11291 | if (!log) | |||
| 11292 | return -ENOMEM12; | |||
| 11293 | ||||
| 11294 | err = nvme_get_log_reachability_associations(hdl, rao, rae, log, log_len); | |||
| 11295 | if (err) | |||
| 11296 | goto err_free; | |||
| 11297 | ||||
| 11298 | err = get_reachability_association_desc(hdl, &args, &log_len, &log); | |||
| 11299 | if (err) | |||
| 11300 | goto err_free; | |||
| 11301 | ||||
| 11302 | *logp = log; | |||
| 11303 | *lenp = log_len; | |||
| 11304 | return 0; | |||
| 11305 | ||||
| 11306 | err_free: | |||
| 11307 | libnvme_free(log); | |||
| 11308 | return err; | |||
| 11309 | } | |||
| 11310 | ||||
| 11311 | static int get_reachability_associations_log(int argc, char **argv, struct command *acmd, | |||
| 11312 | struct plugin *plugin) | |||
| 11313 | { | |||
| 11314 | const char *desc = "Retrieve Reachability Associations Log, show it"; | |||
| 11315 | const char *rao = "Return Associations Only"; | |||
| 11316 | nvme_print_flags_t flags; | |||
| 11317 | int err; | |||
| 11318 | __u64 len = 0; | |||
| 11319 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_reachability_associations_log *log = NULL((void*)0); | |||
| 11320 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 11321 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 11322 | ||||
| 11323 | struct config { | |||
| 11324 | bool_Bool rao; | |||
| 11325 | bool_Bool rae; | |||
| 11326 | }; | |||
| 11327 | ||||
| 11328 | struct config cfg = { | |||
| 11329 | .rao = false0, | |||
| 11330 | .rae = false0, | |||
| 11331 | }; | |||
| 11332 | ||||
| 11333 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"associations-only", 'a', ((void*)0), CFG_FLAG, & cfg.rao, 0, rao, 0, }, {"rae", 'r', ((void*)0), CFG_FLAG, & cfg.rae, 0, rae, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 11334 | OPT_FLAG("associations-only", 'a', &cfg.rao, rao),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"associations-only", 'a', ((void*)0), CFG_FLAG, & cfg.rao, 0, rao, 0, }, {"rae", 'r', ((void*)0), CFG_FLAG, & cfg.rae, 0, rae, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 11335 | OPT_FLAG("rae", 'r', &cfg.rae, rae))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"associations-only", 'a', ((void*)0), CFG_FLAG, & cfg.rao, 0, rao, 0, }, {"rae", 'r', ((void*)0), CFG_FLAG, & cfg.rae, 0, rae, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 11336 | ||||
| 11337 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 11338 | if (err) | |||
| 11339 | return err; | |||
| 11340 | ||||
| 11341 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 11342 | if (err < 0) { | |||
| 11343 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 11344 | return err; | |||
| 11345 | } | |||
| 11346 | ||||
| 11347 | err = get_reachability_associations(hdl, cfg.rao, cfg.rae, &log, &len); | |||
| 11348 | if (err) { | |||
| 11349 | nvme_show_err(err, "reachability associations log"); | |||
| 11350 | return err; | |||
| 11351 | } | |||
| 11352 | ||||
| 11353 | nvme_show_reachability_associations_log(log, len, flags); | |||
| 11354 | ||||
| 11355 | return err; | |||
| 11356 | } | |||
| 11357 | ||||
| 11358 | static int get_host_discovery(struct libnvme_transport_handle *hdl, bool_Bool allhoste, bool_Bool rae, | |||
| 11359 | struct nvme_host_discover_log **logp) | |||
| 11360 | { | |||
| 11361 | int err; | |||
| 11362 | struct nvme_host_discover_log *log; | |||
| 11363 | __u64 log_len = sizeof(*log); | |||
| 11364 | struct nvme_get_log_args args = { | |||
| 11365 | .lid = NVME_LOG_LID_HOST_DISCOVERY, | |||
| 11366 | .nsid = NVME_NSID_ALL, | |||
| 11367 | .lsp = allhoste, | |||
| 11368 | .rae = rae, | |||
| 11369 | }; | |||
| 11370 | ||||
| 11371 | log = libnvme_alloc(log_len); | |||
| 11372 | if (!log) | |||
| 11373 | return -ENOMEM12; | |||
| 11374 | ||||
| 11375 | err = nvme_get_log_host_discovery(hdl, allhoste, rae, log, log_len); | |||
| 11376 | if (err) | |||
| 11377 | goto err_free; | |||
| 11378 | ||||
| 11379 | log_len = le32_to_cpu(log->thdlpl); | |||
| 11380 | err = get_log_offset(hdl, &args, &log_len, le32_to_cpu(log->thdlpl) - log_len, | |||
| 11381 | (void **)&log); | |||
| 11382 | if (err) | |||
| 11383 | goto err_free; | |||
| 11384 | ||||
| 11385 | *logp = log; | |||
| 11386 | return 0; | |||
| 11387 | ||||
| 11388 | err_free: | |||
| 11389 | libnvme_free(log); | |||
| 11390 | return err; | |||
| 11391 | } | |||
| 11392 | ||||
| 11393 | static int get_host_discovery_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 11394 | { | |||
| 11395 | const char *desc = "Retrieve Host Discovery Log, show it"; | |||
| 11396 | const char *allhoste = "All Host Entries"; | |||
| 11397 | nvme_print_flags_t flags; | |||
| 11398 | int err; | |||
| 11399 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_host_discover_log *log = NULL((void*)0); | |||
| 11400 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 11401 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 11402 | ||||
| 11403 | struct config { | |||
| 11404 | bool_Bool allhoste; | |||
| 11405 | bool_Bool rae; | |||
| 11406 | }; | |||
| 11407 | ||||
| 11408 | struct config cfg = { | |||
| 11409 | .allhoste = false0, | |||
| 11410 | .rae = false0, | |||
| 11411 | }; | |||
| 11412 | ||||
| 11413 | NVME_ARGS(opts,struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"all-host-entries", 'a', ((void*)0), CFG_FLAG, &cfg .allhoste, 0, allhoste, 0, }, {"rae", 'r', ((void*)0), CFG_FLAG , &cfg.rae, 0, rae, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 11414 | OPT_FLAG("all-host-entries", 'a', &cfg.allhoste, allhoste),struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"all-host-entries", 'a', ((void*)0), CFG_FLAG, &cfg .allhoste, 0, allhoste, 0, }, {"rae", 'r', ((void*)0), CFG_FLAG , &cfg.rae, 0, rae, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } } | |||
| 11415 | OPT_FLAG("rae", 'r', &cfg.rae, rae))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"all-host-entries", 'a', ((void*)0), CFG_FLAG, &cfg .allhoste, 0, allhoste, 0, }, {"rae", 'r', ((void*)0), CFG_FLAG , &cfg.rae, 0, rae, 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, }, {"output-format", 'o', "FMT", CFG_STRING, &nvme_args .output_format, 1, "Output format: normal|json|binary|tabular" , 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}, { ((void*)0) } }; | |||
| 11416 | ||||
| 11417 | ||||
| 11418 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 11419 | if (err) | |||
| 11420 | return err; | |||
| 11421 | ||||
| 11422 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 11423 | if (err < 0) { | |||
| 11424 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 11425 | return err; | |||
| 11426 | } | |||
| 11427 | ||||
| 11428 | err = get_host_discovery(hdl, cfg.allhoste, cfg.rae, &log); | |||
| 11429 | if (err) { | |||
| 11430 | nvme_show_err(err, "host discovery log"); | |||
| 11431 | return err; | |||
| 11432 | } | |||
| 11433 | ||||
| 11434 | nvme_show_host_discovery_log(log, flags); | |||
| 11435 | ||||
| 11436 | return err; | |||
| 11437 | } | |||
| 11438 | ||||
| 11439 | static int get_ave_discovery(struct libnvme_transport_handle *hdl, bool_Bool rae, struct nvme_ave_discover_log **logp) | |||
| 11440 | { | |||
| 11441 | int err; | |||
| 11442 | struct nvme_ave_discover_log *log; | |||
| 11443 | __u64 log_len = sizeof(*log); | |||
| 11444 | struct nvme_get_log_args args = { | |||
| 11445 | .lid = NVME_LOG_LID_AVE_DISCOVERY, | |||
| 11446 | .nsid = NVME_NSID_ALL, | |||
| 11447 | .rae = rae, | |||
| 11448 | }; | |||
| 11449 | ||||
| 11450 | log = libnvme_alloc(log_len); | |||
| 11451 | if (!log) | |||
| 11452 | return -ENOMEM12; | |||
| 11453 | ||||
| 11454 | err = nvme_get_log_ave_discovery(hdl, rae, log, log_len); | |||
| 11455 | if (err) | |||
| 11456 | goto err_free; | |||
| 11457 | ||||
| 11458 | log_len = le32_to_cpu(log->tadlpl); | |||
| 11459 | err = get_log_offset(hdl, &args, &log_len, le32_to_cpu(log->tadlpl) - log_len, | |||
| 11460 | (void **)&log); | |||
| 11461 | if (err) | |||
| 11462 | goto err_free; | |||
| 11463 | ||||
| 11464 | *logp = log; | |||
| 11465 | return 0; | |||
| 11466 | ||||
| 11467 | err_free: | |||
| 11468 | libnvme_free(log); | |||
| 11469 | return err; | |||
| 11470 | } | |||
| 11471 | ||||
| 11472 | static int get_ave_discovery_log(int argc, char **argv, struct command *acmd, struct plugin *plugin) | |||
| 11473 | { | |||
| 11474 | const char *desc = "Retrieve AVE Discovery Log, show it"; | |||
| 11475 | nvme_print_flags_t flags; | |||
| 11476 | int err; | |||
| 11477 | ||||
| 11478 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_ave_discover_log *log = NULL((void*)0); | |||
| 11479 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 11480 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 11481 | ||||
| 11482 | struct config { | |||
| 11483 | bool_Bool rae; | |||
| 11484 | }; | |||
| 11485 | ||||
| 11486 | struct config cfg = { | |||
| 11487 | .rae = false0, | |||
| 11488 | }; | |||
| 11489 | ||||
| 11490 | NVME_ARGS(opts, OPT_FLAG("rae", 'r', &cfg.rae, rae))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"rae", 'r', ((void*)0), CFG_FLAG, &cfg.rae, 0, rae , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 11491 | ||||
| 11492 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 11493 | if (err) | |||
| 11494 | return err; | |||
| 11495 | ||||
| 11496 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 11497 | if (err < 0) { | |||
| 11498 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 11499 | return err; | |||
| 11500 | } | |||
| 11501 | ||||
| 11502 | err = get_ave_discovery(hdl, cfg.rae, &log); | |||
| 11503 | if (err) { | |||
| 11504 | nvme_show_err(err, "ave discovery log"); | |||
| 11505 | return err; | |||
| 11506 | } | |||
| 11507 | ||||
| 11508 | nvme_show_ave_discovery_log(log, flags); | |||
| 11509 | ||||
| 11510 | return err; | |||
| 11511 | } | |||
| 11512 | ||||
| 11513 | static int get_pull_model_ddc_req(struct libnvme_transport_handle *hdl, | |||
| 11514 | bool_Bool rae, struct nvme_pull_model_ddc_req_log **logp) | |||
| 11515 | { | |||
| 11516 | int err; | |||
| 11517 | struct nvme_pull_model_ddc_req_log *log; | |||
| 11518 | __u64 log_len = sizeof(*log); | |||
| 11519 | struct nvme_get_log_args args = { | |||
| 11520 | .lid = NVME_LOG_LID_PULL_MODEL_DDC_REQ, | |||
| 11521 | .nsid = NVME_NSID_ALL, | |||
| 11522 | .rae = rae, | |||
| 11523 | }; | |||
| 11524 | ||||
| 11525 | log = libnvme_alloc(log_len); | |||
| 11526 | if (!log) | |||
| 11527 | return -ENOMEM12; | |||
| 11528 | ||||
| 11529 | err = nvme_get_log_pull_model_ddc_req(hdl, rae, log, log_len); | |||
| 11530 | if (err) | |||
| 11531 | goto err_free; | |||
| 11532 | ||||
| 11533 | log_len = le32_to_cpu(log->tpdrpl); | |||
| 11534 | err = get_log_offset(hdl, &args, &log_len, le32_to_cpu(log->tpdrpl) - log_len, | |||
| 11535 | (void **)&log); | |||
| 11536 | if (err) | |||
| 11537 | goto err_free; | |||
| 11538 | ||||
| 11539 | *logp = log; | |||
| 11540 | return 0; | |||
| 11541 | ||||
| 11542 | err_free: | |||
| 11543 | libnvme_free(log); | |||
| 11544 | return err; | |||
| 11545 | } | |||
| 11546 | ||||
| 11547 | static int get_pull_model_ddc_req_log(int argc, char **argv, struct command *acmd, | |||
| 11548 | struct plugin *plugin) | |||
| 11549 | { | |||
| 11550 | const char *desc = "Retrieve Pull Model DDC Request Log, show it"; | |||
| 11551 | nvme_print_flags_t flags; | |||
| 11552 | int err; | |||
| 11553 | ||||
| 11554 | __cleanup_libnvme_free__attribute__((cleanup(libnvme_freep))) struct nvme_pull_model_ddc_req_log *log = NULL((void*)0); | |||
| 11555 | __cleanup_nvme_global_ctx__attribute__((cleanup(cleanup_nvme_global_ctx))) struct libnvme_global_ctx *ctx = NULL((void*)0); | |||
| 11556 | __cleanup_nvme_transport_handle__attribute__((cleanup(cleanup_nvme_transport_handle))) struct libnvme_transport_handle *hdl = NULL((void*)0); | |||
| 11557 | ||||
| 11558 | struct config { | |||
| 11559 | bool_Bool rae; | |||
| 11560 | }; | |||
| 11561 | ||||
| 11562 | struct config cfg = { | |||
| 11563 | .rae = false0, | |||
| 11564 | }; | |||
| 11565 | ||||
| 11566 | NVME_ARGS(opts, OPT_FLAG("rae", 'r', &cfg.rae, rae))struct argconfig_commandline_options opts[] = { {"", 0, ((void *)0), CFG_GROUP_SEPARATOR, ((void*)0), 0, "Options", 0, ((void *)0)}, {"rae", 'r', ((void*)0), CFG_FLAG, &cfg.rae, 0, rae , 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, } , {"output-format", 'o', "FMT", CFG_STRING, &nvme_args.output_format , 1, "Output format: normal|json|binary|tabular", 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}, { ((void*)0) } }; | |||
| 11567 | ||||
| 11568 | err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts); | |||
| 11569 | if (err
| |||
| ||||
| 11570 | return err; | |||
| 11571 | ||||
| 11572 | err = validate_output_format(nvme_args.output_format, &flags); | |||
| 11573 | if (err
| |||
| 11574 | nvme_show_error("Invalid output format")nvme_show_message(1, "Invalid output format"); | |||
| 11575 | return err; | |||
| 11576 | } | |||
| 11577 | ||||
| 11578 | err = get_pull_model_ddc_req(hdl, cfg.rae, &log); | |||
| 11579 | if (err) { | |||
| 11580 | nvme_show_err(err, "pull model ddc req log"); | |||
| 11581 | return err; | |||
| 11582 | } | |||
| 11583 | ||||
| 11584 | nvme_show_pull_model_ddc_req_log(log, flags); | |||
| 11585 | ||||
| 11586 | return err; | |||
| 11587 | } | |||
| 11588 | ||||
| 11589 | void register_extension(struct plugin *plugin) | |||
| 11590 | { | |||
| 11591 | plugin->parent = &nvme; | |||
| 11592 | nvme.extensions->tail->next = plugin; | |||
| 11593 | nvme.extensions->tail = plugin; | |||
| 11594 | } | |||
| 11595 | ||||
| 11596 | int main(int argc, char **argv) | |||
| 11597 | { | |||
| 11598 | int err; | |||
| 11599 | ||||
| 11600 | #ifdef _WIN32 | |||
| 11601 | /* | |||
| 11602 | * Set stdout and stderr to binary mode to prevent Windows text-mode | |||
| 11603 | * translation from converting LF to CRLF and corrupting binary output. | |||
| 11604 | */ | |||
| 11605 | _setmode(_fileno(stdoutstdout), O_BINARY); | |||
| 11606 | _setmode(_fileno(stderrstderr), O_BINARY); | |||
| 11607 | #endif | |||
| 11608 | ||||
| 11609 | nvme.extensions->parent = &nvme; | |||
| 11610 | if (argc < 2) { | |||
| 11611 | general_help(&builtin, NULL((void*)0)); | |||
| 11612 | return 0; | |||
| 11613 | } | |||
| 11614 | setlocale(LC_ALL6, ""); | |||
| 11615 | ||||
| 11616 | err = nvme_install_sigint_handler(); | |||
| 11617 | if (err) | |||
| 11618 | return err; | |||
| 11619 | ||||
| 11620 | err = handle_plugin(argc, argv, nvme.extensions); | |||
| 11621 | if (err == -ENOTTY25) | |||
| 11622 | general_help(&builtin, NULL((void*)0)); | |||
| 11623 | ||||
| 11624 | return err ? 1 : 0; | |||
| 11625 | } |