summaryrefslogtreecommitdiff
path: root/sysutils/smartmontools/patches
diff options
context:
space:
mode:
authortnn <tnn@pkgsrc.org>2019-01-18 02:04:43 +0000
committertnn <tnn@pkgsrc.org>2019-01-18 02:04:43 +0000
commit1cf6082bf1819671f1c240abe503e06476687965 (patch)
treec477abba3227e5f3a3e332b3d2bb1b489c4c3d59 /sysutils/smartmontools/patches
parentcf24227e05478aab99f66987ecaf460721d1cccd (diff)
downloadpkgsrc-1cf6082bf1819671f1c240abe503e06476687965.tar.gz
smartmontools: fix 6.6 -> 7.0 NVMe SMART data readout regression. Bump.
Diffstat (limited to 'sysutils/smartmontools/patches')
-rw-r--r--sysutils/smartmontools/patches/patch-nvmecmds.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/sysutils/smartmontools/patches/patch-nvmecmds.cpp b/sysutils/smartmontools/patches/patch-nvmecmds.cpp
new file mode 100644
index 00000000000..77d5f1cd226
--- /dev/null
+++ b/sysutils/smartmontools/patches/patch-nvmecmds.cpp
@@ -0,0 +1,34 @@
+$NetBSD: patch-nvmecmds.cpp,v 1.1 2019/01/18 02:04:43 tnn Exp $
+
+It looks from the code like it is supposed to work to read the SMART data
+by calling the nvme passthrough ioctl with broadcast nsid.
+But it doesn't seem to work on NetBSD? So use the explicit nsid instead.
+
+--- nvmecmds.cpp.orig 2018-08-19 18:45:53.000000000 +0000
++++ nvmecmds.cpp
+@@ -207,7 +207,11 @@ bool nvme_read_log_page(nvme_device * de
+ // Read NVMe Error Information Log.
+ bool nvme_read_error_log(nvme_device * device, nvme_error_log_page * error_log, unsigned num_entries)
+ {
+- if (!nvme_read_log_page(device, 0x01, error_log, num_entries * sizeof(*error_log), true))
++ bool use_broadcast_nsid = true;
++#if defined(__NetBSD__)
++ use_broadcast_nsid = false;
++#endif
++ if (!nvme_read_log_page(device, 0x01, error_log, num_entries * sizeof(*error_log), use_broadcast_nsid))
+ return false;
+
+ if (isbigendian()) {
+@@ -228,7 +232,11 @@ bool nvme_read_error_log(nvme_device * d
+ // Read NVMe SMART/Health Information log.
+ bool nvme_read_smart_log(nvme_device * device, nvme_smart_log & smart_log)
+ {
+- if (!nvme_read_log_page(device, 0x02, &smart_log, sizeof(smart_log), true))
++ bool use_broadcast_nsid = true;
++#if defined(__NetBSD__)
++ use_broadcast_nsid = false;
++#endif
++ if (!nvme_read_log_page(device, 0x02, &smart_log, sizeof(smart_log), use_broadcast_nsid))
+ return false;
+
+ if (isbigendian()) {