aboutsummaryrefslogtreecommitdiff
path: root/lib/sg_pt_win32.c
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2018-02-05 23:31:17 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2018-02-05 23:31:17 +0000
commit792b75e01390e59708874f41cb189ecb590ebbdb (patch)
treec4dd80978af62f7b56b21548eeba1cafee2185a4 /lib/sg_pt_win32.c
parent9fe92189ee2e0769daaefccf68d3fabff62b4f6b (diff)
downloadsg3_utils-792b75e01390e59708874f41cb189ecb590ebbdb.tar.gz
Info section added to end of ./configure; sg_persist: add --maxlen=LEN option; sg_opcodes: report when --no-inquiry ignored
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@750 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'lib/sg_pt_win32.c')
-rw-r--r--lib/sg_pt_win32.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/sg_pt_win32.c b/lib/sg_pt_win32.c
index 9b9adb10..1692d9d2 100644
--- a/lib/sg_pt_win32.c
+++ b/lib/sg_pt_win32.c
@@ -630,7 +630,8 @@ construct_scsi_pt_obj_with_fd(int dev_fd, int vb)
psp->swb_i.spt.TimeOutValue = DEF_TIMEOUT;
}
psp->dev_fd = (dev_fd < 0) ? -1 : dev_fd;
- vp = malloc(sizeof(struct sg_pt_win32_scsi *)); // yes a pointer
+ vp = (struct sg_pt_base *)malloc(sizeof(struct sg_pt_win32_scsi *));
+ /* yes, allocating the size of a pointer (8 bytes) */
if (vp)
vp->implp = psp;
else
@@ -1371,7 +1372,8 @@ do_nvme_admin_cmd(struct sg_pt_win32_scsi * psp, struct sg_pt_handle * shp,
dp = psp->dxferp;
}
if (vb > 2) {
- pr2ws("NVMe command:\n");
+ pr2ws("NVMe is_read=%s, dlen=%u, command:\n",
+ (is_read ? "true" : "false"), dlen);
hex2stderr((const uint8_t *)cmdp, cmd_len, 1);
if ((vb > 3) && (! is_read) && dp) {
if (dlen > 0) {
@@ -1429,7 +1431,6 @@ do_nvme_admin_cmd(struct sg_pt_win32_scsi * psp, struct sg_pt_handle * shp,
pr2ws("%s: IOCTL_SCSI_MINIPORT failed: %s [%u]\n", __func__,
get_err_str(n, sizeof(b), b), n);
-pr2ws("handle=%u, alloc_len=%u, num_out=%u\n", shp->fh, alloc_len, (uint32_t)num_out);
}
}
/* nvme_status is SCT|SC, therefor it excludes DNR+More */
@@ -2241,8 +2242,8 @@ do_nvme_pt(struct sg_pt_win32_scsi * psp, struct sg_pt_handle * shp,
return SCSI_PT_DO_BAD_PARAMS;
}
if (vb > 3)
- pr2ws("%s: opcode=0x%x, cmd_len=%u, fdev_name: %s\n", __func__,
- cdbp[0], cmd_len, shp->dname);
+ pr2ws("%s: opcode=0x%x, cmd_len=%u, fdev_name: %s, dlen=%u\n",
+ __func__, cdbp[0], cmd_len, shp->dname, psp->dxfer_len);
/* direct NVMe command (i.e. 64 bytes long) or SNTL */
if (scsi_cdb) {
switch (cdbp[0]) {
@@ -2279,7 +2280,17 @@ do_nvme_pt(struct sg_pt_win32_scsi * psp, struct sg_pt_handle * shp,
return 0;
}
}
- return do_nvme_admin_cmd(psp, shp, NULL, NULL, 0, false, time_secs, vb);
+ if(psp->dxfer_len > 0) {
+ uint8_t * cmdp = psp->nvme_cmd;
+
+ sg_put_unaligned_le32(psp->dxfer_len, cmdp + SG_NVME_PT_DATA_LEN);
+ sg_put_unaligned_le64((uint64_t)(sg_uintptr_t)psp->dxferp,
+ cmdp + SG_NVME_PT_ADDR);
+ if (vb > 2)
+ pr2ws("%s: NVMe command, dlen=%u, dxferp=0x%p\n", __func__,
+ psp->dxfer_len, psp->dxferp);
+ }
+ return do_nvme_admin_cmd(psp, shp, NULL, NULL, 0, true, time_secs, vb);
}
#else /* (HAVE_NVME && (! IGNORE_NVME)) */