Package init

This commit is contained in:
overweight 2019-09-30 11:17:14 -04:00
commit fd5adad55e
18 changed files with 5961 additions and 0 deletions

View File

@ -0,0 +1,12 @@
diff -up a/smartmontools-5.38/smartd.conf.defaultconf b/smartmontools-5.38/smartd.conf
--- a/smartmontools-5.38/smartd.conf.defaultconf 2008-08-07 12:21:53.000000000 +0200
+++ b/smartmontools-5.38/smartd.conf 2008-08-07 12:24:26.000000000 +0200
@@ -20,7 +20,7 @@
# Directives listed below, which will be applied to all devices that
# are found. Most users should comment out DEVICESCAN and explicitly
# list the devices that they wish to monitor.
-DEVICESCAN
+DEVICESCAN -H -m root -M exec /usr/libexec/smartmontools/smartdnotify -n standby,10,q
# Alternative setting to ignore temperature and power-on hours reports
# in syslog.

View File

@ -0,0 +1,42 @@
From d936fd78afb9d1fa68237367f33ebaa4f0ac1de4 Mon Sep 17 00:00:00 2001
From: samm-git <samm@os2.kiev.ua>
Date: Mon, 6 Nov 2017 22:06:52 +0000
Subject: [PATCH 004/291] os_linux.cpp/os_netbsd.cpp: fix crash on --scan if
WITH_NVME_DEVICESCAN is not set and '-d <type>' is not specified
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4599 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
smartmontools/ChangeLog | 5 +++++
smartmontools/os_linux.cpp | 2 +-
smartmontools/os_netbsd.cpp | 2 +-
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/smartmontools/os_linux.cpp b/smartmontools/os_linux.cpp
index 407f3cd2..46958ae0 100644
--- a/smartmontools/os_linux.cpp
+++ b/smartmontools/os_linux.cpp
@@ -3010,7 +3010,7 @@ bool linux_smart_interface::scan_smart_devices(smart_device_list & devlist,
#ifdef WITH_NVME_DEVICESCAN // TODO: Remove when NVMe support is no longer EXPERIMENTAL
bool scan_nvme = (!*type || !strcmp(type, "nvme"));
#else
- bool scan_nvme = ( !strcmp(type, "nvme"));
+ bool scan_nvme = (type && !strcmp(type, "nvme"));
#endif
if (!(scan_ata || scan_scsi || scan_nvme)) {
diff --git a/smartmontools/os_netbsd.cpp b/smartmontools/os_netbsd.cpp
index 4320cc47..4f8b2cbf 100644
--- a/smartmontools/os_netbsd.cpp
+++ b/smartmontools/os_netbsd.cpp
@@ -754,7 +754,7 @@ bool netbsd_smart_interface::scan_smart_devices(smart_device_list & devlist,
#ifdef WITH_NVME_DEVICESCAN // TODO: Remove when NVMe support is no longer EXPERIMENTAL
bool scan_nvme = !*type || !strcmp(type, "nvme");
#else
- bool scan_nvme = !strcmp(type, "nvme");
+ bool scan_nvme = type && !strcmp(type, "nvme");
#endif
// Make namelists
--
2.19.1

View File

@ -0,0 +1,28 @@
From a53a5e1ca98472c32b8f7b91cd69bdd5dfc6c309 Mon Sep 17 00:00:00 2001
From: chrfranke <authors@smartmontools.org>
Date: Wed, 8 Nov 2017 06:30:44 +0000
Subject: [PATCH 009/291] ataprint.cpp: Fix detection of Device Statistics log
with 256 sectors (#922).
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4604 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
smartmontools/ChangeLog | 3 +++
smartmontools/ataprint.cpp | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/smartmontools/ataprint.cpp b/smartmontools/ataprint.cpp
index df42351d..b2f22681 100644
--- a/smartmontools/ataprint.cpp
+++ b/smartmontools/ataprint.cpp
@@ -3687,7 +3687,7 @@ int ataPrintMain (ata_device * device, const ata_print_options & options)
bool use_gplog = true;
unsigned nsectors = 0;
if (gplogdir)
- nsectors = GetNumLogSectors(gplogdir, 0x04, false);
+ nsectors = GetNumLogSectors(gplogdir, 0x04, true);
else if (smartlogdir){ // for systems without ATA_READ_LOG_EXT
nsectors = GetNumLogSectors(smartlogdir, 0x04, false);
use_gplog = false;
--
2.19.1

42
6002-drivedb.h.patch Normal file
View File

@ -0,0 +1,42 @@
From 60bb2ca697b89285fcba4f011039808eb475f622 Mon Sep 17 00:00:00 2001
From: chrfranke <authors@smartmontools.org>
Date: Mon, 13 Nov 2017 20:47:34 +0000
Subject: [PATCH 017/291] drivedb.h: - Western Digital Red: WD80EZZX - USB: WD
My Book (0x1058:0x25ee) (Redhat Bugzilla 1446533)
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4612 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
smartmontools/ChangeLog | 6 ++++++
smartmontools/drivedb.h | 7 ++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/smartmontools/drivedb.h b/smartmontools/drivedb.h
index d81c0b79..cc42f667 100644
--- a/smartmontools/drivedb.h
+++ b/smartmontools/drivedb.h
@@ -3798,7 +3798,8 @@ const drive_settings builtin_knowndrives[] = {
// WDC WD10JFCX-68N6GN0/01.01A01, WDC WD40EFRX-68WT0N0/80.00A80,
// WDC WD60EFRX-68MYMN1/82.00A82, WDC WD80EFAX-68LHPN0/83.H0A83,
// WDC WD80EFZX-68UW8N0/83.H0A83
- "WDC WD(7500BFC|10JFC|[1-6]0EFR|80EF[AZ])X-.*",
+ // WDC WD80EZZX-11CSGA0/83.H0A03 (My Book 0x1058:0x25ee)
+ "WDC WD(7500BFC|10JFC|[1-6]0EFR|80E[FZ][AZ])X-.*",
"", "",
"-v 22,raw48,Helium_Level" // WD80EFZX
},
@@ -4739,10 +4740,10 @@ const drive_settings builtin_knowndrives[] = {
"-d sat"
},
{ "USB: WD My Book / Easystore; ", // 3.5"
- "0x1058:0x(09(0[06]|10)|11(0[01245]|1[0d]|30|40)|1230|25(a3|fb))",
+ "0x1058:0x(09(0[06]|10)|11(0[01245]|1[0d]|30|40)|1230|25(a3|ee|fb))",
"", // 0x0906=0x0012, 10=0x0106
// 0x1100/01=0x0165, 02=0x1028, 10=0x1030, 1d=0x1020, 30=0x1012, 40=0x1003
- // 0x1230=0x1065, 0x25a3=0x1013, 0x25fb=0x3004
+ // 0x1230=0x1065, 0x25a3=0x1013, 0x25ee=0x4004, 0x25fb=0x3004
"",
"-d sat"
},
--
2.19.1

View File

@ -0,0 +1,87 @@
From d80b89acbcbf619f81410db4b3f9e0a7149cae1e Mon Sep 17 00:00:00 2001
From: chrfranke <authors@smartmontools.org>
Date: Thu, 16 Nov 2017 21:06:57 +0000
Subject: [PATCH 026/291] update-smart-drivedb.in: Include configured PATH in
help and error messages.
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4622 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
smartmontools/ChangeLog | 3 +++
smartmontools/update-smart-drivedb.in | 22 ++++++++++++++++++----
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/smartmontools/update-smart-drivedb.in b/smartmontools/update-smart-drivedb.in
index aa23437a..44dd4718 100644
--- a/smartmontools/update-smart-drivedb.in
+++ b/smartmontools/update-smart-drivedb.in
@@ -45,10 +45,16 @@ GPG="@gnupg@"
# Smartctl used for syntax check
SMARTCTL="$sbindir/smartctl"
+# PATH information for help and error messages
+@ENABLE_SCRIPTPATH_FALSE@pathinfo='$PATH'
+@ENABLE_SCRIPTPATH_TRUE@pathinfo="'$PATH'"
+
myname=$0
usage()
{
+@ENABLE_SCRIPTPATH_TRUE@ pathinfo="
+@ENABLE_SCRIPTPATH_TRUE@ $pathinfo"
cat <<EOF
smartmontools $VERSION drive database update script
@@ -57,7 +63,7 @@ Usage: $myname [OPTIONS] [DESTFILE]
-s SMARTCTL Use SMARTCTL for syntax check ('-s -' to disable)
[default: $SMARTCTL]
-t TOOL Use TOOL for download: $os_dltools
- [default: first one found in PATH]
+ [default: first one found in $pathinfo]
-u LOCATION Use URL of LOCATION for download:
sf (Sourceforge code browser via HTTPS)
svn (SVN repository via HTTPS) [default]
@@ -85,6 +91,14 @@ error()
exit 1
}
+err_notfound()
+{
+ case $1 in
+ */*) error "$1: not found $2" ;;
+ *) error "$1: not found in $pathinfo $2" ;;
+ esac
+}
+
warning()
{
echo "$myname: (Warning) $*" >&2
@@ -410,7 +424,7 @@ if [ -z "$tool" ]; then
break
fi
done
- test -n "$tool" || error "found none of: $os_dltools"
+ test -n "$tool" || error "found none of '$os_dltools' in $pathinfo"
fi
test -n "$url" || selecturl "svn"
@@ -435,7 +449,7 @@ esac
# Check for smartctl
if [ "$smtctl" != "-" ]; then
"$smtctl" -V >/dev/null 2>&1 \
- || error "$smtctl: not found ('-s -' to ignore)"
+ || err_notfound "$smtctl" "('-s -' to ignore)"
fi
# Check for GnuPG
@@ -443,7 +457,7 @@ if [ -z "$no_verify" ]; then
test -n "$GPG" \
|| error "GnuPG is not available ('--no-verify' to ignore)"
"$GPG" --version >/dev/null 2>&1 \
- || error "$GPG: not found ('--no-verify' to ignore)"
+ || err_notfound "$GPG" "('--no-verify' to ignore)"
fi
# Use destination directory as temp directory for gpg
--
2.19.1

View File

@ -0,0 +1,42 @@
From 8878751819531b402859ec07d23da745a873092a Mon Sep 17 00:00:00 2001
From: chrfranke <authors@smartmontools.org>
Date: Thu, 16 Nov 2017 21:38:28 +0000
Subject: [PATCH 028/291] os_linux.cpp: Add missing braces to 3ware SELinux
code. This possibly harmless bug was introduced ~10 years ago in r2510. It is
now detected by g++ 6.3 -Wmisleading-indentation warning.
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4624 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
smartmontools/ChangeLog | 4 ++++
smartmontools/os_linux.cpp | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/smartmontools/os_linux.cpp b/smartmontools/os_linux.cpp
index a1fb6a7f..51f78b92 100644
--- a/smartmontools/os_linux.cpp
+++ b/smartmontools/os_linux.cpp
@@ -5,7 +5,7 @@
*
* Copyright (C) 2003-11 Bruce Allen
* Copyright (C) 2003-11 Doug Gilbert <dgilbert@interlog.com>
- * Copyright (C) 2008-16 Christian Franke
+ * Copyright (C) 2008-17 Christian Franke
*
* Original AACRaid code:
* Copyright (C) 2014 Raghava Aditya <raghava.aditya@pmcs.com>
@@ -1626,10 +1626,11 @@ static int setup_3ware_nodes(const char *nodename, const char *driver_name)
pout("Error initializing contexts database for /dev");
if (getfscreatecon(&orig_context) < 0) {
pout("Error retrieving original SELinux fscreate context");
- if (selinux_enforced)
+ if (selinux_enforced) {
matchpathcon_fini();
return 6;
}
+ }
}
#endif
/* Now check if nodes are correct */
--
2.19.1

View File

@ -0,0 +1,54 @@
From 033ec9c2170bb6bb26f7fe67cf05719989e257fe Mon Sep 17 00:00:00 2001
From: samm-git <samm@os2.kiev.ua>
Date: Sat, 18 Nov 2017 13:46:44 +0000
Subject: [PATCH 031/291] drivedb.h: fix Innolite Satadom D150QV entry (#939)
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4627 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
smartmontools/ChangeLog | 4 +++-
smartmontools/drivedb.h | 13 +++++++------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/smartmontools/drivedb.h b/smartmontools/drivedb.h
index 1ee92009..d78afab4 100644
--- a/smartmontools/drivedb.h
+++ b/smartmontools/drivedb.h
@@ -748,8 +748,9 @@ const drive_settings builtin_knowndrives[] = {
//"-v 194,tempminmax,Temperature_Celsius "
"-v 241,raw48,Host_Writes"
},
- { "InnoDisk InnoLite SATADOM D150QV-L SSDs", // tested with InnoLite SATADOM D150QV-L/120319
- "InnoLite SATADOM D150QV-L",
+ { "InnoDisk InnoLite SATADOM D150QV SSDs", // tested with InnoLite SATADOM D150QV-L/120319
+ // InnoLite SATADOM D150QV/120319
+ "InnoLite SATADOM D150QV.*",
"", "",
//"-v 1,raw48,Raw_Read_Error_Rate "
//"-v 2,raw48,Throughput_Performance "
@@ -757,18 +758,18 @@ const drive_settings builtin_knowndrives[] = {
//"-v 5,raw16(raw16),Reallocated_Sector_Ct "
//"-v 7,raw48,Seek_Error_Rate " // from InnoDisk iSMART Linux tool, useless for SSD
//"-v 8,raw48,Seek_Time_Performance "
- //"-v 9,raw24(raw8),Power_On_Hours "
+ //"-v 9,raw48,Power_On_Hours "
//"-v 10,raw48,Spin_Retry_Count "
//"-v 12,raw48,Power_Cycle_Count "
"-v 168,raw48,SATA_PHY_Error_Count "
- "-v 170,raw48,Bad_Block_Count "
- "-v 173,raw48,Erase_Count "
+ "-v 170,raw16,Bad_Block_Count_New/Tot "
+ "-v 173,raw16,Erase_Count_Max/Avg "
"-v 175,raw48,Bad_Cluster_Table_Count "
"-v 192,raw48,Unexpect_Power_Loss_Ct "
//"-v 194,tempminmax,Temperature_Celsius "
//"-v 197,raw48,Current_Pending_Sector "
"-v 229,hex48,Flash_ID "
- "-v 235,raw48,Later_Bad_Block "
+ "-v 235,raw16,Lat_Bad_Blk_Era/Wri/Rea "
"-v 236,raw48,Unstable_Power_Count "
"-v 240,raw48,Write_Head"
},
--
2.19.1

View File

@ -0,0 +1,46 @@
From 23435e436dca1d54d847df704cd947ef56736e65 Mon Sep 17 00:00:00 2001
From: dpgilbert <authors@smartmontools.org>
Date: Wed, 27 Dec 2017 05:50:47 +0000
Subject: [PATCH 073/291] os_freebsd.cpp: on error was setting set_nvme_err()
to 1, fix
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4670 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
smartmontools/ChangeLog | 5 +++++
smartmontools/os_freebsd.cpp | 11 ++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/smartmontools/os_freebsd.cpp b/smartmontools/os_freebsd.cpp
index 92e225f8..c0bb3b85 100644
--- a/smartmontools/os_freebsd.cpp
+++ b/smartmontools/os_freebsd.cpp
@@ -519,6 +519,7 @@ bool freebsd_nvme_device::nvme_pass_through(const nvme_cmd_in & in, nvme_cmd_out
{
// nvme_passthru_cmd pt;
struct nvme_pt_command pt;
+ struct nvme_completion *cp_p;
memset(&pt, 0, sizeof(pt));
pt.cmd.opc = in.opcode;
@@ -538,10 +539,14 @@ bool freebsd_nvme_device::nvme_pass_through(const nvme_cmd_in & in, nvme_cmd_out
if (status < 0)
return set_err(errno, "NVME_PASSTHROUGH_CMD: %s", strerror(errno));
- out.result=pt.cpl.cdw0; // Command specific result (DW0)
+ cp_p = &pt.cpl;
+ out.result=cp_p->cdw0; // Command specific result (DW0)
- if (nvme_completion_is_error(&pt.cpl))
- return set_nvme_err(out, nvme_completion_is_error(&pt.cpl));
+ if (nvme_completion_is_error(cp_p)) { /* ignore DNR and More bits */
+ uint16_t nvme_status = ((cp_p->status.sct << 8) | cp_p->status.sc) & 0x3ff;
+
+ return set_nvme_err(out, nvme_status);
+ }
return true;
}
--
2.19.1

View File

@ -0,0 +1,37 @@
From 3ddb98cebda43e56ba023c5e12306a000a60a707 Mon Sep 17 00:00:00 2001
From: chrfranke <authors@smartmontools.org>
Date: Wed, 28 Mar 2018 19:37:45 +0000
Subject: [PATCH 124/291] os_linux.cpp: Fix device scan crash on missing
/proc/devices.
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4723 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
smartmontools/ChangeLog | 2 ++
smartmontools/os_linux.cpp | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/smartmontools/os_linux.cpp b/smartmontools/os_linux.cpp
index 6df97e94..29203409 100644
--- a/smartmontools/os_linux.cpp
+++ b/smartmontools/os_linux.cpp
@@ -5,7 +5,7 @@
*
* Copyright (C) 2003-11 Bruce Allen
* Copyright (C) 2003-11 Doug Gilbert <dgilbert@interlog.com>
- * Copyright (C) 2008-17 Christian Franke
+ * Copyright (C) 2008-18 Christian Franke
*
* Original AACRaid code:
* Copyright (C) 2014 Raghava Aditya <raghava.aditya@pmcs.com>
@@ -2961,6 +2961,8 @@ bool linux_smart_interface::get_dev_megasas(smart_device_list & devlist)
char line[128];
bool scan_megasas = false;
FILE * fp = fopen("/proc/devices", "r");
+ if (!fp)
+ return false;
while (fgets(line, sizeof(line), fp) != NULL) {
n1=0;
if (sscanf(line, "%d megaraid_sas_ioctl%n", &mjr, &n1) == 1 && n1 == 22) {
--
2.19.1

View File

@ -0,0 +1,40 @@
From 3e342f88588499b26dbef61a2fe78e9a4838567a Mon Sep 17 00:00:00 2001
From: chrfranke <authors@smartmontools.org>
Date: Wed, 26 Sep 2018 19:44:15 +0000
Subject: [PATCH 186/291] smartd.cpp: Always ignore failure of ATA SMART ENABLE
command if '-T permissive' is specified. Useful for testing on virtual
machines.
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4790 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
smartmontools/ChangeLog | 6 ++++++
smartmontools/smartd.cpp | 12 +++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/smartmontools/smartd.cpp b/smartmontools/smartd.cpp
index 0692ca4d..fc54b233 100644
--- a/smartmontools/smartd.cpp
+++ b/smartmontools/smartd.cpp
@@ -2037,10 +2037,16 @@ static int ATADeviceScan(dev_config & cfg, dev_state & state, ata_device * atade
PrintOut(LOG_INFO,"Device: %s, could not enable SMART capability\n",name);
if (ataIsSmartEnabled(&drive) <= 0) {
- CloseDevice(atadev, name);
- return 2;
+ if (!cfg.permissive) {
+ PrintOut(LOG_INFO, "Device: %s, to proceed anyway, use '-T permissive' Directive.\n", name);
+ CloseDevice(atadev, name);
+ return 2;
+ }
+ PrintOut(LOG_INFO, "Device: %s, proceeding since '-T permissive' Directive given.\n", name);
+ }
+ else {
+ PrintOut(LOG_INFO, "Device: %s, proceeding since SMART is already enabled\n", name);
}
- PrintOut(LOG_INFO, "Device: %s, proceeding since SMART is already enabled\n", name);
}
// disable device attribute autosave...
--
2.19.1

View File

@ -0,0 +1,62 @@
From f201d3a068d2bbdc36b89d248b521ba2da3ad741 Mon Sep 17 00:00:00 2001
From: chrfranke <authors@smartmontools.org>
Date: Thu, 11 Oct 2018 18:51:35 +0000
Subject: [PATCH 204/291] os_linux.cpp: Fix '-d megaraid' open crash on missing
/proc/devices. There is no /proc/devices on ESXi (see #800) and WSL.
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4809 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
smartmontools/ChangeLog | 5 +++++
smartmontools/os_linux.cpp | 34 ++++++++++++++++++----------------
2 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/smartmontools/os_linux.cpp b/smartmontools/os_linux.cpp
index 1a1b0858..9790818a 100644
--- a/smartmontools/os_linux.cpp
+++ b/smartmontools/os_linux.cpp
@@ -1299,24 +1299,26 @@ bool linux_megaraid_device::open()
}
/* Perform mknod of device ioctl node */
FILE * fp = fopen("/proc/devices", "r");
- while (fgets(line, sizeof(line), fp) != NULL) {
- int n1 = 0;
- if (sscanf(line, "%d megaraid_sas_ioctl%n", &mjr, &n1) == 1 && n1 == 22) {
- n1=mknod("/dev/megaraid_sas_ioctl_node", S_IFCHR, makedev(mjr, 0));
- if(report > 0)
- pout("Creating /dev/megaraid_sas_ioctl_node = %d\n", n1 >= 0 ? 0 : errno);
- if (n1 >= 0 || errno == EEXIST)
- break;
- }
- else if (sscanf(line, "%d megadev%n", &mjr, &n1) == 1 && n1 == 11) {
- n1=mknod("/dev/megadev0", S_IFCHR, makedev(mjr, 0));
- if(report > 0)
- pout("Creating /dev/megadev0 = %d\n", n1 >= 0 ? 0 : errno);
- if (n1 >= 0 || errno == EEXIST)
- break;
+ if (fp) {
+ while (fgets(line, sizeof(line), fp) != NULL) {
+ int n1 = 0;
+ if (sscanf(line, "%d megaraid_sas_ioctl%n", &mjr, &n1) == 1 && n1 == 22) {
+ n1=mknod("/dev/megaraid_sas_ioctl_node", S_IFCHR, makedev(mjr, 0));
+ if(report > 0)
+ pout("Creating /dev/megaraid_sas_ioctl_node = %d\n", n1 >= 0 ? 0 : errno);
+ if (n1 >= 0 || errno == EEXIST)
+ break;
+ }
+ else if (sscanf(line, "%d megadev%n", &mjr, &n1) == 1 && n1 == 11) {
+ n1=mknod("/dev/megadev0", S_IFCHR, makedev(mjr, 0));
+ if(report > 0)
+ pout("Creating /dev/megadev0 = %d\n", n1 >= 0 ? 0 : errno);
+ if (n1 >= 0 || errno == EEXIST)
+ break;
+ }
}
+ fclose(fp);
}
- fclose(fp);
/* Open Device IOCTL node */
if ((m_fd = ::open("/dev/megaraid_sas_ioctl_node", O_RDWR)) >= 0) {
--
2.19.1

View File

@ -0,0 +1,51 @@
From 2520e4983eb084cf0b48dded77d358d9f085b9d2 Mon Sep 17 00:00:00 2001
From: samm-git <samm@os2.kiev.ua>
Date: Fri, 9 Nov 2018 07:18:23 +0000
Subject: [PATCH 225/291] os_darwin.cpp, os_freebsd.cpp: fix return value in
error paths
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4831 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
smartmontools/ChangeLog | 5 +++++
smartmontools/os_darwin.cpp | 4 ++--
smartmontools/os_freebsd.cpp | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/smartmontools/os_darwin.cpp b/smartmontools/os_darwin.cpp
index 1620981b..25888047 100644
--- a/smartmontools/os_darwin.cpp
+++ b/smartmontools/os_darwin.cpp
@@ -403,7 +403,7 @@ bool darwin_ata_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out & ou
int rc = 0;
if (! ifp)
- return -1;
+ return false;
smartIf = *ifp;
clear_err(); errno = 0;
do {
@@ -558,7 +558,7 @@ bool darwin_nvme_device::nvme_pass_through(const nvme_cmd_in & in, nvme_cmd_out
unsigned int page = in.cdw10 & 0xff;
if (! ifp)
- return -1;
+ return false;
smartIfNVMe = *ifp;
// currently only GetIdentifyData and SMARTReadData are supported
switch (in.opcode) {
diff --git a/smartmontools/os_freebsd.cpp b/smartmontools/os_freebsd.cpp
index 49f82c58..ffe3b151 100644
--- a/smartmontools/os_freebsd.cpp
+++ b/smartmontools/os_freebsd.cpp
@@ -613,7 +613,7 @@ bool freebsd_escalade_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_ou
if (m_disknum < 0) {
printwarning(NO_DISK_3WARE,NULL);
- return -1;
+ return false;
}
memset(ioctl_buffer, 0, TW_IOCTL_BUFFER_SIZE);
--
2.19.1

View File

@ -0,0 +1,33 @@
From 613b1f96b0535563d98376e46ea3ed5ad0252ea7 Mon Sep 17 00:00:00 2001
From: chrfranke <authors@smartmontools.org>
Date: Sun, 2 Dec 2018 15:46:22 +0000
Subject: [PATCH 234/291] ataprint.cpp: Fix Form Factor string with bits set in
reserved area - Happens with APPLE SSD SD0256F
Patch provided by Harry Mallon.
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4841 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
smartmontools/ChangeLog | 5 +++++
smartmontools/ataprint.cpp | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/smartmontools/ataprint.cpp b/smartmontools/ataprint.cpp
index 5fccf4ba..495d5401 100644
--- a/smartmontools/ataprint.cpp
+++ b/smartmontools/ataprint.cpp
@@ -404,9 +404,10 @@ static inline std::string format_st_er_desc(
static const char * get_form_factor(unsigned short word168)
{
+ // Bits 0:3 are the form factor
// Table A.32 of T13/2161-D (ACS-3) Revision 4p, September 19, 2013
// Table 236 of T13/BSR INCITS 529 (ACS-4) Revision 04, August 25, 2014
- switch (word168) {
+ switch (word168 & 0xF) {
case 0x1: return "5.25 inches";
case 0x2: return "3.5 inches";
case 0x3: return "2.5 inches";
--
2.19.1

5214
drivedb.h Normal file

File diff suppressed because it is too large Load Diff

33
smartdnotify Normal file
View File

@ -0,0 +1,33 @@
#! /bin/sh
# Send mail
if which mail >/dev/null 2>&1
then
echo "$SMARTD_MESSAGE" | mail -s "$SMARTD_FAILTYPE" "$SMARTD_ADDRESS"
fi
# Notify desktop user
MESSAGE="SMART Disk monitor:"
case "$SMARTD_FAILTYPE" in
"EmailTest"|"Health"|"Temperature"|"Usage")
;;
*)
# "CurrentPendingSector", // 10
# "OfflineUncorrectableSector", // 11
# "FailedReadSmartErrorLog", // 7
# "ErrorCount", // 4
# "FailedReadSmartData", // 6
# "FailedHealthCheck", // 5
# "FailedOpenDevice", // 9
# "SelfTest", // 3
# "FailedReadSmartSelfTestLog", // 8
exit 0
esac
# direct write to terminals, do not use 'wall', because we don't want its ugly header
for t in $(who | awk '{ print $2; }' | grep -e '^tty' -e '^pts/')
do
echo "$MESSAGE
$SMARTD_MESSAGE" >/dev/$t 2>/dev/null ||:
done

BIN
smartmontools-6.6.tar.gz Normal file

Binary file not shown.

132
smartmontools.spec Normal file
View File

@ -0,0 +1,132 @@
Name: smartmontools
Version: 6.6
Release: 6
Epoch: 1
Summary: S.M.A.R.T. utility toolset
License: GPLv2+
URL: http://smartmontools.sourceforge.net/
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Source1: smartmontools.sysconf
Source2: smartdnotify
Source3: drivedb.h
Patch0: 0000-smartmontools-5.38-defaultconf.patch
Patch6000: 6000-os_linux.cpp-os_netbsd.cpp-fix-crash-on-scan-if-WITH.patch
Patch6001: 6001-ataprint.cpp-Fix-detection-of-Device-Statistics-log-.patch
Patch6002: 6002-drivedb.h.patch
Patch6003: 6003-update-smart-drivedb.in-Include-configured-PATH-in-h.patch
Patch6004: 6004-os_linux.cpp-Add-missing-braces-to-3ware-SELinux-cod.patch
Patch6005: 6005-drivedb.h-fix-Innolite-Satadom-D150QV-entry-939.patch
Patch6006: 6006-os_freebsd.cpp-on-error-was-setting-set_nvme_err-to-.patch
Patch6007: 6007-os_linux.cpp-Fix-device-scan-crash-on-missing-proc-d.patch
Patch6008: 6008-smartd.cpp-Always-ignore-failure-of-ATA-SMART-ENABLE.patch
Patch6009: 6009-os_linux.cpp-Fix-d-megaraid-open-crash-on-missing-pr.patch
Patch6010: 6010-os_darwin.cpp-os_freebsd.cpp-fix-return-value-in-err.patch
Patch6011: 6011-ataprint.cpp-Fix-Form-Factor-string-with-bits-set-in.patch
BuildRequires: groff gcc-c++ automake
BuildRequires: libselinux-devel libcap-ng-devel systemd-units
Requires(preun): systemd-units
Requires(post): systemd-units
Requires(postun): systemd-units
%description
smartmontools contains utilities that control and monitor storage
devices using the Self-Monitoring, Analysis and Reporting Technology
(SMART) system build into ATA/SATA and SCSI/SAS hard drives and
solid-state drives. This is used to check the reliability of the
drive and to predict drive failures.
%package help
Summary: Including man files for smartmontools
Requires: man
%description help
This contains man files for the using of smartmontools.
%prep
cp %{SOURCE3} .
%autosetup -n %{name}-%{version} -p2
%build
autoreconf -i
%configure --with-selinux --with-libcap-ng=yes --with-systemdsystemunitdir=%{_unitdir} --sysconfdir=%{_sysconfdir}/%{name}/
make %{?_smp_mflags} CXXFLAGS="$RPM_OPT_FLAGS -fpie" LDFLAGS="-pie -Wl,-z,relro,-z,now"
sed -i 's|/etc/smartmontools/sysconfig|/etc/sysconfig|g' smartd.service
%install
%make_install
mkdir -p %{buildroot}%{_sysconfdir}/%{name}/smartd_warning.d
install -D -p -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/smartmontools
install -D -p -m 755 %{SOURCE2} %{buildroot}%{_libexecdir}/%{name}/smartdnotify
mkdir -p %{buildroot}%{_sharedstatedir}/%{name}
%preun
%systemd_preun smartd.service
%post
%systemd_post smartd.service
%postun
%systemd_postun_with_restart smartd.service
%files
%doc %{_docdir}/%{name}
%dir %{_sysconfdir}/%{name}
%dir %{_sysconfdir}/%{name}/smartd_warning.d
%config(noreplace) %{_sysconfdir}/%{name}/smartd.conf
%config(noreplace) %{_sysconfdir}/%{name}/smartd_warning.sh
%config(noreplace) %{_sysconfdir}/sysconfig/smartmontools
%{_unitdir}/smartd.service
%{_sbindir}/{smartd,update-smart-drivedb,smartctl}
%{_datadir}/%{name}
%{_libexecdir}/%{name}
%{_sharedstatedir}/%{name}
%files help
%{_mandir}/man*/{smart*,update-smart*}
%changelog
* Wed Aug 21 2019 zhanghaibo <ted.zhang@huawei.com> - 1:6.6-6
- Type:enhancemnet
- ID:NA
- SUG:NA
- DESCi:openEuler Debranding
* Wed Aug 21 2019 Su Weifeng <suweifeng1@huawei.com> - 1:6.6-5.h2
- Type:other
- ID:NA
- SUG:NA
- DESC:rename patches
* Thu Apr 18 2019 yangzhuangzhuang<yangzhuangzhuang1@huawei.com> - 1:6.6-5.h1
- Type:bugfix
- ID:NA
- SUG:restart
- DESC:os_linux.cpp/os_netbsd.cpp: fix crash on --scan if WITH_NVME_DEVICESC is not set and '-d <type>' is not specified
ataprint.cpp: Fix detection of Device Statistics log with 256 sectors (#922)
drivedb.h: - Western Digital Red: WD80EZZX - USB: WD
update-smart-drivedb.in: Include configured PATH in help and error messages
os_linux.cpp: Add missing braces to 3ware SELinux code
drivedb.h: fix Innolite Satadom D150QV entry (#939)
os_freebsd.cpp: on error was setting set_nvme_err() to 1
os_linux.cpp: Fix device scan crash on missing /proc/devices
smartd.cpp: Always ignore failure of ATA SMART ENABLE command if
os_linux.cpp: Fix '-d megaraid' open crash on missing /proc/devices
os_darwin.cpp, os_freebsd.cpp: fix return value in error paths
ataprint.cpp: Fix Form Factor string with bits set in reserved area
- Package init

6
smartmontools.sysconf Normal file
View File

@ -0,0 +1,6 @@
# command line options for smartd
# Add -s /var/lib/smartmontools to enable state persistence
smartd_opts="-q never"
# autogenerated config file options
# smartd_conf_opts="-H -m root"