summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbsiegert <bsiegert@pkgsrc.org>2018-08-18 10:34:16 +0000
committerbsiegert <bsiegert@pkgsrc.org>2018-08-18 10:34:16 +0000
commit417714c691fdefa5b58abdaffb86684ce125532b (patch)
tree0dcd40bf4782aa2d363cfd15f14f33ef4e61a2fa
parent810579963d1137f17727c1983d6e0c2c179af20e (diff)
downloadpkgsrc-417714c691fdefa5b58abdaffb86684ce125532b.tar.gz
Pullup ticket #5808 - requested by sevan
sysutils/smartmontools: NetBSD build fix Revisions pulled up: - sysutils/smartmontools/Makefile 1.32 - sysutils/smartmontools/distinfo 1.31 - sysutils/smartmontools/patches/patch-os_netbsd.cpp 1.2 --- Module Name: pkgsrc Committed By: sevan Date: Sat Aug 4 19:05:13 UTC 2018 Modified Files: pkgsrc/sysutils/smartmontools: Makefile distinfo pkgsrc/sysutils/smartmontools/patches: patch-os_netbsd.cpp Log Message: Backport fix for NetBSD on bigendian systems https://www.smartmontools.org/ticket/943 https://www.smartmontools.org/changeset/4628
-rw-r--r--sysutils/smartmontools/Makefile3
-rw-r--r--sysutils/smartmontools/distinfo4
-rw-r--r--sysutils/smartmontools/patches/patch-os_netbsd.cpp101
3 files changed, 104 insertions, 4 deletions
diff --git a/sysutils/smartmontools/Makefile b/sysutils/smartmontools/Makefile
index 648ea0d1a0e..e7ddfa30fc7 100644
--- a/sysutils/smartmontools/Makefile
+++ b/sysutils/smartmontools/Makefile
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.30 2017/12/15 03:02:10 nonaka Exp $
+# $NetBSD: Makefile,v 1.30.6.1 2018/08/18 10:34:16 bsiegert Exp $
DISTNAME= smartmontools-6.6
+PKGREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=smartmontools/}
diff --git a/sysutils/smartmontools/distinfo b/sysutils/smartmontools/distinfo
index 926d1c522e2..ffea16cbd25 100644
--- a/sysutils/smartmontools/distinfo
+++ b/sysutils/smartmontools/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.30 2017/12/15 11:38:26 hauke Exp $
+$NetBSD: distinfo,v 1.30.6.1 2018/08/18 10:34:16 bsiegert Exp $
SHA1 (smartmontools-6.6.tar.gz) = 8946f6350d6df9341d571381d66ffbb7d83b8af2
RMD160 (smartmontools-6.6.tar.gz) = 8504a7a04e99d26acb3662ae5e0e8e6d38a52b5d
@@ -6,4 +6,4 @@ SHA512 (smartmontools-6.6.tar.gz) = 64bb533dac29f62ddd662a16a12c97df1af9cbac9ac5
Size (smartmontools-6.6.tar.gz) = 903847 bytes
SHA1 (patch-aa) = bd08aff267f0e9e9307ebc57858e61e35144bf16
SHA1 (patch-ag) = 01b0b35d89d6d6a11b13b3c05a141c46a0c1590b
-SHA1 (patch-os_netbsd.cpp) = 8402fe8bf5e5af2c262e4b159ff3799814d6963a
+SHA1 (patch-os_netbsd.cpp) = 70a5fcfbdced36203b2b07b3496cddf915ef8938
diff --git a/sysutils/smartmontools/patches/patch-os_netbsd.cpp b/sysutils/smartmontools/patches/patch-os_netbsd.cpp
index e470ee94ba4..4902574f2e8 100644
--- a/sysutils/smartmontools/patches/patch-os_netbsd.cpp
+++ b/sysutils/smartmontools/patches/patch-os_netbsd.cpp
@@ -1,6 +1,9 @@
-$NetBSD: patch-os_netbsd.cpp,v 1.1 2017/12/15 11:38:26 hauke Exp $
+$NetBSD: patch-os_netbsd.cpp,v 1.1.6.1 2018/08/18 10:34:16 bsiegert Exp $
Missing #include
+Backport fix for NetBSD on bigendian systems
+https://www.smartmontools.org/ticket/943
+https://www.smartmontools.org/changeset/4628
--- os_netbsd.cpp.orig 2017-08-08 19:38:15.000000000 +0000
+++ os_netbsd.cpp
@@ -12,3 +15,99 @@ Missing #include
#include <errno.h>
#include <unistd.h>
+@@ -206,7 +207,7 @@ bool netbsd_ata_device::ata_pass_through
+ req.sec_count = in.in_regs.sector_count;
+ req.sec_num = in.in_regs.lba_low;
+ req.head = in.in_regs.device;
+- req.cylinder = le16toh(in.in_regs.lba_mid | (in.in_regs.lba_high << 8));
++ req.cylinder = in.in_regs.lba_mid | (in.in_regs.lba_high << 8);
+
+ switch (in.direction) {
+ case ata_cmd_in::no_data:
+@@ -237,41 +238,10 @@ bool netbsd_ata_device::ata_pass_through
+ out.out_regs.sector_count = req.sec_count;
+ out.out_regs.lba_low = req.sec_num;
+ out.out_regs.device = req.head;
+- out.out_regs.lba_mid = le16toh(req.cylinder);
+- out.out_regs.lba_high = le16toh(req.cylinder) >> 8;
++ out.out_regs.lba_mid = req.cylinder;
++ out.out_regs.lba_high = req.cylinder >> 8;
+ out.out_regs.status = req.command;
+
+- // Command specific processing
+- if (in.in_regs.command == ATA_SMART_CMD
+- && in.in_regs.features == ATA_SMART_STATUS
+- && in.out_needed.lba_high)
+- {
+- unsigned const char normal_lo=0x4f, normal_hi=0xc2;
+- unsigned const char failed_lo=0xf4, failed_hi=0x2c;
+-
+- // Cyl low and Cyl high unchanged means "Good SMART status"
+- if (!(out.out_regs.lba_mid==normal_lo && out.out_regs.lba_high==normal_hi)
+- // These values mean "Bad SMART status"
+- && !(out.out_regs.lba_mid==failed_lo && out.out_regs.lba_high==failed_hi))
+-
+- {
+- // We haven't gotten output that makes sense; print out some debugging info
+- char buf[512];
+- snprintf(buf, sizeof(buf),
+- "CMD=0x%02x\nFR =0x%02x\nNS =0x%02x\nSC =0x%02x\nCL =0x%02x\nCH =0x%02x\nRETURN =0x%04x\n",
+- (int)req.command,
+- (int)req.features,
+- (int)req.sec_count,
+- (int)req.sec_num,
+- (int)(le16toh(req.cylinder) & 0xff),
+- (int)((le16toh(req.cylinder) >> 8) & 0xff),
+- (int)req.error);
+- printwarning(BAD_SMART,buf);
+- out.out_regs.lba_high = failed_hi;
+- out.out_regs.lba_mid = failed_lo;
+- }
+- }
+-
+ return true;
+ }
+
+@@ -834,24 +804,29 @@ smart_device * netbsd_smart_interface::a
+ }
+ }
+
+- if (str_starts_with(test_name, net_dev_raw_prefix)) {
++ if (str_starts_with(test_name, net_dev_raw_prefix))
+ test_name += strlen(net_dev_raw_prefix);
+- if (!strncmp(net_dev_ata_disk, test_name, strlen(net_dev_ata_disk)))
+- return get_ata_device(test_name, "ata");
+- if (!strncmp(net_dev_scsi_disk, test_name, strlen(net_dev_scsi_disk))) {
++ else if (str_starts_with(test_name, net_dev_prefix))
++ test_name += strlen(net_dev_prefix);
++ else
++ return 0; // device is not starting with /dev/ or /dev/r*
++
++ if (!strncmp(net_dev_ata_disk, test_name, strlen(net_dev_ata_disk)))
++ return get_ata_device(name, "ata");
++
++ if (!strncmp(net_dev_scsi_disk, test_name, strlen(net_dev_scsi_disk))) {
+ // XXX Try to detect possible USB->(S)ATA bridge
+ // XXX get USB vendor ID, product ID and version from sd(4)/umass(4).
+ // XXX check sat device via get_usb_dev_type_by_id().
+-
+ // No USB bridge found, assume regular SCSI device
+- return get_scsi_device(test_name, "scsi");
+- }
+- if (!strncmp(net_dev_scsi_tape, test_name, strlen(net_dev_scsi_tape)))
+- return get_scsi_device(test_name, "scsi");
+- } else if (str_starts_with(test_name, net_dev_prefix)) {
+- if (!strncmp(NVME_PREFIX, test_name, strlen(NVME_PREFIX)))
+- return get_nvme_device(test_name, "nvme", 0 /* use default nsid */);
+- }
++ return get_scsi_device(name, "scsi");
++ }
++
++ if (!strncmp(net_dev_scsi_tape, test_name, strlen(net_dev_scsi_tape)))
++ return get_scsi_device(name, "scsi");
++
++ if (!strncmp(net_dev_nvme_ctrl, test_name, strlen(net_dev_nvme_ctrl)))
++ return get_nvme_device(name, "nvme", 0 /* use default nsid */);
+
+ // device type unknown
+ return 0;