Changeset 3249
- Timestamp:
- 01/31/11 20:33:37 (2 years ago)
- Location:
- trunk/smartmontools
- Files:
-
- 4 modified
-
CHANGELOG (modified) (1 diff)
-
ataprint.cpp (modified) (6 diffs)
-
scsiprint.cpp (modified) (16 diffs)
-
smartctl.8.in (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/smartmontools/CHANGELOG
r3248 r3249 41 41 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE> 42 42 43 [CF] smartctl: Print help message if no option is specified (ticket #39). 44 Don't issue any other ATA command if only '-n POWERMODE' is specified. 45 43 46 [CF] smartd: Output multiple lines via separate syslog(3) calls 44 47 (ticket #135). -
trunk/smartmontools/ataprint.cpp
r3247 r3249 1762 1762 int ataPrintMain (ata_device * device, const ata_print_options & options) 1763 1763 { 1764 int returnval = 0;1765 1766 1764 // If requested, check power mode first 1767 1765 const char * powername = 0; … … 1773 1771 case -1: 1774 1772 if (errno == ENOSYS) { 1775 pout("CHECK POWER STATUS not implemented, ignoring -n Option\n"); break;1773 pout("CHECK POWER MODE not implemented, ignoring -n option\n"); break; 1776 1774 } 1777 1775 powername = "SLEEP"; powerlimit = 2; … … 1784 1782 powername = "ACTIVE or IDLE"; break; 1785 1783 default: 1786 pout("CHECK POWER STATUS returned %d, not ATA compliant, ignoring -n Option\n", powermode);1784 pout("CHECK POWER MODE returned unknown value 0x%02x, ignoring -n option\n", powermode); 1787 1785 break; 1788 1786 } … … 1825 1823 ); 1826 1824 1825 // SMART and GP log directories needed ? 1826 bool need_smart_logdir = options.smart_logdir; 1827 1828 bool need_gp_logdir = ( 1829 options.gp_logdir 1830 || options.smart_ext_error_log 1831 || options.smart_ext_selftest_log 1832 || options.sataphy 1833 ); 1834 1835 unsigned i; 1836 for (i = 0; i < options.log_requests.size(); i++) { 1837 if (options.log_requests[i].gpl) 1838 need_gp_logdir = true; 1839 else 1840 need_smart_logdir = true; 1841 } 1842 1843 // SCT commands needed ? 1844 bool need_sct_support = ( 1845 options.sct_temp_sts 1846 || options.sct_temp_hist 1847 || options.sct_temp_int 1848 || options.sct_erc_get 1849 || options.sct_erc_set 1850 ); 1851 1852 // Exit if no further options specified 1853 if (!( options.drive_info || need_smart_support 1854 || need_smart_logdir || need_gp_logdir 1855 || need_sct_support )) { 1856 if (powername) 1857 pout("Device is in %s mode\n", powername); 1858 else 1859 pout("ATA device successfully opened\n\n" 1860 "Use 'smartctl -a' (or '-x') to print SMART (and more) information\n\n"); 1861 return 0; 1862 } 1863 1827 1864 // Start by getting Drive ID information. We need this, to know if SMART is supported. 1865 int returnval = 0; 1828 1866 ata_identify_device drive; memset(&drive, 0, sizeof(drive)); 1829 1867 int retid = ataReadHDIdentity(device,&drive); … … 2147 2185 } 2148 2186 2149 // SMART and GP log directories needed? 2150 bool need_smart_logdir = ( 2151 options.smart_logdir 2152 // If GP Log is supported use smart log directory for 2153 // error and selftest log support check. 2154 || ( isGeneralPurposeLoggingCapable(&drive) 2155 && ( options.smart_error_log || options.smart_selftest_log 2156 || options.retry_error_log || options.retry_selftest_log)) 2157 ); 2158 2159 bool need_gp_logdir = ( 2160 options.gp_logdir 2161 || options.smart_ext_error_log 2162 || options.smart_ext_selftest_log 2163 || options.sataphy 2164 ); 2165 2166 unsigned i; 2167 for (i = 0; i < options.log_requests.size(); i++) { 2168 if (options.log_requests[i].gpl) 2169 need_gp_logdir = true; 2170 else 2171 need_smart_logdir = true; 2172 } 2187 // If GP Log is supported use smart log directory for 2188 // error and selftest log support check. 2189 if ( isGeneralPurposeLoggingCapable(&drive) 2190 && ( options.smart_error_log || options.smart_selftest_log 2191 || options.retry_error_log || options.retry_selftest_log)) 2192 need_smart_logdir = true; 2173 2193 2174 2194 ata_smart_log_directory smartlogdir_buf, gplogdir_buf; … … 2375 2395 // SCT commands 2376 2396 bool sct_ok = false; 2377 if ( options.sct_temp_sts || options.sct_temp_hist || options.sct_temp_int 2378 || options.sct_erc_get || options.sct_erc_set ) { 2397 if (need_sct_support) { 2379 2398 if (!isSCTCapable(&drive)) { 2380 2399 pout("Warning: device does not support SCT Commands\n"); -
trunk/smartmontools/scsiprint.cpp
r3196 r3249 1571 1571 int res, durationSec; 1572 1572 1573 bool any_output = options.drive_info; 1574 1573 1575 res = scsiGetDriveInfo(device, &peripheral_type, options.drive_info); 1574 1576 if (res) { … … 1577 1579 else 1578 1580 failuretest(MANDATORY_CMD, returnval |= FAILID); 1581 any_output = true; 1579 1582 } 1580 1583 … … 1582 1585 if (scsiSmartEnable(device)) 1583 1586 failuretest(MANDATORY_CMD, returnval |= FAILSMART); 1587 any_output = true; 1584 1588 } 1585 1589 … … 1587 1591 if (scsiSmartDisable(device)) 1588 1592 failuretest(MANDATORY_CMD,returnval |= FAILSMART); 1593 any_output = true; 1589 1594 } 1590 1595 … … 1594 1599 failuretest(OPTIONAL_CMD,returnval |= FAILSMART); 1595 1600 } 1601 any_output = true; 1596 1602 } 1597 1603 … … 1601 1607 failuretest(OPTIONAL_CMD,returnval |= FAILSMART); 1602 1608 } 1609 any_output = true; 1603 1610 } 1604 1611 … … 1624 1631 } 1625 1632 } 1633 any_output = true; 1626 1634 } 1627 1635 if (options.smart_vendor_attrib) { … … 1642 1650 scsiPrintSeagateFactoryLPage(device); 1643 1651 } 1652 any_output = true; 1644 1653 } 1645 1654 if (options.smart_error_log) { … … 1650 1659 pout("\n[GLTSD (Global Logging Target Save Disable) set. " 1651 1660 "Enable Save with '-S on']\n"); 1661 any_output = true; 1652 1662 } 1653 1663 if (options.smart_selftest_log) { … … 1663 1673 if (0 != res) 1664 1674 failuretest(OPTIONAL_CMD, returnval|=res); 1675 any_output = true; 1665 1676 } 1666 1677 if (options.smart_background_log) { … … 1676 1687 if (0 != res) 1677 1688 failuretest(OPTIONAL_CMD, returnval|=res); 1689 any_output = true; 1678 1690 } 1679 1691 if (options.smart_default_selftest) { … … 1681 1693 return returnval | FAILSMART; 1682 1694 pout("Default Self Test Successful\n"); 1695 any_output = true; 1683 1696 } 1684 1697 if (options.smart_short_cap_selftest) { … … 1686 1699 return returnval | FAILSMART; 1687 1700 pout("Short Foreground Self Test Successful\n"); 1701 any_output = true; 1688 1702 } 1689 1703 if (options.smart_short_selftest) { … … 1692 1706 pout("Short Background Self Test has begun\n"); 1693 1707 pout("Use smartctl -X to abort test\n"); 1708 any_output = true; 1694 1709 } 1695 1710 if (options.smart_extend_selftest) { … … 1707 1722 } 1708 1723 pout("Use smartctl -X to abort test\n"); 1724 any_output = true; 1709 1725 } 1710 1726 if (options.smart_extend_cap_selftest) { … … 1717 1733 return returnval | FAILSMART; 1718 1734 pout("Self Test returned without error\n"); 1735 any_output = true; 1719 1736 } 1720 1737 if (options.sasphy) { 1721 1738 if (scsiPrintSasPhy(device, options.sasphy_reset)) 1722 1739 return returnval | FAILSMART; 1740 any_output = true; 1723 1741 } 1742 1743 if (!any_output) 1744 pout("SCSI device successfully opened\n\n" 1745 "Use 'smartctl -a' (or '-x') to print SMART (and more) information\n\n"); 1746 1724 1747 return returnval; 1725 1748 } -
trunk/smartmontools/smartctl.8.in
r3203 r3249 544 544 checks when the device is in a low\-power mode. It may be used to prevent 545 545 a disk from being spun\-up by \fBsmartctl\fP. The power mode is ignored by 546 default. The allowed values of POWERMODE are: 546 default. A nonzero exit status is returned if the device is in one of the 547 specified low\-power modes (see RETURN VALUES below). 548 549 Note: If this option is used it may also be necessary to specify the device 550 type with the \'-d\' option. Otherwise the device may spin up due to 551 commands issued during device type autodetection. 552 553 The valid arguments to this option are: 547 554 548 555 .I never … … 1671 1678 .B smartctl \-a /dev/sdb 1672 1679 .fi 1673 Print a large amount of SMART information for drive /dev/sd a. This may1680 Print a large amount of SMART information for drive /dev/sdb . This may 1674 1681 be a SCSI disk or an ATA (SATA) disk. 1675 1682 .PP … … 1803 1810 .TP 1804 1811 .B Bit 1: 1805 Device open failed, or device did not return an IDENTIFY DEVICE structure. 1812 Device open failed, device did not return an IDENTIFY DEVICE structure, 1813 or device is in a low-power mode (see \'\-n\' option above). 1806 1814 .TP 1807 1815 .B Bit 2: