From: Hannes Reinecke Date: Thu, 18 Nov 2021 13:00:34 +0000 (+0100) Subject: Update to add 'result' and 'timeout' arguments X-Git-Tag: v2.0-rc0~46^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=76906159c95435619c631f8a4fbe8c4085295fdc;p=users%2Fsagi%2Fnvme-cli.git Update to add 'result' and 'timeout' arguments With the latest libnvme update the ioctl wrapper functions have been sanitized to always include a 'timeout' and 'result' argument. Signed-off-by: Hannes Reinecke --- diff --git a/libnvme b/libnvme index fef21562..38d5f958 160000 --- a/libnvme +++ b/libnvme @@ -1 +1 @@ -Subproject commit fef2156256d7ceabd555b9ba079846abbf864891 +Subproject commit 38d5f958a9c557499060f326d68fca47b8da362d diff --git a/nvme-rpmb.c b/nvme-rpmb.c index d92bbd67..05fc28a9 100644 --- a/nvme-rpmb.c +++ b/nvme-rpmb.c @@ -268,11 +268,11 @@ struct rpmb_config_block_t { #define SEND_RPMB_REQ(tgt, size, req) \ nvme_security_send(fd, 0, tgt, RPMB_NVME_SPSP, 0, RPMB_NVME_SECP, 0, size, \ - (unsigned char *)(req), NULL) + (unsigned char *)(req), NVME_DEFAULT_IOCTL_TIMEOUT, NULL) #define RECV_RPMB_RSP(tgt, size, rsp) \ nvme_security_receive(fd, 0, tgt, RPMB_NVME_SPSP, 0, RPMB_NVME_SECP, 0, size, \ - (unsigned char *)(rsp), NULL) + (unsigned char *)(rsp), NVME_DEFAULT_IOCTL_TIMEOUT, NULL) /* Initialize nonce value in rpmb request frame */ static void rpmb_nonce_init(struct rpmb_data_frame_t *req) diff --git a/nvme.c b/nvme.c index 303315ce..27cc5067 100644 --- a/nvme.c +++ b/nvme.c @@ -472,8 +472,10 @@ static int get_telemetry_log(int argc, char **argv, struct command *cmd, struct } memset(buf, 0, len); - err = nvme_get_features(fd, NVME_NSID_ALL, NVME_FEAT_FID_HOST_BEHAVIOR, 0, 0, - 0, len, buf, &result); + err = nvme_get_features(fd, NVME_NSID_ALL, + NVME_FEAT_FID_HOST_BEHAVIOR, 0, 0, 0, + len, buf, NVME_DEFAULT_IOCTL_TIMEOUT, + &result); if (err > 0) { nvme_show_status(err); } else if (err < 0) { @@ -1585,7 +1587,7 @@ static int get_log(int argc, char **argv, struct command *cmd, struct plugin *pl err = nvme_get_log(fd, cfg.log_id, cfg.namespace_id, cfg.lpo, cfg.lsp, cfg.lsi, cfg.rae, cfg.uuid_index, NVME_CSI_NVM, - cfg.log_len, log); + cfg.log_len, log, NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (!err) { if (!cfg.raw_binary) { printf("Device:%s log-id:%d namespace-id:%#x\n", @@ -3204,7 +3206,8 @@ static int get_feature_id(int fd, struct feat_cfg *cfg, void **buf, return nvme_get_features(fd, cfg->feature_id, cfg->namespace_id, cfg->sel, cfg->cdw11, cfg->uuid_index, - cfg->data_len, *buf, result); + cfg->data_len, *buf, + NVME_DEFAULT_IOCTL_TIMEOUT, result); } static void get_feature_id_print(struct feat_cfg cfg, int err, __u32 result, @@ -3463,7 +3466,8 @@ static int fw_download(int argc, char **argv, struct command *cmd, struct plugin while (fw_size > 0) { cfg.xfer = min(cfg.xfer, fw_size); - err = nvme_fw_download(fd, cfg.offset, cfg.xfer, fw_buf); + err = nvme_fw_download(fd, cfg.offset, cfg.xfer, fw_buf, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (err < 0) { perror("fw-download"); break; @@ -3742,7 +3746,8 @@ static int sanitize(int argc, char **argv, struct command *cmd, struct plugin *p } ret = nvme_sanitize_nvm(fd, cfg.sanact, cfg.ause, cfg.owpass, cfg.oipbp, - cfg.no_dealloc, cfg.ovrpat); + cfg.no_dealloc, cfg.ovrpat, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (ret < 0) perror("sanitize"); else if (ret > 0) @@ -3767,7 +3772,8 @@ static int nvme_get_properties(int fd, void **pbar) memset(*pbar, 0xff, size); for (offset = NVME_REG_CAP; offset <= NVME_REG_CMBSZ;) { - err = nvme_get_property(fd, offset, &value); + err = nvme_get_property(fd, offset, &value, + NVME_DEFAULT_IOCTL_TIMEOUT); if (err > 0 && (err & 0xff) == NVME_SC_INVALID_FIELD) { err = 0; value = -1; @@ -3929,7 +3935,8 @@ static int get_property(int argc, char **argv, struct command *cmd, struct plugi goto close_fd; } - err = nvme_get_property(fd, cfg.offset, &value); + err = nvme_get_property(fd, cfg.offset, &value, + NVME_DEFAULT_IOCTL_TIMEOUT); if (err < 0) { perror("get-property"); } else if (!err) { @@ -3983,7 +3990,8 @@ static int set_property(int argc, char **argv, struct command *cmd, struct plugi goto close_fd; } - err = nvme_set_property(fd, cfg.offset, cfg.value); + err = nvme_set_property(fd, cfg.offset, cfg.value, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (err < 0) { perror("set-property"); } else if (!err) { @@ -4203,7 +4211,7 @@ static int format(int argc, char **argv, struct command *cmd, struct plugin *plu } err = nvme_format_nvm(fd, cfg.namespace_id, cfg.lbaf, cfg.ms, cfg.pi, - cfg.pil, cfg.ses, cfg.timeout); + cfg.pil, cfg.ses, cfg.timeout, NULL); if (err < 0) perror("format"); else if (err != 0) @@ -4385,7 +4393,7 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin err = nvme_set_features(fd, cfg.feature_id, cfg.namespace_id, cfg.value, cfg.cdw12, cfg.save, cfg.uuid_index, 0, - cfg.data_len, buf, &result); + cfg.data_len, buf, NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (err < 0) { perror("set-feature"); } else if (!err) { @@ -4510,8 +4518,10 @@ static int sec_send(int argc, char **argv, struct command *cmd, struct plugin *p goto free; } - err = nvme_security_send(fd, cfg.namespace_id, cfg.nssf, cfg.spsp & 0xff, - cfg.spsp >> 8, cfg.secp, cfg.tl, cfg.tl, sec_buf, NULL); + err = nvme_security_send(fd, cfg.namespace_id, cfg.nssf, + cfg.spsp & 0xff, cfg.spsp >> 8, cfg.secp, + cfg.tl, cfg.tl, sec_buf, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (err < 0) perror("security-send"); else if (err != 0) @@ -4652,7 +4662,8 @@ static int dir_send(int argc, char **argv, struct command *cmd, struct plugin *p } err = nvme_directive_send(fd, cfg.namespace_id, cfg.dspec, cfg.doper, - cfg.dtype, dw12, cfg.data_len, buf, &result); + cfg.dtype, dw12, cfg.data_len, buf, + NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (err < 0) { perror("dir-send"); goto close_ffd; @@ -4720,7 +4731,7 @@ static int write_uncor(int argc, char **argv, struct command *cmd, struct plugin } err = nvme_write_uncorrectable(fd, cfg.namespace_id, cfg.start_block, - cfg.block_count); + cfg.block_count, NVME_DEFAULT_IOCTL_TIMEOUT); if (err < 0) perror("write uncorrectable"); else if (err != 0) @@ -4823,8 +4834,10 @@ static int write_zeroes(int argc, char **argv, struct command *cmd, struct plugi } } - err = nvme_write_zeros(fd, cfg.namespace_id, cfg.start_block, cfg.block_count, - control, cfg.ref_tag, cfg.app_tag, cfg.app_tag_mask, cfg.storage_tag); + err = nvme_write_zeros(fd, cfg.namespace_id, cfg.start_block, + cfg.block_count, control, cfg.ref_tag, + cfg.app_tag, cfg.app_tag_mask, cfg.storage_tag, + NVME_DEFAULT_IOCTL_TIMEOUT); if (err < 0) perror("write-zeroes"); else if (err != 0) @@ -4919,7 +4932,8 @@ static int dsm(int argc, char **argv, struct command *cmd, struct plugin *plugin cfg.cdw11 = (cfg.ad << 2) | (cfg.idw << 1) | (cfg.idr << 0); nvme_init_dsm_range(dsm, ctx_attrs, nlbs, slbas, nr); - err = nvme_dsm(fd, cfg.namespace_id, cfg.cdw11, nr, dsm); + err = nvme_dsm(fd, cfg.namespace_id, cfg.cdw11, nr, dsm, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (err < 0) perror("data-set management"); else if (err != 0) @@ -5048,7 +5062,8 @@ static int copy(int argc, char **argv, struct command *cmd, struct plugin *plugi err = nvme_copy(fd, cfg.namespace_id, copy, cfg.sdlba, nr, cfg.prinfor, cfg.prinfow, cfg.dtype, cfg.dspec, cfg.format, cfg.lr, - cfg.fua, cfg.ilbrt, cfg.lbatm, cfg.lbat); + cfg.fua, cfg.ilbrt, cfg.lbatm, cfg.lbat, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (err < 0) perror("NVMe Copy"); else if (err != 0) @@ -5171,7 +5186,8 @@ static int resv_acquire(int argc, char **argv, struct command *cmd, struct plugi } err = nvme_resv_acquire(fd, cfg.namespace_id, cfg.rtype, cfg.racqa, - !!cfg.iekey, cfg.crkey, cfg.prkey); + !!cfg.iekey, cfg.crkey, cfg.prkey, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (err < 0) perror("reservation acquire"); else if (err != 0) @@ -5249,7 +5265,8 @@ static int resv_register(int argc, char **argv, struct command *cmd, struct plug } err = nvme_resv_register(fd, cfg.namespace_id, cfg.rrega, cfg.cptpl, - !!cfg.iekey, cfg.crkey, cfg.nrkey); + !!cfg.iekey, cfg.crkey, cfg.nrkey, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (err < 0) perror("reservation register"); else if (err != 0) @@ -5323,7 +5340,8 @@ static int resv_release(int argc, char **argv, struct command *cmd, struct plugi } err = nvme_resv_release(fd, cfg.namespace_id, cfg.rtype, cfg.rrela, - !!cfg.iekey, cfg.crkey); + !!cfg.iekey, cfg.crkey, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (err < 0) perror("reservation release"); else if (err != 0) @@ -5409,7 +5427,8 @@ static int resv_report(int argc, char **argv, struct command *cmd, struct plugin } memset(status, 0, size); - err = nvme_resv_report(fd, cfg.namespace_id, cfg.eds, size, status); + err = nvme_resv_report(fd, cfg.namespace_id, cfg.eds, size, status, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (!err) nvme_show_resv_report(status, size, cfg.eds, flags); else if (err > 0) @@ -5693,12 +5712,14 @@ static int submit_io(int opcode, char *command, const char *desc, err = nvme_write(fd, cfg.namespace_id, cfg.start_block, cfg.block_count, control, dsmgmt, 0, cfg.ref_tag, cfg.app_tag, cfg.app_tag_mask, cfg.storage_tag, - buffer_size, buffer, cfg.metadata_size, mbuffer); + buffer_size, buffer, cfg.metadata_size, mbuffer, + NVME_DEFAULT_IOCTL_TIMEOUT); else err = nvme_read(fd, cfg.namespace_id, cfg.start_block, cfg.block_count, control, dsmgmt, cfg.ref_tag, cfg.app_tag, cfg.app_tag_mask, cfg.storage_tag, - buffer_size, buffer, cfg.metadata_size, mbuffer); + buffer_size, buffer, cfg.metadata_size, mbuffer, + NVME_DEFAULT_IOCTL_TIMEOUT); gettimeofday(&end_time, NULL); if (cfg.latency) printf(" latency: %s: %llu us\n", @@ -5846,8 +5867,10 @@ static int verify_cmd(int argc, char **argv, struct command *cmd, struct plugin } } - err = nvme_verify(fd, cfg.namespace_id, cfg.start_block, cfg.block_count, - control, cfg.ref_tag, cfg.app_tag, cfg.app_tag_mask, cfg.storage_tag); + err = nvme_verify(fd, cfg.namespace_id, cfg.start_block, + cfg.block_count, control, cfg.ref_tag, + cfg.app_tag, cfg.app_tag_mask, cfg.storage_tag, + NVME_DEFAULT_IOCTL_TIMEOUT); if (err < 0) perror("verify"); else if (err != 0) @@ -5920,8 +5943,10 @@ static int sec_recv(int argc, char **argv, struct command *cmd, struct plugin *p } } - err = nvme_security_receive(fd, cfg.namespace_id, cfg.nssf, cfg.spsp & 0xff, - cfg.spsp >> 8, cfg.secp, cfg.al, cfg.size, sec_buf, NULL); + err = nvme_security_receive(fd, cfg.namespace_id, cfg.nssf, + cfg.spsp & 0xff, cfg.spsp >> 8, + cfg.secp, cfg.al, cfg.size, sec_buf, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (err < 0) perror("security receive"); else if (err != 0) @@ -6017,7 +6042,8 @@ static int get_lba_status(int argc, char **argv, struct command *cmd, } err = nvme_get_lba_status(fd, cfg.namespace_id, cfg.slba, cfg.mndw, - cfg.atype, cfg.rl, buf); + cfg.atype, cfg.rl, NVME_DEFAULT_IOCTL_TIMEOUT, + buf, NULL); if (!err) nvme_show_lba_status(buf, buf_len, flags); else if (err > 0) @@ -6081,7 +6107,7 @@ static int capacity_mgmt(int argc, char **argv, struct command *cmd, struct plug } err = nvme_capacity_mgmt(fd, cfg.operation, cfg.element_id, cfg.dw11, - cfg.dw12, &result); + cfg.dw12, NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (!err) { printf("Capacity Management Command is Success\n"); if (cfg.operation == 1) { @@ -6207,7 +6233,8 @@ static int dir_receive(int argc, char **argv, struct command *cmd, struct plugin } err = nvme_directive_recv(fd, cfg.namespace_id, cfg.dspec, cfg.doper, - cfg.dtype, dw12, cfg.data_len, buf, &result); + cfg.dtype, dw12, cfg.data_len, buf, + NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (!err) nvme_directive_show(cfg.dtype, cfg.doper, cfg.dspec, cfg.namespace_id, result, buf, cfg.data_len, diff --git a/plugins/intel/intel-nvme.c b/plugins/intel/intel-nvme.c index 98c90c58..06f909ea 100644 --- a/plugins/intel/intel-nvme.c +++ b/plugins/intel/intel-nvme.c @@ -1066,7 +1066,8 @@ static int get_lat_stats_log(int argc, char **argv, struct command *cmd, struct __u32 result; err = nvme_get_features(fd, 0xf7, 0, 0, cfg.write ? 0x1 : 0x0, 0, - sizeof(thresholds), thresholds, &result); + sizeof(thresholds), thresholds, + NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (err) { fprintf(stderr, "Quering thresholds failed. "); nvme_show_status(err); @@ -1548,7 +1549,7 @@ static int enable_lat_stats_tracking(int argc, char **argv, switch (option) { case None: err = nvme_get_features(fd, fid, nsid, sel, cdw11, 0, data_len, buf, - &result); + NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (!err) { printf( "Latency Statistics Tracking (FID 0x%X) is currently (%i).\n", @@ -1561,7 +1562,8 @@ static int enable_lat_stats_tracking(int argc, char **argv, case True: case False: err = nvme_set_features(fd, fid, nsid, option, cdw12, save, 0, - 0, data_len, buf, &result); + 0, data_len, buf, + NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (err > 0) { nvme_show_status(err); } else if (err < 0) { @@ -1640,7 +1642,8 @@ static int set_lat_stats_thresholds(int argc, char **argv, err = nvme_set_features(fd, fid, nsid, cfg.write ? 0x1 : 0x0, cdw12, save, 0, 0, sizeof(thresholds), - thresholds, &result); + thresholds, NVME_DEFAULT_IOCTL_TIMEOUT, + &result); if (err > 0) { nvme_show_status(err); diff --git a/plugins/memblaze/memblaze-nvme.c b/plugins/memblaze/memblaze-nvme.c index 95ba281f..5c0b22bb 100644 --- a/plugins/memblaze/memblaze-nvme.c +++ b/plugins/memblaze/memblaze-nvme.c @@ -491,7 +491,8 @@ static int mb_get_powermanager_status(int argc, char **argv, struct command *cmd fd = parse_and_open(argc, argv, desc, opts); if (fd < 0) return fd; - err = nvme_get_features(fd, feature_id, 0, 0, 0, 0, 0, NULL, &result); + err = nvme_get_features(fd, feature_id, 0, 0, 0, 0, 0, NULL, + NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (err < 0) { perror("get-feature"); } @@ -534,7 +535,7 @@ static int mb_set_powermanager_status(int argc, char **argv, struct command *cmd if (fd < 0) return fd; err = nvme_set_features(fd, cfg.feature_id, 0, cfg.value, 0, cfg.save, - 0, 0, 0, NULL, &result); + 0, 0, 0, NULL, NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (err < 0) { perror("set-feature"); } @@ -592,7 +593,7 @@ static int mb_set_high_latency_log(int argc, char **argv, struct command *cmd, s cfg.value = (param1 << MB_FEAT_HIGH_LATENCY_VALUE_SHIFT) | param2; err = nvme_set_features(fd, cfg.feature_id, 0, cfg.value, 0, 0, 0, 0, 0, - NULL, &result); + NULL, NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (err < 0) { perror("set-feature"); } @@ -829,7 +830,8 @@ static int mb_selective_download(int argc, char **argv, struct command *cmd, str while (fw_size > 0) { xfer = min(xfer, fw_size); - err = nvme_fw_download(fd, offset, xfer, fw_buf); + err = nvme_fw_download(fd, offset, xfer, fw_buf, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (err < 0) { perror("fw-download"); goto out; @@ -1028,7 +1030,7 @@ static int memblaze_clear_error_log(int argc, char **argv, struct command *cmd, err = nvme_set_features(fd, cfg.feature_id, 0, cfg.value, 0, cfg.save, - 0, 0, 0, NULL, &result); + 0, 0, 0, NULL, NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (err < 0) { perror("set-feature"); } @@ -1107,7 +1109,8 @@ static int mb_set_lat_stats(int argc, char **argv, switch (option) { case None: err = nvme_get_features(fd, nsid, fid, sel, cdw11, 0, - data_len, buf, &result); + data_len, buf, + NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (!err) { printf( "Latency Statistics Tracking (FID 0x%X) is currently (%i).\n", @@ -1120,7 +1123,8 @@ static int mb_set_lat_stats(int argc, char **argv, case True: case False: err = nvme_set_features(fd, fid, nsid, option, cdw12, save, - 0, 0, data_len, buf, &result); + 0, 0, data_len, buf, + NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (err > 0) { nvme_show_status(err); } else if (err < 0) { diff --git a/plugins/micron/micron-nvme.c b/plugins/micron/micron-nvme.c index dbf1d30d..9eef88e6 100644 --- a/plugins/micron/micron-nvme.c +++ b/plugins/micron/micron-nvme.c @@ -555,7 +555,8 @@ static int micron_selective_download(int argc, char **argv, while (fw_size > 0) { xfer = min(xfer, fw_size); - err = nvme_fw_download(fd, offset, xfer, fw_buf); + err = nvme_fw_download(fd, offset, xfer, fw_buf, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (err < 0) { perror("fw-download"); goto out; @@ -636,7 +637,8 @@ static int micron_smbus_option(int argc, char **argv, } else if (!strcmp(opt.option, "status")) { cdw10 = opt.value; - err = nvme_get_features(fd, fid, 1, 0, cdw10, 0, 0, NULL, &result); + err = nvme_get_features(fd, fid, 1, 0, cdw10, 0, 0, NULL, + NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (err == 0) { printf("SMBus status on the drive: %s (returns %s temperature) \n", (result & 1) ? "enabled" : "disabled", @@ -1843,7 +1845,8 @@ static int GetFeatureSettings(int fd, const char *dir) bufp = NULL; } - err = nvme_get_features(fd, fmap[i].id, 1, 0, 0x0, 0, len, bufp, &attrVal); + err = nvme_get_features(fd, fmap[i].id, 1, 0, 0x0, 0, len, bufp, + NVME_DEFAULT_IOCTL_TIMEOUT, &attrVal); if (err == 0) { sprintf(msg, "feature: 0x%X", fmap[i].id); WriteData((__u8*)&attrVal, sizeof(attrVal), dir, fmap[i].file, msg); @@ -2317,14 +2320,16 @@ static int micron_telemetry_cntrl_option(int argc, char **argv, } if (!strcmp(opt.option, "enable")) { - err = nvme_set_features(fd, fid, 1, 1, 0, (opt.select & 0x1), 0, 0, 0, 0, &result); + err = nvme_set_features(fd, fid, 1, 1, 0, (opt.select & 0x1), + 0, 0, 0, 0, NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (err == 0) { printf("successfully set controller telemetry option\n"); } else { printf("Failed to set controller telemetry option\n"); } } else if (!strcmp(opt.option, "disable")) { - err = nvme_set_features(fd, fid, 1, 0, 0, (opt.select & 0x1), 0, 0, 0, 0, &result); + err = nvme_set_features(fd, fid, 1, 0, 0, (opt.select & 0x1), + 0, 0, 0, 0, NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (err == 0) { printf("successfully disabled controller telemetry option\n"); } else { @@ -2332,7 +2337,8 @@ static int micron_telemetry_cntrl_option(int argc, char **argv, } } else if (!strcmp(opt.option, "status")) { opt.select &= 0x3; - err = nvme_get_features(fd, fid, 1, opt.select, 0, 0, 0, 0, &result); + err = nvme_get_features(fd, fid, 1, opt.select, 0, 0, 0, 0, + NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (err == 0) { printf("Controller telemetry option : %s\n", (result) ? "enabled" : "disabled"); diff --git a/plugins/seagate/seagate-nvme.c b/plugins/seagate/seagate-nvme.c index 57205855..af8edc69 100644 --- a/plugins/seagate/seagate-nvme.c +++ b/plugins/seagate/seagate-nvme.c @@ -1127,8 +1127,10 @@ static int get_host_tele(int argc, char **argv, struct command *cmd, struct plug memset(log, 0, blksToGet * 512); - err = nvme_get_log(fd, cfg.log_id, cfg.namespace_id, offset, 0, 0, true, - 0, 0, blksToGet * 512, (void *)log); + err = nvme_get_log(fd, cfg.log_id, cfg.namespace_id, offset, + 0, 0, true, 0, 0, blksToGet * 512, + (void *)log, NVME_DEFAULT_IOCTL_TIMEOUT, + NULL); if (!err) { offset += blksToGet * 512; @@ -1223,8 +1225,9 @@ static int get_ctrl_tele(int argc, char **argv, struct command *cmd, struct plug memset(log, 0, blksToGet * 512); - err = nvme_get_log(fd, log_id, cfg.namespace_id, offset, 0, 0, true, - 0, 0, blksToGet * 512, (void *)log); + err = nvme_get_log(fd, log_id, cfg.namespace_id, offset, 0, 0, + true, 0, 0, blksToGet * 512, (void *)log, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (!err) { offset += blksToGet * 512; @@ -1341,8 +1344,9 @@ static int vs_internal_log(int argc, char **argv, struct command *cmd, struct pl memset(log, 0, blksToGet * 512); - err = nvme_get_log(fd, log_id, cfg.namespace_id, offset, 0, 0, true, - 0, 0, blksToGet * 512, (void *)log); + err = nvme_get_log(fd, log_id, cfg.namespace_id, offset, 0, 0, + true, 0, 0, blksToGet * 512, (void *)log, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (!err) { offset += blksToGet * 512; diff --git a/plugins/shannon/shannon-nvme.c b/plugins/shannon/shannon-nvme.c index e7659c1f..46373ba8 100644 --- a/plugins/shannon/shannon-nvme.c +++ b/plugins/shannon/shannon-nvme.c @@ -227,7 +227,8 @@ static int get_additional_feature(int argc, char **argv, struct command *cmd, st } err = nvme_get_features(fd, cfg.feature_id, cfg.namespace_id, cfg.sel, - cfg.cdw11, 0, cfg.data_len, buf, &result); + cfg.cdw11, 0, cfg.data_len, buf, + NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (!err) { #if 0 printf("get-feature:0x%02x (%s), %s value: %#08x\n", cfg.feature_id, @@ -340,7 +341,8 @@ static int set_additional_feature(int argc, char **argv, struct command *cmd, st } err = nvme_set_features(fd, cfg.feature_id, cfg.namespace_id, cfg.value, - 0, cfg.save, 0, 0, cfg.data_len, buf, &result); + 0, cfg.save, 0, 0, cfg.data_len, buf, + NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (err < 0) { perror("set-feature"); goto free; diff --git a/plugins/toshiba/toshiba-nvme.c b/plugins/toshiba/toshiba-nvme.c index 8b8b2168..77da83d5 100644 --- a/plugins/toshiba/toshiba-nvme.c +++ b/plugins/toshiba/toshiba-nvme.c @@ -547,8 +547,9 @@ static int clear_correctable_errors(int argc, char **argv, struct command *cmd, if (err) goto end; - err = nvme_set_features(fd, feature_id, namespace_id, value, cdw12, save, - 0, 0, 0, NULL, &result); + err = nvme_set_features(fd, feature_id, namespace_id, value, cdw12, + save, 0, 0, 0, NULL, + NVME_DEFAULT_IOCTL_TIMEOUT, &result); if (err) fprintf(stderr, "%s: couldn't clear PCIe correctable errors \n", __func__); diff --git a/plugins/wdc/wdc-nvme.c b/plugins/wdc/wdc-nvme.c index 5193469a..52ef8225 100644 --- a/plugins/wdc/wdc-nvme.c +++ b/plugins/wdc/wdc-nvme.c @@ -1682,7 +1682,9 @@ static bool get_dev_mgment_cbs_data(nvme_root_t r, int fd, __u8 log_id, void **c memset(data, 0, sizeof (__u8) * WDC_C2_LOG_BUF_LEN); /* get the log page length */ - ret = nvme_get_log(fd, lid, 0xFFFFFFFF, NVME_LOG_LSP_NONE, 0, 0, false, uuid_ix, 0, WDC_C2_LOG_BUF_LEN, data); + ret = nvme_get_log(fd, lid, 0xFFFFFFFF, NVME_LOG_LSP_NONE, 0, 0, + false, uuid_ix, 0, WDC_C2_LOG_BUF_LEN, data, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (ret) { fprintf(stderr, "ERROR : WDC : Unable to get 0x%x Log Page length, ret = 0x%x\n", lid, ret); goto end; @@ -1701,8 +1703,10 @@ static bool get_dev_mgment_cbs_data(nvme_root_t r, int fd, __u8 log_id, void **c } /* get the log page data */ - ret = nvme_get_log(fd, WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_OPCODE, 0xFFFFFFFF, 0, - NVME_LOG_LSP_NONE, 0, false, uuid_ix, 0, le32_to_cpu(hdr_ptr->length), data); + ret = nvme_get_log(fd, WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_OPCODE, + 0xFFFFFFFF, 0, NVME_LOG_LSP_NONE, 0, false, + uuid_ix, 0, le32_to_cpu(hdr_ptr->length), data, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (ret) { fprintf(stderr, "ERROR : WDC : Unable to read C2 Log Page data, ret = 0x%x\n", ret); @@ -1722,8 +1726,10 @@ static bool get_dev_mgment_cbs_data(nvme_root_t r, int fd, __u8 log_id, void **c /* not found with uuid = 1 try with uuid = 0 */ uuid_ix = 0; /* get the log page data */ - ret = nvme_get_log(fd, WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_OPCODE, 0xFFFFFFFF, 0, - NVME_LOG_LSP_NONE, 0, false, uuid_ix, 0, le32_to_cpu(hdr_ptr->length), data); + ret = nvme_get_log(fd, WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_OPCODE, + 0xFFFFFFFF, 0, NVME_LOG_LSP_NONE, 0, false, + uuid_ix, 0, le32_to_cpu(hdr_ptr->length), + data, NVME_DEFAULT_IOCTL_TIMEOUT, NULL); hdr_ptr = (struct wdc_c2_log_page_header *)data; sph = (struct wdc_c2_log_subpage_header *)(data + length); @@ -2149,8 +2155,10 @@ static int wdc_do_cap_telemetry_log(int fd, char *file, __u32 bs, int type, int } memset(buf, 0, len); - err = nvme_get_features(fd, NVME_NSID_ALL, NVME_FEAT_FID_HOST_BEHAVIOR, 0, 0, - 0, len, buf, &result); + err = nvme_get_features(fd, NVME_NSID_ALL, + NVME_FEAT_FID_HOST_BEHAVIOR, 0, 0, 0, + len, buf, NVME_DEFAULT_IOCTL_TIMEOUT, + &result); if (err > 0) { nvme_show_status(err); } else if (err < 0) { @@ -4979,7 +4987,8 @@ static int wdc_get_c0_log_page(nvme_root_t r, int fd, char *format, /* Get the 0xC0 log data */ ret = nvme_get_log(fd, WDC_NVME_GET_EOL_STATUS_LOG_OPCODE, namespace_id, 0, - NVME_LOG_LSP_NONE, 0, false, uuid_index, 0, WDC_NVME_SMART_CLOUD_ATTR_LEN, data); + NVME_LOG_LSP_NONE, 0, false, uuid_index, 0, WDC_NVME_SMART_CLOUD_ATTR_LEN, data, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (strcmp(format, "json")) nvme_show_status(ret); @@ -5026,7 +5035,8 @@ static int wdc_get_c0_log_page(nvme_root_t r, int fd, char *format, /* Get the 0xC0 log data */ ret = nvme_get_log(fd, WDC_NVME_GET_EOL_STATUS_LOG_OPCODE, NVME_NSID_ALL, 0, - NVME_LOG_LSP_NONE, 0, false, uuid_index, 0, WDC_NVME_EOL_STATUS_LOG_LEN, data); + NVME_LOG_LSP_NONE, 0, false, uuid_index, 0, WDC_NVME_EOL_STATUS_LOG_LEN, data, + NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (strcmp(format, "json")) nvme_show_status(ret); @@ -6101,8 +6111,10 @@ static int wdc_vs_fw_activate_history(int argc, char **argv, struct command *com } /* Get the 0xC0 log data */ - ret = nvme_get_log(fd, WDC_NVME_GET_SMART_CLOUD_ATTR_LOG_OPCODE, 0xFFFFFFFF, 0, - NVME_LOG_LSP_NONE, 0, false, uuid_index, 0, WDC_NVME_SMART_CLOUD_ATTR_LEN, data); + ret = nvme_get_log(fd, WDC_NVME_GET_SMART_CLOUD_ATTR_LOG_OPCODE, + 0xFFFFFFFF, 0, NVME_LOG_LSP_NONE, 0, false, + uuid_index, 0, WDC_NVME_SMART_CLOUD_ATTR_LEN, + data, NVME_DEFAULT_IOCTL_TIMEOUT, NULL); if (ret == 0) { /* Verify GUID matches */ diff --git a/plugins/zns/zns.c b/plugins/zns/zns.c index dc5f319c..801124f2 100644 --- a/plugins/zns/zns.c +++ b/plugins/zns/zns.c @@ -231,8 +231,8 @@ static int __zns_mgmt_send(int fd, __u32 namespace_id, __u64 zslba, { int err; - err = nvme_zns_mgmt_send(fd, namespace_id, zslba, select_all, timeout, zsa, - data_len, buf); + err = nvme_zns_mgmt_send(fd, namespace_id, zslba, select_all, timeout, + zsa, data_len, buf, NULL); close(fd); return err; } @@ -639,8 +639,10 @@ static int zone_mgmt_recv(int argc, char **argv, struct command *cmd, struct plu } } - err = nvme_zns_mgmt_recv(fd, cfg.namespace_id, cfg.zslba, cfg.zra, - cfg.zrasf, cfg.partial, cfg.data_len, data); + err = nvme_zns_mgmt_recv(fd, cfg.namespace_id, + NVME_DEFAULT_IOCTL_TIMEOUT, cfg.zslba, cfg.zra, + cfg.zrasf, cfg.partial, cfg.data_len, data, + NULL); if (!err) printf("zone-mgmt-recv: Success, action:%d zone:%"PRIx64" nsid:%d\n", cfg.zra, (uint64_t)cfg.zslba, cfg.namespace_id); @@ -761,8 +763,9 @@ static int report_zones(int argc, char **argv, struct command *cmd, struct plugi goto close_fd; } - err = nvme_zns_report_zones(fd, cfg.namespace_id, 0, - 0, cfg.state, 0, log_len, buff); + err = nvme_zns_report_zones(fd, cfg.namespace_id, + NVME_DEFAULT_IOCTL_TIMEOUT, 0, 0, + cfg.state, 0, log_len, buff, NULL); if (err > 0) { nvme_show_status(err); goto free_buff; @@ -804,8 +807,10 @@ static int report_zones(int argc, char **argv, struct command *cmd, struct plugi log_len = sizeof(struct nvme_zone_report) + ((sizeof(struct nvme_zns_desc) * nr_zones_chunks) + (nr_zones_chunks * zdes)); } - err = nvme_zns_report_zones(fd, cfg.namespace_id, offset, - cfg.extended, cfg.state, cfg.partial, log_len, report); + err = nvme_zns_report_zones(fd, cfg.namespace_id, + NVME_DEFAULT_IOCTL_TIMEOUT, offset, + cfg.extended, cfg.state, + cfg.partial, log_len, report, NULL); if (err > 0) { nvme_show_status(err); break; @@ -1001,7 +1006,7 @@ static int zone_append(int argc, char **argv, struct command *cmd, struct plugin err = nvme_zns_append(fd, cfg.namespace_id, cfg.zslba, nblocks, control, cfg.ref_tag, cfg.lbat, cfg.lbatm, cfg.data_size, buf, cfg.metadata_size, mbuf, - &result); + NVME_DEFAULT_IOCTL_TIMEOUT, &result); gettimeofday(&end_time, NULL); if (cfg.latency) printf(" latency: zone append: %llu us\n",