|
|
2576b79 |
diff -Naurp ../smartmontools-5.39.regfix/atacmds.cpp ../smartmontools-5.39/atacmds.cpp
|
|
|
2576b79 |
--- ../smartmontools-5.39.regfix/atacmds.cpp 2010-01-20 15:47:48.099341028 +0100
|
|
|
2576b79 |
+++ ../smartmontools-5.39/atacmds.cpp 2010-01-20 16:13:58.380345000 +0100
|
|
|
2576b79 |
@@ -2370,13 +2370,17 @@ int ataPrintSmartSelfTestlog(const ata_s
|
|
|
2576b79 |
uint64_t lba48 = (log->lbafirstfailure < 0xffffffff ? log->lbafirstfailure : 0xffffffffffffULL);
|
|
|
2576b79 |
|
|
|
2576b79 |
// Print entry
|
|
|
2576b79 |
- bool errorfound = ataPrintSmartSelfTestEntry(testno,
|
|
|
2576b79 |
- log->selftestnumber, log->selfteststatus, log->timestamp,
|
|
|
2576b79 |
- lba48, !allentries, noheaderprinted);
|
|
|
2576b79 |
-
|
|
|
2576b79 |
- // keep track of time of most recent error
|
|
|
2576b79 |
- if (errorfound && !hours)
|
|
|
2576b79 |
- hours=log->timestamp;
|
|
|
2576b79 |
+ if (ataPrintSmartSelfTestEntry(testno,
|
|
|
2576b79 |
+ log->selftestnumber, log->selfteststatus,
|
|
|
2576b79 |
+ log->timestamp, lba48, !allentries, noheaderprinted)) {
|
|
|
2576b79 |
+
|
|
|
2576b79 |
+ // Self-test showed an error
|
|
|
2576b79 |
+ retval++;
|
|
|
2576b79 |
+
|
|
|
2576b79 |
+ // keep track of time of most recent error
|
|
|
2576b79 |
+ if (!hours)
|
|
|
2576b79 |
+ hours = log->timestamp;
|
|
|
2576b79 |
+ }
|
|
|
2576b79 |
}
|
|
|
2576b79 |
}
|
|
|
2576b79 |
if (!allentries && retval)
|
|
|
2576b79 |
diff -Naurp ../smartmontools-5.39.regfix/ataprint.cpp ../smartmontools-5.39/ataprint.cpp
|
|
|
2576b79 |
--- ../smartmontools-5.39.regfix/ataprint.cpp 2010-01-20 15:47:48.099341028 +0100
|
|
|
2576b79 |
+++ ../smartmontools-5.39/ataprint.cpp 2010-01-20 16:12:24.039465040 +0100
|
|
|
2576b79 |
@@ -3,8 +3,8 @@
|
|
|
2576b79 |
*
|
|
|
2576b79 |
* Home page of code is: http://smartmontools.sourceforge.net
|
|
|
2576b79 |
*
|
|
|
2576b79 |
- * Copyright (C) 2002-9 Bruce Allen <smartmontools-support@lists.sourceforge.net>
|
|
|
2576b79 |
- * Copyright (C) 2008-9 Christian Franke <smartmontools-support@lists.sourceforge.net>
|
|
|
2576b79 |
+ * Copyright (C) 2002-10 Bruce Allen <smartmontools-support@lists.sourceforge.net>
|
|
|
2576b79 |
+ * Copyright (C) 2008-10 Christian Franke <smartmontools-support@lists.sourceforge.net>
|
|
|
2576b79 |
* Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
|
|
|
2576b79 |
*
|
|
|
2576b79 |
* This program is free software; you can redistribute it and/or modify
|
|
|
2576b79 |
@@ -2066,7 +2066,6 @@ int ataPrintMain (ata_device * device, c
|
|
|
2576b79 |
|| options.smart_ext_selftest_log
|
|
|
2576b79 |
|| options.sataphy
|
|
|
2576b79 |
|| !options.log_requests.empty() ) {
|
|
|
2576b79 |
- PRINT_ON(con);
|
|
|
2576b79 |
if (isGeneralPurposeLoggingCapable(&drive))
|
|
|
2576b79 |
pout("General Purpose Logging (GPL) feature set supported\n");
|
|
|
2576b79 |
|
|
|
2576b79 |
@@ -2087,31 +2086,26 @@ int ataPrintMain (ata_device * device, c
|
|
|
2576b79 |
// Read SMART Log directory
|
|
|
2576b79 |
if (need_smart_logdir) {
|
|
|
2576b79 |
if (ataReadLogDirectory(device, &smartlogdir_buf, false)){
|
|
|
2576b79 |
- PRINT_OFF(con);
|
|
|
2576b79 |
pout("Read SMART Log Directory failed.\n\n");
|
|
|
2576b79 |
failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
|
|
|
2576b79 |
}
|
|
|
2576b79 |
else
|
|
|
2576b79 |
smartlogdir = &smartlogdir_buf;
|
|
|
2576b79 |
}
|
|
|
2576b79 |
- PRINT_ON(con);
|
|
|
2576b79 |
|
|
|
2576b79 |
// Read GP Log directory
|
|
|
2576b79 |
if (need_gp_logdir) {
|
|
|
2576b79 |
if (ataReadLogDirectory(device, &gplogdir_buf, true)){
|
|
|
2576b79 |
- PRINT_OFF(con);
|
|
|
2576b79 |
pout("Read GP Log Directory failed.\n\n");
|
|
|
2576b79 |
failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
|
|
|
2576b79 |
}
|
|
|
2576b79 |
else
|
|
|
2576b79 |
gplogdir = &gplogdir_buf;
|
|
|
2576b79 |
}
|
|
|
2576b79 |
- PRINT_ON(con);
|
|
|
2576b79 |
|
|
|
2576b79 |
// Print log directories
|
|
|
2576b79 |
if ((options.gp_logdir && gplogdir) || (options.smart_logdir && smartlogdir))
|
|
|
2576b79 |
PrintLogDirectories(gplogdir, smartlogdir);
|
|
|
2576b79 |
- PRINT_OFF(con);
|
|
|
2576b79 |
|
|
|
2576b79 |
// Print log pages
|
|
|
2576b79 |
for (i = 0; i < options.log_requests.size(); i++) {
|
|
|
2576b79 |
diff -Naurp ../smartmontools-5.39.regfix/CHANGELOG ../smartmontools-5.39/CHANGELOG
|
|
|
2576b79 |
--- ../smartmontools-5.39.regfix/CHANGELOG 2010-01-20 15:47:48.100527305 +0100
|
|
|
2576b79 |
+++ ../smartmontools-5.39/CHANGELOG 2010-01-20 16:28:38.174340078 +0100
|
|
|
2576b79 |
@@ -45,6 +45,20 @@ NOTES FOR FUTURE RELEASES: see TODO file
|
|
|
2576b79 |
|
|
|
2576b79 |
smartmontools 5.39 2009-12-09
|
|
|
2576b79 |
|
|
|
2576b79 |
+ [CF] Linux: Allow smartd 'DEVICESCAN -d sat' (ticket #13).
|
|
|
2576b79 |
+ Detects (S)ATA devices behind a standard SAT layer
|
|
|
2576b79 |
+ (Vendor ID: "ATA "), but not USB bridges with SAT support.
|
|
|
2576b79 |
+ Only added for backward compatibility with 5.38.
|
|
|
2576b79 |
+ No longer needed as 'DEVICESCAN' without '-d' includes these devices.
|
|
|
2576b79 |
+
|
|
|
2576b79 |
+ [CF] smartd: Fix directive '-l selftest' (ticket #36)
|
|
|
2576b79 |
+ Regression was introduced with r2773.
|
|
|
2576b79 |
+
|
|
|
2576b79 |
+ [CF] smartctl: Don't print log directory if '-q errorsonly' is specified.
|
|
|
2576b79 |
+
|
|
|
2576b79 |
+ [CF] smartctl: Fix option '-q, --quietmode' (ticket #11).
|
|
|
2576b79 |
+ Regression was introduced with r2807.
|
|
|
2576b79 |
+
|
|
|
2576b79 |
[CF] do_release: Commit CHANGELOG and NEWS also. Allow to review changes.
|
|
|
2576b79 |
|
|
|
2576b79 |
[CF] Linux: Add workaround for Adaptec series 2, 5 and 5Z controllers
|
|
|
2576b79 |
diff -Naurp ../smartmontools-5.39.regfix/NEWS ../smartmontools-5.39/NEWS
|
|
|
2576b79 |
--- ../smartmontools-5.39.regfix/NEWS 2010-01-20 15:47:48.104527238 +0100
|
|
|
2576b79 |
+++ ../smartmontools-5.39/NEWS 2010-01-20 16:28:51.388652458 +0100
|
|
|
2576b79 |
@@ -8,6 +8,9 @@ http://smartmontools.svn.sourceforge.net
|
|
|
2576b79 |
Date 2009-12-09
|
|
|
2576b79 |
Summary: smartmontools release 5.39 (UNSTABLE/EXPERIMENTAL)
|
|
|
2576b79 |
-----------------------------------------------------------
|
|
|
2576b79 |
+- Fix regression in smartctl option '-q, --quietmode'.
|
|
|
2576b79 |
+- Fix regression in smartd directive '-l selftest'
|
|
|
2576b79 |
+- Linux: Allow smartd 'DEVICESCAN -d sat'.
|
|
|
2576b79 |
- Sourcecode repository moved from CVS to SVN
|
|
|
2576b79 |
- Support for USB devices with Cypress, JMicron and Sunplus USB bridges
|
|
|
2576b79 |
- USB device type autodetection for some devices on Linux, Windows and FreeBSD
|
|
|
2576b79 |
diff -Naurp ../smartmontools-5.39.regfix/os_linux.cpp ../smartmontools-5.39/os_linux.cpp
|
|
|
2576b79 |
--- ../smartmontools-5.39.regfix/os_linux.cpp 2010-01-20 15:47:48.106527477 +0100
|
|
|
2576b79 |
+++ ../smartmontools-5.39/os_linux.cpp 2010-01-20 16:28:19.456339800 +0100
|
|
|
2576b79 |
@@ -831,17 +831,22 @@ class linux_scsi_device
|
|
|
2576b79 |
public /*extends*/ linux_smart_device
|
|
|
2576b79 |
{
|
|
|
2576b79 |
public:
|
|
|
2576b79 |
- linux_scsi_device(smart_interface * intf, const char * dev_name, const char * req_type);
|
|
|
2576b79 |
+ linux_scsi_device(smart_interface * intf, const char * dev_name,
|
|
|
2576b79 |
+ const char * req_type, bool scanning = false);
|
|
|
2576b79 |
|
|
|
2576b79 |
virtual smart_device * autodetect_open();
|
|
|
2576b79 |
|
|
|
2576b79 |
virtual bool scsi_pass_through(scsi_cmnd_io * iop);
|
|
|
2576b79 |
+
|
|
|
2576b79 |
+private:
|
|
|
2576b79 |
+ bool m_scanning; ///< true if created within scan_smart_devices
|
|
|
2576b79 |
};
|
|
|
2576b79 |
|
|
|
2576b79 |
linux_scsi_device::linux_scsi_device(smart_interface * intf,
|
|
|
2576b79 |
- const char * dev_name, const char * req_type)
|
|
|
2576b79 |
+ const char * dev_name, const char * req_type, bool scanning /*= false*/)
|
|
|
2576b79 |
: smart_device(intf, dev_name, "scsi", req_type),
|
|
|
2576b79 |
- linux_smart_device(O_RDWR | O_NONBLOCK, O_RDONLY | O_NONBLOCK)
|
|
|
2576b79 |
+ linux_smart_device(O_RDWR | O_NONBLOCK, O_RDONLY | O_NONBLOCK),
|
|
|
2576b79 |
+ m_scanning(scanning)
|
|
|
2576b79 |
{
|
|
|
2576b79 |
}
|
|
|
2576b79 |
|
|
|
2576b79 |
@@ -2646,8 +2651,13 @@ smart_device * linux_scsi_device::autode
|
|
|
2576b79 |
return this;
|
|
|
2576b79 |
|
|
|
2576b79 |
// No Autodetection if device type was specified by user
|
|
|
2576b79 |
- if (*get_req_type())
|
|
|
2576b79 |
- return this;
|
|
|
2576b79 |
+ bool sat_only = false;
|
|
|
2576b79 |
+ if (*get_req_type()) {
|
|
|
2576b79 |
+ // Detect SAT if device object was created by scan_smart_devices().
|
|
|
2576b79 |
+ if (!(m_scanning && !strcmp(get_req_type(), "sat")))
|
|
|
2576b79 |
+ return this;
|
|
|
2576b79 |
+ sat_only = true;
|
|
|
2576b79 |
+ }
|
|
|
2576b79 |
|
|
|
2576b79 |
// The code below is based on smartd.cpp:SCSIFilterKnown()
|
|
|
2576b79 |
|
|
|
2576b79 |
@@ -2668,36 +2678,43 @@ smart_device * linux_scsi_device::autode
|
|
|
2576b79 |
|
|
|
2576b79 |
int avail_len = req_buff[4] + 5;
|
|
|
2576b79 |
int len = (avail_len < req_len ? avail_len : req_len);
|
|
|
2576b79 |
- if (len < 36)
|
|
|
2576b79 |
+ if (len < 36) {
|
|
|
2576b79 |
+ if (sat_only) {
|
|
|
2576b79 |
+ close();
|
|
|
2576b79 |
+ set_err(EIO, "INQUIRY too short for SAT");
|
|
|
2576b79 |
+ }
|
|
|
2576b79 |
return this;
|
|
|
2576b79 |
+ }
|
|
|
2576b79 |
|
|
|
2576b79 |
// Use INQUIRY to detect type
|
|
|
2576b79 |
+ if (!sat_only) {
|
|
|
2576b79 |
|
|
|
2576b79 |
- // 3ware ?
|
|
|
2576b79 |
- if (!memcmp(req_buff + 8, "3ware", 5) || !memcmp(req_buff + 8, "AMCC", 4)) {
|
|
|
2576b79 |
- close();
|
|
|
2576b79 |
- set_err(EINVAL, "AMCC/3ware controller, please try adding '-d 3ware,N',\n"
|
|
|
2576b79 |
- "you may need to replace %s with /dev/twaN or /dev/tweN", get_dev_name());
|
|
|
2576b79 |
- return this;
|
|
|
2576b79 |
- }
|
|
|
2576b79 |
+ // 3ware ?
|
|
|
2576b79 |
+ if (!memcmp(req_buff + 8, "3ware", 5) || !memcmp(req_buff + 8, "AMCC", 4)) {
|
|
|
2576b79 |
+ close();
|
|
|
2576b79 |
+ set_err(EINVAL, "AMCC/3ware controller, please try adding '-d 3ware,N',\n"
|
|
|
2576b79 |
+ "you may need to replace %s with /dev/twaN or /dev/tweN", get_dev_name());
|
|
|
2576b79 |
+ return this;
|
|
|
2576b79 |
+ }
|
|
|
2576b79 |
|
|
|
2576b79 |
- // DELL?
|
|
|
2576b79 |
- if (!memcmp(req_buff + 8, "DELL PERC", 12) || !memcmp(req_buff + 8, "MegaRAID", 8)) {
|
|
|
2576b79 |
- close();
|
|
|
2576b79 |
- set_err(EINVAL, "DELL or MegaRaid controller, please try adding '-d megaraid,N'");
|
|
|
2576b79 |
- return this;
|
|
|
2576b79 |
- }
|
|
|
2576b79 |
+ // DELL?
|
|
|
2576b79 |
+ if (!memcmp(req_buff + 8, "DELL PERC", 12) || !memcmp(req_buff + 8, "MegaRAID", 8)) {
|
|
|
2576b79 |
+ close();
|
|
|
2576b79 |
+ set_err(EINVAL, "DELL or MegaRaid controller, please try adding '-d megaraid,N'");
|
|
|
2576b79 |
+ return this;
|
|
|
2576b79 |
+ }
|
|
|
2576b79 |
|
|
|
2576b79 |
- // Marvell ?
|
|
|
2576b79 |
- if (len >= 42 && !memcmp(req_buff + 36, "MVSATA", 6)) {
|
|
|
2576b79 |
- //pout("Device %s: using '-d marvell' for ATA disk with Marvell driver\n", get_dev_name());
|
|
|
2576b79 |
- close();
|
|
|
2576b79 |
- smart_device_auto_ptr newdev(
|
|
|
2576b79 |
- new linux_marvell_device(smi(), get_dev_name(), get_req_type())
|
|
|
2576b79 |
- );
|
|
|
2576b79 |
- newdev->open(); // TODO: Can possibly pass open fd
|
|
|
2576b79 |
- delete this;
|
|
|
2576b79 |
- return newdev.release();
|
|
|
2576b79 |
+ // Marvell ?
|
|
|
2576b79 |
+ if (len >= 42 && !memcmp(req_buff + 36, "MVSATA", 6)) {
|
|
|
2576b79 |
+ //pout("Device %s: using '-d marvell' for ATA disk with Marvell driver\n", get_dev_name());
|
|
|
2576b79 |
+ close();
|
|
|
2576b79 |
+ smart_device_auto_ptr newdev(
|
|
|
2576b79 |
+ new linux_marvell_device(smi(), get_dev_name(), get_req_type())
|
|
|
2576b79 |
+ );
|
|
|
2576b79 |
+ newdev->open(); // TODO: Can possibly pass open fd
|
|
|
2576b79 |
+ delete this;
|
|
|
2576b79 |
+ return newdev.release();
|
|
|
2576b79 |
+ }
|
|
|
2576b79 |
}
|
|
|
2576b79 |
|
|
|
2576b79 |
// SAT or USB ?
|
|
|
2576b79 |
@@ -2709,6 +2726,11 @@ smart_device * linux_scsi_device::autode
|
|
|
2576b79 |
}
|
|
|
2576b79 |
|
|
|
2576b79 |
// Nothing special found
|
|
|
2576b79 |
+
|
|
|
2576b79 |
+ if (sat_only) {
|
|
|
2576b79 |
+ close();
|
|
|
2576b79 |
+ set_err(EIO, "Not a SAT device");
|
|
|
2576b79 |
+ }
|
|
|
2576b79 |
return this;
|
|
|
2576b79 |
}
|
|
|
2576b79 |
|
|
|
2576b79 |
@@ -2891,7 +2913,7 @@ bool linux_smart_interface::get_dev_list
|
|
|
2576b79 |
if (autodetect)
|
|
|
2576b79 |
dev = autodetect_smart_device(name);
|
|
|
2576b79 |
else if (is_scsi)
|
|
|
2576b79 |
- dev = new linux_scsi_device(this, name, req_type);
|
|
|
2576b79 |
+ dev = new linux_scsi_device(this, name, req_type, true /*scanning*/);
|
|
|
2576b79 |
else
|
|
|
2576b79 |
dev = new linux_ata_device(this, name, req_type);
|
|
|
2576b79 |
if (dev) // autodetect_smart_device() may return nullptr.
|
|
|
2576b79 |
@@ -2917,7 +2939,8 @@ bool linux_smart_interface::scan_smart_d
|
|
|
2576b79 |
type = "";
|
|
|
2576b79 |
|
|
|
2576b79 |
bool scan_ata = (!*type || !strcmp(type, "ata" ));
|
|
|
2576b79 |
- bool scan_scsi = (!*type || !strcmp(type, "scsi"));
|
|
|
2576b79 |
+ // "sat" detection will be later handled in linux_scsi_device::autodetect_open()
|
|
|
2576b79 |
+ bool scan_scsi = (!*type || !strcmp(type, "scsi") || !strcmp(type, "sat"));
|
|
|
2576b79 |
if (!(scan_ata || scan_scsi))
|
|
|
2576b79 |
return true;
|
|
|
2576b79 |
|
|
|
2576b79 |
diff -Naurp ../smartmontools-5.39.regfix/smartctl.cpp ../smartmontools-5.39/smartctl.cpp
|
|
|
2576b79 |
--- ../smartmontools-5.39.regfix/smartctl.cpp 2010-01-20 15:47:48.215402112 +0100
|
|
|
2576b79 |
+++ ../smartmontools-5.39/smartctl.cpp 2010-01-20 16:12:24.039465040 +0100
|
|
|
2576b79 |
@@ -3,8 +3,8 @@
|
|
|
2576b79 |
*
|
|
|
2576b79 |
* Home page of code is: http://smartmontools.sourceforge.net
|
|
|
2576b79 |
*
|
|
|
2576b79 |
- * Copyright (C) 2002-9 Bruce Allen <smartmontools-support@lists.sourceforge.net>
|
|
|
2576b79 |
- * Copyright (C) 2008-9 Christian Franke <smartmontools-support@lists.sourceforge.net>
|
|
|
2576b79 |
+ * Copyright (C) 2002-10 Bruce Allen <smartmontools-support@lists.sourceforge.net>
|
|
|
2576b79 |
+ * Copyright (C) 2008-10 Christian Franke <smartmontools-support@lists.sourceforge.net>
|
|
|
2576b79 |
* Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
|
|
|
2576b79 |
*
|
|
|
2576b79 |
* This program is free software; you can redistribute it and/or modify
|
|
|
2576b79 |
@@ -730,7 +730,7 @@ const char * parse_options(int argc, cha
|
|
|
2576b79 |
// print output is switchable, then start with the print output
|
|
|
2576b79 |
// turned off
|
|
|
2576b79 |
if (con->printing_switchable)
|
|
|
2576b79 |
- con->dont_print = false;
|
|
|
2576b79 |
+ con->dont_print = true;
|
|
|
2576b79 |
|
|
|
2576b79 |
// error message if user has asked for more than one test
|
|
|
2576b79 |
if (testcnt > 1) {
|