]> git.proxmox.com Git - mirror_smartmontools-debian.git/commitdiff
Imported Upstream version 5.42+svn3521
authorGiuseppe Iuculano <iuculano@debian.org>
Wed, 7 Mar 2012 22:23:28 +0000 (23:23 +0100)
committerGiuseppe Iuculano <iuculano@debian.org>
Wed, 7 Mar 2012 22:23:28 +0000 (23:23 +0100)
52 files changed:
CHANGELOG
COPYING
INSTALL
Makefile.am
NEWS
atacmds.cpp
atacmds.h
ataprint.cpp
ataprint.h
autogen.sh
cciss.cpp
cissio_freebsd.h [new file with mode: 0644]
configure.in
dev_interface.cpp
dev_interface.h
drivedb.h
int64.h
knowndrives.cpp
os_freebsd.cpp
os_linux.cpp
os_solaris.cpp
os_win32.cpp
os_win32/daemon_win32.cpp
os_win32/installer.nsi
os_win32/runcmd.c [new file with mode: 0644]
os_win32/runcmd_vc10.vcxproj [new file with mode: 0644]
os_win32/runcmda.exe.manifest [new file with mode: 0644]
os_win32/runcmdu.exe.manifest [new file with mode: 0644]
os_win32/smartctl_vc10.vcxproj [new file with mode: 0644]
os_win32/smartctl_vc10.vcxproj.filters [new file with mode: 0644]
os_win32/smartctl_vc8.vcproj [deleted file]
os_win32/smartd_vc10.vcxproj [new file with mode: 0644]
os_win32/smartd_vc10.vcxproj.filters [new file with mode: 0644]
os_win32/smartd_vc8.vcproj [deleted file]
os_win32/smartmontools_vc10.sln [new file with mode: 0644]
os_win32/smartmontools_vc8.sln [deleted file]
os_win32/syslogevt_vc10.vcxproj [new file with mode: 0644]
os_win32/syslogevt_vc8.vcproj [deleted file]
os_win32/update-smart-drivedb.nsi
os_win32/wmiquery.h
scsiata.cpp
scsicmds.h
scsiprint.cpp
scsiprint.h
smartctl.8.in
smartctl.cpp
smartd.8.in
smartd.conf.5.in
smartd.cpp
smartd.freebsd.initd.in
utility.cpp
utility.h

index 120ae90d5dde4f2ddb59e15d8b8bf1a849db2db6..dc727559401bbed4a60556fcffbb4901bacb2c23 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,6 @@
 CHANGELOG for smartmontools
 
-$Id: CHANGELOG 3365 2011-06-09 18:47:31Z chrfranke $
+$Id: CHANGELOG 3521 2012-03-06 21:15:25Z chrfranke $
 
 The most recent version of this file is:
 http://smartmontools.svn.sourceforge.net/viewvc/smartmontools/trunk/smartmontools/CHANGELOG?view=markup
@@ -41,6 +41,445 @@ Maintainers / Developers Key (alphabetic order):
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
 
+  [CF] Windows: Add Win8 to get_os_version_str().
+
+  [CF] Windows: Remove MSVC specific pragma, disable warning in project file.
+
+  [CF] Add '-d sat,auto[,N]' option for controller independent SAT detection.
+
+  [CF] dev_interface.h: Replace this_is_ata/scsi(*) by hide_ata/scsi(bool).
+
+  [CF] smartctl: Allow '-d test' in conjunction with other '-d TYPE' options.
+
+  [AS] FreeBSD: sync init script with one from ports repository.
+
+  [CF] drivedb.h updates:
+       - SandForce Driven SSDs: ADATA S510
+       - JMicron based SSDs: Toshiba THNSNC128GMLJ
+       - Samsung based SSDs: 830 Series
+       - Hitachi Deskstar E7K1000
+       - Hitachi Ultrastar A7K1000: Fix name, allow trailing characters
+       - Hitachi Ultrastar A7K2000: Remove duplicate entry
+       - Toshiba 2.5" HDD MK..55GSX
+       - Western Digital AV-GP: WD..EURS variants
+
+  [CF] drivedb.h USB updates:
+       - Buffalo MiniStation HD-PCTU2 (0x0411:0x01d9) (ticket #211)
+       - Philips SDE3273VC/97 (0x0471:0x2021) (ticket #212)
+       - Samsung M2 Portable 3.0 (0x04e8:0x60c5)
+       - Iomega GDHDU2 (0x059b:0x0475)
+       - LaCie minimus USB 3.0 (0x059f:0x104a)
+       - Seagate FreeAgent GoFlex Desk USB 3.0 (0x0bc2:0x50a5)
+       - Maxtor BlackArmor Portable (0x0d49:0x7550)
+       - WD My Passport Essential SE USB 3.0 (0x1058:0x0742)
+       - Initio (0x13fd:0x1e40)
+       - Verbatim External Hard Drive 2TB (0x18a5:0x022a)
+       - Hitachi Touro Desk (0x4971:0x1011)
+
+  [CF] smartd: Add smartd.conf directive '-e' to set ATA settings on
+       startup: aam, apm, lookahead, security-freeze, standby, wcache.
+
+  [CF] drivedb.h updates:
+       - SandForce Driven SSDs: Corsair Force GT
+       - Indilinx Barefoot based SSDs: Corsair Nova
+       - SAMSUNG SpinPoint M8
+       - Seagate SV35.5
+
+  [CF] smartctl: Change short option for '--set' from '-e' to '-s'.
+       Keep backward compatibility with short option for '--smart'.
+
+  [CF] smartctl: Print description of APM level.
+
+  [CF] smartctl: Add option '-e standby,[N|off|now]' to set standby timer
+       or standby mode.
+
+  [CF] smartctl: Add options '-g security' and '-e security-freeze' to
+       get/freeze ATA security settings.
+
+  [CF] smartctl: Add options '-g/e lookahead' and '-g/e wcache' to get/set
+       read look-ahead and write cache feature.
+
+  [CF] smartctl: Add options '-g aam' and '-e aam,[N|off]' to get/set
+       ATA Automatic Acoustic Management feature.  Add '-g all'.
+
+  [CF] os_win32.cpp: Prevent warnings from gcc option -Wformat-security.
+
+  [CF] smartctl: Add options '-g, --get apm' and '-e, --set apm,[N|off]'
+       to get/set ATA Advanced Power Management feature.
+       Original patch was provided by Marcus Sorensen.
+
+  [AS] os_freebsd.cpp - do not skip ATA devices from cam list. Starting from
+       FreeBSD 9.0 such devices are exported ONLY as camdev`s, so DEVICESCAN
+       was broken. Its possible to get duplicates now on some old systems.
+
+  [CF] drivedb.h updates:
+       - SandForce Driven SSDs: Add OCZ Solid 3, OCZ Deneva 2 C/R
+       - Seagate Momentus 5400.7
+
+  [CF] Happy New Year! Update copyright year in version info.
+
+  [CF] drivedb.h updates:
+       - SandForce Driven SSDs: Add Patriot Pyro
+       - Intel 320 Series SSDs: Fix 40GB
+       - Seagate Barracuda XT: Add 4TB
+
+  [CF] drivedb.h updates:
+       - SandForce Driven SSDs: Add Corsair Force 3
+       - Hitachi Travelstar 5K320: Add SA00 and SA02 models
+       - Western Digital Caviar SE SATA: Add 300GB
+
+  [CF] Cygwin smartd: Remove SIGQUIT workaround, no longer needed with
+       current Cygwin tty emulation.
+
+  [CF] smartd: Disable auto standby also after start of scheduled
+       self-test.
+
+  [CF] smartd: Add smartd.conf DEFAULT directive.  Allows to set default
+       settings for multiple devices.
+
+  [CF] smartd: Re-enable auto standby if smartd.conf is re-read.
+
+  [AS] drivedb.h update: Seagate Barracuda (SATA 3Gb/s, 4K Sectors)
+
+  [AS] drivedb.h update: Seagate Constellation ES.2 (SATA 6Gb/s)
+
+  [CF] drivedb.h updates:
+       - Sandforce Driven SSDs: Add OCZ Vertex 3 Max IOPS (ticket #209)
+       - Seagate ST1.2 CompactFlash (found in ticket #125)
+
+  [CF] Fix GPL version reported by '-V' option.
+       Now reports GPLv2+ which is consistent with file headers.
+       Patch was provided by Stanislav Brabec.
+
+  [CF] drivedb.h updates:
+       - Sandforce Driven SSDs: Add OCZ Deneva 2 Async variant, 60GB, 480GB
+       - Indilinx Martini based SSDs: OCZ VERTEX-PLUS only
+
+  [CF] smartd: Add '-l offlinests,ns' and '-l selfteststs,ns' directives.
+       dev_interface: Add smart_interface::disable_system_auto_standby().
+       os_win32.cpp: Implement disable_system_auto_standby().
+
+  [CF] dev_interface: Let smart_interface::set_err() return false.
+
+  [CF] drivedb.h updates:
+       - SAMSUNG SpinPoint M8U (USB)
+       - Toshiba 3.5" HDD MKx002TSKB: Fix typo
+
+  [CF] smartctl: Print average temperature from SCT status only if
+       value is reasonable.  Field is not part of ATA-8.
+
+  [CF] smartd: Report ignored '-r' and '-R' directives.
+
+  [CF] smartctl: Use 16-bit value (ATA-8) for extended self-test polling
+       time if 8-bit value is 0xff (ticket #207).
+
+  [CF] drivedb.h updates:
+       - SandForce Driven SSDs: Add OCZ-REVODRIVE3, OCZ Z-DRIVE R4
+       - Hitachi Travelstar Z7K320
+       - Toshiba 2.5" HDD MK..56GSY
+       - Toshiba 2.5" HDD MKx002TSKB
+       - Seagate U9
+       - Seagate U*: sort entries, unify names, remove duplicate
+       - Seagate Constellation ES (SATA 6Gb/s)
+       - Seagate DB35
+       - Seagate DB35.2
+       - Western Digital Scorpio Black: Add 500GB
+       - Western Digital Scorpio Black (Adv. Format)
+
+  [CF] drivedb.h USB updates:
+       - Samsung S2 (0x04e8:0x1f05)
+       - Toshiba Stor.E (0x0939:0x0b16) (ticket #206)
+       - Seagate FreeAgent (0x0bc2:0x5040)
+       - Initio/Thermaltake BlacX (0x13fd:0x0840)
+
+  [DG] [SCSI] smartd: skip non-storage devices (e.g. SES devices)
+
+  [AS] drivedb.h updates: Added Seagate SV35 Series
+
+  [CF] smartctl: Don't start ATA self-test if another test is already
+       running (ticket #40).  Add option '-t force' to allow override.
+
+  [CF] atacmds.h: Remove bogus ataSmart*Test*() prototypes.
+
+  [CF] Define __attribute_format_printf() for functions with printf() style
+       arguments.  Allow MinGW build with __USE_MINGW_ANSI_STDIO enabled.
+
+  [CF] Makefile.am: Replace sed compound command in MAN_FILTER.
+       This fixes build on Solaris (ticket #203).
+
+  [AS] os_freebsd.cpp: Dereference symlinks before guess of device type
+       (problem reported by email).
+
+  [CF] drivedb.h USB updates:
+       - LG Mini HXD5 (0x043e:0x70f1)
+       - Freecom/Intel (0x07ab:0xfc8e)
+       - Dura Micro (0x0c0b:0xb001) (Debian bug 643928)
+       - Initio 6Y120L0 (0x13fd:0x1150): unsupported
+
+  [CF] drivedb.h USB update:
+       - Seagate FreeAgent GoFlex Desk USB 3.0 (0x0bc2:0x50a1):
+         Revert to -d sat,12 (ticket #151).
+
+  [AS] os_freebsd.cpp - fixed crash on FreeBSD9-RC1 caused by r225950
+
+  [AS] smartctl.8 - added information about -d areca on FreeBSD
+
+  [AS] os_freebsd.cpp: backport quirks for the LSI controllers with SATA
+       disks to the FreeBSD. Tested with DELL Perc/6i controller.
+
+  [AS] os_freebsd.cpp: disable SAT autodetection on megaraid controllers
+
+  [AS] drivedb.h update: 
+       - Hitachi Ultrastar 7K2000
+
+  [CF] drivedb.h update:
+       - Seagate Momentus XT: Add bug warning for firmware SD24 and SD25
+
+  [CF] Don't include pkg-config macros in aclocal.m4, copy to m4/pkg.m4
+       instead.  Allow builds from SVN without pkg-config installed
+       but prevent 'make dist' when pkg-config support is missing.
+
+  [CF] Move automake --foreign option from autogen.sh to configure.in.
+       This fixes autoreconf support.
+
+  [CF] Replace COPYING file with current (2010-03-24) version from
+       http://www.gnu.org/licenses/gpl-2.0.txt
+
+smartmontools 5.42 2011-10-20
+
+  [CF] Windows installer: Add install dir to PATH in CMD shortcut.
+
+  [CF] drivedb.h updates:
+       - SAMSUNG SpinPoint MP5
+       - Seagate Barracuda 7200.11: Change warning text, Seagate
+         apparently released fixed firmware without changing version
+         number (Debian bug 632758)
+       - Western Digital RE4 GP
+       - Western Digital VelociRaptor: Add 150GB, 300GB LHX variants
+       - Western Digital Scorpio Blue Serial ATA (Adv. Format):
+         Add 1TB JPVT variant
+
+  [CF] drivedb.h USB update:
+       - WD Elements SE USB 3.0 (0x1058:0x1042)
+
+  [CF] Windows installer: Rework to support UAC.
+       Replace *-run.bat files by runcmd?.exe wrappers.
+       Run drive menu entries elevated (ticket #173).
+
+  [CF] smartctl.8.in: Add example script which prints all status bits
+       (ticket #191).
+
+  [CF] Cygwin smartd: Remove '--service' option, update man page.
+
+  [CF] smartd: Require absolute path name also for '-p' option.
+       Allow relative path names for '-A', '-s', '-p' in Windows
+       version only.
+
+  [CF] smartd: Log model family from drive database if known.
+
+  [CF] drivedb.h update:
+       - SMART Xcel-10 2.5 SATA SSD: Shorten names,
+         document supported default attributes.
+
+  [CF] smartctl -P showall: Report error if attribute name is too long.
+
+  [AS] freebsd: use system ciss header if available, it is added
+       to the base system by recent commit.
+
+  [CF] smartd.conf.5.in: Update Windows 'msgbox' info.
+       Add missing IF/ENDIF for Solaris and Windows.
+
+  [CF] man pages: Remove reference to T13 web site.  It does no
+       longer provide links to the ATA documents.
+
+  [CF] smartctl: Replace '-t scttempint,N[,p]' option
+       by '-l scttempint,N[,p]'.
+
+  [CF] drivedb.h USB update:
+       - Oxford (0x0928:0x0000): unsupported, see
+         https://bugs.freedesktop.org/show_bug.cgi?id=24951
+
+  [CF] Minor cleanup to prevent warnings from new gcc 4.6 options
+       -Wunused-but-set-parameter/variable.
+
+  [CF] Windows smartd: Fix format string for 64-bit version.
+
+  [CF] Remove EXPERIMENTAL notes for features already present in 5.40.
+
+  [CF] smartctl: Add new log addresses from ACS-3 revision 1.
+
+  [CF] smartctl: Print ATA ACS-x versions properly (ticket #183).
+
+  [CF] smartctl: Add option '-l devstat[,PAGE]',
+       print ATA Device Statistics log pages (ticket #106).
+
+       Thanks to David Boreham for providing access to a machine for testing.
+
+  [AS] man pages: trivial man page syntax fixes (ticket #199)
+
+  [CF] drivedb.h update:
+       - SMART Xcel-10 2.5 SATA SSD: Fix syntax error (ticket #200)
+
+  [AS] drivedb.h update:
+       - SMART Xcel-10 2.5 SATA SSD
+
+  [DG] [SCSI] document 'ssd' list option in man page and smartctl usage.
+
+  [CF] Windows: Fix device type detection for Intel ICHxR RAID Volumes.
+
+  [CF] smartd: Resend warning emails if problem reappears (ticket #167).
+
+  [CF] smartd: Add separate directives '-l offlinests' and '-l selfteststs'
+       to enable tracking of status changes.  Disable '-l offlinests' by
+       default to avoid misleading messages (see Debian bug 636078).
+
+  [CF] drivedb.h updates:
+       - Crucial/Micron RealSSD C300/C400: Add m4 series (ticket #192)
+       - SandForce Driven SSDs: Add OCZ-AGILITY3
+       - Indilinx Barefoot based SSDs: Add RENICE Z2
+       - Intel 710 Series SSDs
+
+  [CF] Windows smartd: Fix quoting of service command line.
+
+  [CF] Cygwin smartd: Remove FreeConsole() after fork().
+       No longer needed for recent versions of Cygwin DLL.
+
+  [CF] smartd: Add some sleep() time after machine standby mode.
+       Some drivers (Intel ICHxR Windows driver) report failures if
+       pass-through is accessed immediately after wake up.
+
+  [AS] -d hpt on linux/freebsd - increased max channel number to 16,
+       fixed documentation.
+       (see http://permalink.gmane.org/gmane.linux.utilities.smartmontools/7846)
+
+  [AS] os_linux.cpp - disabling SMART WRITE LOG SECTOR command on 
+       megaraid interface for SATA disks.
+
+  [AS] os_freebsd.cpp: -l scterc was broken on FreeBSD, fixed for atacam and
+       ata drivers (bug #198).
+
+  [CF] drivedb.h updates:
+       - Crucial/Micron RealSSD C300/C400: Add C400
+       - SandForce Driven SSDs: Add Kingston HyperX,
+         OCZ-REVODRIVE, OCZ Deneva 2
+       - Intel X18-M/X25-M/X25-V G2 SSDs: Add 120GB
+       - Hitachi Travelstar 7K200: Match capital letters also
+       - Hitachi Ultrastar 7K3000
+       - Seagate Barracuda Green: Add ST2000DL001-* (ticket #195)
+       - WD My Passport Essential SE: Add WD10TMVW-*
+
+  [CF] drivedb.h USB updates:
+       - Seagate FreeAgent GoFlex USB 3.0 (0x0bc2:0x5071) (ticket #195)
+       - Seagate FreeAgent GoFlex Desk USB 3.0 (0x0bc2:0x50a1):
+         Enable -d sat,16 (ticket #151).
+       - Oyen Digital MiniPro USB 3.0 (0x0dc4:0x020a) (ticket #193)
+       - WD My Passport Essential SE USB 3.0 (0x1058:0x0740)
+
+  [CF] Windows: Add MSVC10 support, remove MSVC8 project files.
+
+  [DG] [SCSI] smartctl output Solid State Media (SSD) percentage used
+       endurance indicator. Add '-l ssd', useful for SATA SSDs?
+
+  [CF] atacmds.cpp: Rework search for temperature min/max values
+       in attributes 190/194.  This fixes temperature tracking
+       for recent WDC drives.
+
+  [CF] drivedb.h USB updates:
+       - LaCie rikiki USB 3.0 (0x059f:0x1057)
+       - Freecom Mobile Drive XXS (0x07ab:0xfc88)
+       - WD Elements SE (0x1058:0x1023)
+
+  [CF] drivedb.h updates:
+       - Indilinx Barefoot based SSDs: Add G.Skill Falcon
+       - JMicron based SSDs (JMF61x): Add Kingston SSDNow V100 Series
+       - Transcend CompactFlash Cards: Add 8, 16GB
+       - Toshiba 1.8" HDD MD..29GSG
+       - SAMSUNG SpinPoint M7U
+       - Western Digital Caviar Green (Adv. Format): Add SATA 6Gb/s variants
+       - Western Digital My Passport USB: Shorten names
+
+  [DG] [SCSI] smartd initial log entry for each drive now shows INQUIRY
+       strings and optionally the LU (logical unit) id and capacity
+
+  [AS] os_freebsd.cpp: fixed return type in autodetect_smart_device.
+
+  [CF] drivedb.h USB updates:
+       - WD My Book Essential (0x1058:0x0910, Debian bug 633724)
+       - Atech (0x11b0:0x6298)
+
+  [CF] drivedb.h update:
+       - Seagate Barracuda ES.2: Add Dell firmware versions (ticket #189)
+
+  [CF] drivedb.h updates:
+       - Seagate Maxtor DiamondMax 21: Add STM380215AS
+       - Seagate Barracuda 7200.12: Add ST3250312AS, ST31000524AS
+       - Toshiba 2.5" HDD MK..50GACY
+       - Toshiba 2.5" HDD MK..76GSX
+
+  [AS] smartd.8 - removed configuration file information from this manual,
+       added reference to smartd.conf.5.
+
+  [AS] smartd.conf.5 - added more platform-specific sections, corrected "areca"
+       device information, corrected sample configuration.
+
+  [AS] os_freebsd.cpp: detecting access to /dev/mfidX devices to show help (#97)
+
+  [CF] Update configure options in INSTALL file, remove outdated info.
+
+  [CF] int64.h: Remove outdated uint64_to_double() workaround for MSVC6.
+
+  [CF] os_win32/update-smart-drivedb.nsi: Add support for /S(ilent) option.
+
+  [CF] configure.in: Don't search for initddir and systemdsystemunitdir
+       when cross-compiling.
+
+  [CF] Makefile.am: Use same syntax also for ENABLE_* man page sections.
+
+  [CF] Add experimental support for platform-specific man pages.
+
+  [CF] Windows: Move '-I os_win32' from configure.in to Makefile.am.
+
+  [CF] configure.in: Fix check for __attribute__((packed)).
+
+  [CF] drivedb.h USB update:
+       - Verbatim Portable Hard Drive (0x18a5:0x0214)
+
+  [CF] drivedb.h update:
+       - SandForce Driven SSDs: Add OWC Mercury Extreme Pro RE (ticket #168)
+
+  [CF] os_linux.cpp: Let MegaRAID autodetect_open() fail for SATA devices.
+       MegaRAID SAT layer has serious bugs as reported by AS.
+
+  [AS] os_freebsd.cpp: Implement 48bit support for the new "atacam" 
+       interface. Tested on FreeBSD 8.2 and works fine. 
+
+  [CF] os_win32.cpp: Fix USB ID detection if two devices with the same
+       name exist (ticket #178).
+
+  [AS] os_freebsd.cpp: including ciss headers to the base, we can not rely 
+       on the header sources in the build time. Also this file was changed 
+       last time > 2 yrs. ago and it is unlikely that it will be changed in 
+       the feature. This will fix FreeBSD PR 150235.
+
+  [AS] drivedb.h update: Added Samsung Story Station 3.0 USB.
+
+  [AS] os_linux.cpp: Areca code converted to the new interface.
+       Patch is based on os_freebsd.cpp patch and is not tested yet.
+
+  [AS] os_freebsd.cpp: Areca code converted to the new interface.
+
+  [AS] os_freebsd.cpp: Added support for the Areca RAID controllers. 
+       Support is basesd on Linux code, but using IOCTL on areca control
+       device instead of SCSI commands to talk with the drives. Hardware
+       access was provided by Andrej Binder.
+
+  [CF] Don't use isprint() for ASCII character check as it may be affected
+       by setlocale().
+
+  [AS] os_freebsd.cpp: Remove all referenced to the FreeBSD 5.0.
+       It is unsupported for a very long time and probably will not compile
+       and work anyway. Also this will fix bug #154.
+
 smartmontools 5.41 2011-06-09
 
   [MS] drivedb.h: revert attribute 190 to default for Samsung SSD controllers,
diff --git a/COPYING b/COPYING
index d60c31a97a544b53039088d14fe9114583c0efc3..d159169d1050894d3ea3b98e1c965c4058208fe1 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -1,12 +1,12 @@
-                   GNU GENERAL PUBLIC LICENSE
-                      Version 2, June 1991
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
 
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
    59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
-                           Preamble
+                            Preamble
 
   The licenses for most software are designed to take away your
 freedom to share and change it.  By contrast, the GNU General Public
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users.  This
 General Public License applies to most of the Free Software
 Foundation's software and to any other program whose authors commit to
 using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
+the GNU Lesser General Public License instead.)  You can apply it to
 your programs, too.
 
   When we speak of free software, we are referring to freedom, not
@@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
 
   The precise terms and conditions for copying, distribution and
 modification follow.
-\f
-                   GNU GENERAL PUBLIC LICENSE
+
+                    GNU GENERAL PUBLIC LICENSE
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
   0. This License applies to any program or other work which contains
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
     License.  (Exception: if the Program itself is interactive but
     does not normally print such an announcement, your work based on
     the Program is not required to print an announcement.)
-\f
+
 These requirements apply to the modified work as a whole.  If
 identifiable sections of that work are not derived from the Program,
 and can be reasonably considered independent and separate works in
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
 access to copy the source code from the same place counts as
 distribution of the source code, even though third parties are not
 compelled to copy the source along with the object code.
-\f
+
   4. You may not copy, modify, sublicense, or distribute the Program
 except as expressly provided under this License.  Any attempt
 otherwise to copy, modify, sublicense or distribute the Program is
@@ -225,7 +225,7 @@ impose that choice.
 
 This section is intended to make thoroughly clear what is believed to
 be a consequence of the rest of this License.
-\f
+
   8. If the distribution and/or use of the Program is restricted in
 certain countries either by patents or by copyrighted interfaces, the
 original copyright holder who places the Program under this License
@@ -255,7 +255,7 @@ make exceptions for this.  Our decision will be guided by the two goals
 of preserving the free status of all derivatives of our free software and
 of promoting the sharing and reuse of software generally.
 
-                           NO WARRANTY
+                            NO WARRANTY
 
   11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGES.
 
-                    END OF TERMS AND CONDITIONS
-\f
-           How to Apply These Terms to Your New Programs
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
 
   If you develop a new program, and you want it to be of the greatest
 possible use to the public, the best way to achieve this is to make it
@@ -303,17 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
 
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 Also add information on how to contact you by electronic and paper mail.
 
 If the program is interactive, make it output a short notice like this
 when it starts in an interactive mode:
 
-    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision version 69, Copyright (C) year name of author
     Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
     This is free software, and you are welcome to redistribute it
     under certain conditions; type `show c' for details.
@@ -336,5 +335,5 @@ necessary.  Here is a sample; alter the names:
 This General Public License does not permit incorporating your program into
 proprietary programs.  If your program is a subroutine library, you may
 consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
+library.  If this is what you want to do, use the GNU Lesser General
 Public License instead of this License.
diff --git a/INSTALL b/INSTALL
index 2e457759c3742184cd8a6a6277cce4d924ec12bd..afbb47a20ae094e96c27d4e9b54890282f37fafb 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,7 +1,7 @@
 Smartmontools installation instructions
 =======================================
 
-$Id: INSTALL 3356 2011-06-06 18:37:53Z chrfranke $
+$Id: INSTALL 3414 2011-09-09 21:07:55Z chrfranke $
 
 Please also see the smartmontools home page:
 http://smartmontools.sourceforge.net/
@@ -234,9 +234,11 @@ Table of contents:
     --sbindir=/usr/local/sbin
     --sysconfdir=/usr/local/etc
     --mandir=/usr/local/share/man
-    --[with-]docdir=/usr/local/share/doc/smartmontools
+    --docdir=/usr/local/share/doc/smartmontools
+    --with-exampledir=/usr/local/share/doc/smartmontools/examplescripts
     --with-drivedbdir=/usr/local/share/smartmontools
-    --with-initscriptdir=/usr/local/etc/rc.d/init.d
+    --with-initscriptdir=auto
+    --with-systemdsystemunitdir=auto
     --enable-drivedb
     --disable-attributelog
     --disable-sample
@@ -276,15 +278,15 @@ Filesystem Hierarchy Standard (FHS, http://www.pathname.com/fhs/):
   ./configure --sbindir=/usr/local/sbin                               \
               --sysconfdir=/usr/local/etc                             \
               --mandir=/usr/local/man                                 \
-              --with-initscriptdir=/usr/local/etc/rc.d/init.d         \
-              --with-docdir=/usr/local/share/doc/smartmontools-VERSION
+              --docdir=/usr/local/share/doc/smartmontools             \
+              --with-initscriptdir=/usr/local/etc/init.d
 
 Red Hat:
   ./configure --sbindir=/usr/sbin                               \
               --sysconfdir=/etc                                 \
               --mandir=/usr/share/man                           \
-              --with-initscriptdir=/etc/rc.d/init.d             \
-              --with-docdir=/usr/share/doc/smartmontools-VERSION
+              --docdir=/usr/share/doc/smartmontools             \
+              --with-initscriptdir=/etc/rc.d/init.d
 
 Slackware:
   If you don't want to overwrite any "distribution" package, use:
@@ -294,8 +296,8 @@ Slackware:
   ./configure --sbindir=/usr/sbin                               \
               --sysconfdir=/etc                                 \
               --mandir=/usr/share/man                           \
-              --with-initscriptdir=/etc/rc.d                    \
-              --with-docdir=/usr/share/doc/smartmontools-VERSION
+              --docdir=/usr/share/doc/smartmontools             \
+              --with-initscriptdir=/etc/rc.d
 
   And
   removepkg smartmontools smartsuite (only root can do this)
@@ -318,8 +320,8 @@ SuSE:
   ./configure --sbindir=/usr/sbin                                        \
               --sysconfdir=/etc                                          \
               --mandir=/usr/share/man                                    \
+              --docdir=/usr/share/doc/packages/smartmontools-VERSION     \
               --with-initscriptdir=/etc/init.d                           \
-              --with-docdir=/usr/share/doc/packages/smartmontools-VERSION
 
 [5] Guidelines for FreeBSD
 ==========================
@@ -327,8 +329,8 @@ SuSE:
   the following:
 
   ./configure --prefix=/usr/local                                      \
+              --docdir=/usr/local/share/doc/smartmontools-VERSION      \
               --with-initscriptdir=/usr/local/etc/rc.d/                \
-              --with-docdir=/usr/local/share/doc/smartmontools-VERSION \
               --enable-sample
 
   NOTE: --enable-sample will cause the smartd.conf and smartd RC files to
@@ -349,14 +351,10 @@ SuSE:
     ./configure --host=i386-apple-darwin \
                 --with-initscriptdir=/Library/StartupItems
 
-[7] Guidelines for NetBSD/OpenBSD
-=================================
+[7] Guidelines for NetBSD
+=========================
   ./configure --prefix=/usr/pkg                                       \
-              --with-docdir=/usr/pkg/share/doc/smartmontools
-
-  On OpenBSD, it is important that you use GNU make (gmake from 
-  /usr/ports/devel/gmake) to build smartmontools, as the BSD make doesn't
-  know how to make the manpages.
+              --docdir=/usr/pkg/share/doc/smartmontools
 
 [8] Guidelines for Solaris
 ==========================
@@ -380,7 +378,7 @@ SuSE:
      --sbindir=/usr/sbin                                \
      --sysconfdir=/etc                                  \
      --mandir=/usr/share/man                            \
-     --with-docdir=/usr/share/doc/smartmontools-VERSION \
+     --docdir=/usr/share/doc/smartmontools-VERSION      \
      --with-initscriptdir=/etc/init.d
 
     To start the script automatically on bootup, create hardlinks that
@@ -412,8 +410,8 @@ Same as Red Hat:
   ./configure --sbindir=/usr/sbin                               \
               --sysconfdir=/etc                                 \
               --mandir=/usr/share/man                           \
-              --with-initscriptdir=/etc/rc.d/init.d             \
-              --with-docdir=/usr/share/doc/smartmontools
+              --docdir=/usr/share/doc/smartmontools             \
+              --with-initscriptdir=/etc/rc.d/init.d
 
   Using DOS text file type as default for the working directories ("textmode"
   mount option) is not recommended. Building the binaries and man pages using
@@ -426,7 +424,7 @@ Same as Red Hat:
   longer accept scripts with CR/LF by default. To run the initial script
   ./autogen.sh checked out with CR/LF on a "binmode" mount, type:
 
-  bash -O igncr ./autogen.sh
+  bash -o igncr ./autogen.sh
 
   instead. This is not necessary for the generated ./configure script.
 
@@ -520,17 +518,17 @@ To both create and run the (interactive) installer, use:
   and resource compiler (windres) are available. This may be disabled
   by passing 'WINDMC=no' to configure.
 
-To prepare os_win32 directory for MSVC8, use the following on MSYS
-or Cygwin:
+To prepare os_win32 directory for MS Visual Studio C++ 2010 [Express],
+use the following on MSYS or Cygwin:
 
   mkdir vctmp && cd vctmp
   ../configure [... any MinGW option set from above ...]
-  make config-vc8
+  make config-vc10
 
-  The MSVC8 project files (os_win32/smartmontools_vc8.sln,
-  os_win32/smart{ctl,d}_vc8.vcproj) are included in SVN (but not in
-  source tarball). The target config-vc8 from a Makefile configured
-  for MinGW creates os_win32/{config,svnversion}_vc8.h from
+  The MSVC project files (os_win32/smartmontools_vc10.sln,
+  os_win32/smart{ctl,d}_vc10.vcxproj) are included in SVN (but not in
+  source tarball). The target config-vc10 from a Makefile configured
+  for MinGW creates os_win32/{config,svnversion}_vc10.h from
   ./{config,svnversion}.h. The configure skript must be run outside
   of the source directory to avoid inclusion of the original config.h.
 
@@ -545,30 +543,20 @@ To compile the OS/2 code, please run
   make install
 
 [12] Guidelines for OpenBSD
-==========================
+===========================
   To match the way it will installed when it becomes available as a PORT, use
   the following:
 
   ./configure --prefix=/usr/local                                      \
-              --sysconfdir=/etc
-              --with-initscriptdir=/usr/local/share/doc/smartmontools-VERSION \
-              --with-docdir=/usr/local/share/doc/smartmontools-VERSION \
+              --sysconfdir=/etc                                        \
+              --docdir=/usr/local/share/doc/smartmontools-VERSION      \
+              --without-initscriptdir                                  \
               --enable-sample
 
-  It is important that you use GNU make (gmake from /usr/ports/devel/gmake)
-  to build smartmontools, as the default OpenBSD make doesn't know how to build
-  the man pages.
-
-  NOTE1: --with-initscriptdir installs a SystemV startup script.  It really
-  should be --without-initscriptdir, but the Makefile code is incorrect and
-  trys to install the initscript (smartd) to /no.  So, an interim fix it to
-  set the initscript dir to the doc dir.
-
-  NOTE2: --enable-sample will cause the smartd.conf and smartd RC files to
+  NOTE: --enable-sample will cause the smartd.conf and smartd RC files to
   be installed with the string '.sample' append to the name, so you will end
   up with the following:
-        /usr/local/etc/smartd.conf.sample
-        /usr/local/etc/rc.d/smartd.sample
+        /etc/smartd.conf.sample
 
 [13] Comments
 ============
@@ -580,6 +568,11 @@ by the following:
   cd objdir
   ../configure [options]
 
+Man pages contents is platform-specific by default. Info specific to other
+platforms may be not visible. To generate man pages with full contents use:
+
+  make os_man_filter=
+
 To install to another destination (used mainly by package maintainers,
 or to examine the package contents without risk of modifying any
 system files) you can replace the step:
@@ -587,7 +580,7 @@ system files) you can replace the step:
 with:
   make DESTDIR=/home/myself/smartmontools-package install
 
-Use a full path. Paths like ~/smartmontools-package may not work.
+Use a full path. Paths like ./smartmontools-package may not work.
 
 After installing smartmontools, you can read the man pages, and try
 out the commands:
index eb1f7a5cf28c7822f6a851076965e95fef00ef4f..969cadce61a8fb043e9f31d4c25955a507f1d009 100644 (file)
@@ -1,10 +1,12 @@
 ## Process this file with automake to produce Makefile.in
 #
-# $Id: Makefile.am 3338 2011-05-23 08:29:12Z samm2 $
+# $Id: Makefile.am 3474 2011-11-10 18:19:58Z chrfranke $
 #
 
 @SET_MAKE@
 
+ACLOCAL_AM_FLAGS = -I m4
+
 # Make sure .cpp takes precedence to avoid compiling old .c file
 SUFFIXES = .cpp .c .s .o
 
@@ -22,6 +24,9 @@ if ENABLE_ATTRIBUTELOG
 AM_CPPFLAGS += -DSMARTMONTOOLS_ATTRIBUTELOG='"$(attributelog)"'
 endif
 
+if OS_WIN32_MINGW
+AM_CPPFLAGS += -I$(srcdir)/os_win32
+endif
 if NEED_GETOPT_LONG
 AM_CPPFLAGS += -I$(srcdir)/getopt -DHAVE_GETOPT_LONG -D__GNU_LIBRARY__
 endif
@@ -83,6 +88,7 @@ EXTRA_smartd_SOURCES = os_darwin.cpp    \
                        os_generic.h     \
                        cciss.cpp        \
                        cciss.h          \
+                       cissio_freebsd.h \
                        dev_legacy.cpp   \
                        megaraid.h
 
@@ -145,6 +151,7 @@ EXTRA_smartctl_SOURCES = os_linux.cpp \
                        os_generic.h   \
                        cciss.cpp      \
                        cciss.h        \
+                       cissio_freebsd.h \
                        dev_legacy.cpp \
                        megaraid.h
 
@@ -324,10 +331,14 @@ EXTRA_DIST = \
         smartd.conf \
         smartd.service.in \
         update-smart-drivedb.in \
+        m4/pkg.m4 \
         os_darwin/SMART.in \
         os_darwin/StartupParameters.plist \
         os_darwin/English_Localizable.strings \
         os_win32/installer.nsi \
+        os_win32/runcmd.c \
+        os_win32/runcmda.exe.manifest \
+        os_win32/runcmdu.exe.manifest \
         os_win32/syslogevt.c \
         os_win32/syslogevt.mc \
         os_win32/update-smart-drivedb.nsi \
@@ -368,7 +379,8 @@ MAINTAINERCLEANFILES = \
         $(srcdir)/depcomp \
         $(srcdir)/install-sh \
         $(srcdir)/missing \
-        $(srcdir)/mkinstalldirs
+        $(srcdir)/mkinstalldirs \
+        $(srcdir)/m4/pkg.m4
 
 utility.o: svnversion.h
 
@@ -408,17 +420,6 @@ if ENABLE_ATTRIBUTELOG
 attributelog_DATA =
 endif
 
-smartd.conf.5.in: smartd.8.in
-       sed '1,/STARTINCLUDE/ D;/ENDINCLUDE/,$$D' < $(srcdir)/smartd.8.in > $(top_builddir)/tmp.directives
-       sed '/STARTINCLUDE/,$$D'  < $(srcdir)/smartd.conf.5.in > $(top_builddir)/tmp.head
-       sed '1,/ENDINCLUDE/D'   < $(srcdir)/smartd.conf.5.in > $(top_builddir)/tmp.tail
-       cat $(top_builddir)/tmp.head > $(srcdir)/smartd.conf.5.in
-       echo '.\" STARTINCLUDE' >> $(srcdir)/smartd.conf.5.in
-       cat $(top_builddir)/tmp.directives >> $(srcdir)/smartd.conf.5.in
-       echo '.\" ENDINCLUDE'   >> $(srcdir)/smartd.conf.5.in
-       cat $(top_builddir)/tmp.tail >> $(srcdir)/smartd.conf.5.in
-       rm -f $(top_builddir)/tmp.head $(top_builddir)/tmp.tail $(top_builddir)/tmp.directives
-
 update-smart-drivedb: update-smart-drivedb.in config.status
        $(SHELL) ./config.status --file=$@
        chmod +x $@
@@ -500,25 +501,25 @@ smartd.service: smartd.service.in Makefile
 if ENABLE_CAPABILITIES
 MAN_CAPABILITIES = cat
 else
-MAN_CAPABILITIES = sed '/BEGIN ENABLE_CAPABILITIES/,/END ENABLE_CAPABILITIES/d'
+MAN_CAPABILITIES = sed '/^\.\\" %IF ENABLE_CAPABILITIES/,/^\.\\" %ENDIF ENABLE_CAPABILITIES/ s,^,.\\"\# ,'
 endif
 
 if ENABLE_DRIVEDB
 MAN_DRIVEDB = sed "s|/usr/local/share/smartmontools/drivedb\\.h|$(drivedbdir)/drivedb.h|g"
 else
-MAN_DRIVEDB = sed '/BEGIN ENABLE_DRIVEDB/,/END ENABLE_DRIVEDB/d'
+MAN_DRIVEDB = sed '/^\.\\" %IF ENABLE_DRIVEDB/,/^\.\\" %ENDIF ENABLE_DRIVEDB/ s,^,.\\"\# ,'
 endif
 
 if ENABLE_SAVESTATES
 MAN_SAVESTATES = sed "s|/usr/local/var/lib/smartmontools/smartd\\.|$(savestates)|g"
 else
-MAN_SAVESTATES = sed '/BEGIN ENABLE_SAVESTATES/,/END ENABLE_SAVESTATES/d'
+MAN_SAVESTATES = sed '/^\.\\" %IF ENABLE_SAVESTATES/,/^\.\\" %ENDIF ENABLE_SAVESTATES/ s,^,.\\"\# ,'
 endif
 
 if ENABLE_ATTRIBUTELOG
 MAN_ATTRIBUTELOG = sed "s|/usr/local/var/lib/smartmontools/attrlog\\.|$(attributelog)|g"
 else
-MAN_ATTRIBUTELOG = sed '/BEGIN ENABLE_ATTRIBUTELOG/,/END ENABLE_ATTRIBUTELOG/d'
+MAN_ATTRIBUTELOG = sed '/^\.\\" %IF ENABLE_ATTRIBUTELOG/,/^\.\\" %ENDIF ENABLE_ATTRIBUTELOG/ s,^,.\\"\# ,'
 endif
 
 MAN_FILTER = \
@@ -533,10 +534,21 @@ MAN_FILTER = \
          s|!exampledir!|$(exampledir)/|g; \
          s|/usr/local/etc/smartd\\.conf|$(sysconfdir)/smartd.conf|g; \
          s|/usr/local/etc/smart_drivedb\\.h|$(sysconfdir)/smart_drivedb\\.h|g" | \
+    $(MAN_ATTRIBUTELOG) | \
     $(MAN_CAPABILITIES) | \
     $(MAN_DRIVEDB) | \
     $(MAN_SAVESTATES) | \
-    $(MAN_ATTRIBUTELOG)
+    if test -n '$(os_man_filter)'; then \
+      sed -e 's,OS_MAN_FILTER,$(os_man_filter),g' \
+          -e '/^\.\\" %IF NOT OS .*$(os_man_filter)/,/^.\\" %ENDIF NOT OS .*$(os_man_filter)/ s,^,.\\"\# ,' \
+          -e '/^\.\\" %IF OS .*$(os_man_filter)/,/^\.\\" %ENDIF OS .*$(os_man_filter)/ s,^,!!,' \
+          -e '/^\.\\" %IF OS ./,/^\.\\" %ENDIF OS ./ s,^,.\\"\# ,' \
+          -e '/^!*\.\\" %IF NOT OS ./,/^!*\.\\" %ENDIF NOT OS ./ s,^,!!,' \
+          -e 's,^!!!*\.\\"! \(.*\)$$,\1 \\"\#,' \
+          -e 's,^!!!*,,' ; \
+    else \
+      cat; \
+    fi
 
 # Implicit rule 'smart%: smart%.in ...' does not work with BSD make
 smartctl.8: smartctl.8.in Makefile svnversion.h
@@ -618,7 +630,9 @@ docdir_win32 = $(distdir_win32)/doc
 EXEFILES_WIN32 = \
         $(exedir_win32)/smartctl.exe \
         $(exedir_win32)/smartctl-nc.exe \
-        $(exedir_win32)/smartd.exe
+        $(exedir_win32)/smartd.exe \
+        $(exedir_win32)/runcmda.exe \
+        $(exedir_win32)/runcmdu.exe
 
 if OS_WIN32_WINDMC
 EXEFILES_WIN32 += \
@@ -649,7 +663,9 @@ FILES_WIN32 = \
         $(docdir_win32)/smartd.8.html \
         $(docdir_win32)/smartd.8.txt \
         $(docdir_win32)/smartd.conf.5.html \
-        $(docdir_win32)/smartd.conf.5.txt
+        $(docdir_win32)/smartd.conf.5.txt \
+        $(exedir_win32)/runcmda.exe.manifest \
+        $(exedir_win32)/runcmdu.exe.manifest
 
 if ENABLE_DRIVEDB
 FILES_WIN32 += \
@@ -658,6 +674,7 @@ endif
 
 CLEANFILES += \
         $(FILES_WIN32) \
+        runcmdu.exe \
         smartctl-nc.exe smartctl-nc.exe.tmp \
         syslogevt.exe syslogevt.h syslogevt.o \
         syslogevt.res.o syslogevt.rc syslogevt_*.bin \
@@ -727,10 +744,18 @@ $(exedir_win32)/%.exe: %.exe
 $(exedir_win32)/update-smart-drivedb.exe: update-smart-drivedb.exe
        cp -p $< $@
 
+# runcmd?.exe only differ by .exe.manifest files
+$(exedir_win32)/runcmda.exe: $(exedir_win32)/runcmdu.exe
+       cp -p $< $@
+
 $(exedir_win32)/%.h: $(srcdir)/%.h
        $(UNIX2DOS) < $< > $@
        touch -r $< $@
 
+$(exedir_win32)/%.exe.manifest: $(srcdir)/os_win32/%.exe.manifest
+       $(UNIX2DOS) < $< > $@
+       touch -r $< $@
+
 $(docdir_win32)/%.html: %.html
        $(UNIX2DOS) < $< > $@
        touch -r $< $@
@@ -767,6 +792,10 @@ smartctl-nc.exe: smartctl.exe
          else echo "EXE patch failed"; exit 1; fi
        mv -f $@.tmp $@
 
+# Build runcmd?.exe
+runcmdu.exe: os_win32/runcmd.c
+       $(CC) -Os -o $@ $<
+
 if OS_WIN32_WINDMC
 # Build syslogevt.exe event message file tool
 
@@ -783,16 +812,16 @@ syslogevt.rc: os_win32/syslogevt.mc
        $(WINDMC) -b $<
 endif
 
-# Build {config,svnversion}_vc8.h for MSVC8 from MinGW {config,svnversion}.h
+# Build {config,svnversion}_vc10.h for MSVC10 from MinGW {config,svnversion}.h
 
-config-vc8: $(srcdir)/os_win32/config_vc8.h  $(srcdir)/os_win32/svnversion_vc8.h
+config-vc10: $(srcdir)/os_win32/config_vc10.h  $(srcdir)/os_win32/svnversion_vc10.h
 
-$(srcdir)/os_win32/config_vc8.h: config.h Makefile
-       sed '1i/* config_vc8.h.  Generated from config.h by Makefile.  */' $< | \
-       sed 's,^#define HAVE_\(ATTR_PACKED\|INTTYPES_H\|[DK_]*NTDDDISK_H\|STDINT_H\|STRINGS_H\|STRTOULL\|U*INT64_T\|UNISTD_H\|WORKING_SNPRINTF\) 1$$,/* #undef HAVE_\1 */,' | \
-       sed 's,^\(#define SMARTMONTOOLS_BUILD_HOST "[^-]*\)[^"]*,\1-pc-win32vc8,' > $@
+$(srcdir)/os_win32/config_vc10.h: config.h Makefile
+       sed -e '1i/* config_vc10.h.  Generated from config.h by Makefile.  */' \
+           -e 's,^#define HAVE_\(ATTR_PACKED\|INTTYPES_H\|[DK_]*NTDDDISK_H\|STRINGS_H\|STRTOULL\|UNISTD_H\|WORKING_SNPRINTF\) 1$$,/* #undef HAVE_\1 */,' \
+           -e 's,^\(#define SMARTMONTOOLS_BUILD_HOST "[^-]*\)[^"]*,\1-pc-w32vc10,' $< > $@
 
-$(srcdir)/os_win32/svnversion_vc8.h: svnversion.h
-       cp svnversion.h $@
+$(srcdir)/os_win32/svnversion_vc10.h: svnversion.h
+       cp $< $@
 
 endif
diff --git a/NEWS b/NEWS
index e589c0bc071dc79daa2660a51bd4112648438691..fdc0545e1667343aaa11011c4ebe16813ac301bb 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,47 @@
 smartmontools NEWS
 ------------------
-$Id: NEWS 3365 2011-06-09 18:47:31Z chrfranke $
+$Id: NEWS 3513 2012-02-15 21:57:21Z chrfranke $
 
 The most up-to-date version of this file is:
 http://smartmontools.svn.sourceforge.net/viewvc/smartmontools/trunk/smartmontools/NEWS?view=markup
 
+Date <Not released yet, please try current SVN>
+Summary: smartmontools release 5.43
+-----------------------------------------------------------
+- smartctl options '-g, --get' and '-s, --set' to get/set
+  various ATA settings: AAM, APM, Read look-ahead, Write
+  cache, Security (freeze), Standby mode/timer.
+- smartd directive '-e' to set (most of) the above settings
+  on startup.
+- smartctl does not start ATA self-test if another test is
+  already running.  Override with new option '-t force'.
+- smartctl supports extended self-test polling times
+  greater than 255 minutes.
+- smartd.conf DEFAULT directive.
+- Windows smartd: directives '-l offlinests,ns' and
+  '-l selfteststs,ns'.
+- FreeBSD: fixed crash on SCSI devices with FreeBSD9-RC1
+
+Date 2011-10-20
+Summary: smartmontools release 5.42
+-----------------------------------------------------------
+- smartctl option '-l devstat' (Device Statistics).
+- smartctl option '-l ssd' (SSD endurance indicator).
+- smartd logs identify information of each SCSI/SAS device.
+- smartd resends warning emails if problem reappears.
+- smartd directives '-l offlinests' and '-l selfteststs'.
+- Many HDD, SSD and USB additions to drive database.
+- Platform-specific man pages.
+- smartd.8 man page no longer includes smartd.conf.5.
+- FreeBSD: Compilation fixes.
+- FreeBSD: Support for Areca controllers.
+- FreeBSD: Fix '-l scterc' support.
+- FreeBSD: Support for 48-bit ATA commands.
+- Linux: Support for Areca controllers enhanced.
+- Windows installer: UAC support.
+- Windows: update-smart-drivedb /S(ilent) option.
+- Windows: improved USB ID detection.
+
 Date 2011-06-09
 Summary: smartmontools release 5.41
 -----------------------------------------------------------
index 2799e5fc619b82fdc0700f78368aa1bb9e77f97c..507f304c9260211f34a6ec9d7e4205ab4d1cc7ae 100644 (file)
@@ -4,7 +4,7 @@
  * Home page of code is: http://smartmontools.sourceforge.net
  *
  * Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net>
- * Copyright (C) 2008-11 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2008-12 Christian Franke <smartmontools-support@lists.sourceforge.net>
  * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
  * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org>
  *
@@ -36,7 +36,7 @@
 #include "utility.h"
 #include "dev_ata_cmd_set.h" // for parsed_ata_device
 
-const char * atacmds_cpp_cvsid = "$Id: atacmds.cpp 3345 2011-05-25 20:50:02Z chrfranke $"
+const char * atacmds_cpp_cvsid = "$Id: atacmds.cpp 3507 2012-02-11 20:16:13Z chrfranke $"
                                  ATACMDS_H_CVSID;
 
 // Print ATA debug messages?
@@ -459,7 +459,7 @@ static void print_regs(const char * prefix, const ata_out_regs & r, const char *
 static void prettyprint(const unsigned char *p, const char *name){
   pout("\n===== [%s] DATA START (BASE-16) =====\n", name);
   for (int i=0; i<512; i+=16, p+=16)
-#define P(n) (isprint((int)(p[n]))?(int)(p[n]):'.')
+#define P(n) (' ' <= p[n] && p[n] <= '~' ? (int)p[n] : '.')
     // print complete line to avoid slow tty output and extra lines in syslog.
     pout("%03d-%03d: %02x %02x %02x %02x %02x %02x %02x %02x "
                     "%02x %02x %02x %02x %02x %02x %02x %02x"
@@ -838,6 +838,31 @@ int ataCheckPowerMode(ata_device * device) {
   return (int)result;
 }
 
+// Issue a no-data ATA command with optional sector count register value
+bool ata_nodata_command(ata_device * device, unsigned char command,
+                        int sector_count /* = -1 */)
+{
+  ata_cmd_in in;
+  in.in_regs.command = command;
+  if (sector_count >= 0)
+    in.in_regs.sector_count = sector_count;
+
+  return device->ata_pass_through(in);
+}
+
+// Issue SET FEATURES command with optional sector count register value
+bool ata_set_features(ata_device * device, unsigned char features,
+                      int sector_count /* = -1 */)
+{
+  ata_cmd_in in;
+  in.in_regs.command = ATA_SET_FEATURES;
+  in.in_regs.features = features;
+  if (sector_count >= 0)
+    in.in_regs.sector_count = sector_count;
+
+  return device->ata_pass_through(in);
+}
+
 // Reads current Device Identity info (512 bytes) into buf.  Returns 0
 // if all OK.  Returns -1 if no ATA Device identity can be
 // established.  Returns >0 if Device is ATA Packet Device (not SMART
@@ -1057,6 +1082,7 @@ int ataReadSmartValues(ata_device * device, struct ata_smart_values *data){
     swap2((char *)&(data->revnumber));
     swap2((char *)&(data->total_time_to_complete_off_line));
     swap2((char *)&(data->smart_capability));
+    swapx(&data->extend_test_completion_time_w);
     for (i=0; i<NUMBER_ATA_SMART_ATTRIBUTES; i++){
       struct ata_smart_attribute *x=data->vendor_attributes+i;
       swap2((char *)&(x->flags));
@@ -1637,7 +1663,8 @@ int ataSmartStatus2(ata_device * device){
 // This is the way to execute ALL tests: offline, short self-test,
 // extended self test, with and without captive mode, etc.
 // TODO: Move to ataprint.cpp ?
-int ataSmartTest(ata_device * device, int testtype, const ata_selective_selftest_args & selargs,
+int ataSmartTest(ata_device * device, int testtype, bool force,
+                 const ata_selective_selftest_args & selargs,
                  const ata_smart_values * sv, uint64_t num_sectors)
 {
   char cmdmsg[128]; const char *type, *captive;
@@ -1664,7 +1691,20 @@ int ataSmartTest(ata_device * device, int testtype, const ata_selective_selftest
     type="Selective self-test";
   else
     type = 0;
-  
+
+  // Check whether another test is already running
+  if (type && (sv->self_test_exec_status >> 4) == 0xf) {
+    if (!force) {
+      pout("Can't start self-test without aborting current test (%d0%% remaining),\n"
+           "%srun 'smartctl -X' to abort test.\n",
+           sv->self_test_exec_status & 0x0f,
+           (!select ? "add '-t force' option to override, or " : ""));
+      return -1;
+    }
+  }
+  else
+    force = false;
+
   // If doing a selective self-test, first use WRITE_LOG to write the
   // selective self-test log.
   ata_selective_selftest_args selargs_io = selargs; // filled with info about actual spans
@@ -1706,7 +1746,7 @@ int ataSmartTest(ata_device * device, int testtype, const ata_selective_selftest
   else {
     pout("Drive command \"%s\" successful.\n", cmdmsg);
     if (type)
-      pout("Testing has begun.\n");
+      pout("Testing has begun%s.\n", (force ? " (previous test aborted)" : ""));
   }
   return 0;
 }
@@ -1722,7 +1762,12 @@ int TestTime(const ata_smart_values *data, int testtype)
     return (int) data->short_test_completion_time;
   case EXTEND_SELF_TEST:
   case EXTEND_CAPTIVE_SELF_TEST:
-    return (int) data->extend_test_completion_time;
+    if (data->extend_test_completion_time_b == 0xff
+        && data->extend_test_completion_time_w != 0x0000
+        && data->extend_test_completion_time_w != 0xffff)
+      return data->extend_test_completion_time_w; // ATA-8
+    else
+      return data->extend_test_completion_time_b;
   case CONVEYANCE_SELF_TEST:
   case CONVEYANCE_CAPTIVE_SELF_TEST:
     return (int) data->conveyance_test_completion_time;
@@ -2072,24 +2117,36 @@ std::string ata_format_attr_raw_value(const ata_smart_attribute & attr,
 
   case RAWFMT_TEMPMINMAX:
     // Temperature
-    s = strprintf("%u", word[0]);
-    if (word[1] || word[2]) {
-      unsigned lo = ~0, hi = ~0;
-      if (!raw[3]) {
-        // 00 HH 00 LL 00 TT (IBM)
-        hi = word[2]; lo = word[1];
-      }
-      else if (!word[2]) {
-        // 00 00 HH LL 00 TT (Maxtor)
-        hi = raw[3]; lo = raw[2];
-      }
-      if (lo > hi) {
-        unsigned t = lo; lo = hi; hi = t;
+    {
+      // Search for possible min/max values
+      // 00 HH 00 LL 00 TT (Hitachi/IBM)
+      // 00 00 HH LL 00 TT (Maxtor, Samsung)
+      // 00 00 00 HH LL TT (WDC)
+      unsigned char lo = 0, hi = 0;
+      int cnt = 0;
+      for (int i = 1; i < 6; i++) {
+        if (raw[i])
+          switch (cnt++) {
+            case 0:
+              lo = raw[i];
+              break;
+            case 1:
+              if (raw[i] < lo) {
+                hi = lo; lo = raw[i];
+              }
+              else
+                hi = raw[i];
+              break;
+          }
       }
-      if (lo <= word[0] && word[0] <= hi)
-        s += strprintf(" (Min/Max %u/%u)", lo, hi);
+
+      unsigned char t = raw[0];
+      if (cnt == 0)
+        s = strprintf("%d", t);
+      else if (cnt == 2 && 0 < lo && lo <= t && t <= hi && hi < 128)
+        s = strprintf("%d (Min/Max %d/%d)", t, lo, hi);
       else
-        s += strprintf(" (%d %d %d %d)", raw[5], raw[4], raw[3], raw[2]);
+        s = strprintf("%d (%d %d %d %d %d)", t, raw[5], raw[4], raw[3], raw[2], raw[1]);
     }
     break;
 
@@ -2301,10 +2358,13 @@ unsigned char ata_return_temperature_value(const ata_smart_values * data, const
     if (idx < 0)
       continue;
     uint64_t raw = ata_get_attr_raw_value(data->vendor_attributes[idx], defs);
-    unsigned temp = (unsigned short)raw; // ignore possible min/max values in high words
+    unsigned temp;
+    // ignore possible min/max values in high words
     if (format == RAWFMT_TEMP10X) // -v N,temp10x
-      temp = (temp+5) / 10;
-    if (!(0 < temp && temp <= 255))
+      temp = ((unsigned short)raw + 5) / 10;
+    else
+      temp = (unsigned char)raw;
+    if (!(0 < temp && temp < 128))
       continue;
     return temp;
   }
index 2dccbb5142ae568050df181ecc7feab7d7733287..9a65b734135efbde54d85fde4bc2f433835f935e 100644 (file)
--- a/atacmds.h
+++ b/atacmds.h
@@ -4,7 +4,7 @@
  * Home page of code is: http://smartmontools.sourceforge.net
  *
  * Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net>
- * Copyright (C) 2008-11 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2008-12 Christian Franke <smartmontools-support@lists.sourceforge.net>
  * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,7 @@
 #ifndef ATACMDS_H_
 #define ATACMDS_H_
 
-#define ATACMDS_H_CVSID "$Id: atacmds.h 3316 2011-04-19 19:34:57Z chrfranke $"
+#define ATACMDS_H_CVSID "$Id: atacmds.h 3508 2012-02-12 15:47:56Z chrfranke $"
 
 #include "dev_interface.h" // ata_device
 
@@ -77,10 +77,25 @@ enum {
 };
 
 // ATA Specification Command Register Values (Commands)
+#define ATA_CHECK_POWER_MODE            0xe5
 #define ATA_IDENTIFY_DEVICE             0xec
 #define ATA_IDENTIFY_PACKET_DEVICE      0xa1
+#define ATA_IDLE                        0xe3
 #define ATA_SMART_CMD                   0xb0
-#define ATA_CHECK_POWER_MODE            0xe5
+#define ATA_SECURITY_FREEZE_LOCK        0xf5
+#define ATA_SET_FEATURES                0xef
+#define ATA_STANDBY_IMMEDIATE           0xe0
+
+// SET_FEATURES subcommands
+#define ATA_DISABLE_AAM                 0xc2
+#define ATA_DISABLE_APM                 0x85
+#define ATA_DISABLE_WRITE_CACHE         0x82
+#define ATA_DISABLE_READ_LOOK_AHEAD     0x55
+#define ATA_ENABLE_AAM                  0x42
+#define ATA_ENABLE_APM                  0x05
+#define ATA_ENABLE_WRITE_CACHE          0x02
+#define ATA_ENABLE_READ_LOOK_AHEAD      0xaa
+
 // 48-bit commands
 #define ATA_READ_LOG_EXT                0x2F
 
@@ -200,8 +215,8 @@ ASSERT_SIZEOF_STRUCT(ata_smart_attribute, 12);
 #define ATTRIBUTE_FLAGS_OTHER(x) ((x) & 0xffc0)
 
 
-/* ata_smart_values is format of the read drive Attribute command */
-/* see Table 34 of T13/1321D Rev 1 spec (Device SMART data structure) for *some* info */
+// Format of data returned by SMART READ DATA
+// Table 62 of T13/1699-D (ATA8-ACS) Revision 6a, September 2008
 #pragma pack(1)
 struct ata_smart_values {
   unsigned short int revnumber;
@@ -215,9 +230,10 @@ struct ata_smart_values {
   unsigned char errorlog_capability;
   unsigned char vendor_specific_371;  // Maxtor, IBM: self-test failure checkpoint see below!
   unsigned char short_test_completion_time;
-  unsigned char extend_test_completion_time;
+  unsigned char extend_test_completion_time_b; // If 0xff, use 16-bit value below
   unsigned char conveyance_test_completion_time;
-  unsigned char reserved_375_385[11];
+  unsigned short extend_test_completion_time_w; // e04130r2, added to T13/1699-D Revision 1c, April 2005
+  unsigned char reserved_377_385[9];
   unsigned char vendor_specific_386_510[125]; // Maxtor bytes 508-509 Attribute/Threshold Revision #
   unsigned char chksum;
 } ATTR_PACKED;
@@ -718,6 +734,12 @@ extern bool dont_print_serial_number;
 int ata_read_identity(ata_device * device, ata_identify_device * buf, bool fix_swapped_id);
 int ataCheckPowerMode(ata_device * device);
 
+// Issue a no-data ATA command with optional sector count register value
+bool ata_nodata_command(ata_device * device, unsigned char command, int sector_count = -1);
+
+// Issue SET FEATURES command with optional sector count register value
+bool ata_set_features(ata_device * device, unsigned char features, int sector_count = -1);
+
 /* Read S.M.A.R.T information from drive */
 int ataReadSmartValues(ata_device * device,struct ata_smart_values *);
 int ataReadSmartThresholds(ata_device * device, struct ata_smart_thresholds_pvt *);
@@ -766,12 +788,10 @@ int ataEnableAutoOffline (ata_device * device);
 int ataDisableAutoOffline (ata_device * device);
 
 /* S.M.A.R.T. test commands */
-int ataSmartOfflineTest (ata_device * device);
-int ataSmartExtendSelfTest (ata_device * device);
-int ataSmartShortSelfTest (ata_device * device);
-int ataSmartShortCapSelfTest (ata_device * device);
-int ataSmartExtendCapSelfTest (ata_device * device);
-int ataSmartSelfTestAbort (ata_device * device);
+int ataSmartTest(ata_device * device, int testtype, bool force,
+                 const ata_selective_selftest_args & args,
+                 const ata_smart_values * sv, uint64_t num_sectors);
+
 int ataWriteSelectiveSelfTestLog(ata_device * device, ata_selective_selftest_args & args,
                                  const ata_smart_values * sv, uint64_t num_sectors,
                                  const ata_selective_selftest_args * prev_spans = 0);
@@ -830,9 +850,6 @@ inline bool isSCTFeatureControlCapable(const ata_identify_device *drive)
 inline bool isSCTDataTableCapable(const ata_identify_device *drive)
   { return ((drive->words088_255[206-88] & 0x21) == 0x21); } // 0x20 = SCT Data Table support
 
-int ataSmartTest(ata_device * device, int testtype, const ata_selective_selftest_args & args,
-                 const ata_smart_values * sv, uint64_t num_sectors);
-
 int TestTime(const ata_smart_values * data, int testtype);
 
 // Attribute state
index 32cb4712650ced173dc4fe37ba76f43e33ad3d0f..19ec8d44cff808445c1e4fa956a4c7d705a097ac 100644 (file)
@@ -4,7 +4,7 @@
  * Home page of code is: http://smartmontools.sourceforge.net
  *
  * Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net>
- * Copyright (C) 2008-11 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2008-12 Christian Franke <smartmontools-support@lists.sourceforge.net>
  * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -40,7 +40,7 @@
 #include "utility.h"
 #include "knowndrives.h"
 
-const char * ataprint_cpp_cvsid = "$Id: ataprint.cpp 3357 2011-06-06 18:56:55Z chrfranke $"
+const char * ataprint_cpp_cvsid = "$Id: ataprint.cpp 3509 2012-02-12 17:10:35Z chrfranke $"
                                   ATAPRINT_H_CVSID;
 
 
@@ -482,13 +482,26 @@ static void print_drive_info(const ata_identify_device * drive,
 
   std::string majorstr, minorstr;
   if (version) {
-    majorstr = strprintf("%d", abs(version));
-    if (description)
-      minorstr = description;
-    else if (!minorrev)
-      minorstr = "Exact ATA specification draft version not indicated";
-    else
-      minorstr = strprintf("Not recognized. Minor revision code: 0x%04x", minorrev);
+    if (version <= 8) {
+      majorstr = strprintf("%d", abs(version));
+      if (description)
+        minorstr = description;
+      else if (!minorrev)
+        minorstr = "Exact ATA specification draft version not indicated";
+      else
+        minorstr = strprintf("Not recognized. Minor revision code: 0x%04x", minorrev);
+    }
+    else {
+      // Bit 9 in word 80 of ATA IDENTIFY data does not mean "ATA-9" but "ACS-2"
+      // TODO: handle this in ataVersionInfo()
+      majorstr = "8";
+      if (description)
+        minorstr = description;
+      else if (!minorrev)
+        minorstr = strprintf("ACS-%d (revision not indicated)", version-9+2);
+      else
+        minorstr = strprintf("ACS-%d (unknown minor revision code: 0x%04x)", version-9+2, minorrev);
+    }
   }
 
   pout("ATA Version is:   %s\n", infofound(majorstr.c_str()));
@@ -741,7 +754,7 @@ static void PrintSmartExtendedSelfTestPollingTime(const ata_smart_values * data)
   pout("Extended self-test routine\n");
   if (isSupportSelfTest(data))
     pout("recommended polling time: \t (%4d) minutes.\n", 
-         (int)data->extend_test_completion_time);
+         TestTime(data, EXTEND_SELF_TEST));
   else
     pout("recommended polling time: \t        Not Supported.\n");
 }
@@ -946,7 +959,7 @@ static unsigned GetNumLogSectors(const ata_smart_log_directory * logdir, unsigne
 }
 
 // Get name of log.
-// Table A.2 of T13/2015-D Revision 4a (ACS-2), December 9, 2010.
+// Table A.2 of T13/2161-D Revision 1 (ACS-3), August 13, 2011.
 static const char * GetLogName(unsigned logaddr)
 {
     switch (logaddr) {
@@ -954,19 +967,21 @@ static const char * GetLogName(unsigned logaddr)
       case 0x01: return "Summary SMART error log";
       case 0x02: return "Comprehensive SMART error log";
       case 0x03: return "Ext. Comprehensive SMART error log";
-      case 0x04: return "Device Statistics";
+      case 0x04: return "Device Statistics log";
       case 0x05: return "Reserved for the CFA"; // ACS-2
       case 0x06: return "SMART self-test log";
       case 0x07: return "Extended self-test log";
-      case 0x08: return "Power Conditions"; // ACS-2
+      case 0x08: return "Power Conditions log"; // ACS-2
       case 0x09: return "Selective self-test log";
       case 0x0d: return "LPS Mis-alignment log"; // ACS-2
-      case 0x10: return "NCQ Command Error";
+      case 0x10: return "NCQ Command Error log";
       case 0x11: return "SATA Phy Event Counters";
+      case 0x19: return "LBA Status log"; // ACS-3
       case 0x20: return "Streaming performance log"; // Obsolete
       case 0x21: return "Write stream error log";
       case 0x22: return "Read stream error log";
       case 0x23: return "Delayed sector log"; // Obsolete
+      case 0x30: return "IDENTIFY DEVICE data log"; // ACS-3
       case 0xe0: return "SCT Command/Status";
       case 0xe1: return "SCT Data Transfer";
       default:
@@ -1032,7 +1047,7 @@ static void PrintLogPages(const char * type, const unsigned char * data,
          (page * 512) + i,
          p[ 0], p[ 1], p[ 2], p[ 3], p[ 4], p[ 5], p[ 6], p[ 7],
          p[ 8], p[ 9], p[10], p[11], p[12], p[13], p[14], p[15]);
-#define P(n) (isprint((int)(p[n]))?(int)(p[n]):'.')
+#define P(n) (' ' <= p[n] && p[n] <= '~' ? (int)p[n] : '.')
     pout("|%c%c%c%c%c%c%c%c"
           "%c%c%c%c%c%c%c%c|\n",
          P( 0), P( 1), P( 2), P( 3), P( 4), P( 5), P( 6), P( 7),
@@ -1043,6 +1058,249 @@ static void PrintLogPages(const char * type, const unsigned char * data,
   }
 }
 
+///////////////////////////////////////////////////////////////////////
+// Device statistics (Log 0x04)
+
+// See Section A.5 of
+//   ATA/ATAPI Command Set - 3 (ACS-3)
+//   T13/2161-D Revision 1, August 13, 2011
+
+struct devstat_entry_info
+{
+  short size; // #bytes of value, -1 for signed char
+  const char * name;
+};
+
+const devstat_entry_info devstat_info_0x00[] = {
+  {  2, "List of supported log pages" },
+  {  0, 0 }
+};
+
+const devstat_entry_info devstat_info_0x01[] = {
+  {  2, "General Statistics" },
+  {  4, "Lifetime Power-On Resets" },
+  {  4, "Power-on Hours" }, // spec says no flags(?)
+  {  6, "Logical Sectors Written" },
+  {  6, "Number of Write Commands" },
+  {  6, "Logical Sectors Read" },
+  {  6, "Number of Read Commands" },
+  {  0, 0 }
+};
+
+const devstat_entry_info devstat_info_0x02[] = {
+  {  2, "Freefall Statistics" },
+  {  4, "Number of Free-Fall Events Detected" },
+  {  4, "Overlimit Shock Events" },
+  {  0, 0 }
+};
+
+const devstat_entry_info devstat_info_0x03[] = {
+  {  2, "Rotating Media Statistics" },
+  {  4, "Spindle Motor Power-on Hours" },
+  {  4, "Head Flying Hours" },
+  {  4, "Head Load Events" },
+  {  4, "Number of Reallocated Logical Sectors" },
+  {  4, "Read Recovery Attempts" },
+  {  4, "Number of Mechanical Start Failures" },
+  {  4, "Number of Realloc. Candidate Logical Sectors" }, // ACS-3
+  {  0, 0 }
+};
+
+const devstat_entry_info devstat_info_0x04[] = {
+  {  2, "General Errors Statistics" },
+  {  4, "Number of Reported Uncorrectable Errors" },
+//{  4, "Number of Resets Between Command Acceptance and Command Completion" },
+  {  4, "Resets Between Cmd Acceptance and Completion" },
+  {  0, 0 }
+};
+
+const devstat_entry_info devstat_info_0x05[] = {
+  {  2, "Temperature Statistics" },
+  { -1, "Current Temperature" },
+  { -1, "Average Short Term Temperature" },
+  { -1, "Average Long Term Temperature" },
+  { -1, "Highest Temperature" },
+  { -1, "Lowest Temperature" },
+  { -1, "Highest Average Short Term Temperature" },
+  { -1, "Lowest Average Short Term Temperature" },
+  { -1, "Highest Average Long Term Temperature" },
+  { -1, "Lowest Average Long Term Temperature" },
+  {  4, "Time in Over-Temperature" },
+  { -1, "Specified Maximum Operating Temperature" },
+  {  4, "Time in Under-Temperature" },
+  { -1, "Specified Minimum Operating Temperature" },
+  {  0, 0 }
+};
+
+const devstat_entry_info devstat_info_0x06[] = {
+  {  2, "Transport Statistics" },
+  {  4, "Number of Hardware Resets" },
+  {  4, "Number of ASR Events" },
+  {  4, "Number of Interface CRC Errors" },
+  {  0, 0 }
+};
+
+const devstat_entry_info devstat_info_0x07[] = {
+  {  2, "Solid State Device Statistics" },
+  {  1, "Percentage Used Endurance Indicator" },
+  {  0, 0 }
+};
+
+const devstat_entry_info * devstat_infos[] = {
+  devstat_info_0x00,
+  devstat_info_0x01,
+  devstat_info_0x02,
+  devstat_info_0x03,
+  devstat_info_0x04,
+  devstat_info_0x05,
+  devstat_info_0x06,
+  devstat_info_0x07
+};
+
+const int num_devstat_infos = sizeof(devstat_infos)/sizeof(devstat_infos[0]);
+
+static void print_device_statistics_page(const unsigned char * data, int page,
+  bool & need_trailer)
+{
+  const devstat_entry_info * info = (page < num_devstat_infos ? devstat_infos[page] : 0);
+  const char * name = (info ? info[0].name : "Unknown Statistics");
+
+  // Check page number in header
+  static const char line[] = "  =====  =                =  == ";
+  if (!data[2]) {
+    pout("%3d%s%s (empty) ==\n", page, line, name);
+    return;
+  }
+  if (data[2] != page) {
+    pout("%3d%s%s (invalid page %d in header) ==\n", page, line, name, data[2]);
+    return;
+  }
+
+  pout("%3d%s%s (rev %d) ==\n", page, line, name, data[0]);
+
+  // Print entries
+  for (int i = 1, offset = 8; offset < 512-7; i++, offset+=8) {
+    // Check for last known entry
+    if (info && !info[i].size)
+      info = 0;
+
+    // Skip unsupported entries
+    unsigned char flags = data[offset+7];
+    if (!(flags & 0x80))
+      continue;
+
+    // Get value size, default to max if unknown
+    int size = (info ? info[i].size : 7);
+
+    // Format value
+    char valstr[32];
+    if (flags & 0x40) { // valid flag
+      // Get value
+      int64_t val;
+      if (size < 0) {
+        val = (signed char)data[offset];
+      }
+      else {
+        val = 0;
+        for (int j = 0; j < size; j++)
+          val |= (int64_t)data[offset+j] << (j*8);
+      }
+      snprintf(valstr, sizeof(valstr), "%"PRId64, val);
+    }
+    else {
+      // Value not known (yet)
+      strcpy(valstr, "-");
+    }
+
+    pout("%3d  0x%03x  %d%c %15s%c %s\n",
+      page, offset,
+      abs(size),
+      (flags & 0x1f ? '+' : ' '), // unknown flags
+      valstr,
+      (flags & 0x20 ? '~' : ' '), // normalized flag
+      (info ? info[i].name : "Unknown"));
+    if (flags & 0x20)
+      need_trailer = true;
+  }
+}
+
+static bool print_device_statistics(ata_device * device, unsigned nsectors,
+  const std::vector<int> & single_pages, bool all_pages, bool ssd_page)
+{
+  // Read list of supported pages from page 0
+  unsigned char page_0[512] = {0, };
+  if (!ataReadLogExt(device, 0x04, 0, 0, page_0, 1))
+    return false;
+
+  unsigned char nentries = page_0[8];
+  if (!(page_0[2] == 0 && nentries > 0)) {
+    pout("Device Statistics page 0 is invalid (page=%d, nentries=%d)\n", page_0[2], nentries);
+    return false;
+  }
+
+  // Prepare list of pages to print
+  std::vector<int> pages;
+  unsigned i;
+  if (all_pages) {
+    // Add all supported pages
+    for (i = 0; i < nentries; i++) {
+      int page = page_0[8+1+i];
+      if (page)
+        pages.push_back(page);
+    }
+    ssd_page = false;
+  }
+  // Add manually specified pages
+  bool print_page_0 = false;
+  for (i = 0; i < single_pages.size() || ssd_page; i++) {
+    int page = (i < single_pages.size() ? single_pages[i] : 7);
+    if (!page)
+      print_page_0 = true;
+    else if (page >= (int)nsectors)
+      pout("Device Statistics Log has only %u pages\n", nsectors);
+    else
+      pages.push_back(page);
+    if (page == 7)
+      ssd_page = false;
+  }
+
+  // Print list of supported pages if requested
+  if (print_page_0) {
+    pout("Device Statistics (GP Log 0x04) supported pages\n");
+    pout("Page Description\n");
+    for (i = 0; i < nentries; i++) {
+      int page = page_0[8+1+i];
+      pout("%3d  %s\n", page,
+        (page < num_devstat_infos ? devstat_infos[page][0].name : "Unknown Statistics"));
+    }
+    pout("\n");
+  }
+
+  // Read & print pages
+  if (!pages.empty()) {
+    pout("Device Statistics (GP Log 0x04)\n");
+    pout("Page Offset Size         Value  Description\n");
+    bool need_trailer = false;
+
+    for (i = 0; i <  pages.size(); i++) {
+      int page = pages[i];
+      unsigned char page_n[512] = {0, };
+      if (!ataReadLogExt(device, 0x04, 0, page, page_n, 1))
+        return false;
+      print_device_statistics_page(page_n, page, need_trailer);
+    }
+
+    if (need_trailer)
+      pout("%30s|_ ~ normalized value\n", "");
+    pout("\n");
+  }
+
+  return true;
+}
+
+
+///////////////////////////////////////////////////////////////////////
+
 // Print log 0x11
 static void PrintSataPhyEventCounters(const unsigned char * data, bool reset)
 {
@@ -1646,11 +1904,11 @@ static int ataPrintSCTStatus(const ata_sct_status_response * sts)
   pout("Device State:                        %s (%u)\n",
     sct_device_state_msg(sts->device_state), sts->device_state);
   char buf1[20], buf2[20];
-  if (   !sts->min_temp && !sts->life_min_temp && !sts->byte205
-      && !sts->under_limit_count && !sts->over_limit_count     ) {
+  if (   !sts->min_temp && !sts->life_min_temp
+      && !sts->under_limit_count && !sts->over_limit_count) {
     // "Reserved" fields not set, assume "old" format version 2
-    // Table 11 of T13/1701DT Revision 5
-    // Table 54 of T13/1699-D Revision 3e
+    // Table 11 of T13/1701DT-N (SMART Command Transport) Revision 5, February 2005
+    // Table 54 of T13/1699-D (ATA8-ACS) Revision 3e, July 2006
     pout("Current Temperature:                 %s Celsius\n",
       sct_ptemp(sts->hda_temp, buf1));
     pout("Power Cycle Max Temperature:         %s Celsius\n",
@@ -1660,17 +1918,18 @@ static int ataPrintSCTStatus(const ata_sct_status_response * sts)
   }
   else {
     // Assume "new" format version 2 or version 3
-    // T13/e06152r0-3 (Additional SCT Temperature Statistics)
-    // Table 60 of T13/1699-D Revision 3f
+    // T13/e06152r0-3 (Additional SCT Temperature Statistics), August - October 2006
+    // Table 60 of T13/1699-D (ATA8-ACS) Revision 3f, December 2006  (format version 2)
+    // Table 80 of T13/1699-D (ATA8-ACS) Revision 6a, September 2008 (format version 3)
     pout("Current Temperature:                    %s Celsius\n",
       sct_ptemp(sts->hda_temp, buf1));
     pout("Power Cycle Min/Max Temperature:     %s/%s Celsius\n",
       sct_ptemp(sts->min_temp, buf1), sct_ptemp(sts->max_temp, buf2));
     pout("Lifetime    Min/Max Temperature:     %s/%s Celsius\n",
       sct_ptemp(sts->life_min_temp, buf1), sct_ptemp(sts->life_max_temp, buf2));
-    if (sts->byte205) // e06152r0-2, removed in e06152r3
-      pout("Lifetime    Average Temperature:        %s Celsius\n",
-        sct_ptemp((signed char)sts->byte205, buf1));
+    signed char avg = sts->byte205; // Average Temperature from e06152r0-2, removed in e06152r3
+    if (0 < avg && sts->life_min_temp <= avg && avg <= sts->life_max_temp)
+      pout("Lifetime    Average Temperature:        %2d Celsius\n", avg);
     pout("Under/Over Temperature Limit Count:  %2u/%u\n",
       sts->under_limit_count, sts->over_limit_count);
   }
@@ -1743,6 +2002,121 @@ static void ataPrintSCTErrorRecoveryControl(bool set, unsigned short read_timer,
     pout("          Write: %6d (%0.1f seconds)\n", write_timer, write_timer/10.0);
 }
 
+static void print_aam_level(const char * msg, int level, int recommended = -1)
+{
+  // Table 56 of T13/1699-D (ATA8-ACS) Revision 6a, September 6, 2008
+  // Obsolete since T13/2015-D (ACS-2) Revision 4a, December 9, 2010
+  const char * s;
+  if (level == 0)
+    s = "vendor specific";
+  else if (level < 128)
+    s = "unknown/retired";
+  else if (level == 128)
+    s = "quiet";
+  else if (level < 254)
+    s = "intermediate";
+  else if (level == 254)
+    s = "maximum performance";
+  else
+    s = "reserved";
+
+  if (recommended >= 0)
+    pout("%s%d (%s), recommended: %d\n", msg, level, s, recommended);
+  else
+    pout("%s%d (%s)\n", msg, level, s);
+}
+
+static void print_apm_level(const char * msg, int level)
+{
+  // Table 120 of T13/2015-D (ACS-2) Revision 7, June 22, 2011
+  const char * s;
+  if (!(1 <= level && level <= 254))
+    s = "reserved";
+  else if (level == 1)
+    s = "minimum power consumption with standby";
+  else if (level < 128)
+    s = "intermediate level with standby";
+  else if (level == 128)
+    s = "minimum power consumption without standby";
+  else if (level < 254)
+    s = "intermediate level without standby";
+  else
+    s = "maximum performance";
+
+  pout("%s%d (%s)\n", msg, level, s);
+}
+
+static void print_ata_security_status(const char * msg, unsigned short state)
+{
+    const char * s1, * s2 = "", * s3 = "", * s4 = "";
+
+    // Table 6 of T13/2015-D (ACS-2) Revision 7, June 22, 2011
+    if (!(state & 0x0001))
+      s1 = "Unavailable";
+    else if (!(state & 0x0002)) {
+      s1 = "Disabled, ";
+      if (!(state & 0x0008))
+        s2 = "NOT FROZEN [SEC1]";
+      else
+        s2 = "frozen [SEC2]";
+    }
+    else {
+      s1 = "ENABLED, PW level ";
+      if (!(state & 0x0020))
+        s2 = "HIGH";
+      else
+        s2 = "MAX";
+
+      if (!(state & 0x0004)) {
+         s3 = ", not locked, ";
+        if (!(state & 0x0008))
+          s4 = "not frozen [SEC5]";
+        else
+          s4 = "frozen [SEC6]";
+      }
+      else {
+        s3 = ", **LOCKED** [SEC4]";
+        if (state & 0x0010)
+          s4 = ", PW ATTEMPTS EXCEEDED";
+      }
+    }
+
+    pout("%s%s%s%s%s\n", msg, s1, s2, s3, s4);
+}
+
+static void print_standby_timer(const char * msg, int timer, const ata_identify_device & drive)
+{
+  const char * s1 = 0;
+  int hours = 0, minutes = 0 , seconds = 0;
+
+  // Table 63 of T13/2015-D (ACS-2) Revision 7, June 22, 2011
+  if (timer == 0)
+    s1 = "disabled";
+  else if (timer <= 240)
+    seconds = timer * 5, minutes = seconds / 60, seconds %= 60;
+  else if (timer <= 251)
+    minutes = (timer - 240) * 30, hours = minutes / 60, minutes %= 60;
+  else if (timer == 252)
+    minutes = 21;
+  else if (timer == 253)
+    s1 = "between 8 hours and 12 hours";
+  else if (timer == 255)
+    minutes = 21, seconds = 15;
+  else
+    s1 = "reserved";
+
+  const char * s2 = "", * s3 = "";
+  if (!(drive.words047_079[49-47] & 0x2000))
+    s2 = " or vendor-specific";
+  if (timer > 0 && (drive.words047_079[50-47] & 0xc001) == 0x4001)
+    s3 = ", a vendor-specific minimum applies";
+
+  if (s1)
+    pout("%s%d (%s%s%s)\n", msg, timer, s1, s2, s3);
+  else
+    pout("%s%d (%02d:%02d:%02d%s%s)\n", msg, timer, hours, minutes, seconds, s2, s3);
+}
+
 
 int ataPrintMain (ata_device * device, const ata_print_options & options)
 {
@@ -1815,6 +2189,9 @@ int ataPrintMain (ata_device * device, const ata_print_options & options)
        || options.smart_ext_error_log
        || options.smart_ext_selftest_log
        || options.sataphy
+       || options.devstat_all_pages
+       || options.devstat_ssd_page
+       || !options.devstat_pages.empty()
   );
 
   unsigned i;
@@ -1837,7 +2214,7 @@ int ataPrintMain (ata_device * device, const ata_print_options & options)
   // Exit if no further options specified
   if (!(   options.drive_info || need_smart_support
         || need_smart_logdir  || need_gp_logdir
-        || need_sct_support                        )) {
+        || need_sct_support || options.get_set_used)) {
     if (powername)
       pout("Device is in %s mode\n", powername);
     else
@@ -1937,6 +2314,47 @@ int ataPrintMain (ata_device * device, const ata_print_options & options)
     }
   }
 
+  // Print AAM status
+  if (options.get_aam) {
+    if ((drive.command_set_2 & 0xc200) != 0x4200) // word083
+      pout("AAM feature is:   Unavailable\n");
+    else if (!(drive.word086 & 0x0200))
+      pout("AAM feature is:   Disabled\n");
+    else
+      print_aam_level("AAM level is:     ", drive.words088_255[94-88] & 0xff,
+        drive.words088_255[94-88] >> 8);
+  }
+
+  // Print APM status
+  if (options.get_apm) {
+    if ((drive.command_set_2 & 0xc008) != 0x4008) // word083
+      pout("APM feature is:   Unavailable\n");
+    else if (!(drive.word086 & 0x0008))
+      pout("APM feature is:   Disabled\n");
+    else
+      print_apm_level("APM level is:     ", drive.words088_255[91-88] & 0xff);
+  }
+
+  // Print read look-ahead status
+  if (options.get_lookahead) {
+    pout("Rd look-ahead is: %s\n",
+      (   (drive.command_set_2 & 0xc000) != 0x4000 // word083
+       || !(drive.command_set_1 & 0x0040)) ? "Unavailable" : // word082
+       !(drive.cfs_enable_1 & 0x0040) ? "Disabled" : "Enabled"); // word085
+  }
+
+  // Print write cache status
+  if (options.get_wcache) {
+    pout("Write cache is:   %s\n",
+      (   (drive.command_set_2 & 0xc000) != 0x4000 // word083
+       || !(drive.command_set_1 & 0x0020)) ? "Unavailable" : // word082
+       !(drive.cfs_enable_1 & 0x0020) ? "Disabled" : "Enabled"); // word085
+  }
+
+  // Print ATA security status
+  if (options.get_security)
+    print_ata_security_status("ATA Security is:  ", drive.words088_255[128-88]);
+
   // Print remaining drive info
   if (options.drive_info) {
     // Print the (now possibly changed) power mode if available
@@ -1955,6 +2373,88 @@ int ataPrintMain (ata_device * device, const ata_print_options & options)
       || options.smart_auto_offl_disable || options.smart_auto_offl_enable)
     pout("=== START OF ENABLE/DISABLE COMMANDS SECTION ===\n");
   
+  // Enable/Disable AAM
+  if (options.set_aam) {
+    if (options.set_aam > 0) {
+      if (!ata_set_features(device, ATA_ENABLE_AAM, options.set_aam-1)) {
+        pout("AAM enable failed: %s\n", device->get_errmsg());
+        returnval |= FAILSMART;
+      }
+      else
+        print_aam_level("AAM set to level ", options.set_aam-1);
+    }
+    else {
+      if (!ata_set_features(device, ATA_DISABLE_AAM)) {
+        pout("AAM disable failed: %s\n", device->get_errmsg());
+        returnval |= FAILSMART;
+      }
+      else
+        pout("AAM disabled\n");
+    }
+  }
+
+  // Enable/Disable APM
+  if (options.set_apm) {
+    if (options.set_apm > 0) {
+      if (!ata_set_features(device, ATA_ENABLE_APM, options.set_apm-1)) {
+        pout("APM enable failed: %s\n", device->get_errmsg());
+        returnval |= FAILSMART;
+      }
+      else
+        print_apm_level("APM set to level ", options.set_apm-1);
+    }
+    else {
+      if (!ata_set_features(device, ATA_DISABLE_APM)) {
+        pout("APM disable failed: %s\n", device->get_errmsg());
+        returnval |= FAILSMART;
+      }
+      else
+        pout("APM disabled\n");
+    }
+  }
+
+  // Enable/Disable read look-ahead
+  if (options.set_lookahead) {
+    bool enable = (options.set_lookahead > 0);
+    if (!ata_set_features(device, (enable ? ATA_ENABLE_READ_LOOK_AHEAD : ATA_DISABLE_READ_LOOK_AHEAD))) {
+        pout("Read look-ahead %sable failed: %s\n", (enable ? "en" : "dis"), device->get_errmsg());
+        returnval |= FAILSMART;
+    }
+    else
+      pout("Read look-ahead %sabled\n", (enable ? "en" : "dis"));
+  }
+
+  // Enable/Disable write cache
+  if (options.set_wcache) {
+    bool enable = (options.set_wcache > 0);
+    if (!ata_set_features(device, (enable ? ATA_ENABLE_WRITE_CACHE : ATA_DISABLE_WRITE_CACHE))) {
+        pout("Write cache %sable failed: %s\n", (enable ? "en" : "dis"), device->get_errmsg());
+        returnval |= FAILSMART;
+    }
+    else
+      pout("Write cache %sabled\n", (enable ? "en" : "dis"));
+  }
+
+  // Freeze ATA security
+  if (options.set_security_freeze) {
+    if (!ata_nodata_command(device, ATA_SECURITY_FREEZE_LOCK)) {
+        pout("ATA SECURITY FREEZE LOCK failed: %s\n", device->get_errmsg());
+        returnval |= FAILSMART;
+    }
+    else
+      pout("ATA Security set to frozen mode\n");
+  }
+
+  // Set standby timer
+  if (options.set_standby) {
+    if (!ata_nodata_command(device, ATA_IDLE, options.set_standby-1)) {
+        pout("ATA IDLE command failed: %s\n", device->get_errmsg());
+        returnval |= FAILSMART;
+    }
+    else
+      print_standby_timer("Standby timer set to ", options.set_standby-1, drive);
+  }
+
   // Enable/Disable SMART commands
   if (options.smart_enable) {
     if (ataEnableSmart(device)) {
@@ -2493,6 +2993,16 @@ int ataPrintMain (ata_device * device, const ata_print_options & options)
     }
   }
 
+  // Print Device Statistics
+  if (options.devstat_all_pages || options.devstat_ssd_page || !options.devstat_pages.empty()) {
+    unsigned nsectors = GetNumLogSectors(gplogdir, 0x04, true);
+    if (!nsectors)
+      pout("Device Statistics (GP Log 0x04) not supported\n");
+    else if (!print_device_statistics(device, nsectors, options.devstat_pages,
+               options.devstat_all_pages, options.devstat_ssd_page))
+      failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
+  }
+
   // Print SATA Phy Event Counters
   if (options.sataphy) {
     unsigned nsectors = GetNumLogSectors(gplogdir, 0x11, true);
@@ -2510,6 +3020,17 @@ int ataPrintMain (ata_device * device, const ata_print_options & options)
     }
   }
 
+  // Set to standby (spindown) mode
+  // (Above commands may spinup drive)
+  if (options.set_standby_now) {
+    if (!ata_nodata_command(device, ATA_STANDBY_IMMEDIATE)) {
+        pout("ATA STANDBY IMMEDIATE command failed: %s\n", device->get_errmsg());
+        returnval |= FAILSMART;
+    }
+    else
+      pout("Device placed in STANDBY mode\n");
+  }
+
   // START OF THE TESTING SECTION OF THE CODE.  IF NO TESTING, RETURN
   if (!smart_val_ok || options.smart_selftest_type == -1)
     return returnval;
@@ -2553,8 +3074,8 @@ int ataPrintMain (ata_device * device, const ata_print_options & options)
 
   // Now do the test.  Note ataSmartTest prints its own error/success
   // messages
-  if (ataSmartTest(device, options.smart_selftest_type, options.smart_selective_args,
-                   &smartval, sizes.sectors                                          ))
+  if (ataSmartTest(device, options.smart_selftest_type, options.smart_selftest_force,
+                   options.smart_selective_args, &smartval, sizes.sectors            ))
     failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
   else {  
     // Tell user how long test will take to complete.  This is tricky
index 00e6a433bdd89cff916a5c771449ce0149d7fd0a..7a7a9bcbbab4b6afa51069f69cb0d079a06e7698 100644 (file)
@@ -4,7 +4,7 @@
  * Home page of code is: http://smartmontools.sourceforge.net
  *
  * Copyright (C) 2002-9 Bruce Allen <smartmontools-support@lists.sourceforge.net>
- * Copyright (C) 2008-9 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2008-12 Christian Franke <smartmontools-support@lists.sourceforge.net>
  * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,7 @@
 #ifndef ATAPRINT_H_
 #define ATAPRINT_H_
 
-#define ATAPRINT_H_CVSID "$Id: ataprint.h 3316 2011-04-19 19:34:57Z chrfranke $\n"
+#define ATAPRINT_H_CVSID "$Id: ataprint.h 3508 2012-02-12 15:47:56Z chrfranke $\n"
 
 #include <vector>
 
@@ -61,6 +61,9 @@ struct ata_print_options
 
   std::vector<ata_log_request> log_requests;
 
+  bool devstat_all_pages, devstat_ssd_page;
+  std::vector<int> devstat_pages;
+
   bool sct_temp_sts, sct_temp_hist;
   bool sct_erc_get;
   bool sct_erc_set;
@@ -72,6 +75,7 @@ struct ata_print_options
   bool smart_auto_save_disable, smart_auto_save_enable;
 
   int smart_selftest_type; // OFFLINE_FULL_SCAN, ..., see atacmds.h. -1 for no test
+  bool smart_selftest_force; // Ignore already running test
   ata_selective_selftest_args smart_selective_args; // Extra args for selective self-test
 
   unsigned sct_temp_int;
@@ -87,6 +91,20 @@ struct ata_print_options
   bool show_presets; // Show presets and exit
   unsigned char powermode; // Skip check, if disk in idle or standby mode
 
+  bool get_set_used; // true if any get/set command is used
+  bool get_aam; // print Automatic Acoustic Management status
+  int set_aam; // disable(-1), enable(1..255->0..254) Automatic Acoustic Management
+  bool get_apm; // print Advanced Power Management status
+  int set_apm; // disable(-1), enable(2..255->1..254) Advanced Power Management
+  bool get_lookahead; // print read look-ahead status
+  int set_lookahead; // disable(-1), enable(1) read look-ahead
+  int set_standby; // set(1..255->0..254) standby timer
+  bool set_standby_now; // set drive to standby
+  bool get_security; // print ATA security status
+  bool set_security_freeze; // Freeze ATA security
+  bool get_wcache; // print write cache status
+  int set_wcache; // disable(-1), enable(1) write cache
+
   ata_print_options()
     : drive_info(false),
       smart_check_status(false),
@@ -99,6 +117,7 @@ struct ata_print_options
       smart_ext_error_log(0),
       smart_ext_selftest_log(0),
       retry_error_log(false), retry_selftest_log(false),
+      devstat_all_pages(false), devstat_ssd_page(false),
       sct_temp_sts(false), sct_temp_hist(false),
       sct_erc_get(false),
       sct_erc_set(false),
@@ -107,14 +126,21 @@ struct ata_print_options
       smart_disable(false), smart_enable(false),
       smart_auto_offl_disable(false), smart_auto_offl_enable(false),
       smart_auto_save_disable(false), smart_auto_save_enable(false),
-      smart_selftest_type(-1),
+      smart_selftest_type(-1), smart_selftest_force(false),
       sct_temp_int(0), sct_temp_int_pers(false),
       output_format(0),
       fix_firmwarebug(FIX_NOTSPECIFIED),
       fix_swapped_id(false),
       ignore_presets(false),
       show_presets(false),
-      powermode(0)
+      powermode(0),
+      get_set_used(false),
+      get_aam(false), set_aam(0),
+      get_apm(false), set_apm(0),
+      get_lookahead(false), set_lookahead(0),
+      set_standby(0), set_standby_now(false),
+      get_security(false), set_security_freeze(false),
+      get_wcache(false), set_wcache(0)
     { }
 };
 
index ca1c41118128a851b6b42a4bd75b06032233020e..5d15b717bd42c516d82687a07702c258c314e53e 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: autogen.sh 3043 2010-01-22 19:24:59Z chrfranke $
+# $Id: autogen.sh 3462 2011-10-27 19:55:10Z chrfranke $
 #
 # Generate ./configure from config.in and Makefile.in from Makefile.am.
 # This also adds files like missing,depcomp,install-sh to the source
@@ -92,9 +92,21 @@ case "$ver" in
     echo "Please report success/failure to the smartmontools-support mailing list."
 esac
 
+# Install pkg-config macros
+# (Don't use 'aclocal -I m4 --install' to keep support for automake < 1.10)
+test -d m4 || mkdir m4 || exit 1
+test -f m4/pkg.m4 || acdir=`${ACLOCAL} --print-ac-dir` &&
+  test -n "$acdir" && test -f "$acdir/pkg.m4" &&
+{
+  echo "$0: installing \`m4/pkg.m4' from \`$acdir/pkg.m4'"
+  cp "$acdir/pkg.m4" m4/pkg.m4
+}
+test -f m4/pkg.m4 ||
+  echo "Warning: cannot install m4/pkg.m4, 'make dist' and systemd detection will not work."
+
 set -e # stops on error status
 
-${ACLOCAL}
+${ACLOCAL} -I m4
 autoheader
-${AUTOMAKE} --add-missing --copy --foreign
+${AUTOMAKE} --add-missing --copy
 autoconf
index 1f5f2e7105da40c9fb1b2df1526b066dd4857870..163491601b9c5941159f67735e1b37e6a4446f74 100644 (file)
--- a/cciss.cpp
+++ b/cciss.cpp
 #  ifndef be32toh
 #    define be32toh __be32_to_cpu
 #  endif
-#elif defined(__FreeBSD__) && defined(HAVE_DEV_CISS_CISSIO_H)
+#elif defined(__FreeBSD__)
 #  include <sys/endian.h>
-#  include <dev/ciss/cissio.h>
+#  include CISS_LOCATION
 #  define _HAVE_CCISS
-#elif defined(__FreeBSD_kernel__) && defined(HAVE_DEV_CISS_CISSIO_H)
+#elif defined(__FreeBSD_kernel__)
 #  include <endian.h>
-#  include <dev/ciss/cissio.h>
+#  include CISS_LOCATION
 #  define _HAVE_CCISS
 #endif
 
@@ -34,7 +34,7 @@
 #include "scsicmds.h"
 #include "utility.h"
 
-const char * cciss_cpp_cvsid = "$Id: cciss.cpp 3266 2011-02-21 16:33:04Z chrfranke $"
+const char * cciss_cpp_cvsid = "$Id: cciss.cpp 3446 2011-10-13 22:36:28Z samm2 $"
   CCISS_H_CVSID;
 
 typedef struct _ReportLUNdata_struct
diff --git a/cissio_freebsd.h b/cissio_freebsd.h
new file mode 100644 (file)
index 0000000..cd88797
--- /dev/null
@@ -0,0 +1,235 @@
+/*-
+ * Copyright (c) 2001 Michael Smith
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     $FreeBSD: src/sys/dev/ciss/cissio.h,v 1.6.2.1.6.1 2010/12/21 17:09:25 kensmith Exp $
+ */
+
+/*
+ * Driver ioctl interface.
+ *
+ * Note that this interface is API-compatible with the Linux implementation
+ * except as noted, and thus this header bears a striking resemblance to 
+ * the Linux driver's cciss_ioctl.h.
+ *
+ */
+
+#include <sys/ioccom.h>
+
+#pragma pack(1)
+
+typedef struct
+{
+    u_int8_t   bus;
+    u_int8_t   dev_fn;
+    u_int32_t  board_id;
+} cciss_pci_info_struct; 
+
+typedef struct
+{
+    u_int32_t  delay;
+    u_int32_t  count;
+} cciss_coalint_struct;
+
+typedef char           NodeName_type[16];
+typedef u_int32_t      Heartbeat_type;
+
+#define CISS_PARSCSIU2 0x0001
+#define CISS_PARCSCIU3 0x0002
+#define CISS_FIBRE1G   0x0100
+#define CISS_FIBRE2G   0x0200
+typedef u_int32_t      BusTypes_type;
+
+typedef char           FirmwareVer_type[4];
+typedef u_int32_t      DriverVer_type;
+
+/* passthrough command definitions */
+#define SENSEINFOBYTES          32
+#define CISS_MAX_LUN           16      
+#define LEVEL2LUN              1
+#define LEVEL3LUN              0
+
+/* command status value */
+#define CMD_SUCCESS            0x0000
+#define CMD_TARGET_STATUS      0x0001
+#define CMD_DATA_UNDERRUN      0x0002
+#define CMD_DATA_OVERRUN       0x0003
+#define CMD_INVALID            0x0004
+#define CMD_PROTOCOL_ERR       0x0005
+#define CMD_HARDWARE_ERR       0x0006
+#define CMD_CONNECTION_LOST    0x0007
+#define CMD_ABORTED            0x0008
+#define CMD_ABORT_FAILED       0x0009
+#define CMD_UNSOLICITED_ABORT  0x000A
+#define CMD_TIMEOUT            0x000B
+#define CMD_UNABORTABLE                0x000C
+
+/* transfer direction */
+#define XFER_NONE              0x00
+#define XFER_WRITE             0x01
+#define XFER_READ              0x02
+#define XFER_RSVD              0x03
+
+/* task attribute */
+#define ATTR_UNTAGGED          0x00
+#define ATTR_SIMPLE            0x04
+#define ATTR_HEADOFQUEUE       0x05
+#define ATTR_ORDERED           0x06
+#define ATTR_ACA               0x07
+
+/* CDB type */
+#define TYPE_CMD               0x00
+#define TYPE_MSG               0x01
+
+/* command list structure */
+typedef union {
+    struct {
+       u_int8_t        Dev;
+       u_int8_t        Bus:6;
+       u_int8_t        Mode:2;
+    } __packed PeripDev;
+    struct {
+       u_int8_t        DevLSB;
+       u_int8_t        DevMSB:6;
+       u_int8_t        Mode:2;
+    } __packed LogDev;
+    struct {
+       u_int8_t        Dev:5;
+       u_int8_t        Bus:3;
+       u_int8_t        Targ:6;
+       u_int8_t        Mode:2;
+    } __packed LogUnit;
+} SCSI3Addr_struct;
+
+typedef struct {
+    u_int32_t          TargetId:24;
+    u_int32_t          Bus:6;
+    u_int32_t          Mode:2;
+    SCSI3Addr_struct   Target[2];
+} __packed PhysDevAddr_struct;
+  
+typedef struct {
+    u_int32_t          VolId:30;
+    u_int32_t          Mode:2;
+    u_int8_t           reserved[4];
+} __packed LogDevAddr_struct;
+
+typedef union {
+    u_int8_t           LunAddrBytes[8];
+    SCSI3Addr_struct   SCSI3Lun[4];
+    PhysDevAddr_struct PhysDev;
+    LogDevAddr_struct  LogDev;
+} __packed LUNAddr_struct;
+
+typedef struct {
+    u_int8_t   CDBLen;
+    struct {
+       u_int8_t        Type:3;
+       u_int8_t        Attribute:3;
+       u_int8_t        Direction:2;
+    } __packed Type;
+    u_int16_t  Timeout;
+    u_int8_t   CDB[16];
+} __packed RequestBlock_struct;
+
+typedef union {
+    struct {
+       u_int8_t        Reserved[3];
+       u_int8_t        Type;
+       u_int32_t       ErrorInfo;
+    } __packed Common_Info;
+    struct {
+       u_int8_t        Reserved[2];
+       u_int8_t        offense_size;
+       u_int8_t        offense_num;
+       u_int32_t       offense_value;
+    } __packed Invalid_Cmd;
+} __packed MoreErrInfo_struct;
+
+typedef struct {
+    u_int8_t           ScsiStatus;
+    u_int8_t           SenseLen;
+    u_int16_t          CommandStatus;
+    u_int32_t          ResidualCnt;
+    MoreErrInfo_struct MoreErrInfo;
+    u_int8_t           SenseInfo[SENSEINFOBYTES];
+} __packed ErrorInfo_struct;
+
+typedef struct {
+    LUNAddr_struct     LUN_info;       /* 8 */
+    RequestBlock_struct        Request;        /* 20 */
+    ErrorInfo_struct   error_info;     /* 48 */
+    u_int16_t          buf_size;       /* 2 */
+    u_int8_t           *buf;           /* 4 */
+} __packed IOCTL_Command_struct;
+
+#ifdef __amd64__
+typedef struct {
+    LUNAddr_struct     LUN_info;       /* 8 */
+    RequestBlock_struct        Request;        /* 20 */
+    ErrorInfo_struct   error_info;     /* 48 */
+    u_int16_t          buf_size;       /* 2 */
+    u_int32_t          buf;            /* 4 */
+} __packed IOCTL_Command_struct32;
+#endif
+
+/************************************************************************
+ * Command queue statistics
+ */
+
+#define CISSQ_FREE     0
+#define CISSQ_NOTIFY   1
+#define CISSQ_COUNT    2
+
+struct ciss_qstat {
+    uint32_t           q_length;
+    uint32_t           q_max;
+};
+
+union ciss_statrequest {
+    uint32_t           cs_item;
+    struct ciss_qstat  cs_qstat;
+};
+
+/*
+ * Note that we'd normally pass the struct in directly, but
+ * this code is trying to be compatible with other drivers.
+ */
+#define CCISS_GETPCIINFO       _IOR ('C', 200, cciss_pci_info_struct)
+#define CCISS_GETINTINFO       _IOR ('C', 201, cciss_coalint_struct)
+#define CCISS_SETINTINFO       _IOW ('C', 202, cciss_coalint_struct)
+#define CCISS_GETNODENAME      _IOR ('C', 203, NodeName_type)
+#define CCISS_SETNODENAME      _IOW ('C', 204, NodeName_type)
+#define CCISS_GETHEARTBEAT     _IOR ('C', 205, Heartbeat_type)
+#define CCISS_GETBUSTYPES      _IOR ('C', 206, BusTypes_type)
+#define CCISS_GETFIRMVER       _IOR ('C', 207, FirmwareVer_type)
+#define CCISS_GETDRIVERVER     _IOR ('C', 208, DriverVer_type)
+#define CCISS_REVALIDVOLS      _IO  ('C', 209)
+#define CCISS_PASSTHRU         _IOWR ('C', 210, IOCTL_Command_struct)
+#ifdef __amd64
+#define CCISS_PASSTHRU32       _IOWR ('C', 210, IOCTL_Command_struct32)
+#endif
+#define CCISS_GETQSTATS                _IOWR ('C', 211, union ciss_statrequest)
+
+#pragma pack()
index 368a0763e3812d287ead073eecd4df4ff7b9535a..aa5b17547fb5ca00f065be1e86b5be4081c6c95a 100644 (file)
@@ -1,15 +1,15 @@
 #
-# $Id: configure.in 3365 2011-06-09 18:47:31Z chrfranke $
+# $Id: configure.in 3462 2011-10-27 19:55:10Z chrfranke $
 #
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.50)
-AC_INIT(smartmontools, 5.41, smartmontools-support@lists.sourceforge.net)
+AC_INIT(smartmontools, 5.43, smartmontools-support@lists.sourceforge.net)
 AC_CONFIG_SRCDIR(smartctl.cpp)
 
 smartmontools_configure_date=`date -u +'%Y-%m-%d %T %Z'`
-smartmontools_cvs_tag=`echo '$Id: configure.in 3365 2011-06-09 18:47:31Z chrfranke $'`
-smartmontools_release_date=2011-06-09
-smartmontools_release_time="18:46:32 UTC"
+smartmontools_cvs_tag=`echo '$Id: configure.in 3462 2011-10-27 19:55:10Z chrfranke $'`
+smartmontools_release_date=2011-10-20
+smartmontools_release_time="19:19:34 UTC"
 
 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_CONFIGURE_ARGS, "$ac_configure_args",            [smartmontools Configure Arguments])
 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_CONFIGURE_DATE, "$smartmontools_configure_date", [smartmontools Configure Date])
@@ -20,7 +20,7 @@ AC_DEFINE_UNQUOTED(PACKAGE_HOMEPAGE,             "http://smartmontools.sourcefor
 
 AM_CONFIG_HEADER(config.h)
 
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([foreign])
 
 AM_MAINTAINER_MODE
 
@@ -29,14 +29,18 @@ dnl Checks for programs.
 AC_PROG_CXX
 AM_PROG_AS
 AC_PROG_INSTALL
-PKG_PROG_PKG_CONFIG
+
+m4_pattern_forbid([^PKG_PROG_])
+if test "$cross_compiling" = "no"; then
+  m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG],
+    [AC_MSG_WARN([m4/pkg.m4 missing, systemd detection disabled])])
+fi
 
 AC_ARG_VAR(WINDMC, [Windows message compiler command])
 AC_ARG_VAR(WINDRES, [Windows resource compiler command])
 AC_ARG_VAR(MAKENSIS, [NSIS compiler command])
 
 AC_CANONICAL_HOST
-dnl Set flags which may affect AC_CHECK_*.
 case "${host}" in
   *-*-mingw*)
     # Cygwin gcc 4.x does no longer support '-mno-cygwin' to select MinGW gcc.
@@ -56,11 +60,6 @@ case "${host}" in
       fi
     fi
     AC_MSG_RESULT([${MAKENSIS:-no}])
-
-    CPPFLAGS="$CPPFLAGS -I$srcdir/os_win32"
-    ;;
-  *-*-freebsd*)
-    CPPFLAGS="$CPPFLAGS -I/usr/src/sys"
     ;;
 esac
 
@@ -98,10 +97,13 @@ AC_CHECK_HEADERS([sys/tweio.h])
 AC_CHECK_HEADERS([sys/twereg.h])
 dnl Check for FreeBSD twa include files...
 AC_CHECK_HEADERS([sys/tw_osl_ioctl.h])
-dnl Check for FreeBSD ciss include files...
-AC_CHECK_HEADERS([dev/ciss/cissio.h])
 dnl This header file is needed for cciss_ioctl.h at least on SuSE LINUX
 AC_CHECK_HEADERS([linux/compiler.h])
+dnl Check for the FreeBSD CCISS system header and use internal one if not found
+AC_CHECK_HEADERS([dev/ciss/cissio.h],
+    [AC_DEFINE([CISS_LOCATION],[<dev/ciss/cissio.h>],[freebsd ciss header location])],
+    [AC_DEFINE([CISS_LOCATION],["cissio_freebsd.h"],[freebsd ciss header location])]
+    )
 dnl Check for Linux CCISS include file
 AC_CHECK_HEADERS([linux/cciss_ioctl.h], [], [], [AC_INCLUDES_DEFAULT
 #ifdef HAVE_LINUX_COMPILER_H
@@ -148,13 +150,13 @@ fi
 AC_MSG_RESULT([$libc_have_working_snprintf])
 
 # check for __attribute__((packed))
+# (sizeof() check is required to avoid false positives if other
+# __attribute__((x)) are supported)
 AC_MSG_CHECKING([whether $CXX supports __attribute__((packed))])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[struct a { int b; } __attribute__((packed));]])],
-                  [gcc_have_attr_packed=yes], [gcc_have_attr_packed=no])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-#error "Sun's compiler cannot handle __attribute__((packed))!"
-#endif]])],
-                  [true], [gcc_have_attr_packed=no])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[
+    struct s { char a; short b; } __attribute__((packed));
+    typedef char t[sizeof(struct s) == 3 ? 1 : -1];]])],
+  [gcc_have_attr_packed=yes], [gcc_have_attr_packed=no])
 AC_SUBST(gcc_have_attr_packed)
 if test "$gcc_have_attr_packed" = "yes"; then
   AC_DEFINE(HAVE_ATTR_PACKED, 1, [Define to 1 if C++ compiler supports __attribute__((packed))])
@@ -172,7 +174,11 @@ AC_ARG_WITH(systemdsystemunitdir,
 systemdsystemunitdir=
 case "$with_systemdsystemunitdir" in
  auto|yes)
-   test -n "$PKG_CONFIG" && systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
+   if test -n "$PKG_CONFIG"; then
+     AC_MSG_CHECKING([for systemdsystemunitdir])
+     systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
+     AC_MSG_RESULT([${systemdsystemunitdir:-no}])
+   fi
    case "$with_systemdsystemunitdir:$sysconfdir:$systemdsystemunitdir" in
      yes:*:) AC_MSG_ERROR([Location of systemd service files not found]) ;;
      yes:*:*|auto:*:|auto:/etc:*) ;;
@@ -188,26 +194,23 @@ AC_ARG_WITH(initscriptdir,
   [AC_HELP_STRING([--with-initscriptdir@<:@=DIR|auto|yes|no@:>@], [Location of init scripts [auto]])],
   [], [with_initscriptdir=auto])
 
-AC_MSG_CHECKING(which init (rc) directory to use)
-initddir=""
-for dir in rc.d/init.d init.d rc.d; do
-  if test -d /etc/$dir; then
-    initddir='${sysconfdir}'/$dir
-    break
-  fi
-done
-AC_MSG_RESULT([${initddir:-not found}])
-
-case "$with_initscriptdir" in
-  auto) test -n "$systemdsystemunitdir" && initddir= ;;
-  yes)
-   if test -z "$initddir"; then
-     AC_MSG_ERROR([Location of init scripts not found])
-   fi ;;
-  no) initddir= ;;
+initddir=
+case "$with_initscriptdir:$cross_compiling:$systemdsystemunitdir" in
+  auto:no:|yes:*)
+    AC_MSG_CHECKING([for init (rc) directory])
+    for dir in rc.d/init.d init.d rc.d; do
+      if test -d /etc/$dir; then
+        initddir='${sysconfdir}'/$dir
+        break
+      fi
+    done
+    AC_MSG_RESULT([${initddir:-no}])
+    case "$with_initscriptdir:$initddir" in
+      yes:) AC_MSG_ERROR([Location of init scripts not found]) ;;
+    esac ;;
+  auto:*|no:*) ;;
   *) initddir="$with_initscriptdir" ;;
 esac
-
 AC_SUBST(initddir)
 AM_CONDITIONAL(INSTALL_INITSCRIPT, [test -n "$initddir"])
 
@@ -340,54 +343,65 @@ os_solaris=no
 os_win32=no
 os_win32_mingw=no
 os_win64=no
+os_man_filter=
 case "${host}" in
   *-*-linux*)
     os_deps='os_linux.o cciss.o'
+    os_man_filter=Linux
     ;;
   *-*-freebsd*|*-*-dragonfly*|*-*-kfreebsd*-gnu*)
     os_deps='os_freebsd.o cciss.o'
     os_libs='-lcam'
     os_dltools='curl wget lynx fetch'
     AC_CHECK_LIB(usb, libusb20_dev_get_device_desc)
+    os_man_filter=FreeBSD
     ;;
   sparc-*-solaris*)
     os_deps='os_solaris.o os_solaris_ata.o'
     os_mailer='mailx'
     os_solaris=yes
+    os_man_filter=Solaris
     ;;
   *-pc-solaris*)
     os_deps='os_solaris.o'
     os_mailer='mailx'
     os_solaris=yes
+    os_man_filter=Solaris
     ;;
   *-*-netbsd*)
     os_deps='os_netbsd.o'
     os_libs='-lutil'
+    os_man_filter=NetBSD
     ;;
   *-*-openbsd*)
     os_deps='os_openbsd.o'
     os_libs='-lutil'
     os_dltools='curl wget lynx ftp'
+    os_man_filter=OpenBSD
     ;;
   *-*-cygwin*)
     os_deps='os_win32.o'
     os_win32=yes
+    os_man_filter=Cygwin
     ;;
   x86_64-*-mingw*)
     os_deps='os_win32.o'
     os_win32=yes
     os_win32_mingw=yes
     os_win64=yes
+    os_man_filter=Windows
     ;;
   *-*-mingw*)
     os_deps='os_win32.o'
     os_win32=yes
     os_win32_mingw=yes
+    os_man_filter=Windows
     ;;
   *-*-darwin*)
     os_deps='os_darwin.o'
     os_libs='-framework CoreFoundation -framework IOKit'
     os_darwin=yes
+    os_man_filter=Darwin
     ;;
   *-*-nto-qnx*)
     os_deps='os_qnxnto.o'
@@ -415,6 +429,7 @@ AC_MSG_RESULT([$os_new_interface])
 AC_SUBST([os_deps])
 AC_SUBST([os_libs])
 AC_SUBST([os_dltools])
+AC_SUBST([os_man_filter])
 if test -n "$os_mailer"; then
   AC_DEFINE_UNQUOTED(DEFAULT_MAILER, "$os_mailer", [Default mailer if "mail" is unavailable])
 fi
index 8b800fa7c03671d6104a2702a3b7f0276eaf842a..da2ccb779d868f8e38f805a97744b31a1388a8e8 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2008-11 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2008-12 Christian Franke <smartmontools-support@lists.sourceforge.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
 #include <stdarg.h>
 #include <stdexcept>
 
-const char * dev_interface_cpp_cvsid = "$Id: dev_interface.cpp 3256 2011-02-08 22:13:41Z chrfranke $"
+const char * dev_interface_cpp_cvsid = "$Id: dev_interface.cpp 3519 2012-03-06 20:01:44Z chrfranke $"
   DEV_INTERFACE_H_CVSID;
 
 /////////////////////////////////////////////////////////////////////////////
@@ -61,8 +61,7 @@ bool smart_device::set_err(int no, const char * msg, ...)
 
 bool smart_device::set_err(int no)
 {
-  smi()->set_err_var(&m_err, no);
-  return false;
+  return smi()->set_err_var(&m_err, no);
 }
 
 smart_device * smart_device::autodetect_open()
@@ -230,7 +229,7 @@ std::string smart_interface::get_valid_dev_types_str()
 {
   // default
   std::string s =
-    "ata, scsi, sat[,N][+TYPE], usbcypress[,X], usbjmicron[,x][,N], usbsunplus";
+    "ata, scsi, sat[,auto][,N][+TYPE], usbcypress[,X], usbjmicron[,x][,N], usbsunplus";
   // append custom
   std::string s2 = get_valid_custom_dev_types_str();
   if (!s2.empty()) {
@@ -244,28 +243,34 @@ std::string smart_interface::get_app_examples(const char * /*appname*/)
   return "";
 }
 
-void smart_interface::set_err(int no, const char * msg, ...)
+bool smart_interface::disable_system_auto_standby(bool /*disable*/)
 {
-  if (!msg) {
-    set_err(no); return;
-  }
+  return set_err(ENOSYS);
+}
+
+bool smart_interface::set_err(int no, const char * msg, ...)
+{
+  if (!msg)
+    return set_err(no);
   m_err.no = no;
   va_list ap; va_start(ap, msg);
   m_err.msg = vstrprintf(msg, ap);
   va_end(ap);
+  return false;
 }
 
-void smart_interface::set_err(int no)
+bool smart_interface::set_err(int no)
 {
-  set_err_var(&m_err, no);
+  return set_err_var(&m_err, no);
 }
 
-void smart_interface::set_err_var(smart_device::error_info * err, int no)
+bool smart_interface::set_err_var(smart_device::error_info * err, int no)
 {
   err->no = no;
   err->msg = get_msg_for_errno(no);
   if (err->msg.empty() && no != 0)
     err->msg = strprintf("Unknown error %d", no);
+  return false;
 }
 
 const char * smart_interface::get_msg_for_errno(int no)
index 716252f566a6647a895fb8cad7c4f4ed9eeaf32f..dae7fc5551e0be966c20301ec7c03b7cf2e30868 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2008-11 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2008-12 Christian Franke <smartmontools-support@lists.sourceforge.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #ifndef DEV_INTERFACE_H
 #define DEV_INTERFACE_H
 
-#define DEV_INTERFACE_H_CVSID "$Id: dev_interface.h 3256 2011-02-08 22:13:41Z chrfranke $\n"
+#define DEV_INTERFACE_H_CVSID "$Id: dev_interface.h 3520 2012-03-06 20:50:10Z chrfranke $\n"
+
+#include "utility.h"
 
 #include <stdexcept>
 #include <string>
 #include <vector>
 
-#if !defined(__GNUC__) && !defined(__attribute__)
-#define __attribute__(x)  /**/
-#endif
-
-#ifdef _MSC_VER // Disable MSVC warning
-#pragma warning(disable:4250) // 'class1' : inherits 'class2::member' via dominance
-#endif
-
 /////////////////////////////////////////////////////////////////////////////
 // Common functionality for all device types
 
@@ -157,7 +151,7 @@ public:
   /// Printf()-like formatting is supported.
   /// Returns false always to allow use as a return expression.
   bool set_err(int no, const char * msg, ...)
-    __attribute__ ((format (printf, 3, 4)));
+    __attribute_format_printf(3, 4);
 
   /// Set last error info struct.
   bool set_err(const error_info & err)
@@ -204,14 +198,6 @@ public:
   virtual void release(const smart_device * dev);
 
 protected:
-  /// Set dynamic downcast for ATA
-  void this_is_ata(ata_device * ata);
-    // {see below;}
-
-  /// Set dynamic downcast for SCSI
-  void this_is_scsi(scsi_device * scsi);
-    // {see below;}
-
   /// Get interface which produced this object.
   smart_interface * smi()
     { return m_intf; }
@@ -223,9 +209,14 @@ protected:
 private:
   smart_interface * m_intf;
   device_info m_info;
+  error_info m_err;
+
+  // Pointers for to_ata(), to_scsi(),
+  // set by ATA/SCSI interface classes.
+  friend class ata_device;
   ata_device * m_ata_ptr;
+  friend class scsi_device;
   scsi_device * m_scsi_ptr;
-  error_info m_err;
 
   // Prevent copy/assigment
   smart_device(const smart_device &);
@@ -518,10 +509,14 @@ protected:
     bool multi_sector_support = false,
     bool ata_48bit_support = false);
 
+  /// Hide/unhide ATA interface.
+  void hide_ata(bool hide = true)
+    { m_ata_ptr = (!hide ? this : 0); }
+
   /// Default constructor, registers device as ATA.
   ata_device()
     : smart_device(never_called)
-    { this_is_ata(this); }
+    { hide_ata(false); }
 };
 
 
@@ -540,30 +535,17 @@ public:
   virtual bool scsi_pass_through(scsi_cmnd_io * iop) = 0;
 
 protected:
+  /// Hide/unhide SCSI interface.
+  void hide_scsi(bool hide = true)
+    { m_scsi_ptr = (!hide ? this : 0); }
+
   /// Default constructor, registers device as SCSI.
   scsi_device()
     : smart_device(never_called)
-    { this_is_scsi(this); }
+    { hide_scsi(false); }
 };
 
 
-/////////////////////////////////////////////////////////////////////////////
-
-// Set dynamic downcasts
-// Note that due to virtual inheritance,
-// (ata == this) does not imply ((void*)ata == (void*)this))
-
-inline void smart_device::this_is_ata(ata_device * ata)
-{
-  m_ata_ptr = (ata == this ? ata : 0);
-}
-
-inline void smart_device::this_is_scsi(scsi_device * scsi)
-{
-  m_scsi_ptr = (scsi == this ? scsi : 0);
-}
-
-
 /////////////////////////////////////////////////////////////////////////////
 /// Smart pointer class for device pointers
 
@@ -748,6 +730,13 @@ public:
   /// TODO: Remove this hack.
   virtual std::string get_app_examples(const char * appname);
 
+  /// Disable/Enable system auto standby/sleep mode.
+  /// Return false if unsupported or if system is running
+  /// on battery.
+  /// Default implementation returns false.
+  virtual bool disable_system_auto_standby(bool disable);
+
+
   ///////////////////////////////////////////////
   // Last error information
 
@@ -763,12 +752,13 @@ public:
 
   /// Set last error number and message.
   /// Printf()-like formatting is supported.
-  void set_err(int no, const char * msg, ...)
-    __attribute__ ((format (printf, 3, 4)));
+  /// Returns false always to allow use as a return expression.
+  bool set_err(int no, const char * msg, ...)
+    __attribute_format_printf(3, 4);
 
   /// Set last error info struct.
-  void set_err(const smart_device::error_info & err)
-    { m_err = err; }
+  bool set_err(const smart_device::error_info & err)
+    { m_err = err; return false; }
 
   /// Clear last error info.
   void clear_err()
@@ -776,11 +766,11 @@ public:
 
   /// Set last error number and default message.
   /// Message is retrieved from get_msg_for_errno(no).
-  void set_err(int no);
+  bool set_err(int no);
 
   /// Set last error number and default message to any error_info.
   /// Used by set_err(no).
-  void set_err_var(smart_device::error_info * err, int no);
+  bool set_err_var(smart_device::error_info * err, int no);
 
   /// Convert error number into message, used by set_err(no).
   /// Default implementation returns strerror(no).
index bc0e76ff9e14cafce88390b9a7d526adba89e178..40a20ec49fb70565578c5e4bb428ce51ed1bfc2a 100644 (file)
--- a/drivedb.h
+++ b/drivedb.h
@@ -4,7 +4,7 @@
  * Home page of code is: http://smartmontools.sourceforge.net
  *
  * Copyright (C) 2003-11 Philip Williams, Bruce Allen
- * Copyright (C) 2008-11 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2008-12 Christian Franke <smartmontools-support@lists.sourceforge.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -75,7 +75,7 @@
 /*
 const drive_settings builtin_knowndrives[] = {
  */
-  { "$Id: drivedb.h 3364 2011-06-08 21:26:23Z manfred99 $",
+  { "$Id: drivedb.h 3515 2012-02-27 21:05:25Z chrfranke $",
     "-", "-",
     "This is a dummy entry to hold the SVN-Id of drivedb.h",
     ""
@@ -88,36 +88,55 @@ const drive_settings builtin_knowndrives[] = {
     "ASUS-PHISON SSD",
     "", "", ""
   },
-  { "Crucial RealSSD C300", // Marvell 88SS9174 BJP2, tested with C300-CTFDDAC128MAG/0002
-    "C300-CTFDDA[AC](064|128|256)MAG",
+  { "Crucial/Micron RealSSD C300/C400",
+    "C300-CTFDDA[AC](064|128|256)MAG|" // Marvell 88SS9174 BJP2, tested with C300-CTFDDAC128MAG/0002
+    "C400-MTFDDA[ACK](064|128|256|512)MAM|" // tested with C400-MTFDDAC256MAM/0002
+    "M4-CT(064|128|256)M4SSD2", // tested with M4-CT064M4SSD2/0002
     "", "",
+  //"-v 1,raw48,Raw_Read_Error_Rate "
+  //"-v 5,raw48,Reallocated_Sector_Ct "
+  //"-v 9,raw48,Power_On_Hours "
+  //"-v 12,raw48,Power_Cycle_Count "
     "-v 170,raw48,Grown_Failing_Block_Ct "
     "-v 171,raw48,Program_Fail_Count "
     "-v 172,raw48,Erase_Fail_Count "
     "-v 173,raw48,Wear_Levelling_Count "
     "-v 174,raw48,Unexpect_Power_Loss_Ct "
-    "-v 181,raw48,Non4k_Aligned_Access "
+    "-v 181,raw16,Non4k_Aligned_Access "
     "-v 183,raw48,SATA_Iface_Downshift "
+  //"-v 184,raw48,End-to-End_Error "
     "-v 189,raw48,Factory_Bad_Block_Ct "
     "-v 202,raw48,Perc_Rated_Life_Used "
     "-v 206,raw48,Write_Error_Rate"
   },
   { "SandForce Driven SSDs",
     "SandForce 1st Ed\\.|" // Demo Drive, tested with firmware 320A13F0
-    "ADATA SSD S599 .?..GB|" // tested with ADATA SSD S599 256GB/3.1.0, 64GB/3.4.6
+    "ADATA SSD S(510|599) .?..GB|" // tested with ADATA SSD S510 60GB/320ABBF0,
+      // ADATA SSD S599 256GB/3.1.0, 64GB/3.4.6
     "Corsair CSSD-F(40|60|80|120|160|240)GBP?2.*|" // Corsair Force, tested with
       // Corsair CSSD-F40GB2/1.1
+    "Corsair Force (3 SSD|GT)|" // SF-2281, tested with Corsair Force 3 SSD/1.3.2, GT/1.3.3
     "FTM(06|12|24|48)CT25H|" // Supertalent TeraDrive CT, tested with
       // FTM24CT25H/STTMP2P1
+    "KINGSTON SH100S3(120|240)G|" // Hyper-X, SF-2281, tested with SH100S3240G/320ABBF0
     "OCZ[ -](AGILITY2([ -]EX)?|COLOSSUS2|ONYX2|VERTEX2|VERTEX-LE)( [123]\\..*)?|" // SF-1200,
       // tested with OCZ-VERTEX2/1.11, OCZ-VERTEX2 3.5/1.11
+    "OCZ-REVODRIVE( X2)?|" // PCIe, SF-1200, tested with OCZ-REVODRIVE( X2)?/1.20
+    "OCZ-REVODRIVE3( X2)?|" // PCIe, SF-2281, tested with OCZ-REVODRIVE3 X2/2.11
     "OCZ[ -](VELO|VERTEX2[ -](EX|PRO))( [123]\\..*)?|" // SF-1500, tested with
       // OCZ VERTEX2-PRO/1.10 (Bogus thresholds for attribute 232 and 235)
-    "OCZ-VERTEX3|"  // SF-2200, tested with OCZ-VERTEX3/2.02
+    "D2[CR]STK251...-....|" // OCZ Deneva 2 C/R, SF-22xx/25xx,
+      // tested with D2CSTK251M11-0240/2.08, D2CSTK251A10-0240/2.15
+    "OCZ-(AGILITY3|SOLID3|VERTEX3( MI)?)|"  // SF-2200, tested with OCZ-VERTEX3/2.02,
+      // OCZ-AGILITY3/2.11, OCZ-SOLID3/2.15, OCZ-VERTEX3 MI/2.15
+    "OCZ Z-DRIVE R4 [CR]M8[48]|" // PCIe, SF-2282/2582, tested with OCZ Z-DRIVE R4 CM84/2.13
+      // (Bogus attributes under Linux)
     "(APOC|DENC|DENEVA|FTNC|GFGC|MANG|MMOC|NIMC|TMSC).*|" // other OCZ SF-1200,
       // tested with DENCSTE251M11-0120/1.33, DENEVA PCI-E/1.33
     "(DENR|DRSAK|EC188|NIMR|PSIR|TRSAK).*|" // other OCZ SF-1500
-    "OWC Mercury Extreme Pro SSD|" // tested with firmware 360A13F0
+    "OWC Mercury Extreme Pro (RE )?SSD|" // tested with
+      // OWC Mercury Extreme Pro SSD/360A13F0
+    "Patriot Pyro|" // tested with Patriot Pyro/332ABBF0
     "UGB(88P|99S)GC...H[BF].", // Unigen, tested with
       // UGB88PGC100HF2/MP Rev2, UGB99SGC100HB3/RC Rev3
     "", "",
@@ -153,10 +172,13 @@ const drive_settings builtin_knowndrives[] = {
     "-v 242,raw48,Lifetime_Reads_GiB"
   },
   { "Indilinx Barefoot based SSDs",
+    "Corsair CSSD-V(32|60|64|128|256)GB2|" // Corsair Nova, tested with Corsair CSSD-V32GB2/2.2
     "CRUCIAL_CT(64|128|256)M225|" // tested with CRUCIAL_CT64M225/1571
+    "G.SKILL FALCON (64|128|256)GB SSD|" // tested with G.SKILL FALCON 128GB SSD/2030
     "OCZ[ -](AGILITY|ONYX|VERTEX( 1199|-TURBO)?)|" // tested with
       // OCZ-ONYX/1.6, OCZ-VERTEX 1199/00.P97, OCZ-VERTEX/1.30, OCZ VERTEX-TURBO/1.5
     "Patriot[ -]Torqx.*|"
+    "RENICE Z2|" // tested with RENICE Z2/2030
     "STT_FT[MD](28|32|56|64)GX25H|" // Super Talent Ultradrive GX, tested with STT_FTM64GX25H/1916
     "TS(18|25)M(64|128)MLC(16|32|64|128|256|512)GSSD|" // ASAX Leopard Hunt II, tested with TS25M64MLC64GSSD/0.1
     "FM-25S2I-(64|128)GBFII|" // G.Skill FALCON II, tested with FM-25S2I-64GBFII
@@ -186,6 +208,18 @@ const drive_settings builtin_knowndrives[] = {
     "-v 212,raw64,SATA_Error_Ct_Handshake "
     "-v 213,raw64,Indilinx_Internal"
   },
+  { "Indilinx Martini based SSDs",
+    "OCZ VERTEX-PLUS", // tested with OCZ VERTEX-PLUS/3.55
+    "", "", ""
+  //"-v 1,raw48,Raw_Read_Error_Rate "
+  //"-v 3,raw48,Spin_Up_Time "
+  //"-v 4,raw48,Start_Stop_Count "
+  //"-v 5,raw48,Reallocated_Sector_Ct "
+  //"-v 9,raw48,Power_On_Hours "
+  //"-v 12,raw48,Power_Cycle_Count "
+  //"-v 232,raw48,Available_Reservd_Space "
+  //"-v 233,raw48,Media_Wearout_Indicator"
+  },
   { "Intel X25-E SSDs",
     "SSDSA2SH(032|064)G1.* INTEL",  // G1 = first generation
     "", "",
@@ -220,7 +254,7 @@ const drive_settings builtin_knowndrives[] = {
   },
   { "Intel X18-M/X25-M/X25-V G2 SSDs", // fixed firmware
       // tested with INTEL SSDSA2M(080|160)G2GC/2CV102J8 (X25-M)
-    "INTEL SSDSA[12]M(040|080|160)G2.*",  // G2 = second generation, 34nm
+    "INTEL SSDSA[12]M(040|080|120|160)G2.*",  // G2 = second generation, 34nm
     "2CV102(J[89A-Z]|[K-Z].)", // >= "2CV102J8"
     "",
   //"-v 3,raw48,Spin_Up_Time "
@@ -239,7 +273,7 @@ const drive_settings builtin_knowndrives[] = {
   },
   { "Intel X18-M/X25-M/X25-V G2 SSDs", // buggy or unknown firmware
       // tested with INTEL SSDSA2M040G2GC/2CV102HD (X25-V)
-    "INTEL SSDSA[12]M(040|080|160)G2.*",
+    "INTEL SSDSA[12]M(040|080|120|160)G2.*",
     "",
     "This drive may require a firmware update to\n"
     "fix possible drive hangs when reading SMART self-test log:\n"
@@ -250,8 +284,31 @@ const drive_settings builtin_knowndrives[] = {
     "-v 227,raw48,Workld_Host_Reads_Perc "
     "-v 228,raw48,Workload_Minutes"
   },
-  { "Intel 320 Series SSDs",
-    "INTEL SSDSA[12]CW(040|080|120|160|300|600)G3",
+  { "Intel 320 Series SSDs", // tested with INTEL SSDSA2CT040G3/4PC10362
+    "INTEL SSDSA[12]C[WT](040|080|120|160|300|600)G3",
+    "", "",
+  //"-v 3,raw48,Spin_Up_Time "
+  //"-v 4,raw48,Start_Stop_Count "
+  //"-v 5,raw48,Reallocated_Sector_Ct "
+  //"-v 9,raw48,Power_On_Hours "
+  //"-v 12,raw48,Power_Cycle_Count "
+    "-v 170,raw48,Reserve_Block_Count "
+    "-v 171,raw48,Program_Fail_Count "
+    "-v 172,raw48,Erase_Fail_Count "
+  //"-v 184,raw48,End-to-End_Error "
+  //"-v 187,raw48,Reported_Uncorrect "
+    "-v 192,raw48,Unsafe_Shutdown_Count "
+    "-v 225,raw48,Host_Writes_32MiB "
+    "-v 226,raw48,Workld_Media_Wear_Indic " // Timed Workload Media Wear Indicator (percent*1024)
+    "-v 227,raw48,Workld_Host_Reads_Perc "  // Timed Workload Host Reads Percentage
+    "-v 228,raw48,Workload_Minutes " // 226,227,228 can be reset by 'smartctl -t vendor,0x40'
+  //"-v 232,raw48,Available_Reservd_Space "
+  //"-v 233,raw48,Media_Wearout_Indicator "
+    "-v 241,raw48,Host_Writes_32MiB "
+    "-v 242,raw48,Host_Reads_32MiB"
+  },
+  { "Intel 710 Series SSDs", // tested with INTEL SSDSA2BZ100G3/6PB10362
+    "INTEL SSDSA2BZ(100|200|300)G3",
     "", "",
   //"-v 3,raw48,Spin_Up_Time "
   //"-v 4,raw48,Start_Stop_Count "
@@ -261,8 +318,11 @@ const drive_settings builtin_knowndrives[] = {
     "-v 170,raw48,Reserve_Block_Count "
     "-v 171,raw48,Program_Fail_Count "
     "-v 172,raw48,Erase_Fail_Count "
+  //"-v 174,raw48,Unknown_Attribute "
+    "-v 183,raw48,SATA_Downshift_Count "
   //"-v 184,raw48,End-to-End_Error "
   //"-v 187,raw48,Reported_Uncorrect "
+  //"-v 190,raw48,Airflow_Temperature_Cel "
     "-v 192,raw48,Unsafe_Shutdown_Count "
     "-v 225,raw48,Host_Writes_32MiB "
     "-v 226,raw48,Workld_Media_Wear_Indic " // Timed Workload Media Wear Indicator (percent*1024)
@@ -325,40 +385,50 @@ const drive_settings builtin_knowndrives[] = {
     //  1.....................................40 chars limit for smartmontools <= r3343
   },
   { "JMicron based SSDs", // JMicron JMF61x
+    "ADATA S596 Turbo|"  // tested with ADATA S596 Turbo 256GB SATA SSD (JMicron JMF616)
+    "APPLE SSD TS.*|"  // Toshiba?, tested with APPLE SSD TS064C/CJAA0201
     "KINGSTON SNV425S2(64|128)GB|"  // SSDNow V Series (2. Generation, JMF618),
                                     // tested with KINGSTON SNV425S264GB/C091126a
     "KINGSTON SS100S2(8|16)G|"  // SSDNow S100 Series, tested with KINGSTON SS100S28G/D100309a
-    "KINGSTON SVP100S2B?(64|96|128|256|512)G|"  // SSDNow V+100 Series,
-                                                // tested with KINGSTON SVP100S296G/CJR10202
+    "KINGSTON SVP?100S2B?(64|96|128|256|512)G|"  // SSDNow V100/V+100 Series,
+                                                 // tested with KINGSTON SVP100S296G/CJR10202,
+                                                 // KINGSTON SV100S2256G/D110225a
     "TOSHIBA THNS128GG4BBAA|"  // Toshiba / Super Talent UltraDrive DX,
                                // tested with Toshiba 128GB 2.5" SSD (built in MacBooks)
-    "APPLE SSD TS.*|"  // Toshiba?, tested with APPLE SSD TS064C/CJAA0201
-    "ADATA S596 Turbo|"  // tested with ADATA S596 Turbo 256GB SATA SSD (JMicron JMF616)
+    "TOSHIBA THNSNC128GMLJ|" // tested with THNSNC128GMLJ/CJTA0202 (built in Toshiba Protege/Dynabook)
     "TS(8|16|32|64|128|192|256|512)GSSD25S-(MD?|S)", // Transcend SATA (JMF612), tested with TS256GSSD25S-M/101028
     "", "",
+  //"-v 1,raw48,Raw_Read_Error_Rate "
+  //"-v 2,raw48,Throughput_Performance "
     "-v 3,raw48,Unknown_Attribute "
+  //"-v 5,raw48,Reallocated_Sector_Ct "
     "-v 7,raw48,Unknown_Attribute "
     "-v 8,raw48,Unknown_Attribute "
   //"-v 9,raw48,Power_On_Hours "
     "-v 10,raw48,Unknown_Attribute "
   //"-v 12,raw48,Power_Cycle_Count "
+  //"-v 167,raw48,Unknown_Attribute "
     "-v 168,raw48,SATA_Phy_Error_Count "
+  //"-v 169,raw48,Unknown_Attribute "
     "-v 170,raw16,Bad_Block_Count "
     "-v 173,raw16,Erase_Count "
     "-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 240,raw48,Unknown_Attribute"
   },
   { "Samsung based SSDs",
     "SAMSUNG SSD PM800 .*GB|"  // SAMSUNG PM800 SSDs, tested with SAMSUNG SSD PM800 TH 64GB/VBM25D1Q
     "SAMSUNG SSD PM810 .*GB|"  // SAMSUNG PM810 (470 series) SSDs, tested with SAMSUNG SSD PM810 2.5" 128GB/AXM06D1Q
-    "SAMSUNG 470 Series SSD",  // SAMSUNG 470 Series SSD, tested with SAMSUNG 470 Series SSD 64GB/AXM09B1Q
+    "SAMSUNG 470 Series SSD|"  // tested with SAMSUNG 470 Series SSD 64GB/AXM09B1Q
+    "SAMSUNG SSD 830 Series",  // tested with SAMSUNG SSD 830 Series 64GB/CXM03B1Q
     "", "",
   //"-v 9,raw48,Power_On_Hours "
   //"-v 12,raw48,Power_Cycle_Count "
   //"-v 175,raw48,Program_Fail_Count_Chip "
   //"-v 176,raw48,Erase_Fail_Count_Chip "
-  //"-v 177,raw48,Wear_Leveling_Count Wear "
+  //"-v 177,raw48,Wear_Leveling_Count "
   //"-v 178,raw48,Used_Rsvd_Blk_Cnt_Chip "
   //"-v 179,raw48,Used_Rsvd_Blk_Cnt_Tot "
   //"-v 180,raw48,Unused_Rsvd_Blk_Cnt_Tot "
@@ -373,9 +443,12 @@ const drive_settings builtin_knowndrives[] = {
     "-v 199,raw48,CRC_Error_Count "
     "-v 201,raw48,Supercap_Status "
     "-v 202,raw48,Exception_Mode_Status"
+  //"-v 240,raw48,Unknown_Attribute " // 830 Series
+  //"-v 241,raw48,Total_LBAs_Written" // 830 Series
   },
-  { "Transcend CompactFlash Cards", // tested with TRANSCEND/20080820, TS4GCF133/20100709
-    "TRANSCEND|TS4GCF133",
+  { "Transcend CompactFlash Cards", // tested with TRANSCEND/20080820,
+      // TS4GCF133/20100709, TS16GCF133/20100709
+    "TRANSCEND|TS(4|8|16)GCF133",
     "", "",
     "-v 7,raw48,Unknown_Attribute "
     "-v 8,raw48,Unknown_Attribute"
@@ -740,6 +813,22 @@ const drive_settings builtin_knowndrives[] = {
     "SAMSUNG HM(161G|(251|321)H|501I|641J)I",
     "", "", ""
   },
+  { "SAMSUNG SpinPoint M7U (USB)", // tested with HM252HX/2AC101C4
+    "SAMSUNG HM(162H|252H|322I|502J)X",
+    "", "", ""
+  },
+  { "SAMSUNG SpinPoint M8 (AFT)", // tested with HN-M101MBB/2AR10001
+    "SAMSUNG HN-M(250|500|750|101)MBB",
+    "", "", ""
+  },
+  { "SAMSUNG SpinPoint M8U (USB)", // tested with HN-M500XBB/2AR10001
+    "SAMSUNG HN-M(320|500|750|101)XBB",
+    "", "", ""
+  },
+  { "SAMSUNG SpinPoint MP5", // tested with HM250HJ/2AK10001
+    "SAMSUNG HM(250H|320H|500J|640J)J",
+    "", "", ""
+  },
   { "SAMSUNG SpinPoint MT2", // tested with HM100UI/2AM10001
     "SAMSUNG HM100UI",
     "", "", ""
@@ -758,6 +847,23 @@ const drive_settings builtin_knowndrives[] = {
     "SAMSUNG HS(122H|2[05]YJ)Z",
     "", "", ""
   },
+  { "SMART Xcel-10 2.5 SATA SSD", //  based on http://www.smartm.com/files/salesLiterature/storage/xcel10.pdf
+    "SMART A25FD-(32|64|128)GI32N", // tested with SMART A25FD-128GI32N/B9F23D4K
+    "",
+    "", // attributes info from http://www.adtron.com/pdf/SMART_Attributes_Xcel-10_810800014_RevB.pdf
+    "-v 1,raw48,Not_Supported "
+    "-v 2,raw48,Not_Supported "
+  //"-v 9,raw48,Power_On_Hours "
+  //"-v 12,raw48,Power_Cycle_Count "
+    "-v 191,raw48,Not_Supported "
+  //"-v 192,raw48,Power-Off_Retract_Count "
+    "-v 197,raw48,ECC_Error_Count "
+  //"-v 198,raw48,Offline_Uncorrectable "
+  //"-v 199,raw48,UDMA_CRC_Error_Count "
+    "-v 251,raw48,Min_Spares_Remain_Perc " // percentage of the total number of spare blocks available
+    "-v 252,raw48,Added_Bad_Flash_Blk_Ct " // number of bad flash blocks
+    "-v 254,raw48,Total_Erase_Blocks_Ct" // number of times the drive has erased any erase block
+  },
 /*
   // TODO: Make the entries below more specific.
   // These entries produce misleading results, because newer
@@ -974,7 +1080,7 @@ const drive_settings builtin_knowndrives[] = {
     "", "", ""
   },
   { "Seagate Maxtor DiamondMax 21", // tested with MAXTOR STM3250310AS/3.AAF
-    "MAXTOR STM3(80815|160215|250310|(250|320)820|320620|500630)AS?",
+    "MAXTOR STM3(80[28]15|160215|250310|(250|320)820|320620|500630)AS?",
     "", "", ""
   },
   { "Seagate Maxtor DiamondMax 22", // fixed firmware
@@ -1148,8 +1254,9 @@ const drive_settings builtin_knowndrives[] = {
     "(Hitachi |HITACHI )?HTS5425(80|12|16|20|25)K9(A3|SA)00",
     "", "", ""
   },
-  { "Hitachi Travelstar 5K320",
-    "(Hitachi |HITACHI )?HT(S|E)5432(80|12|16|25|32)L9(A3(00)?|SA01)",
+  { "Hitachi Travelstar 5K320", // tested with HITACHI HTS543232L9SA00/FB4ZC4EC,
+    // Hitachi HTS543212L9SA02/FBBAC52F
+    "(Hitachi |HITACHI )?HT(S|E)5432(80|12|16|25|32)L9(A3(00)?|SA0[012])",
     "", "", ""
   },
   { "Hitachi Travelstar 5K500.B",
@@ -1172,8 +1279,8 @@ const drive_settings builtin_knowndrives[] = {
     "(Hitachi )?HTE7210[168]0G9(AT|SA)00",
     "", "", ""
   },
-  { "Hitachi Travelstar 7K200",
-    "(Hitachi )?HTS7220(80|10|12|16|20)K9(A3|SA)00",
+  { "Hitachi Travelstar 7K200", // tested with HITACHI HTS722016K9SA00/DCDZC75A
+    "(Hitachi |HITACHI )?HTS7220(80|10|12|16|20)K9(A3|SA)00",
     "", "", ""
   },
   { "Hitachi Travelstar 7K320", // tested with
@@ -1181,6 +1288,10 @@ const drive_settings builtin_knowndrives[] = {
     "(Hitachi )?HT[ES]7232(80|12|16|25|32)L9(A300|A36[02]|SA61)",
     "", "", ""
   },
+  { "Hitachi Travelstar Z7K320", // tested with HITACHI HTS723232A7A364/EC2ZB70B
+    "(HITACHI )?HT[ES]7232(16|25|32)A7A36[145]",
+    "", "", ""
+  },
   { "Hitachi Travelstar 7K500",
     "(Hitachi )?HT[ES]7250(12|16|25|32|50)A9A36[45]",
     "", "", ""
@@ -1205,7 +1316,7 @@ const drive_settings builtin_knowndrives[] = {
     "(IBM-)?IC35L(030|060|090|120|180)AVV207-[01]",
     "", "", ""
   },
-  { "Hitachi Deskstar 5K3000",
+  { "Hitachi Deskstar 5K3000", // tested with HDS5C3030ALA630/MEAOA5C0
     "(Hitachi )?HDS5C30(15|20|30)ALA63[02].*",
     "", "", ""
   },
@@ -1257,6 +1368,10 @@ const drive_settings builtin_knowndrives[] = {
     "(Hitachi )?HDS7210((16|25)CLA382|(32|50)CLA362|(64|75|10)CLA332)",
     "", "", ""
   },
+  { "Hitachi Deskstar E7K1000", // tested with HDE721010SLA330/ST6OA31B
+    "Hitachi HDE7210(50|75|10)SLA330",
+    "", "", ""
+  },
   { "Hitachi Deskstar 7K2000",
     "Hitachi HDS722020ALA330",
     "", "", ""
@@ -1265,12 +1380,18 @@ const drive_settings builtin_knowndrives[] = {
     "Hitachi HDS7230((15|20)BLA642|30ALA640)",
     "", "", ""
   },
-  { "Hitachi Ultrastar 7K1000",
-    "(Hitachi )?HUA7210(50|75|10)KLA330",
+  { "Hitachi Ultrastar A7K1000", // tested with
+    // HUA721010KLA330      44X2459 42C0424IBM/GKAOAB4A
+    "(Hitachi )?HUA7210(50|75|10)KLA330.*",
+    "", "", ""
+  },
+  { "Hitachi Ultrastar A7K2000", // tested with
+    // HUA722010CLA330      43W7629 42C0401IBM
+    "(Hitachi )?HUA7220(50|10|20)[AC]LA33[01].*",
     "", "", ""
   },
-  { "Hitachi Ultrastar A7K2000",
-    "(Hitachi )?HUA7220((50|10)C|20A)LA33[01]",
+  { "Hitachi Ultrastar 7K3000", // tested with HUA723030ALA640/MKAOA580
+    "Hitachi HUA7230(20|30)ALA640",
     "", "", ""
   },
   { "Toshiba 2.5\" HDD (10-20 GB)",
@@ -1285,15 +1406,29 @@ const drive_settings builtin_knowndrives[] = {
     "TOSHIBA MK(80(25GAS|26GAX|32GAX|32GSX)|10(31GAS|32GAX)|12(33GAS|34G[AS]X)|2035GSS)",
     "", "", ""
   },
+  { "Toshiba 2.5\" HDD MK..50GACY", // tested with TOSHIBA MK8050GACY/TF105A
+    "TOSHIBA MK8050GACY",
+    "", "", ""
+  },
   { "Toshiba 2.5\" HDD MK..52GSX",
     "TOSHIBA MK(80|12|16|25|32)52GSX",
     "", "", ""
   },
-  { "Toshiba 2.5\" HDD MK..59GSXP (Adv. Format)", // Adv. Format
+  { "Toshiba 2.5\" HDD MK..55GSX", // tested with TOSHIBA MK5055GSX/FG001A
+    "TOSHIBA MK(12|16|25|32|40|50)55GSX",
+    "", "", ""
+  },
+  { "Toshiba 2.5\" HDD MK..56GSY", // tested with TOSHIBA MK2556GSYF/LJ001D
+    "TOSHIBA MK(16|25|32|50)56GSYF?",
+    "",
+    "",
+    "-v 9,minutes"
+  },
+  { "Toshiba 2.5\" HDD MK..59GSXP (Adv. Format)",
     "TOSHIBA MK(32|50|64|75)59GSXP?",
     "", "", ""
   },
-  { "Toshiba 2.5\" HDD MK..59GSM (Adv. Format)", // Adv. Format
+  { "Toshiba 2.5\" HDD MK..59GSM (Adv. Format)",
     "TOSHIBA MK(75|10)59GSM",
     "", "", ""
   },
@@ -1301,10 +1436,24 @@ const drive_settings builtin_knowndrives[] = {
     "TOSHIBA MK(16|25|32|50|64)65GSX",
     "", "", ""
   },
+  { "Toshiba 2.5\" HDD MK..76GSX", // tested with TOSHIBA MK3276GSX/GS002D
+    "TOSHIBA MK(16|25|32|50|64)76GSX",
+    "",
+    "",
+    "-v 9,minutes"
+  },
+  { "Toshiba 3.5\" HDD MK.002TSKB", // tested with TOSHIBA MK1002TSKB/MT1A
+    "TOSHIBA MK(10|20)02TSKB",
+    "", "", ""
+  },
   { "Toshiba 1.8\" HDD",
     "TOSHIBA MK[23468]00[4-9]GA[HL]",
     "", "", ""
   },
+  { "Toshiba 1.8\" HDD MK..29GSG",
+    "TOSHIBA MK(12|16|25)29GSG",
+    "", "", ""
+  },
   { "", // TOSHIBA MK6022GAX
     "TOSHIBA MK6022GAX",
     "", "", ""
@@ -1353,6 +1502,15 @@ const drive_settings builtin_knowndrives[] = {
     "ST9(80313|160(301|314)|(12|25)0315|250317|(320|500)325|500327|640320)ASG?",
     "", "", ""
   },
+  { "Seagate Momentus 5400.7",
+    "ST9(160316|(250|320)310|(500|640)320)AS",
+    "", "", ""
+  },
+  { "Seagate Momentus 5400.7 (Adv. Format)", // tested with ST9640322AS/0001BSM2
+      // (device reports 4KiB LPS with 1 sector offset)
+    "ST9(320312|400321|640322|750423)AS",
+    "", "", ""
+  },
   { "Seagate Momentus 5400 PSD", // Hybrid drives
     "ST9(808212|(120|160)8220)AS",
     "", "", ""
@@ -1377,9 +1535,29 @@ const drive_settings builtin_knowndrives[] = {
     "ST9((160413|25041[12]|320426|50042[12])AS|(16041[489]|2504[16]4|32042[67]|500426)ASG)",
     "", "", ""
   },
-  { "Seagate Momentus XT", // tested with ST95005620AS/SD22
+  { "Seagate Momentus XT", // fixed firmware
     "ST9(2505610|3205620|5005620)AS",
-    "", "", ""
+    "SD2[68]",
+    "", ""
+  },
+  { "Seagate Momentus XT", // buggy firmware, tested with ST92505610AS/SD24
+    "ST9(2505610|3205620|5005620)AS",
+    "SD2[45]",
+    "These drives may corrupt large files,\n"
+    "AND THIS FIRMWARE VERSION IS AFFECTED,\n"
+    "see the following web pages for details:\n"
+    "http://forums.seagate.com/t5/Momentus-XT-Momentus-Momentus/Momentus-XT-corrupting-large-files-Linux/td-p/109008\n"
+    "http://superuser.com/questions/313447/seagate-momentus-xt-corrupting-files-linux-and-mac",
+    ""
+  },
+  { "Seagate Momentus XT", // unknown firmware
+    "ST9(2505610|3205620|5005620)AS",
+    "",
+    "These drives may corrupt large files,\n"
+    "see the following web pages for details:\n"
+    "http://forums.seagate.com/t5/Momentus-XT-Momentus-Momentus/Momentus-XT-corrupting-large-files-Linux/td-p/109008\n"
+    "http://superuser.com/questions/313447/seagate-momentus-xt-corrupting-files-linux-and-mac",
+    ""
   },
   { "Seagate Medalist 1010, 1720, 1721, 2120, 3230 and 4340",  // ATA2, with -t permissive
     "ST3(1010|1720|1721|2120|3230|4340)A",
@@ -1389,38 +1567,38 @@ const drive_settings builtin_knowndrives[] = {
     "ST3(2110|3221|4321|6531|8641)A",
     "", "", ""
   },
-  { "Seagate U Series X",
-    "ST3(10014A(CE)?|20014A)",
-    "", "", ""
-  },
-  { "Seagate U8",
-    "ST3(4313|6811|8410|13021|17221)A",
+  { "Seagate U4",
+    "ST3(2112|4311|6421|8421)A",
     "", "", ""
   },
-  { "Seagate U7",
-    "ST3(30012|40012|60012|80022|120020)A",
+  { "Seagate U5",
+    "ST3(40823|30621|20413|15311|10211)A",
     "", "", ""
   },
-  { "Seagate U Series 6",
+  { "Seagate U6",
     "ST3(8002|6002|4081|3061|2041)0A",
     "", "", ""
   },
-  { "Seagate U Series 5",
-    "ST3(40823|30621|20413|15311|10211)A",
+  { "Seagate U7",
+    "ST3(30012|40012|60012|80022|120020)A",
     "", "", ""
   },
-  { "Seagate U4",
-    "ST3(2112|4311|6421|8421)A",
+  { "Seagate U8",
+    "ST3(4313|6811|8410|4313|13021|17221)A",
     "", "", ""
   },
-  { "Seagate U8",
-    "ST3(8410|4313|17221|13021)A",
+  { "Seagate U9", // tested with ST3160022ACE/9.51
+    "ST3(80012|120025|160022)A(CE)?",
     "", "", ""
   },
   { "Seagate U10",
     "ST3(20423|15323|10212)A",
     "", "", ""
   },
+  { "Seagate UX",
+    "ST3(10014A(CE)?|20014A)",
+    "", "", ""
+  },
   { "Seagate Barracuda ATA",
     "ST3(2804|2724|2043|1362|1022|681)0A",
     "", "", ""
@@ -1476,14 +1654,15 @@ const drive_settings builtin_knowndrives[] = {
     "SD[12]B", // http://seagate.custkb.com/seagate/crm/selfservice/search.jsp?DocId=207957
     "", ""
   },
-  { "Seagate Barracuda 7200.11", // buggy firmware
+  { "Seagate Barracuda 7200.11", // buggy or fixed firmware
     "ST3(500[368]20|640[35]30|750[36]30|1000340)AS?",
     "(AD14|SD1[5-9]|SD81)",
     "There are known problems with these drives,\n"
-    "AND THIS FIRMWARE VERSION IS AFFECTED,\n"
-    "see the following Seagate web pages:\n"
+    "THIS DRIVE MAY OR MAY NOT BE AFFECTED,\n"
+    "see the following web pages for details:\n"
     "http://seagate.custkb.com/seagate/crm/selfservice/search.jsp?DocId=207931\n"
-    "http://seagate.custkb.com/seagate/crm/selfservice/search.jsp?DocId=207951",
+    "http://seagate.custkb.com/seagate/crm/selfservice/search.jsp?DocId=207951\n"
+    "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=632758",
     ""
   },
   { "Seagate Barracuda 7200.11", // unknown firmware
@@ -1496,8 +1675,8 @@ const drive_settings builtin_knowndrives[] = {
     "http://seagate.custkb.com/seagate/crm/selfservice/search.jsp?DocId=207957",
     ""
   },
-  { "Seagate Barracuda 7200.12",
-    "ST3(160318|25031[18]|320418|50041[08]|750(518|52[38])|100052[38])AS",
+  { "Seagate Barracuda 7200.12", // tested with ST3250312AS/JC45, ST31000524AS/JC45
+    "ST3(160318|25031[128]|320418|50041[08]|750(518|52[38])|100052[348])AS",
     "", "", ""
   },
   { "Seagate Barracuda ES",
@@ -1506,9 +1685,19 @@ const drive_settings builtin_knowndrives[] = {
   },
   { "Seagate Barracuda ES.2", // fixed firmware
     "ST3(25031|50032|75033|100034)0NS",
-    "SN[01]6", // http://seagate.custkb.com/seagate/crm/selfservice/search.jsp?DocId=207963
+    "SN[01]6|"         // http://seagate.custkb.com/seagate/crm/selfservice/search.jsp?DocId=207963
+    "MA(0[^7]|[^0].)", // http://dellfirmware.seagate.com/dell_firmware/DellFirmwareRequest.jsp
     "", ""
   },
+  { "Seagate Barracuda ES.2", // buggy firmware (Dell)
+    "ST3(25031|50032|75033|100034)0NS",
+    "MA07",
+    "There are known problems with these drives,\n"
+    "AND THIS FIRMWARE VERSION IS AFFECTED,\n"
+    "see the following Seagate web page:\n"
+    "http://dellfirmware.seagate.com/dell_firmware/DellFirmwareRequest.jsp",
+    ""
+  },
   { "Seagate Barracuda ES.2", // unknown firmware
     "ST3(25031|50032|75033|100034)0NS",
     "",
@@ -1523,11 +1712,16 @@ const drive_settings builtin_knowndrives[] = {
     "", "", ""
   },
   { "Seagate Barracuda Green (Adv. Format)",
-    "ST(1000DL002|(15|20)00DL003)-.*",
+    "ST((10|15|20)00DL00[123])-.*",
     "", "", ""
   },
-  { "Seagate Barracuda XT",
-    "ST(32000641|33000651)AS",
+  { "Seagate Barracuda XT", // tested with ST32000641AS/CC13,
+      // ST4000DX000-1C5160/CC42
+    "ST(3(2000641|3000651)AS|4000DX000-.*)",
+    "", "", ""
+  },
+  { "Seagate Barracuda (SATA 3Gb/s, 4K Sectors)", // tested with ST250DM000-1BC141
+    "ST(3000|2000|1500|750|500|320|250)DM00[012]-.*",
     "", "", ""
   },
   { "Seagate Constellation (SATA)", // tested with ST9500530NS/SN03
@@ -1538,6 +1732,14 @@ const drive_settings builtin_knowndrives[] = {
     "ST3(50051|100052|200064)4NS",
     "", "", ""
   },
+  { "Seagate Constellation ES (SATA 6Gb/s)", // tested with ST1000NM0011/SN02
+    "ST(5|10|20)00NM0011",
+    "", "", ""
+  },
+  { "Seagate Constellation ES.2 (SATA 6Gb/s)", // tested with ST33000650NS
+    "ST3300065[012]NS",
+    "", "", ""
+  },
   { "Seagate Pipeline HD 5900.1",
     "ST3(160310|320[34]10|500(321|422))CS",
     "", "", ""
@@ -1559,11 +1761,31 @@ const drive_settings builtin_knowndrives[] = {
     "", "", ""
   },
   { "Seagate SV35.2",
-    "ST3(160815|250820|320620|500630|750640)(A|S)V",
+    "ST3(160815|250820|320620|500630|750640)[AS]V",
+    "", "", ""
+  },
+  { "Seagate SV35.5", // tested with ST31000525SV/CV12
+    "ST3(250311|500410|1000525)SV",
+    "", "", ""
+  },
+  { "Seagate SV35",
+    "ST(2000VX002|31000526SV|3500411SV)",
+    "", "", ""
+  },
+  { "Seagate DB35", // tested with ST3250823ACE/3.03
+    "ST3(200826|250823|300831|400832)ACE",
+    "", "", ""
+  },
+  { "Seagate DB35.2", // tested with ST3160212SCE/3.ACB
+    "ST3(802110|120213|160212|200827|250824|300822|400833|500841)[AS]CE",
     "", "", ""
   },
   { "Seagate DB35.3",
-    "ST3(750640SCE|((80|160)215|(250|320|400)820|500830|750840)(A|S)CE)",
+    "ST3(750640SCE|((80|160)215|(250|320|400)820|500830|750840)[AS]CE)",
+    "", "", ""
+  },
+  { "Seagate ST1.2 CompactFlash", // tested with ST68022CF/3.01
+    "ST6[468]022CF",
     "", "", ""
   },
   { "Western Digital Protege",
@@ -1642,8 +1864,8 @@ const drive_settings builtin_knowndrives[] = {
     "WDC WD(4|8|20|32)00BD-.*",
     "", "", ""
   },
-  { "Western Digital Caviar SE Serial ATA",
-    "WDC WD(4|8|12|16|20|25|32|40)00(JD|KD|PD)-.*",
+  { "Western Digital Caviar SE Serial ATA", // tested with WDC WD3000JD-98KLB0/08.05J08
+    "WDC WD(4|8|12|16|20|25|30|32|40)00(JD|KD|PD)-.*",
     "", "", ""
   },
   { "Western Digital Caviar SE Serial ATA",
@@ -1687,6 +1909,10 @@ const drive_settings builtin_knowndrives[] = {
     "WDC WD((((25|50)03A|1003F)BYX)|((15|20)03FYYS))-.*",
     "", "", ""
   },
+  { "Western Digital RE4-GP", // tested with WDC WD2002FYPS-02W3B0/04.01G01
+    "WDC WD2002FYPS-.*",
+    "", "", ""
+  },
   { "Western Digital Caviar Green",
     "WDC WD((50|64|75)00AA(C|V)S|(50|64|75)00AADS|10EA(C|V)S|(10|15|20)EADS)-.*",
     "", "", ""
@@ -1695,6 +1921,11 @@ const drive_settings builtin_knowndrives[] = {
     "WDC WD(((64|75|80)00AA|(10|15|20)EA|(25|30)EZ)R|20EAC)S-.*",
     "", "", ""
   },
+  { "Western Digital Caviar Green (Adv. Format)", // SATA 6Gb/s variants
+      // tested with WDC WD30EZRX-00MMMB0/80.00A80
+    "WDC WD(7500AA|(10|15|20)EA|(25|30)EZ)RX-.*",
+    "", "", ""
+  },
   { "Western Digital Caviar Black",
     "WDC WD((500|640|750)1AAL|1001FA[EL]|2001FAS)S-.*",
     "", "", ""
@@ -1711,8 +1942,8 @@ const drive_settings builtin_knowndrives[] = {
     "WDC WD(16|25|32)00AVJS-.*",
     "", "", ""
   },
-  { "Western Digital AV-GP",
-    "WDC WD((16|25|32|50|64|75)00AVVS|(50|75)00AVCS|10EVVS|(10|20)EVCS|(10|15|20)EVDS)-.*",
+  { "Western Digital AV-GP", // tested with WDC WD10EURS-630AB1/80.00A80
+    "WDC WD((16|25|32|50|64|75)00AVVS|(50|75)00AVCS|(10|15|20|25|30)EURS|10EVVS|(10|20)EVCS|(10|15|20)EVDS)-.*",
     "", "", ""
   },
   { "Western Digital AV-25",
@@ -1727,8 +1958,8 @@ const drive_settings builtin_knowndrives[] = {
     "WDC WD1500AHFD-.*",
     "", "", ""
   },
-  { "Western Digital VelociRaptor",
-    "WDC WD(((800H|(1500|3000)[BH]|1600H|3000G)LFS)|((4500|6000)[BH]LHX))-.*",
+  { "Western Digital VelociRaptor", // tested with WDC WD1500HLHX-01JJPV0/04.05G04
+    "WDC WD(((800H|(1500|3000)[BH]|1600H|3000G)LFS)|((1500|3000|4500|6000)[BH]LHX))-.*",
     "", "", ""
   },
   { "Western Digital Scorpio EIDE",
@@ -1747,23 +1978,29 @@ const drive_settings builtin_knowndrives[] = {
     "WDC WD((4|6|8|10|12|16|25)00BEVS|(8|12|16|25|32|40|50|64)00BEVT|7500KEVT|10TEVT)-.*",
     "", "", ""
   },
-  { "Western Digital Scorpio Blue Serial ATA (Adv. Format)",
-    "WDC WD((16|25|32|50|64|75)00BPVT|10TPVT)-.*",
+  { "Western Digital Scorpio Blue Serial ATA (Adv. Format)", // tested with
+      // WDC WD10JPVT-00A1YT0/01.01A01
+    "WDC WD((16|25|32|50|64|75)00BPVT|10[JT]PVT)-.*",
+    "", "", ""
+  },
+  { "Western Digital Scorpio Black", // tested with WDC WD5000BEKT-00KA9T0/01.01A01
+    "WDC WD(8|12|16|25|32|50)00B[EJ]KT-.*",
     "", "", ""
   },
-  { "Western Digital Scorpio Black Serial ATA",
-    "WDC WD(8|12|16|25|32)00B[EJ]KT-.*",
+  { "Western Digital Scorpio Black (Adv. Format)",
+    "WDC WD(50|75)00BPKT-.*",
     "", "", ""
   },
-  { "Western Digital My Passport Essential hard drive (USB interface)",
+  { "Western Digital My Passport Essential (USB)",
     "WDC WD(25|32|40|50)00BMVU-.*",
     "", "", ""
   },
-  { "Western Digital My Passport Essential SE hard drive (USB interface)",
-    "WDC WD(7500K|10T)MVV-.*",
+  { "Western Digital My Passport Essential SE (USB, Adv. Format)", // tested with
+      // WDC WD10TMVW-11ZSMS5/01.01A01
+    "WDC WD(7500K|10T)MV[VW]-.*",
     "", "", ""
   },
-  { "Western Digital My Passport hard drive (USB interface)", // tested with
+  { "Western Digital My Passport (USB)", // tested with
       // WDC WD5000BMVW-11AMCS0/01.01A01
     "WDC WD(3200BMVV|5000BMVW)-.*",
     "", "", ""
@@ -1842,6 +2079,26 @@ const drive_settings builtin_knowndrives[] = {
     "",
     "-d sat"
   },
+  { "USB: Buffalo MiniStation Stealth HD-PCTU2; ",
+    "0x0411:0x01d9",
+    "", // 0x0108
+    "",
+    "-d sat"
+  },
+  // LG Electronics
+  { "USB: LG Mini HXD5; JMicron",
+    "0x043e:0x70f1",
+    "", // 0x0100
+    "",
+    "-d usbjmicron"
+  },
+  // Philips
+  { "USB: Philips; ", // SDE3273FC/97 2.5" SATA HDD enclosure
+    "0x0471:0x2021",
+    "", // 0x0103
+    "",
+    "-d sat"
+  },
   // Toshiba
   { "USB: Toshiba Canvio 500GB; ",
     "0x0480:0xa004",
@@ -1871,7 +2128,7 @@ const drive_settings builtin_knowndrives[] = {
   },
   // Samsung
   { "USB: Samsung S2 Portable; JMicron",
-    "0x04e8:0x1f0[68]",
+    "0x04e8:0x1f0[568]",
     "",
     "",
     "-d usbjmicron"
@@ -1894,12 +2151,24 @@ const drive_settings builtin_knowndrives[] = {
     "",
     "-d usbjmicron"
   },
+  { "USB: Samsung Story Station 3.0; ",
+    "0x04e8:0x6052",
+    "",
+    "",
+    "-d sat"
+  },
   { "USB: Samsung Story Station 3.0; ",
     "0x04e8:0x6054",
     "",
     "",
     "-d sat"
   },
+  { "USB: Samsung M2 Portable 3.0; ",
+    "0x04e8:0x60c5",
+    "",
+    "",
+    "-d sat"
+  },
   // Sunplus
   { "USB: ; SunPlus",
     "0x04fc:0x0c05",
@@ -1944,6 +2213,12 @@ const drive_settings builtin_knowndrives[] = {
     "",
     "-d usbsunplus"
   },
+  { "USB: Iomega GDHDU2; JMicron",
+    "0x059b:0x0475",
+    "", // 0x0100
+    "",
+    "-d usbjmicron"
+  },
   // LaCie
   { "USB: LaCie hard disk (FA Porsche design);",
     "0x059f:0x0651",
@@ -1994,7 +2269,13 @@ const drive_settings builtin_knowndrives[] = {
     "-d usbjmicron,x"
   },
   { "USB: LaCie rikiki USB 3.0; ",
-    "0x059f:0x1049",
+    "0x059f:0x10(49|57)",
+    "",
+    "",
+    "-d sat"
+  },
+  { "USB: LaCie minimus USB 3.0; ",
+    "0x059f:0x104a",
     "",
     "",
     "-d sat"
@@ -2040,12 +2321,24 @@ const drive_settings builtin_knowndrives[] = {
     "" // unsupported
   },
   // Freecom
+  { "USB: Freecom Mobile Drive XXS; JMicron",
+    "0x07ab:0xfc88",
+    "", // 0x0101
+    "",
+    "-d usbjmicron,x"
+  },
   { "USB: Freecom Hard Drive XS; Sunplus",
     "0x07ab:0xfc8e",
     "", // 0x010f
     "",
     "-d usbsunplus"
   },
+  { "USB: Freecom; ", // Intel labeled
+    "0x07ab:0xfc8f",
+    "", // 0x0000
+    "",
+    "-d sat"
+  },
   { "USB: Freecom Classic HD 120GB; ",
     "0x07ab:0xfccd",
     "",
@@ -2066,12 +2359,19 @@ const drive_settings builtin_knowndrives[] = {
     "-d usbsunplus"
   },
   // Oxford Semiconductor, Ltd
+  { "USB: ; Oxford",
+    "0x0928:0x0000",
+    "",
+    "",
+    "" // unsupported
+  },
   { "USB: ; Oxford OXU921DS",
     "0x0928:0x0002",
     "",
     "",
     "" // unsupported
   },
+  // Toshiba Corp.
   { "USB: Toshiba PX1396E-3T01; Sunplus", // similar to Dura Micro 501
     "0x0930:0x0b09",
     "",
@@ -2084,6 +2384,13 @@ const drive_settings builtin_knowndrives[] = {
     "",
     "-d usbsunplus"
   },
+  // Lumberg, Inc.
+  { "USB: Toshiba Stor.E; Sunplus",
+    "0x0939:0x0b16",
+    "",
+    "",
+    "-d usbsunplus"
+  },
   // Seagate
   { "USB: Seagate FreeAgent Go; ",
     "0x0bc2:0x2(000|100|101)",
@@ -2133,13 +2440,37 @@ const drive_settings builtin_knowndrives[] = {
     "",
     "-d sat,12"
   },
-  { "USB: Seagate FreeAgent GoFlex Desk USB 3.0; ",
+  { "USB: Seagate FreeAgent; ",
+    "0x0bc2:0x5040",
+    "",
+    "",
+    "-d sat"
+  },
+  { "USB: Seagate FreeAgent GoFlex USB 3.0; ", // 2TB
+    "0x0bc2:0x5071",
+    "",
+    "",
+    "-d sat"
+  },
+  { "USB: Seagate FreeAgent GoFlex Desk USB 3.0; ", // 3TB
     "0x0bc2:0x50a1",
     "",
     "",
-    "-d sat,12"
+    "-d sat,12" // "-d sat" does not work (ticket #151)
+  },
+  { "USB: Seagate FreeAgent GoFlex Desk USB 3.0; ", // 4TB
+    "0x0bc2:0x50a5",
+    "", // 0x0100
+    "",
+    "-d sat"
   },
   // Dura Micro
+  { "USB: Dura Micro; Cypress",
+    "0x0c0b:0xb001",
+    "", // 0x1110
+    "",
+    "-d usbcypress"
+  },
   { "USB: Dura Micro 509; Sunplus",
     "0x0c0b:0xb159",
     "", // 0x0103
@@ -2171,6 +2502,12 @@ const drive_settings builtin_knowndrives[] = {
     "",
     "-d sat"
   },
+  { "USB: Maxtor BlackArmor Portable; ",
+    "0x0d49:0x7550",
+    "",
+    "",
+    "-d sat"
+  },
   { "USB: Maxtor Basics Desktop; ",
     "0x0d49:0x7410",
     "", // 0x0122
@@ -2183,6 +2520,13 @@ const drive_settings builtin_knowndrives[] = {
     "",
     "-d sat"
   },
+  // Oyen Digital
+  { "USB: Oyen Digital MiniPro USB 3.0; ",
+    "0x0dc4:0x020a",
+    "",
+    "",
+    "-d sat"
+  },
   // Cowon Systems, Inc.
   { "USB: Cowon iAudio X5; ",
     "0x0e21:0x0510",
@@ -2234,12 +2578,24 @@ const drive_settings builtin_knowndrives[] = {
     "",
     "-d sat"
   },
+  { "USB: WD My Passport Essential SE USB 3.0; ",
+    "0x1058:0x074[02]",
+    "",
+    "",
+    "-d sat"
+  },
   { "USB: WD My Book ES; ",
     "0x1058:0x0906",
     "", // 0x0012
     "",
     "-d sat"
   },
+  { "USB: WD My Book Essential; ",
+    "0x1058:0x0910",
+    "", // 0x0106
+    "",
+    "-d sat"
+  },
   { "USB: WD Elements Desktop; ",
     "0x1058:0x1001",
     "", // 0x0104
@@ -2264,6 +2620,18 @@ const drive_settings builtin_knowndrives[] = {
     "",
     "-d sat"
   },
+  { "USB: WD Elements SE; ", // 1TB
+    "0x1058:0x1023",
+    "",
+    "",
+    "-d sat"
+  },
+  { "USB: WD Elements SE USB 3.0; ",
+    "0x1058:0x1042",
+    "",
+    "",
+    "-d sat"
+  },
   { "USB: WD My Book Essential; ",
     "0x1058:0x1100",
     "", // 0x0165
@@ -2294,6 +2662,13 @@ const drive_settings builtin_knowndrives[] = {
     "",
     "-d sat"
   },
+  // Atech Flash Technology
+  { "USB: ; Atech", // Enclosure from Kingston SSDNow notebook upgrade kit
+    "0x11b0:0x6298",
+    "", // 0x0108
+    "",
+    "-d sat"
+  },
   // A-DATA
   { "USB: A-DATA SH93; Cypress",
     "0x125f:0xa93a",
@@ -2308,6 +2683,18 @@ const drive_settings builtin_knowndrives[] = {
     "",
     "" // unsupported
   },
+  { "USB: ; Initio", // Thermaltake BlacX
+    "0x13fd:0x0840",
+    "",
+    "",
+    "-d sat"
+  },
+  { "USB: ; Initio 6Y120L0", // CoolerMaster XCraft RX-3HU
+    "0x13fd:0x1150",
+    "",
+    "",
+    "" // unsupported
+  },
   { "USB: ; Initio", // USB->SATA
     "0x13fd:0x1240",
     "", // 0x0104
@@ -2326,10 +2713,16 @@ const drive_settings builtin_knowndrives[] = {
     "",
     "-d sat"
   },
+  { "USB: ; Initio", // NexStar CX USB enclosure
+    "0x13fd:0x1e40",
+    "",
+    "",
+    "-d sat"
+  },
   // Super Top
   { "USB: Super Top generic enclosure; Cypress",
     "0x14cd:0x6116",
-    "",
+    "", // 0x0160 also reported as unsupported
     "",
     "-d usbcypress"
   },
@@ -2421,6 +2814,12 @@ const drive_settings builtin_knowndrives[] = {
     "-d sat"
   },
   // Verbatim
+  { "USB: Verbatim Portable Hard Drive; Sunplus",
+    "0x18a5:0x0214",
+    "", // 0x0112
+    "",
+    "-d usbsunplus"
+  },
   { "USB: Verbatim FW/USB160; Oxford OXUF934SSA-LQAG", // USB+IEE1394->SATA
     "0x18a5:0x0215",
     "", // 0x0001
@@ -2439,6 +2838,12 @@ const drive_settings builtin_knowndrives[] = {
     "",
     "-d usbjmicron" // "-d usbjmicron,x" does not work
   },
+  { "USB: Verbatim External Hard Drive; JMicron", // 2TB
+    "0x18a5:0x022a",
+    "",
+    "",
+    "-d usbjmicron"
+  },
   // Silicon Image
   { "USB: Vantec NST-400MX-SR; Silicon Image 5744",
     "0x1a4a:0x1670",
@@ -2454,6 +2859,12 @@ const drive_settings builtin_knowndrives[] = {
     "-d usbsunplus"
   },
   // Hitachi/SimpleTech
+  { "USB: Hitachi Touro Desk; JMicron", // 3TB
+    "0x4971:0x1011",
+    "",
+    "",
+    "-d usbjmicron"
+  },
   { "USB: Hitachi/SimpleTech; JMicron", // 1TB
     "0x4971:0xce17",
     "",
diff --git a/int64.h b/int64.h
index 93df11308409a19bdee74e983f3abe8fece4d680..b346bd916d779c24c219f4b2fb5303b87713e8e8 100644 (file)
--- a/int64.h
+++ b/int64.h
@@ -3,8 +3,8 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2002-8 Bruce Allen <smartmontools-support@lists.sourceforge.net>
- * Copyright (C) 2004-8 Christian Franke
+ * Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2004-11 Christian Franke
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
 #ifndef INT64_H_
 #define INT64_H_
 
-#define INT64_H_CVSID "$Id: int64.h,v 1.17 2008/03/04 22:09:47 ballen4705 Exp $\n"
+#define INT64_H_CVSID "$Id: int64.h 3475 2011-11-10 21:43:40Z chrfranke $"
 
 // 64 bit integer typedefs and format strings
 
@@ -40,7 +40,7 @@
 #include <sys/int_types.h>
 #else
 #if defined(_WIN32) && defined(_MSC_VER)
-// for MSVC 6.0
+// for MSVC <= 9 (MSVC10 and MinGW provide <stdint.h>)
 typedef          __int64    int64_t;
 typedef unsigned __int64   uint64_t;
 #else
@@ -59,12 +59,12 @@ typedef unsigned long long uint64_t;
 #endif // HAVE_STDINT_H
 #endif // HAVE_INTTYPES_H
 
-#ifdef _WIN32
-// for MSVCRT.DLL (used by both MSVC 6.0 and MinGW)
+#if defined(_WIN32) && !defined(PRId64)
+// for MSVC (MinGW provides <inttypes.h>)
 #define PRId64 "I64d"
 #define PRIu64 "I64u"
 #define PRIx64 "I64x"
-#endif // _WIN32
+#endif // _WIN32 && !PRId64
 
 // If macros not defined in inttypes.h, fix here.  Default is GCC
 // style
@@ -80,16 +80,4 @@ typedef unsigned long long uint64_t;
 #define PRIx64 "llx"
 #endif // ndef PRIx64
 
-
-#if defined(_WIN32) && defined(_MSC_VER)
-// for MSVC 6.0: "unsigned __int64 -> double" conversion not implemented (why?-)
-__inline double uint64_to_double(uint64_t ull) {
-  return ((int64_t)ull >= 0 ? (double)(int64_t)ull :
-    ((double)(int64_t)(ull - 9223372036854775808UI64)) + 9223372036854775808.0);
-}
-#else
-#define uint64_to_double(ull) ((double)(ull))
-#endif // _WIN32 && _MSC_VER
-
-
 #endif // INT64_H
index cad0be217c3177b08de2dba613b3237edab0adc2..422b8654eebb499117fc3ab0ded0a840f3c183f9 100644 (file)
@@ -34,7 +34,7 @@
 
 #include <stdexcept>
 
-const char * knowndrives_cpp_cvsid = "$Id: knowndrives.cpp 3343 2011-05-25 20:18:17Z chrfranke $"
+const char * knowndrives_cpp_cvsid = "$Id: knowndrives.cpp 3447 2011-10-14 20:32:00Z chrfranke $"
                                      KNOWNDRIVES_H_CVSID;
 
 #define MODEL_STRING_LENGTH                         40
@@ -375,9 +375,16 @@ static int showonepreset(const drive_settings * dbentry)
       }
       for (int i = 0; i < MAX_ATTRIBUTE_NUM; i++) {
         if (defs[i].priority != PRIOR_DEFAULT) {
+          std::string name = ata_get_smart_attr_name(i, defs);
           // Use leading zeros instead of spaces so that everything lines up.
           pout("%-*s %03d %s\n", TABLEPRINTWIDTH, first_preset ? "ATTRIBUTE OPTIONS:" : "",
-               i, ata_get_smart_attr_name(i, defs).c_str());
+               i, name.c_str());
+          // Check max name length suitable for smartctl -A output
+          const unsigned maxlen = 23;
+          if (name.size() > maxlen) {
+            pout("%*s\n", TABLEPRINTWIDTH+6+maxlen, "Error: Attribute name too long ------^");
+            errcnt++;
+          }
           first_preset = false;
         }
       }
index a974aaf9f2a6596e073c60e1bdfd0afb49ac262a..9e89d402198bc4ecb10c6225ac35396094c620a5 100644 (file)
@@ -74,7 +74,7 @@
 #define PATHINQ_SETTINGS_SIZE   128
 #endif
 
-const char *os_XXXX_c_cvsid="$Id: os_freebsd.cpp 3335 2011-05-21 17:32:16Z samm2 $" \
+const char *os_XXXX_c_cvsid="$Id: os_freebsd.cpp 3502 2012-01-26 09:41:05Z samm2 $" \
 ATACMDS_H_CVSID CCISS_H_CVSID CONFIG_H_CVSID INT64_H_CVSID OS_FREEBSD_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
 
 #define NO_RETURN 0
@@ -117,6 +117,8 @@ void printwarning(int msgNo, const char* extra) {
 #define ATA_DEVICE "/dev/ata"
 #endif
 
+#define ARGUSED(x) ((void)(x))
+
 // global variable holding byte count of allocated memory
 long long bytes;
 
@@ -192,6 +194,9 @@ static const char  smartctl_examples[] =
   "  smartctl -a --device=cciss,0 /dev/ciss0\n"
          "                              (Prints all SMART information for first disk \n"
          "                               on Common Interface for SCSI-3 Support driver)\n"
+  "  smartctl -a --device=areca,1 /dev/arcmsr0\n"
+         "                              (Prints all SMART information for first disk \n"
+         "                               on first ARECA RAID controller)\n"
 
          ;
 
@@ -236,7 +241,7 @@ public:
   virtual bool ata_pass_through(const ata_cmd_in & in, ata_cmd_out & out);
 
 protected:
-  virtual int do_cmd(struct ata_ioc_request* request);
+  virtual int do_cmd(struct ata_ioc_request* request, bool is_48bit_cmd);
 };
 
 freebsd_ata_device::freebsd_ata_device(smart_interface * intf, const char * dev_name, const char * req_type)
@@ -245,9 +250,10 @@ freebsd_ata_device::freebsd_ata_device(smart_interface * intf, const char * dev_
 {
 }
 
-int freebsd_ata_device::do_cmd( struct ata_ioc_request* request)
+int freebsd_ata_device::do_cmd( struct ata_ioc_request* request, bool is_48bit_cmd)
 {
   int fd = get_fd();
+  ARGUSED(is_48bit_cmd); // no support for 48 bit commands in the IOCATAREQUEST
   return ioctl(fd, IOCATAREQUEST, request);
 }
 
@@ -255,10 +261,14 @@ int freebsd_ata_device::do_cmd( struct ata_ioc_request* request)
 
 bool freebsd_ata_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out & out)
 {
+  bool ata_48bit = false; // no ata_48bit_support via IOCATAREQUEST
+  if(!strcmp("atacam",get_dev_type())) // enable for atacam interface
+    ata_48bit = true;
+
   if (!ata_cmd_is_ok(in,
     true,  // data_out_support
     true,  // multi_sector_support
-    false) // no ata_48bit_support via IOCATAREQUEST
+    ata_48bit) 
     ) 
     return false;
 
@@ -277,22 +287,22 @@ bool freebsd_ata_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out & o
       request.flags=ATA_CMD_CONTROL;
       break;
     case ata_cmd_in::data_in:  
-      request.flags=ATA_CMD_READ;
+      request.flags=ATA_CMD_READ | ATA_CMD_CONTROL;
       request.data=(char *)in.buffer;
       request.count=in.size;
       break;
     case ata_cmd_in::data_out: 
-      request.flags=ATA_CMD_WRITE;
+      request.flags=ATA_CMD_WRITE | ATA_CMD_CONTROL;
       request.data=(char *)in.buffer;
       request.count=in.size;
       break;
     default:
       return set_err(ENOSYS);
   }
-                          
-  clear_err(); 
+
+  clear_err();
   errno = 0;
-  if (do_cmd(&request))
+  if (do_cmd(&request, in.in_regs.is_48bit_cmd()))
       return set_err(errno);
   if (request.error)
       return set_err(EIO, "request failed, error code 0x%02x", request.error);
@@ -310,10 +320,6 @@ bool freebsd_ata_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out & o
     unsigned const char normal_lo=0x4f, normal_hi=0xc2;
     unsigned const char failed_lo=0xf4, failed_hi=0x2c;
 
-#if (FREEBSDVER < 502000)
-    printwarning(NO_RETURN,NULL);
-#endif
-
     // 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"
@@ -354,7 +360,7 @@ protected:
   int m_fd;
   struct cam_device *m_camdev;
 
-  virtual int do_cmd( struct ata_ioc_request* request);
+  virtual int do_cmd( struct ata_ioc_request* request , bool is_48bit_cmd);
 };
 
 bool freebsd_atacam_device::open(){
@@ -374,7 +380,7 @@ bool freebsd_atacam_device::close(){
   return true;
 }
 
-int freebsd_atacam_device::do_cmd( struct ata_ioc_request* request)
+int freebsd_atacam_device::do_cmd( struct ata_ioc_request* request, bool is_48bit_cmd)
 {
   union ccb ccb;
   int camflags;
@@ -383,10 +389,12 @@ int freebsd_atacam_device::do_cmd( struct ata_ioc_request* request)
 
   if (request->count == 0)
     camflags = CAM_DIR_NONE;
-  else if (request->flags == ATA_CMD_READ)
+  else if (request->flags & ATA_CMD_READ)
     camflags = CAM_DIR_IN;
   else
     camflags = CAM_DIR_OUT;
+  if(is_48bit_cmd)
+    camflags |= CAM_ATAIO_48BIT;
 
   cam_fill_ataio(&ccb.ataio,
                  0,
@@ -397,18 +405,20 @@ int freebsd_atacam_device::do_cmd( struct ata_ioc_request* request)
                  request->count,
                  request->timeout * 1000); // timeout in seconds
 
+  ccb.ataio.cmd.flags = CAM_ATAIO_NEEDRESULT;
   // ata_28bit_cmd
-  if (request->flags == ATA_CMD_CONTROL)
-    ccb.ataio.cmd.flags = CAM_ATAIO_NEEDRESULT;
-  else
-    ccb.ataio.cmd.flags = 0;
   ccb.ataio.cmd.command = request->u.ata.command;
   ccb.ataio.cmd.features = request->u.ata.feature;
   ccb.ataio.cmd.lba_low = request->u.ata.lba;
   ccb.ataio.cmd.lba_mid = request->u.ata.lba >> 8;
   ccb.ataio.cmd.lba_high = request->u.ata.lba >> 16;
+  // ata_48bit cmd
+  ccb.ataio.cmd.lba_low_exp = request->u.ata.lba >> 24;
+  ccb.ataio.cmd.lba_mid_exp = request->u.ata.lba >> 32;
+  ccb.ataio.cmd.lba_high_exp = request->u.ata.lba >> 40;
   ccb.ataio.cmd.device = 0x40 | ((request->u.ata.lba >> 24) & 0x0f);
   ccb.ataio.cmd.sector_count = request->u.ata.count;
+  ccb.ataio.cmd.sector_count_exp = request->u.ata.count  >> 8;;
 
   ccb.ccb_h.flags |= CAM_DEV_QFRZDIS;
 
@@ -422,7 +432,17 @@ int freebsd_atacam_device::do_cmd( struct ata_ioc_request* request)
     return -1;
   }
 
-  request->u.ata.count = ccb.ataio.res.sector_count;
+  request->u.ata.lba =
+    ((u_int64_t)(ccb.ataio.res.lba_low)) |
+    ((u_int64_t)(ccb.ataio.res.lba_mid) << 8) |
+    ((u_int64_t)(ccb.ataio.res.lba_high) << 16) |
+    ((u_int64_t)(ccb.ataio.res.lba_low_exp) << 24) |
+    ((u_int64_t)(ccb.ataio.res.lba_mid_exp) << 32) |
+    ((u_int64_t)(ccb.ataio.res.lba_high_exp) << 40);
+
+  request->u.ata.count = ccb.ataio.res.sector_count | (ccb.ataio.res.sector_count_exp << 8);
+  request->error = ccb.ataio.res.error;
+
   return 0;
 }
 
@@ -993,6 +1013,20 @@ bool freebsd_scsi_device::scsi_pass_through(scsi_cmnd_io * iop)
     warnx("error allocating ccb");
     return -ENOMEM;
   }
+  // mfi SAT layer is known to be buggy
+  if(!strcmp("mfi",m_camdev->sim_name)) {
+    if (iop->cmnd[0] == SAT_ATA_PASSTHROUGH_12 || iop->cmnd[0] == SAT_ATA_PASSTHROUGH_16) { 
+      // Controller does not return ATA output registers in SAT sense data
+      if (iop->cmnd[2] & (1 << 5)) // chk_cond
+        return set_err(ENOSYS, "ATA return descriptor not supported by controller firmware");
+    }
+    // SMART WRITE LOG SECTOR causing media errors
+    if ((iop->cmnd[0] == SAT_ATA_PASSTHROUGH_16 && iop->cmnd[14] == ATA_SMART_CMD 
+        && iop->cmnd[3]==0 && iop->cmnd[4] == ATA_SMART_WRITE_LOG_SECTOR) || 
+        (iop->cmnd[0] == SAT_ATA_PASSTHROUGH_12 && iop->cmnd[9] == ATA_SMART_CMD &&
+        iop->cmnd[3] == ATA_SMART_WRITE_LOG_SECTOR)) 
+      return set_err(ENOSYS, "SMART WRITE LOG SECTOR command is not supported by controller firmware"); 
+  }
 
   // clear out structure, except for header that was filled in for us
   bzero(&(&ccb->ccb_h)[1],
@@ -1012,24 +1046,20 @@ bool freebsd_scsi_device::scsi_pass_through(scsi_cmnd_io * iop)
 
   if (cam_send_ccb(m_camdev,ccb) < 0) {
     warn("error sending SCSI ccb");
-#if (FREEBSDVER > 500000)
     cam_error_print(m_camdev,ccb,CAM_ESF_ALL,CAM_EPF_ALL,stderr);
-#endif
     cam_freeccb(ccb);
     return -EIO;
   }
 
   if (((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) && ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_SCSI_STATUS_ERROR)) {
-#if (FREEBSDVER > 500000)
     cam_error_print(m_camdev,ccb,CAM_ESF_ALL,CAM_EPF_ALL,stderr);
-#endif
     cam_freeccb(ccb);
     return -EIO;
   }
 
   if (iop->sensep) {
-    memcpy(iop->sensep,&(ccb->csio.sense_data),sizeof(struct scsi_sense_data));
-    iop->resp_sense_len = sizeof(struct scsi_sense_data);
+    iop->resp_sense_len = ccb->csio.sense_len - ccb->csio.sense_resid;
+    memcpy(iop->sensep,&(ccb->csio.sense_data),iop->resp_sense_len);
   }
 
   iop->scsi_status = ccb->csio.scsi_status;
@@ -1051,6 +1081,435 @@ bool freebsd_scsi_device::scsi_pass_through(scsi_cmnd_io * iop)
 }
 
 
+/////////////////////////////////////////////////////////////////////////////
+/// Areca RAID support
+
+class freebsd_areca_device
+: public /*implements*/ ata_device,
+  public /*extends*/ freebsd_smart_device
+{
+public:
+  freebsd_areca_device(smart_interface * intf, const char * dev_name, int disknum);
+
+protected:
+  virtual bool ata_pass_through(const ata_cmd_in & in, ata_cmd_out & out); 
+
+private:
+  int m_disknum; ///< Disk number.
+};
+
+
+// PURPOSE
+//   This is an interface routine meant to isolate the OS dependent
+//   parts of the code, and to provide a debugging interface.  Each
+//   different port and OS needs to provide it's own interface.  This
+//   is the linux interface to the Areca "arcmsr" driver.  It allows ATA
+//   commands to be passed through the SCSI driver.
+// DETAILED DESCRIPTION OF ARGUMENTS
+//   fd: is the file descriptor provided by open()
+//   disknum is the disk number (0 to 15) in the RAID array
+//   command: defines the different operations.
+//   select: additional input data if needed (which log, which type of
+//           self-test).
+//   data:   location to write output data, if needed (512 bytes).
+//   Note: not all commands use all arguments.
+// RETURN VALUES
+//  -1 if the command failed
+//   0 if the command succeeded,
+//   STATUS_CHECK routine: 
+//  -1 if the command failed
+//   0 if the command succeeded and disk SMART status is "OK"
+//   1 if the command succeeded and disk SMART status is "FAILING"
+
+
+/*FunctionCode*/
+#define FUNCTION_READ_RQBUFFER                 0x0801
+#define FUNCTION_WRITE_WQBUFFER                0x0802
+#define FUNCTION_CLEAR_RQBUFFER                0x0803
+#define FUNCTION_CLEAR_WQBUFFER                0x0804
+
+/* ARECA IO CONTROL CODE*/
+#define ARCMSR_IOCTL_READ_RQBUFFER           _IOWR('F', FUNCTION_READ_RQBUFFER, sSRB_BUFFER)
+#define ARCMSR_IOCTL_WRITE_WQBUFFER          _IOWR('F', FUNCTION_WRITE_WQBUFFER, sSRB_BUFFER)
+#define ARCMSR_IOCTL_CLEAR_RQBUFFER          _IOWR('F', FUNCTION_CLEAR_RQBUFFER, sSRB_BUFFER)
+#define ARCMSR_IOCTL_CLEAR_WQBUFFER          _IOWR('F', FUNCTION_CLEAR_WQBUFFER, sSRB_BUFFER)
+#define ARECA_SIG_STR                                                  "ARCMSR"
+
+
+
+// The SRB_IO_CONTROL & SRB_BUFFER structures are used to communicate(to/from) to areca driver
+typedef struct _SRB_IO_CONTROL
+{
+       unsigned int HeaderLength;
+       unsigned char Signature[8];
+       unsigned int Timeout;
+       unsigned int ControlCode;
+       unsigned int ReturnCode;
+       unsigned int Length;
+} sSRB_IO_CONTROL;
+
+typedef struct _SRB_BUFFER
+{
+       sSRB_IO_CONTROL srbioctl;
+       unsigned char   ioctldatabuffer[1032]; // the buffer to put the command data to/from firmware
+} sSRB_BUFFER;
+
+
+// For debugging areca code
+
+static void areca_dumpdata(unsigned char *block, int len)
+{
+       int ln = (len / 16) + 1;         // total line#
+       unsigned char c;
+       int pos = 0;
+
+       printf(" Address = %p, Length = (0x%x)%d\n", block, len, len);
+       printf("      0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F      ASCII      \n");
+       printf("=====================================================================\n");
+
+       for ( int l = 0; l < ln && len; l++ )
+       {
+               // printf the line# and the HEX data
+               // if a line data length < 16 then append the space to the tail of line to reach 16 chars
+               printf("%02X | ", l);
+               for ( pos = 0; pos < 16 && len; pos++, len-- )
+               {
+                       c = block[l*16+pos];    
+                       printf("%02X ", c);
+               }
+
+               if ( pos < 16 )
+               {
+                       for ( int loop = pos; loop < 16; loop++ )
+                       {
+                               printf("   ");
+                       }
+               }
+
+               // print ASCII char
+               for ( int loop = 0; loop < pos; loop++ )
+               {
+                       c = block[l*16+loop];
+                       if ( c >= 0x20 && c <= 0x7F )
+                       {
+                               printf("%c", c);
+                       }
+                       else
+                       {
+                               printf(".");
+                       }
+               }
+               printf("\n");
+       }   
+       printf("=====================================================================\n");
+}
+
+
+static int arcmsr_command_handler(int fd, unsigned long arcmsr_cmd, unsigned char *data, int data_len, void *ext_data /* reserved for further use */)
+{
+       ARGUSED(ext_data);
+
+       int ioctlreturn = 0;
+       sSRB_BUFFER sBuf;
+
+       unsigned char *areca_return_packet;
+       int total = 0;
+       int expected = -1;
+       unsigned char return_buff[2048];
+       unsigned char *ptr = &return_buff[0];
+       memset(return_buff, 0, sizeof(return_buff));
+
+       memset((unsigned char *)&sBuf, 0, sizeof(sBuf));
+
+
+       sBuf.srbioctl.HeaderLength = sizeof(sSRB_IO_CONTROL);   
+       memcpy(sBuf.srbioctl.Signature, ARECA_SIG_STR, strlen(ARECA_SIG_STR));
+       sBuf.srbioctl.Timeout = 10000;      
+       sBuf.srbioctl.ControlCode = ARCMSR_IOCTL_READ_RQBUFFER;
+
+       switch ( arcmsr_cmd )
+       {
+       // command for writing data to driver
+       case ARCMSR_IOCTL_WRITE_WQBUFFER:   
+               if ( data && data_len )
+               {
+                       sBuf.srbioctl.Length = data_len;    
+                       memcpy((unsigned char *)sBuf.ioctldatabuffer, (unsigned char *)data, data_len);
+               }
+               // commands for clearing related buffer of driver
+       case ARCMSR_IOCTL_CLEAR_RQBUFFER:
+       case ARCMSR_IOCTL_CLEAR_WQBUFFER:
+               break;
+               // command for reading data from driver
+       case ARCMSR_IOCTL_READ_RQBUFFER:    
+               break;
+       default:
+               // unknown arcmsr commands
+               return -1;
+       }
+
+
+       while ( 1 )
+       {
+               ioctlreturn = ioctl(fd,arcmsr_cmd,&sBuf);
+               if ( ioctlreturn  )
+               {
+                       // errors found
+                       break;
+               }
+
+               if ( arcmsr_cmd != ARCMSR_IOCTL_READ_RQBUFFER )
+               {
+                       // if succeeded, just returns the length of outgoing data
+                       return data_len;
+               }
+
+               if ( sBuf.srbioctl.Length )
+               {
+                       if(ata_debugmode)
+                           areca_dumpdata(&sBuf.ioctldatabuffer[0], sBuf.srbioctl.Length);
+                       memcpy(ptr, &sBuf.ioctldatabuffer[0], sBuf.srbioctl.Length);
+                       ptr += sBuf.srbioctl.Length;
+                       total += sBuf.srbioctl.Length;
+                       // the returned bytes enough to compute payload length ?
+                       if ( expected < 0 && total >= 5 )
+                       {
+                               areca_return_packet = (unsigned char *)&return_buff[0];
+                               if ( areca_return_packet[0] == 0x5E && 
+                                        areca_return_packet[1] == 0x01 && 
+                                        areca_return_packet[2] == 0x61 )
+                               {
+                                       // valid header, let's compute the returned payload length,
+                                       // we expected the total length is 
+                                       // payload + 3 bytes header + 2 bytes length + 1 byte checksum
+                                       expected = areca_return_packet[4] * 256 + areca_return_packet[3] + 6;
+                               }
+                       }
+
+                       if ( total >= 7 && total >= expected )
+                       {
+                               //printf("total bytes received = %d, expected length = %d\n", total, expected);
+
+                               // ------ Okay! we received enough --------
+                               break;
+                       }
+               }
+       }
+
+       // Deal with the different error cases
+       if ( ioctlreturn )
+       {
+               pout("ioctl write buffer failed code = %x\n", ioctlreturn);
+               return -2;
+       }
+
+
+       if ( data )
+       {
+               memcpy(data, return_buff, total);
+       }
+
+       return total;
+}
+
+
+freebsd_areca_device::freebsd_areca_device(smart_interface * intf, const char * dev_name, int disknum)
+: smart_device(intf, dev_name, "areca", "areca"),
+  freebsd_smart_device("ATA"),
+  m_disknum(disknum)
+{
+  set_info().info_name = strprintf("%s [areca_%02d]", dev_name, disknum);
+}
+
+// Areca RAID Controller
+// int freebsd_areca_device::ata_command_interface(smart_command_set command, int select, char * data)
+bool freebsd_areca_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out & out) 
+{
+if (!ata_cmd_is_ok(in, 
+    true, // data_out_support 
+    false, // TODO: multi_sector_support 
+    true) // ata_48bit_support 
+    )
+    return false; 
+
+       // ATA input registers
+       typedef struct _ATA_INPUT_REGISTERS
+       {
+               unsigned char features;
+               unsigned char sector_count;
+               unsigned char sector_number;
+               unsigned char cylinder_low; 
+               unsigned char cylinder_high;    
+               unsigned char device_head;  
+               unsigned char command;      
+               unsigned char reserved[8];
+               unsigned char data[512]; // [in/out] buffer for outgoing/incoming data
+       } sATA_INPUT_REGISTERS;
+
+       // ATA output registers
+       // Note: The output registers is re-sorted for areca internal use only
+       typedef struct _ATA_OUTPUT_REGISTERS
+       {
+               unsigned char error;
+               unsigned char status;
+               unsigned char sector_count;
+               unsigned char sector_number;
+               unsigned char cylinder_low; 
+               unsigned char cylinder_high;
+       }sATA_OUTPUT_REGISTERS;
+
+       // Areca packet format for outgoing:
+       // B[0~2] : 3 bytes header, fixed value 0x5E, 0x01, 0x61
+       // B[3~4] : 2 bytes command length + variant data length, little endian
+       // B[5]   : 1 bytes areca defined command code, ATA passthrough command code is 0x1c
+       // B[6~last-1] : variant bytes payload data
+       // B[last] : 1 byte checksum, simply sum(B[3] ~ B[last -1])
+       // 
+       // 
+       //   header 3 bytes  length 2 bytes   cmd 1 byte    payload data x bytes  cs 1 byte 
+       // +--------------------------------------------------------------------------------+
+       // + 0x5E 0x01 0x61 |   0x00 0x00   |     0x1c   | .................... |   0x00    |
+       // +--------------------------------------------------------------------------------+
+       // 
+
+       //Areca packet format for incoming:
+       // B[0~2] : 3 bytes header, fixed value 0x5E, 0x01, 0x61
+       // B[3~4] : 2 bytes payload length, little endian
+       // B[5~last-1] : variant bytes returned payload data
+       // B[last] : 1 byte checksum, simply sum(B[3] ~ B[last -1])
+       // 
+       // 
+       //   header 3 bytes  length 2 bytes   payload data x bytes  cs 1 byte 
+       // +-------------------------------------------------------------------+
+       // + 0x5E 0x01 0x61 |   0x00 0x00   | .................... |   0x00    |
+       // +-------------------------------------------------------------------+
+       unsigned char    areca_packet[640];
+       int areca_packet_len = sizeof(areca_packet);
+       unsigned char cs = 0;   
+
+       sATA_INPUT_REGISTERS *ata_cmd;
+
+       // For debugging
+       memset(areca_packet, 0, areca_packet_len);
+
+       // ----- BEGIN TO SETUP HEADERS -------
+       areca_packet[0] = 0x5E;
+       areca_packet[1] = 0x01;
+       areca_packet[2] = 0x61;
+       areca_packet[3] = (unsigned char)((areca_packet_len - 6) & 0xff);
+       areca_packet[4] = (unsigned char)(((areca_packet_len - 6) >> 8) & 0xff);
+       areca_packet[5] = 0x1c; // areca defined code for ATA passthrough command
+
+       // ----- BEGIN TO SETUP PAYLOAD DATA -----
+       memcpy(&areca_packet[7], "SmrT", 4);    // areca defined password
+       ata_cmd = (sATA_INPUT_REGISTERS *)&areca_packet[12];
+
+       // Set registers
+        {
+           const ata_in_regs_48bit & r = in.in_regs;
+           ata_cmd->features     = r.features_16;
+           ata_cmd->sector_count  = r.sector_count_16;
+           ata_cmd->sector_number = r.lba_low_16;
+           ata_cmd->cylinder_low  = r.lba_mid_16;
+           ata_cmd->cylinder_high = r.lba_high_16;
+           ata_cmd->device_head   = r.device;
+           ata_cmd->command      = r.command;
+       }
+       bool readdata = false; 
+       if (in.direction == ata_cmd_in::data_in) { 
+           readdata = true;
+           // the command will read data
+           areca_packet[6] = 0x13;
+       }
+       else if ( in.direction == ata_cmd_in::no_data )
+       {
+               // the commands will return no data
+               areca_packet[6] = 0x15;
+       }
+       else if (in.direction == ata_cmd_in::data_out) 
+       {
+               // the commands will write data
+               memcpy(ata_cmd->data, in.buffer, in.size);
+               areca_packet[6] = 0x14;
+       }
+       else {
+           // COMMAND NOT SUPPORTED VIA ARECA IOCTL INTERFACE
+           return set_err(ENOTSUP, "DATA OUT not supported for this Areca controller type");
+       }
+
+       areca_packet[11] = m_disknum - 1;                  // drive number
+
+       // ----- BEGIN TO SETUP CHECKSUM -----
+       for ( int loop = 3; loop < areca_packet_len - 1; loop++ )
+       {
+               cs += areca_packet[loop]; 
+       }
+       areca_packet[areca_packet_len-1] = cs;
+
+       // ----- BEGIN TO SEND TO ARECA DRIVER ------
+       int expected = 0;       
+       unsigned char return_buff[2048];
+       memset(return_buff, 0, sizeof(return_buff));
+
+       expected = arcmsr_command_handler(get_fd(), ARCMSR_IOCTL_CLEAR_RQBUFFER, NULL, 0, NULL);
+        if (expected==-3) {
+           return set_err(EIO);
+       }
+
+       expected = arcmsr_command_handler(get_fd(), ARCMSR_IOCTL_CLEAR_WQBUFFER, NULL, 0, NULL);
+       expected = arcmsr_command_handler(get_fd(), ARCMSR_IOCTL_WRITE_WQBUFFER, areca_packet, areca_packet_len, NULL);
+       if ( expected > 0 )
+       {
+               expected = arcmsr_command_handler(get_fd(), ARCMSR_IOCTL_READ_RQBUFFER, return_buff, sizeof(return_buff), NULL);
+       }
+       if ( expected < 0 )
+       {
+               return -1;
+       }
+
+       // ----- VERIFY THE CHECKSUM -----
+       cs = 0;
+       for ( int loop = 3; loop < expected - 1; loop++ )
+       {
+               cs += return_buff[loop]; 
+       }
+
+       if ( return_buff[expected - 1] != cs )
+       {
+               return set_err(EIO);
+       }
+
+       sATA_OUTPUT_REGISTERS *ata_out = (sATA_OUTPUT_REGISTERS *)&return_buff[5] ;
+       if ( ata_out->status )
+       {
+               if ( in.in_regs.command == ATA_IDENTIFY_DEVICE
+                && !nonempty((unsigned char *)in.buffer, in.size)) 
+                {
+                   return set_err(ENODEV, "No drive on port %d", m_disknum);
+                } 
+       }
+
+       // returns with data
+       if (readdata)
+       {
+               memcpy(in.buffer, &return_buff[7], in.size); 
+       }
+
+       // Return register values
+       {
+           ata_out_regs_48bit & r = out.out_regs;
+           r.error           = ata_out->error;
+           r.sector_count_16 = ata_out->sector_count;
+           r.lba_low_16      = ata_out->sector_number;
+           r.lba_mid_16      = ata_out->cylinder_low;
+           r.lba_high_16     = ata_out->cylinder_high;
+           r.status          = ata_out->status;
+       }
+       return true;
+}
+
+
+
 /////////////////////////////////////////////////////////////////////////////
 /// Implement CCISS RAID support with old functions
 
@@ -1072,11 +1531,6 @@ bool freebsd_cciss_device::open()
 {
   const char *dev = get_dev_name();
   int fd;
-#ifndef HAVE_DEV_CISS_CISSIO_H
-  pout("CCISS support is not available in this build of smartmontools,\n"
-    "/usr/src/sys/dev/ciss/cissio.h was not available at build time.\n\n");
-  return false;
-#endif  
   if ((fd = ::open(dev,O_RDWR))<0) {
     set_err(errno);
     return false;
@@ -1096,12 +1550,10 @@ freebsd_cciss_device::freebsd_cciss_device(smart_interface * intf,
 
 bool freebsd_cciss_device::scsi_pass_through(scsi_cmnd_io * iop)
 {
-#ifdef HAVE_DEV_CISS_CISSIO_H
   int status = cciss_io_interface(get_fd(), m_disknum, iop, scsi_debugmode);
   if (status < 0)
       return set_err(-status);
   return true;
-#endif
   // not reached
   return true;
 }
@@ -1152,12 +1604,18 @@ smart_device * freebsd_scsi_device::autodetect_open()
     return this;
   }
 
-  // SAT or USB ?
+  // SAT or USB, skip MFI controllers because of bugs
   {
     smart_device * newdev = smi()->autodetect_sat_device(this, req_buff, len);
-    if (newdev)
+    if (newdev) {
       // NOTE: 'this' is now owned by '*newdev'
+      if(!strcmp("mfi",m_camdev->sim_name)) {
+        newdev->close();
+        newdev->set_err(ENOSYS, "SATA device detected,\n"
+          "MegaRAID SAT layer is reportedly buggy, use '-d sat' to try anyhow");
+      }
       return newdev;
+    }
   }
 
   // Nothing special found
@@ -1311,8 +1769,7 @@ bool get_dev_names_cam(std::vector<std::string> & names, bool show_all)
       if (ccb.cdm.matches[i].type == DEV_MATCH_BUS) {
         bus_result = &ccb.cdm.matches[i].result.bus_result;
 
-        if (strcmp(bus_result->dev_name,"ata") == 0 /* ATAPICAM devices will be probed as ATA devices, skip'em there */
-          || strcmp(bus_result->dev_name,"xpt") == 0) /* skip XPT bus at all */
+        if (strcmp(bus_result->dev_name,"xpt") == 0) /* skip XPT bus at all */
         skip_bus = 1;
         else
           skip_bus = 0;
@@ -1641,10 +2098,23 @@ smart_device * freebsd_smart_interface::autodetect_smart_device(const char * nam
   int bus=-1;
   int i,c;
   int len;
+  const char * test_name = name;
 
   // if dev_name null, or string length zero
   if (!name || !(len = strlen(name)))
-    return false;
+    return 0;
+
+  // Dereference symlinks
+  struct stat st;
+  std::string pathbuf;
+  if (!lstat(name, &st) && S_ISLNK(st.st_mode)) {
+    char * p = realpath(name, (char *)0);
+    if (p) {
+      pathbuf = p;
+      free(p);
+      test_name = pathbuf.c_str();
+    }
+  }
 
   // check ATA bus
   char * * atanames = 0; int numata = 0;
@@ -1652,10 +2122,10 @@ smart_device * freebsd_smart_interface::autodetect_smart_device(const char * nam
   if (numata > 0) {
     // check ATA/ATAPI devices
     for (i = 0; i < numata; i++) {
-      if(!strcmp(atanames[i],name)) {
+      if(!strcmp(atanames[i],test_name)) {
         for (c = i; c < numata; c++) free(atanames[c]);
         free(atanames);
-        return new freebsd_ata_device(this, name, "");
+        return new freebsd_ata_device(this, test_name, "");
       }
       else free(atanames[i]);
     }
@@ -1673,14 +2143,13 @@ smart_device * freebsd_smart_interface::autodetect_smart_device(const char * nam
   else if (!scsinames.empty()) {
     // check all devices on CAM bus
     for (i = 0; i < (int)scsinames.size(); i++) {
-      if(strcmp(scsinames[i].c_str(), name)==0)
+      if(strcmp(scsinames[i].c_str(), test_name)==0)
       { // our disk device is CAM
-        if ((cam_dev = cam_open_device(name, O_RDWR)) == NULL) {
+        if ((cam_dev = cam_open_device(test_name, O_RDWR)) == NULL) {
           // open failure
           set_err(errno);
-          return false;
+          return 0;
         }
-        
         // zero the payload
         bzero(&(&ccb.ccb_h)[1], PATHINQ_SETTINGS_SIZE);
         ccb.ccb_h.func_code = XPT_PATH_INQ; // send PATH_INQ to the device
@@ -1698,24 +2167,27 @@ smart_device * freebsd_smart_interface::autodetect_smart_device(const char * nam
           if(usbdevlist(bus,vendor_id, product_id, version)){
             const char * usbtype = get_usb_dev_type_by_id(vendor_id, product_id, version);
             if (usbtype)
-              return get_sat_device(usbtype, new freebsd_scsi_device(this, name, ""));
+              return get_sat_device(usbtype, new freebsd_scsi_device(this, test_name, ""));
           }
-          return false;
+          return 0;
         }
 #if FREEBSDVER > 800100
         // check if we have ATA device connected to CAM (ada)
         if(ccb.cpi.protocol == PROTO_ATA){
           cam_close_device(cam_dev);
-          return new freebsd_atacam_device(this, name, "");
+          return new freebsd_atacam_device(this, test_name, "");
         }
 #endif
         // close cam device, we don`t need it anymore
         cam_close_device(cam_dev);
         // handle as usual scsi
-        return new freebsd_scsi_device(this, name, "");      
+        return new freebsd_scsi_device(this, test_name, "");      
       }
     }
   }
+  // device is LSI raid supported by mfi driver
+  if(!strncmp("/dev/mfid", test_name, strlen("/dev/mfid")))
+    set_err(EINVAL, "To monitor disks on LSI RAID load mfip.ko module and run 'smartctl -a /dev/passX' to show SMART information");
   // device type unknown
   return 0;
 }
@@ -1767,7 +2239,7 @@ smart_device * freebsd_smart_interface::get_custom_smart_device(const char * nam
       set_err(EINVAL, "Option '-d hpt,L/M/N' invalid controller id L supplied");
       return 0;
     }
-    if (!(1 <= channel && channel <= 8)) {
+    if (!(1 <= channel && channel <= 16)) {
       set_err(EINVAL, "Option '-d hpt,L/M/N' invalid channel number M supplied");
       return 0;
     }
@@ -1796,13 +2268,26 @@ smart_device * freebsd_smart_interface::get_custom_smart_device(const char * nam
   if(!strcmp(type,"atacam"))
     return new freebsd_atacam_device(this, name, "");
 #endif
+  // Areca?
+  disknum = n1 = n2 = -1;
+  if (sscanf(type, "areca,%n%d%n", &n1, &disknum, &n2) == 1 || n1 == 6) {
+    if (n2 != (int)strlen(type)) {
+      set_err(EINVAL, "Option -d areca,N requires N to be a non-negative integer");
+      return 0;
+    }
+    if (!(1 <= disknum && disknum <= 24)) {
+      set_err(EINVAL, "Option -d areca,N (N=%d) must have 1 <= N <= 24", disknum);
+      return 0;
+    }
+    return new freebsd_areca_device(this, name, disknum);
+  }
 
   return 0;
 }
 
 std::string freebsd_smart_interface::get_valid_custom_dev_types_str()
 {
-  return "3ware,N, hpt,L/M/N, cciss,N"
+  return "3ware,N, hpt,L/M/N, cciss,N, areca,N"
 #if FREEBSDVER > 800100
   ", atacam"
 #endif
index c46b756f63dcb65f12f881c070ddaaa3534596c7..46c8b3a40bf0268d58cddc0921813cf4dfc44fc5 100644 (file)
@@ -89,7 +89,7 @@
 
 #define ARGUSED(x) ((void)(x))
 
-const char * os_linux_cpp_cvsid = "$Id: os_linux.cpp 3317 2011-04-19 19:42:54Z chrfranke $"
+const char * os_linux_cpp_cvsid = "$Id: os_linux.cpp 3441 2011-10-12 17:22:15Z chrfranke $"
   OS_LINUX_H_CVSID;
 
 
@@ -940,9 +940,13 @@ smart_device * linux_megaraid_device::autodetect_open()
   {
     // SAT or USB ?
     ata_device * newdev = smi()->autodetect_sat_device(this, req_buff, len);
-    if (newdev)
+    if (newdev) {
       // NOTE: 'this' is now owned by '*newdev'
+      newdev->close();
+      newdev->set_err(ENOSYS, "SATA device detected,\n"
+        "MegaRAID SAT layer is reportedly buggy, use '-d sat+megaraid,N' to try anyhow");
       return newdev;
+    }
   }
 
   // Nothing special found
@@ -1050,11 +1054,17 @@ bool linux_megaraid_device::scsi_pass_through(scsi_cmnd_io *iop)
   if (iop->cmnd[0] == 0x00)
     return true;
 
-  if (iop->cmnd[0] == 0xa1 || iop->cmnd[0] == 0x85) { // SAT_ATA_PASSTHROUGH_12/16
+  if (iop->cmnd[0] == SAT_ATA_PASSTHROUGH_12 || iop->cmnd[0] == SAT_ATA_PASSTHROUGH_16) { 
     // Controller does not return ATA output registers in SAT sense data
     if (iop->cmnd[2] & (1 << 5)) // chk_cond
       return set_err(ENOSYS, "ATA return descriptor not supported by controller firmware");
   }
+  // SMART WRITE LOG SECTOR causing media errors
+  if ((iop->cmnd[0] == SAT_ATA_PASSTHROUGH_16 && iop->cmnd[14] == ATA_SMART_CMD 
+       && iop->cmnd[3]==0 && iop->cmnd[4] == ATA_SMART_WRITE_LOG_SECTOR) || 
+      (iop->cmnd[0] == SAT_ATA_PASSTHROUGH_12 && iop->cmnd[9] == ATA_SMART_CMD &&
+        iop->cmnd[3] == ATA_SMART_WRITE_LOG_SECTOR)) 
+    return set_err(ENOSYS, "SMART WRITE LOG SECTOR command is not supported by controller firmware"); 
 
   if (pt_cmd == NULL)
     return false;
@@ -1115,14 +1125,11 @@ bool linux_megaraid_device::megasas_cmd(int cdbLen, void *cdb,
 /* Issue passthrough scsi commands to PERC2/3/4 controllers */
 bool linux_megaraid_device::megadev_cmd(int cdbLen, void *cdb, 
   int dataLen, void *data,
-  int senseLen, void *sense, int /*report*/)
+  int /*senseLen*/, void * /*sense*/, int /*report*/)
 {
   struct uioctl_t uio;
   int rc;
 
-  sense = NULL;
-  senseLen = 0;
-
   /* Don't issue to the controller */
   if (m_disknum == 7)
     return false;
@@ -1641,14 +1648,14 @@ bool linux_escalade_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out
 /// Areca RAID support
 
 class linux_areca_device
-: public /*implements*/ ata_device_with_command_set,
+: public /*implements*/ ata_device,
   public /*extends*/ linux_smart_device
 {
 public:
   linux_areca_device(smart_interface * intf, const char * dev_name, int disknum);
 
 protected:
-  virtual int ata_command_interface(smart_command_set command, int select, char * data);
+  virtual bool ata_pass_through(const ata_cmd_in & in, ata_cmd_out & out); 
 
 private:
   int m_disknum; ///< Disk number.
@@ -1966,8 +1973,16 @@ linux_areca_device::linux_areca_device(smart_interface * intf, const char * dev_
 }
 
 // Areca RAID Controller
-int linux_areca_device::ata_command_interface(smart_command_set command, int select, char * data)
+// int linux_areca_device::ata_command_interface(smart_command_set command, int select, char * data)
+bool linux_areca_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out & out) 
 {
+if (!ata_cmd_is_ok(in, 
+    true, // data_out_support 
+    false, // TODO: multi_sector_support 
+    true) // ata_48bit_support 
+    )
+    return false; 
+
        // ATA input registers
        typedef struct _ATA_INPUT_REGISTERS
        {
@@ -2041,113 +2056,42 @@ int linux_areca_device::ata_command_interface(smart_command_set command, int sel
        areca_packet[4] = (unsigned char)(((areca_packet_len - 6) >> 8) & 0xff);
        areca_packet[5] = 0x1c; // areca defined code for ATA passthrough command
 
-
        // ----- BEGIN TO SETUP PAYLOAD DATA -----
-
        memcpy(&areca_packet[7], "SmrT", 4);    // areca defined password
-
        ata_cmd = (sATA_INPUT_REGISTERS *)&areca_packet[12];
-       ata_cmd->cylinder_low    = 0x4F;
-       ata_cmd->cylinder_high   = 0xC2;
-
 
-       if ( command == READ_VALUES     ||
-                command == READ_THRESHOLDS ||
-                command == READ_LOG ||
-                command == IDENTIFY ||
-                command == PIDENTIFY )
-       {
-               // the commands will return data
-               areca_packet[6] = 0x13;
-               ata_cmd->sector_count = 0x1;
+       // Set registers
+        {
+           const ata_in_regs_48bit & r = in.in_regs;
+           ata_cmd->features     = r.features_16;
+           ata_cmd->sector_count  = r.sector_count_16;
+           ata_cmd->sector_number = r.lba_low_16;
+           ata_cmd->cylinder_low  = r.lba_mid_16;
+           ata_cmd->cylinder_high = r.lba_high_16;
+           ata_cmd->device_head   = r.device;
+           ata_cmd->command      = r.command;
        }
-       else if ( command == WRITE_LOG )
-       {
-               // the commands will write data
-               areca_packet[6] = 0x14;
+       bool readdata = false; 
+       if (in.direction == ata_cmd_in::data_in) { 
+           readdata = true;
+           // the command will read data
+           areca_packet[6] = 0x13;
        }
-       else
+       else if ( in.direction == ata_cmd_in::no_data )
        {
                // the commands will return no data
                areca_packet[6] = 0x15;
        }
-
-
-       ata_cmd->command = ATA_SMART_CMD;
-       // Now set ATA registers depending upon command
-       switch ( command )
+       else if (in.direction == ata_cmd_in::data_out) 
        {
-       case CHECK_POWER_MODE:  
-               //printf("command = CHECK_POWER_MODE\n");
-               ata_cmd->command = ATA_CHECK_POWER_MODE;        
-               break;
-       case READ_VALUES:
-               //printf("command = READ_VALUES\n");
-               ata_cmd->features = ATA_SMART_READ_VALUES;
-               break;
-       case READ_THRESHOLDS:    
-               //printf("command = READ_THRESHOLDS\n");
-               ata_cmd->features = ATA_SMART_READ_THRESHOLDS;
-               break;
-       case READ_LOG: 
-               //printf("command = READ_LOG\n");
-               ata_cmd->features = ATA_SMART_READ_LOG_SECTOR;
-               ata_cmd->sector_number = select;        
-               break;
-       case WRITE_LOG:        
-               //printf("command = WRITE_LOG\n");    
-               ata_cmd->features = ATA_SMART_WRITE_LOG_SECTOR;
-               memcpy(ata_cmd->data, data, 512);
-               ata_cmd->sector_count = 1;
-               ata_cmd->sector_number = select;
-               break;
-       case IDENTIFY:
-               //printf("command = IDENTIFY\n");   
-               ata_cmd->command = ATA_IDENTIFY_DEVICE;         
-               break;
-       case PIDENTIFY:
-               //printf("command = PIDENTIFY\n");
-               errno=ENODEV;
-               return -1;
-       case ENABLE:
-               //printf("command = ENABLE\n");
-               ata_cmd->features = ATA_SMART_ENABLE;
-               break;
-       case DISABLE:
-               //printf("command = DISABLE\n");
-               ata_cmd->features = ATA_SMART_DISABLE;
-               break;
-       case AUTO_OFFLINE:
-               //printf("command = AUTO_OFFLINE\n");
-               ata_cmd->features = ATA_SMART_AUTO_OFFLINE;
-               // Enable or disable?
-               ata_cmd->sector_count = select;
-               break;
-       case AUTOSAVE:
-               //printf("command = AUTOSAVE\n");
-               ata_cmd->features = ATA_SMART_AUTOSAVE;
-               // Enable or disable?
-               ata_cmd->sector_count = select;
-               break;
-       case IMMEDIATE_OFFLINE:
-               //printf("command = IMMEDIATE_OFFLINE\n");
-               ata_cmd->features = ATA_SMART_IMMEDIATE_OFFLINE;
-               // What test type to run?
-               ata_cmd->sector_number = select;
-               break;
-       case STATUS_CHECK:
-               //printf("command = STATUS_CHECK\n");
-               ata_cmd->features = ATA_SMART_STATUS;           
-               break;
-       case STATUS:
-               //printf("command = STATUS\n");
-               ata_cmd->features = ATA_SMART_STATUS;       
-               break;
-       default:
-               //printf("command = UNKNOWN\n");
-               errno=ENOSYS;
-               return -1;
-       };
+               // the commands will write data
+               memcpy(ata_cmd->data, in.buffer, in.size);
+               areca_packet[6] = 0x14;
+       }
+       else {
+           // COMMAND NOT SUPPORTED VIA ARECA IOCTL INTERFACE
+           return set_err(ENOTSUP, "DATA OUT not supported for this Areca controller type");
+       }
 
        areca_packet[11] = m_disknum - 1;                  // drive number
 
@@ -2166,7 +2110,7 @@ int linux_areca_device::ata_command_interface(smart_command_set command, int sel
        expected = arcmsr_command_handler(get_fd(), ARCMSR_IOCTL_CLEAR_RQBUFFER, NULL, 0, NULL);
         if (expected==-3) {
            find_areca_in_proc(NULL);
-           return -1;
+           return set_err(EIO);
        }
 
        expected = arcmsr_command_handler(get_fd(), ARCMSR_IOCTL_CLEAR_WQBUFFER, NULL, 0, NULL);
@@ -2189,45 +2133,36 @@ int linux_areca_device::ata_command_interface(smart_command_set command, int sel
 
        if ( return_buff[expected - 1] != cs )
        {
-               errno = EIO;
-               return -1;
+               return set_err(EIO);
        }
 
        sATA_OUTPUT_REGISTERS *ata_out = (sATA_OUTPUT_REGISTERS *)&return_buff[5] ;
        if ( ata_out->status )
        {
-               if ( command == IDENTIFY )
-               {
-                       pout("The firmware of your Areca RAID controller appears to be outdated!\n" \
-                                "Please update your controller to firmware version 1.46 or later.\n" \
-                                "You may download it here: ftp://ftp.areca.com.tw/RaidCards/BIOS_Firmware\n\n");
-               }
-               errno = EIO;
-               return -1;
+               if ( in.in_regs.command == ATA_IDENTIFY_DEVICE
+                && !nonempty((unsigned char *)in.buffer, in.size)) 
+                {
+                   return set_err(ENODEV, "No drive on port %d", m_disknum);
+                } 
        }
 
        // returns with data
-       if ( command == READ_VALUES     ||
-                command == READ_THRESHOLDS ||
-                command == READ_LOG ||
-                command == IDENTIFY ||
-                command == PIDENTIFY )
+       if (readdata)
        {
-               memcpy(data, &return_buff[7], 512); 
+               memcpy(in.buffer, &return_buff[7], in.size); 
        }
 
-       if ( command == CHECK_POWER_MODE )
+       // Return register values
        {
-               data[0] = ata_out->sector_count;
+           ata_out_regs_48bit & r = out.out_regs;
+           r.error           = ata_out->error;
+           r.sector_count_16 = ata_out->sector_count;
+           r.lba_low_16      = ata_out->sector_number;
+           r.lba_mid_16      = ata_out->cylinder_low;
+           r.lba_high_16     = ata_out->cylinder_high;
+           r.status          = ata_out->status;
        }
-
-       if ( command == STATUS_CHECK &&
-                ( ata_out->cylinder_low == 0xF4 && ata_out->cylinder_high == 0x2C ) )
-       {
-               return 1;
-       }
-
-       return 0;
+       return true;
 }
 
 
@@ -3150,7 +3085,7 @@ smart_device * linux_smart_interface::get_custom_smart_device(const char * name,
       set_err(EINVAL, "Option '-d hpt,L/M/N' invalid controller id L supplied");
       return 0;
     }
-    if (!(1 <= channel && channel <= 8)) {
+    if (!(1 <= channel && channel <= 16)) {
       set_err(EINVAL, "Option '-d hpt,L/M/N' invalid channel number M supplied");
       return 0;
     }
index a3601d0785f2669a9553ecfca843229e0d11da54..b36f700902d893f9a3f00510c678323b6f838b70 100644 (file)
@@ -445,13 +445,18 @@ int do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
 
     if ((SCSI_STATUS_CHECK_CONDITION == iop->scsi_status) &&
         iop->sensep && (len > 3)) {
-      pout("  status=0x%x: sense_key=0x%x asc=0x%x ascq=0x%x\n", 
-           iop->scsi_status, iop->sensep[2] & 0xf,
-           iop->sensep[12], iop->sensep[13]);
+      if ((iop->sensep[0] & 0x7f) > 0x71)
+        pout("  status=%x: [desc] sense_key=%x asc=%x ascq=%x\n",
+             iop->scsi_status, iop->sensep[1] & 0xf,
+             iop->sensep[2], iop->sensep[3]);
+      else
+        pout("  status=%x: sense_key=%x asc=%x ascq=%x\n",
+             iop->scsi_status, iop->sensep[2] & 0xf,
+             iop->sensep[12], iop->sensep[13]);
       if (report > 1) {
           pout("  >>> Sense buffer, len=%d:\n", len);
           dStrHex((const char *)iop->sensep, ((len > 252) ? 252 : len) , 1);
-        }
+      }
     } else if (iop->scsi_status)
       pout("  status=%x\n", iop->scsi_status);
     if (iop->resid)
index 06ae4b5522eaa26266fcd31684e0c431d2b5787d..befd673002800353025f1d9f883b655b353f50d2 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2004-11 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2004-12 Christian Franke <smartmontools-support@lists.sourceforge.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -60,8 +60,8 @@
 #include <ddk/ntddscsi.h>
 #include <ddk/ntddstor.h>
 #else
-// MSVC8, older MinGW
-// (Missing: IOCTL_STORAGE_QUERY_PROPERTY, FILE_DEVICE_SCSI)
+// MSVC10, older MinGW
+// (Missing: IOCTL_SCSI_MINIPORT_*)
 #include <ntddscsi.h>
 #include <winioctl.h>
 #endif
@@ -85,7 +85,7 @@
 #define SELECT_WIN_32_64(x32, x64) (x64)
 #endif
 
-const char * os_win32_cpp_cvsid = "$Id: os_win32.cpp 3358 2011-06-06 19:04:20Z chrfranke $";
+const char * os_win32_cpp_cvsid = "$Id: os_win32.cpp 3521 2012-03-06 21:15:25Z chrfranke $";
 
 // Disable Win9x/ME specific code if no longer supported by compiler.
 #ifdef _WIN64
@@ -184,8 +184,10 @@ ASSERT_SIZEOF(SCSI_PASS_THROUGH_DIRECT, SELECT_WIN_32_64(44, 56));
 // SMART IOCTL via SCSI MINIPORT ioctl
 
 #ifndef FILE_DEVICE_SCSI
-
 #define FILE_DEVICE_SCSI 0x001b
+#endif
+
+#ifndef IOCTL_SCSI_MINIPORT_SMART_VERSION
 
 #define IOCTL_SCSI_MINIPORT_SMART_VERSION               ((FILE_DEVICE_SCSI << 16) + 0x0500)
 #define IOCTL_SCSI_MINIPORT_IDENTIFY                    ((FILE_DEVICE_SCSI << 16) + 0x0501)
@@ -201,7 +203,7 @@ ASSERT_SIZEOF(SCSI_PASS_THROUGH_DIRECT, SELECT_WIN_32_64(44, 56));
 #define IOCTL_SCSI_MINIPORT_READ_SMART_LOG              ((FILE_DEVICE_SCSI << 16) + 0x050b)
 #define IOCTL_SCSI_MINIPORT_WRITE_SMART_LOG             ((FILE_DEVICE_SCSI << 16) + 0x050c)
 
-#endif // FILE_DEVICE_SCSI
+#endif // IOCTL_SCSI_MINIPORT_SMART_VERSION
 
 ASSERT_CONST(IOCTL_SCSI_MINIPORT, 0x04d008);
 ASSERT_SIZEOF(SRB_IO_CONTROL, 28);
@@ -581,6 +583,8 @@ class winnt_smart_interface
 : public /*extends*/ win_smart_interface
 {
 public:
+  virtual bool disable_system_auto_standby(bool disable);
+
   virtual bool scan_smart_devices(smart_device_list & devlist, const char * type,
     const char * pattern = 0);
 
@@ -655,6 +659,9 @@ std::string win_smart_interface::get_os_version_str()
     case VER_PLATFORM_WIN32_NT     <<16|0x0600| 1:
       w = (vi.wProductType == VER_NT_WORKSTATION   ?   "win7"
                                                    :   "2008r2"); break;
+    case VER_PLATFORM_WIN32_NT     <<16|0x0600| 2:
+      w = (vi.wProductType == VER_NT_WORKSTATION   ?   "win8"
+                                                   :   "win8s"); break;
     default: w = 0; break;
   }
 
@@ -1016,6 +1023,28 @@ std::string win_smart_interface::get_app_examples(const char * appname)
 }
 
 
+bool winnt_smart_interface::disable_system_auto_standby(bool disable)
+{
+  if (disable) {
+    SYSTEM_POWER_STATUS ps;
+    if (!GetSystemPowerStatus(&ps))
+      return set_err(ENOSYS, "Unknown power status");
+    if (ps.ACLineStatus != 1) {
+      SetThreadExecutionState(ES_CONTINUOUS);
+      if (ps.ACLineStatus == 0)
+        set_err(EIO, "AC offline");
+      else
+        set_err(EIO, "Unknown AC line status");
+      return false;
+    }
+  }
+
+  if (!SetThreadExecutionState(ES_CONTINUOUS | (disable ? ES_SYSTEM_REQUIRED : 0)))
+    return set_err(ENOSYS);
+  return true;
+}
+
+
 /////////////////////////////////////////////////////////////////////////////
 // ATA Interface
 /////////////////////////////////////////////////////////////////////////////
@@ -1896,7 +1925,7 @@ bool win_tw_cli_device::open()
         // Show tw_cli error message
         err++;
         err[strcspn(err, "\r\n")] = 0;
-        return set_err(EIO, err);
+        return set_err(EIO, "%s", err);
       }
       return set_err(EIO);
     }
@@ -2022,14 +2051,22 @@ static int storage_predict_failure_ioctl(HANDLE hdevice, char * data = 0)
 
 /////////////////////////////////////////////////////////////////////////////
 
+// Return true if Intel ICHxR RAID volume
+static bool is_intel_raid_volume(const STORAGE_DEVICE_DESCRIPTOR_DATA * data)
+{
+  if (!(data->desc.VendorIdOffset && data->desc.ProductIdOffset))
+    return false;
+  const char * vendor = data->raw + data->desc.VendorIdOffset;
+  if (!(!strnicmp(vendor, "Intel", 5) && strspn(vendor+5, " ") == strlen(vendor+5)))
+    return false;
+  if (strnicmp(data->raw + data->desc.ProductIdOffset, "Raid ", 5))
+    return false;
+  return true;
+}
+
 // get DEV_* for open handle
 static win_dev_type get_controller_type(HANDLE hdevice, bool admin, GETVERSIONINPARAMS_EX * ata_version_ex)
 {
-  // Try SMART_GET_VERSION first to detect ATA SMART support
-  // for drivers reporting BusTypeScsi (3ware)
-  if (admin && smart_get_version(hdevice, ata_version_ex) >= 0)
-    return DEV_ATA;
-
   // Get BusType from device descriptor
   STORAGE_DEVICE_DESCRIPTOR_DATA data;
   if (storage_query_property_ioctl(hdevice, &data))
@@ -2042,12 +2079,24 @@ static win_dev_type get_controller_type(HANDLE hdevice, bool admin, GETVERSIONIN
       if (ata_version_ex)
         memset(ata_version_ex, 0, sizeof(*ata_version_ex));
       return DEV_ATA;
+
     case BusTypeScsi:
+    case BusTypeRAID:
+      // Intel ICHxR RAID volume: reports SMART_GET_VERSION but does not support SMART_*
+      if (is_intel_raid_volume(&data))
+        return DEV_SCSI;
+      // LSI/3ware RAID volume: supports SMART_*
+      if (admin && smart_get_version(hdevice, ata_version_ex) >= 0)
+        return DEV_ATA;
+      return DEV_SCSI;
+
     case 0x09: // BusTypeiScsi
     case 0x0a: // BusTypeSas
       return DEV_SCSI;
+
     case BusTypeUsb:
       return DEV_USB;
+
     default:
       return DEV_UNKNOWN;
   }
@@ -2173,8 +2222,9 @@ static bool get_usb_id(int drive, unsigned short & vendor_id, unsigned short & p
   if (!ws.query(we, "SELECT Antecedent,Dependent FROM Win32_USBControllerDevice"))
     return false;
 
-  std::string usb_devid;
-  std::string prev_usb_ant, prev_usb_devid;
+  unsigned short usb_venid = 0, prev_usb_venid = 0;
+  unsigned short usb_proid = 0, prev_usb_proid = 0;
+  std::string prev_usb_ant;
   std::string prev_ant, ant, dep;
 
   const regular_expression regex("^.*PnPEntity\\.DeviceID=\"([^\"]*)\"", REG_EXTENDED);
@@ -2200,10 +2250,14 @@ static bool get_usb_id(int drive, unsigned short & vendor_id, unsigned short & p
 
     if (str_starts_with(devid, "USB\\\\VID_")) {
       // USB bridge entry, save CONTROLLER, ID
-      if (debug)
-        pout("  +-> \"%s\"\n", devid.c_str());
+      int nc = -1;
+      if (!(sscanf(devid.c_str(), "USB\\\\VID_%4hx&PID_%4hx%n",
+            &prev_usb_venid, &prev_usb_proid, &nc) == 2 && nc == 9+4+5+4)) {
+        prev_usb_venid = prev_usb_proid = 0;
+      }
       prev_usb_ant = ant;
-      prev_usb_devid = devid;
+      if (debug)
+        pout("  +-> \"%s\" [0x%04x:0x%04x]\n", devid.c_str(), prev_usb_venid, prev_usb_proid);
       continue;
     }
     else if (str_starts_with(devid, "USBSTOR\\\\")) {
@@ -2220,26 +2274,32 @@ static bool get_usb_id(int drive, unsigned short & vendor_id, unsigned short & p
       // Continue if not name of physical disk drive
       if (name2 != name) {
         if (debug)
-          pout("  |    (Name: \"%s\")\n", name2.c_str());
+          pout("  +---> (\"%s\")\n", name2.c_str());
         continue;
       }
-      if (debug)
-        pout("  |    Name: \"%s\"\n", name2.c_str());
 
-      // Fail if previos USB bridge is associated to other controller
-      if (ant != prev_usb_ant)
+      // Fail if previos USB bridge is associated to other controller or ID is unknown
+      if (!(ant == prev_usb_ant && prev_usb_venid)) {
+        if (debug)
+          pout("  +---> \"%s\" (Error: No USB bridge found)\n", name2.c_str());
         return false;
+      }
 
       // Handle multiple devices with same name
-      if (!usb_devid.empty()) {
+      if (usb_venid) {
         // Fail if multiple devices with same name have different USB bridge types
-        if (usb_devid != prev_usb_devid)
+        if (!(usb_venid == prev_usb_venid && usb_proid == prev_usb_proid)) {
+          if (debug)
+            pout("  +---> \"%s\" (Error: More than one USB ID found)\n", name2.c_str());
           return false;
-        continue;
+        }
       }
 
       // Found
-      usb_devid = prev_usb_devid;
+      usb_venid = prev_usb_venid;
+      usb_proid = prev_usb_proid;
+      if (debug)
+        pout("  +===> \"%s\" [0x%04x:0x%04x]\n", name2.c_str(), usb_venid, usb_proid);
 
       // Continue to check for duplicate names ...
     }
@@ -2249,14 +2309,12 @@ static bool get_usb_id(int drive, unsigned short & vendor_id, unsigned short & p
     }
   }
 
-  // Parse USB ID
-  int nc = -1;
-  if (!(sscanf(usb_devid.c_str(), "USB\\\\VID_%4hx&PID_%4hx%n",
-               &vendor_id, &product_id, &nc) == 2 && nc == 9+4+5+4))
+  if (!usb_venid)
     return false;
 
-  if (debug)
-    pout("USB ID = 0x%04x:0x%04x\n", vendor_id, product_id);
+  vendor_id = usb_venid;
+  product_id = usb_proid;
+
   return true;
 }
 
@@ -3747,7 +3805,7 @@ bool win_aspi_device::scsi_pass_through(scsi_cmnd_io * iop)
     }
     else
       j += snprintf(&buff[j], (sz > j ? (sz - j) : 0), "]\n");
-    pout(buff);
+    pout("%s", buff);
   }
 
   ASPI_SRB srb;
@@ -3990,7 +4048,7 @@ bool win_scsi_device::scsi_pass_through(struct scsi_cmnd_io * iop)
     }
     else
       j += snprintf(&buff[j], (sz > j ? (sz - j) : 0), "]\n");
-    pout(buff);
+    pout("%s", buff);
   }
 
   SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER sb;
index ccda10182867775eedaea744d0c3038a2c2e9657..481f0b5faf187cbcab5f18389f5eaa0ba86f6139 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2004-10 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2004-11 Christian Franke <smartmontools-support@lists.sourceforge.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@
 
 #include "daemon_win32.h"
 
-const char * daemon_win32_cpp_cvsid = "$Id: daemon_win32.cpp 3267 2011-02-21 17:14:25Z chrfranke $"
+const char * daemon_win32_cpp_cvsid = "$Id: daemon_win32.cpp 3426 2011-10-06 18:23:15Z chrfranke $"
   DAEMON_WIN32_H_CVSID;
 
 
@@ -1034,13 +1034,27 @@ static int svcadm_main(const char * ident, const daemon_winsvc_options * svc_opt
                        CloseServiceHandle(hm);
                        return 1;
                }
+               // Add quotes if necessary
+               if (strchr(path, ' ')) {
+                       i = strlen(path);
+                       path[i+1] = '"'; path[i+2] = 0;
+                       while (--i >= 0)
+                               path[i+1] = path[i];
+                       path[0] = '"';
+               }
                // Append options
                strcat(path, " "); strcat(path, svc_opts->cmd_opt);
                for (i = 2; i < argc; i++) {
                        const char * s = argv[i];
-                       if (strlen(path)+strlen(s)+1 >= sizeof(path))
+                       if (strlen(path)+1+1+strlen(s)+1 >= sizeof(path))
                                break;
-                       strcat(path, " "); strcat(path, s);
+                       // Add quotes if necessary
+                       if (strchr(s, ' ') && !strchr(s, '"')) {
+                               strcat(path, " \""); strcat(path, s); strcat(path, "\"");
+                       }
+                       else {
+                               strcat(path, " "); strcat(path, s);
+                       }
                }
                // Create
                if (!(hs = CreateService(hm,
index 74c02f23ddf5368308f99af69ad9ec8eeed2294d..101c04f4f106e726d3b81795aa5a689ca74a8899 100644 (file)
@@ -13,7 +13,7 @@
 ; You should have received a copy of the GNU General Public License
 ; (for example COPYING); If not, see <http://www.gnu.org/licenses/>.
 ;
-; $Id: installer.nsi 3298 2011-03-22 18:36:44Z chrfranke $
+; $Id: installer.nsi 3457 2011-10-20 16:36:47Z chrfranke $
 ;
 
 
@@ -42,6 +42,8 @@ InstallColors /windows
 
 InstallDir "$PROGRAMFILES\smartmontools"
 InstallDirRegKey HKLM "Software\smartmontools" "Install_Dir"
+
+Var EDITOR
 Var UBCDDIR
 
 LicenseData "${INPDIR}\doc\COPYING.txt"
@@ -199,64 +201,65 @@ Section "Start Menu Shortcuts" MENU_SECTION
 
   CreateDirectory "$SMPROGRAMS\smartmontools"
 
+  !macro CreateAdminShortCut link target args
+    CreateShortCut '${link}' '${target}' '${args}'
+    push '${link}'
+    Call ShellLinkSetRunAs
+  !macroend
+
+  ; runcmdu
+  IfFileExists "$INSTDIR\bin\smartctl.exe" 0 +2
+  IfFileExists "$INSTDIR\bin\smartd.exe" 0 +4
+    SetOutPath "$INSTDIR\bin"
+    File "${INPDIR}\bin\runcmdu.exe"
+    File "${INPDIR}\bin\runcmdu.exe.manifest"
+
   ; smartctl
   IfFileExists "$INSTDIR\bin\smartctl.exe" 0 noctl
     SetOutPath "$INSTDIR\bin"
-    DetailPrint "Create file: $INSTDIR\bin\smartctl-run.bat"
-    Push "$INSTDIR\bin\smartctl-run.bat"
-    Call CreateSmartctlBat
-    IfFileExists "$WINDIR\system32\cmd.exe" 0 +2
-      CreateShortCut "$SMPROGRAMS\smartmontools\smartctl (CMD).lnk" "cmd.exe" "/k smartctl-run.bat"
+    IfFileExists "$WINDIR\system32\cmd.exe" 0 nocmd
+      !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl (Admin CMD).lnk" "$WINDIR\system32\cmd.exe" '/k PATH=$INSTDIR\bin;%PATH%&cd /d "$INSTDIR\bin"'
+    nocmd:
     CreateDirectory "$SMPROGRAMS\smartmontools\smartctl Examples"
     FileOpen $0 "$SMPROGRAMS\smartmontools\smartctl Examples\!Read this first!.txt" "w"
     FileWrite $0 "All the example commands in this directory$\r$\napply to the first drive (sda).$\r$\n"
     FileClose $0
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\All info (-a).lnk"                    "$INSTDIR\bin\smartctl-run.bat" "-a sda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Identify drive (-i).lnk"              "$INSTDIR\bin\smartctl-run.bat" "-i sda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART attributes (-A).lnk"            "$INSTDIR\bin\smartctl-run.bat" "-A sda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART capabilities (-c).lnk"          "$INSTDIR\bin\smartctl-run.bat" "-c sda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART health status (-H).lnk"         "$INSTDIR\bin\smartctl-run.bat" "-H sda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART error log (-l error).lnk"       "$INSTDIR\bin\smartctl-run.bat" "-l error sda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART selftest log (-l selftest).lnk" "$INSTDIR\bin\smartctl-run.bat" "-l selftest sda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Start long selftest (-t long).lnk"    "$INSTDIR\bin\smartctl-run.bat" "-t long sda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Start offline test (-t offline).lnk"  "$INSTDIR\bin\smartctl-run.bat" "-t offline sda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Start short selftest (-t short).lnk"  "$INSTDIR\bin\smartctl-run.bat" "-t short sda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Stop(Abort) selftest (-X).lnk"        "$INSTDIR\bin\smartctl-run.bat" "-X sda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Turn SMART off (-s off).lnk"          "$INSTDIR\bin\smartctl-run.bat" "-s off sda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Turn SMART on (-s on).lnk"            "$INSTDIR\bin\smartctl-run.bat" "-s on sda"  
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\All info (-a).lnk"                    "$INSTDIR\bin\runcmdu.exe" "smartctl -a sda"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Identify drive (-i).lnk"              "$INSTDIR\bin\runcmdu.exe" "smartctl -i sda"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART attributes (-A).lnk"            "$INSTDIR\bin\runcmdu.exe" "smartctl -A sda"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART capabilities (-c).lnk"          "$INSTDIR\bin\runcmdu.exe" "smartctl -c sda"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART health status (-H).lnk"         "$INSTDIR\bin\runcmdu.exe" "smartctl -H sda"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART error log (-l error).lnk"       "$INSTDIR\bin\runcmdu.exe" "smartctl -l error sda"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART selftest log (-l selftest).lnk" "$INSTDIR\bin\runcmdu.exe" "smartctl -l selftest sda"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Start long selftest (-t long).lnk"    "$INSTDIR\bin\runcmdu.exe" "smartctl -t long sda"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Start offline test (-t offline).lnk"  "$INSTDIR\bin\runcmdu.exe" "smartctl -t offline sda"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Start short selftest (-t short).lnk"  "$INSTDIR\bin\runcmdu.exe" "smartctl -t short sda"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Stop(Abort) selftest (-X).lnk"        "$INSTDIR\bin\runcmdu.exe" "smartctl -X sda"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Turn SMART off (-s off).lnk"          "$INSTDIR\bin\runcmdu.exe" "smartctl -s off sda"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Turn SMART on (-s on).lnk"            "$INSTDIR\bin\runcmdu.exe" "smartctl -s on sda"
   noctl:
 
   ; smartd
   IfFileExists "$INSTDIR\bin\smartd.exe" 0 nod
     SetOutPath "$INSTDIR\bin"
-    DetailPrint "Create file: $INSTDIR\bin\smartd-run.bat"
-    FileOpen $0 "$INSTDIR\bin\smartd-run.bat" "w"
-    FileWrite $0 '@echo off$\r$\necho smartd %1 %2 %3 %4 %5$\r$\n"$INSTDIR\bin\smartd" %1 %2 %3 %4 %5$\r$\npause$\r$\n'
-    FileClose $0
     CreateDirectory "$SMPROGRAMS\smartmontools\smartd Examples"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Daemon start, smartd.log.lnk" "$INSTDIR\bin\smartd-run.bat" "-l local0"
-    IfFileExists "$WINDIR\system32\cmd.exe" 0 +2
-      CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Daemon start, eventlog.lnk" "$INSTDIR\bin\smartd-run.bat" ""
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Daemon stop.lnk" "$INSTDIR\bin\smartd-run.bat" "stop"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Do all tests once (-q onecheck).lnk" "$INSTDIR\bin\smartd-run.bat" "-q onecheck"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Debug mode (-d).lnk" "$INSTDIR\bin\smartd-run.bat" "-d"
-    IfFileExists "$WINDIR\notepad.exe" 0 nopad
-      CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Edit smartd.conf.lnk" "$WINDIR\notepad.exe" "$INSTDIR\bin\smartd.conf"
-      CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\View smartd.log.lnk" "$WINDIR\notepad.exe" "$INSTDIR\bin\smartd.log"
-    nopad:
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Daemon start, smartd.log.lnk"           "$INSTDIR\bin\runcmdu.exe" "smartd -l local0"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Daemon start, eventlog.lnk"             "$INSTDIR\bin\runcmdu.exe" "smartd"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Daemon stop.lnk"                        "$INSTDIR\bin\runcmdu.exe" "smartd stop"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Do all tests once (-q onecheck).lnk"    "$INSTDIR\bin\runcmdu.exe" "smartd -q onecheck"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Debug mode (-d).lnk"                    "$INSTDIR\bin\runcmdu.exe" "smartd -d"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\smartd.conf (edit).lnk" "$EDITOR" "$INSTDIR\bin\smartd.conf"
+    CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\smartd.conf (view).lnk"                   "$EDITOR" "$INSTDIR\bin\smartd.conf"
+    CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\smartd.log (view).lnk"                    "$EDITOR" "$INSTDIR\bin\smartd.log"
 
     ; smartd service (not on 9x/ME)
     IfFileExists "$WINDIR\system32\cmd.exe" 0 nosvc
-      CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service install, eventlog, 30min.lnk" "$INSTDIR\bin\smartd-run.bat" "install"
-      CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service install, smartd.log, 10min.lnk" "$INSTDIR\bin\smartd-run.bat" "install -l local0 -i 600"
-      CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service install, smartd.log, 30min.lnk" "$INSTDIR\bin\smartd-run.bat" "install -l local0"
-      CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service remove.lnk" "$INSTDIR\bin\smartd-run.bat" "remove"
-      DetailPrint "Create file: $INSTDIR\bin\net-run.bat"
-      FileOpen $0 "$INSTDIR\bin\net-run.bat" "w"
-      FileWrite $0 "@echo off$\r$\necho net %1 %2 %3 %4 %5$\r$\nnet %1 %2 %3 %4 %5$\r$\npause$\r$\n"
-      FileClose $0
-      CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service start.lnk" "$INSTDIR\bin\net-run.bat" "start smartd"
-      CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service stop.lnk" "$INSTDIR\bin\net-run.bat" "stop smartd"
+      !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service install, eventlog, 30min.lnk"   "$INSTDIR\bin\runcmdu.exe" "smartd install"
+      !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service install, smartd.log, 10min.lnk" "$INSTDIR\bin\runcmdu.exe" "smartd install -l local0 -i 600"
+      !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service install, smartd.log, 30min.lnk" "$INSTDIR\bin\runcmdu.exe" "smartd install -l local0"
+      !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service remove.lnk"                     "$INSTDIR\bin\runcmdu.exe" "smartd remove"
+      !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service start.lnk"                      "$INSTDIR\bin\runcmdu.exe" "net start smartd"
+      !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service stop.lnk"                       "$INSTDIR\bin\runcmdu.exe" "net stop smartd"
     nosvc:
   nod:
 
@@ -270,11 +273,11 @@ Section "Start Menu Shortcuts" MENU_SECTION
     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\smartctl manual page (txt).lnk"     "$INSTDIR\doc\smartctl.8.txt"
     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\smartd manual page (txt).lnk"       "$INSTDIR\doc\smartd.8.txt"
     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\smartd.conf manual page (txt).lnk"  "$INSTDIR\doc\smartd.conf.5.txt"
-    IfFileExists "$WINDIR\notepad.exe" 0 +5
-      CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\smartd.conf sample.lnk" "$WINDIR\notepad.exe" "$INSTDIR\doc\smartd.conf"
-      IfFileExists "$INSTDIR\bin\drivedb.h" 0 +3
-        CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\drivedb.h (view).lnk" "$WINDIR\notepad.exe" "$INSTDIR\bin\drivedb.h"
-        CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\drivedb-add.h (create, edit).lnk" "$WINDIR\notepad.exe" "$INSTDIR\bin\drivedb-add.h"
+    CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\smartd.conf sample.lnk" "$EDITOR" "$INSTDIR\doc\smartd.conf"
+    IfFileExists "$INSTDIR\bin\drivedb.h" 0 nodb
+        CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\drivedb.h (view).lnk" "$EDITOR" "$INSTDIR\bin\drivedb.h"
+        !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\Documentation\drivedb-add.h (create, edit).lnk" "$EDITOR" "$INSTDIR\bin\drivedb-add.h"
+    nodb:
     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\AUTHORS.lnk"   "$INSTDIR\doc\AUTHORS.txt"
     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\CHANGELOG.lnk" "$INSTDIR\doc\CHANGELOG.txt"
     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\COPYING.lnk"   "$INSTDIR\doc\COPYING.txt"
@@ -290,12 +293,16 @@ Section "Start Menu Shortcuts" MENU_SECTION
   CreateShortCut "$SMPROGRAMS\smartmontools\smartmontools Home Page.lnk" "http://smartmontools.sourceforge.net/"
 
   ; drivedb.h update
-  IfFileExists "$INSTDIR\bin\update-smart-drivedb.exe" 0 +2
-    CreateShortCut "$SMPROGRAMS\smartmontools\drivedb.h update.lnk" "$INSTDIR\bin\update-smart-drivedb.exe"
+  IfFileExists "$INSTDIR\bin\update-smart-drivedb.exe" 0 noupdb
+    SetOutPath "$INSTDIR\bin"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\drivedb.h update.lnk" "$INSTDIR\bin\update-smart-drivedb.exe" ""
+  noupdb:
 
   ; Uninstall
-  IfFileExists "$INSTDIR\uninst-smartmontools.exe" 0 +2
-    CreateShortCut "$SMPROGRAMS\smartmontools\Uninstall smartmontools.lnk" "$INSTDIR\uninst-smartmontools.exe"
+  IfFileExists "$INSTDIR\uninst-smartmontools.exe" 0 noinst
+    SetOutPath "$INSTDIR"
+    !insertmacro CreateAdminShortCut "$SMPROGRAMS\smartmontools\Uninstall smartmontools.lnk" "$INSTDIR\uninst-smartmontools.exe" ""
+  noinst:
 
 SectionEnd
 
@@ -329,10 +336,10 @@ SectionGroup "Add smartctl to drive menu"
 !macro DriveSection id name args
   Section 'smartctl ${args} ...' DRIVE_${id}_SECTION
     SectionIn 3
-    Call CheckSmartctlBat
+    Call CheckRunCmdA
     DetailPrint 'Add drive menu entry "${name}": smartctl ${args} ...'
     WriteRegStr HKCR "Drive\shell\smartctl${id}" "" "${name}"
-    WriteRegStr HKCR "Drive\shell\smartctl${id}\command" "" '"$INSTDIR\bin\smartctl-run.bat" ${args} %L'
+    WriteRegStr HKCR "Drive\shell\smartctl${id}\command" "" '"$INSTDIR\bin\runcmda.exe" "$INSTDIR\bin\smartctl.exe" ${args} %L'
   SectionEnd
 !macroend
 
@@ -372,14 +379,11 @@ Section "UBCD4Win Plugin" UBCD_SECTION
   FileWrite $0 '$\r$\n$\t<MENU ID="Diagnostic">$\r$\n$\t$\t<MITEM TYPE="ITEM" DISABLED="'
   FileWrite $0 '@Not(@FileExists(@GetProgramDrive()\Programs\smartmontools\smartctl.exe))" '
   FileWrite $0 'CMD="RUN" FUNC="cmd.exe /k cd /d @GetProgramDrive()\Programs\smartmontools&'
-  FileWrite $0 'set PATH=@GetProgramDrive()\Programs\smartmontools;%PATH%&smartctl-run.bat  ">'
+  FileWrite $0 'set PATH=@GetProgramDrive()\Programs\smartmontools;%PATH%  ">'
   FileWrite $0 'smartctl</MITEM>$\r$\n$\t</MENU>$\r$\n</NU2MENU>$\r$\n'
   FileClose $0
   
   SetOutPath "$UBCDDIR\files"
-  DetailPrint "Create file: smartctl-run.bat"
-  Push "$UBCDDIR\files\smartctl-run.bat"
-  Call CreateSmartctlBat
   File "${INPDIR}\bin\smartctl.exe"
   File "${INPDIR}\bin\smartd.exe"
   File "${INPDIR}\doc\smartctl.8.html"
@@ -441,6 +445,10 @@ Section "Uninstall"
   Delete "$INSTDIR\bin\smartctl-run.bat"
   Delete "$INSTDIR\bin\smartd-run.bat"
   Delete "$INSTDIR\bin\net-run.bat"
+  Delete "$INSTDIR\bin\runcmda.exe"
+  Delete "$INSTDIR\bin\runcmda.exe.manifest"
+  Delete "$INSTDIR\bin\runcmdu.exe"
+  Delete "$INSTDIR\bin\runcmdu.exe.manifest"
   Delete "$INSTDIR\doc\AUTHORS.txt"
   Delete "$INSTDIR\doc\CHANGELOG.txt"
   Delete "$INSTDIR\doc\COPYING.txt"
@@ -500,6 +508,11 @@ SectionEnd
 
 Function .onInit
 
+  ; Use Notepad++ if installed
+  StrCpy $EDITOR "$PROGRAMFILES\Notepad++\notepad++.exe"
+  IfFileExists "$EDITOR" +2 0
+    StrCpy $EDITOR "notepad.exe"
+
   ; Get UBCD4Win install location
   ReadRegStr $0 HKLM "Software\UBCD4Win" "InstallPath"
   StrCmp $0 "" 0 +2
@@ -598,40 +611,13 @@ done:
 FunctionEnd
 
 
-; Create smartctl-run.bat
-
-Function CreateSmartctlBat
-  Exch $0
-  FileOpen $0 $0 "w"
-  FileWrite $0 '@echo off$\r$\nif not "%1" == "" goto run$\r$\n'
-  FileWrite $0 'echo Examples (for first drive):$\r$\n'
-  FileWrite $0 'echo smartctl -i sda            Show identify information$\r$\n'
-  FileWrite $0 'echo smartctl -H sda            Show SMART health status$\r$\n'
-  FileWrite $0 'echo smartctl -c sda            Show SMART capabilities$\r$\n'
-  FileWrite $0 'echo smartctl -A sda            Show SMART attributes$\r$\n'
-  FileWrite $0 'echo smartctl -l error sda      Show error log$\r$\n'
-  FileWrite $0 'echo smartctl -l selftest sda   Show self-test log$\r$\n'
-  FileWrite $0 'echo smartctl -a sda            Show all of the above$\r$\n'
-  FileWrite $0 'echo smartctl -t short sda      Start short self test$\r$\n'
-  FileWrite $0 'echo smartctl -t long sda       Start long self test$\r$\n'
-  FileWrite $0 'echo Use "sdb", "sdc", ... for second, third, ... drive.$\r$\n'
-  FileWrite $0 'echo See man page (smartctl.8.*) for further info.$\r$\n'
-  FileWrite $0 'goto end$\r$\n:run$\r$\n'
-  FileWrite $0 'echo smartctl %1 %2 %3 %4 %5$\r$\n'
-  FileWrite $0 '"$INSTDIR\bin\smartctl" %1 %2 %3 %4 %5$\r$\n'
-  FileWrite $0 'pause$\r$\n:end$\r$\n'
-  FileClose $0
-  Pop $0
-FunctionEnd
-
-; Create smartctl-run.bat if missing
+; Install runcmda.exe if missing
 
-Function CheckSmartctlBat
-  IfFileExists "$INSTDIR\bin\smartctl-run.bat" done 0
+Function CheckRunCmdA
+  IfFileExists "$INSTDIR\bin\runcmda.exe" done 0
     SetOutPath "$INSTDIR\bin"
-    DetailPrint "Create file: $INSTDIR\bin\smartctl-run.bat"
-    Push "$INSTDIR\bin\smartctl-run.bat"
-    Call CreateSmartctlBat
+    File "${INPDIR}\bin\runcmda.exe"
+    File "${INPDIR}\bin\runcmda.exe.manifest"
   done:
 FunctionEnd
 
@@ -780,3 +766,58 @@ FunctionEnd
 !macroend
 !insertmacro StrStr ""
 !insertmacro StrStr "un."
+
+
+;--------------------------------------------------------------------
+; Set Run As Administrator flag in shortcut
+;
+; Slightly modified version from:
+; http://nsis.sourceforge.net/IShellLink_Set_RunAs_flag
+;
+
+!include "LogicLib.nsh"
+
+!define IPersistFile {0000010b-0000-0000-c000-000000000046}
+!define CLSID_ShellLink {00021401-0000-0000-C000-000000000046}
+!define IID_IShellLinkA {000214EE-0000-0000-C000-000000000046}
+!define IID_IShellLinkW {000214F9-0000-0000-C000-000000000046}
+!define IShellLinkDataList {45e2b4ae-b1c3-11d0-b92f-00a0c90312e1}
+!ifdef NSIS_UNICODE
+  !define IID_IShellLink ${IID_IShellLinkW}
+!else
+  !define IID_IShellLink ${IID_IShellLinkA}
+!endif
+
+Function ShellLinkSetRunAs
+  System::Store S ; push $0-$9, $R0-$R9
+  pop $9
+  ; $0 = CoCreateInstance(CLSID_ShellLink, 0, CLSCTX_INPROC_SERVER, IID_IShellLink, &$1)
+  System::Call "ole32::CoCreateInstance(g'${CLSID_ShellLink}',i0,i1,g'${IID_IShellLink}',*i.r1)i.r0"
+  ${If} $0 = 0
+    System::Call "$1->0(g'${IPersistFile}',*i.r2)i.r0" ; $0 = $1->QueryInterface(IPersistFile, &$2)
+    ${If} $0 = 0
+      System::Call "$2->5(w '$9',i 0)i.r0" ; $0 = $2->Load($9, STGM_READ)
+      ${If} $0 = 0
+        System::Call "$1->0(g'${IShellLinkDataList}',*i.r3)i.r0" ; $0 = $1->QueryInterface(IShellLinkDataList, &$3)
+        ${If} $0 = 0
+          System::Call "$3->6(*i.r4)i.r0"; $0 = $3->GetFlags(&$4)
+          ${If} $0 = 0
+            System::Call "$3->7(i $4|0x2000)i.r0" ; $0 = $3->SetFlags($4|SLDF_RUNAS_USER)
+            ${If} $0 = 0
+              System::Call "$2->6(w '$9',i1)i.r0" ; $2->Save($9, TRUE)
+            ${EndIf}
+          ${EndIf}
+          System::Call "$3->2()" ; $3->Release()
+        ${EndIf}
+        System::Call "$2->2()" ; $2->Release()
+      ${EndIf}
+    ${EndIf}
+    System::Call "$1->2()" ; $1->Release()
+  ${EndIf}
+  ${If} $0 <> 0
+    DetailPrint "Set RunAsAdmin: $9 failed ($0)"
+  ${Else}
+    DetailPrint "Set RunAsAdmin: $9"
+  ${EndIf}
+  System::Store L ; push $0-$9, $R0-$R9
+FunctionEnd
diff --git a/os_win32/runcmd.c b/os_win32/runcmd.c
new file mode 100644 (file)
index 0000000..8be8198
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Run console command and wait for user input
+ *
+ * Home page of code is: http://smartmontools.sourceforge.net
+ *
+ * Copyright (C) 2011 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * You should have received a copy of the GNU General Public License
+ * (for example COPYING); If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+char svnid[] = "$Id: runcmd.c 3453 2011-10-16 12:45:27Z chrfranke $";
+
+#include <stdio.h>
+#include <windows.h>
+
+int main(int argc, char **argv)
+{
+  char * cmd = GetCommandLineA();
+  DWORD exitcode;
+  STARTUPINFOA si = { sizeof(si), };
+  PROCESS_INFORMATION pi;
+  int key;
+
+  if (*cmd == '"') {
+    cmd++;
+    while (*cmd && !(*cmd == '"' && cmd[-1] != '\\'))
+      cmd++;
+    if (*cmd)
+      cmd++;
+  }
+  else {
+    while (*cmd && !(*cmd == ' ' || *cmd == '\t'))
+      cmd++;
+  }
+
+  while (*cmd == ' ' || *cmd == '\t')
+    cmd++;
+
+  if (*cmd) {
+    printf("%s\n\n", cmd); fflush(stdout);
+  }
+
+  if (!*cmd) {
+    printf("Usage: %s COMMAND [ARG ...]\n", argv[0]);
+    exitcode = 1;
+  }
+  else if (!CreateProcessA((char *)0, cmd,
+      (SECURITY_ATTRIBUTES *)0, (SECURITY_ATTRIBUTES *)0,
+      TRUE/*inherit*/, 0/*no flags*/, (void *)0, (char *)0, &si, &pi)
+  ) {
+    DWORD err = GetLastError();
+    if (err == ERROR_FILE_NOT_FOUND)
+      printf("Command not found\n");
+    else
+      printf("CreateProcess() failed with error=%u\n", err);
+    exitcode = 1;
+  }
+  else {
+    CloseHandle(pi.hThread);
+
+    exitcode = 42;
+    WaitForSingleObject(pi.hProcess, INFINITE);
+    GetExitCodeProcess(pi.hProcess, &exitcode);
+    CloseHandle(pi.hProcess);
+
+    if (exitcode)
+      printf("\nExitcode: %u (0x%02x)", exitcode, exitcode);
+  }
+
+  printf("\nType <return> to exit: "); fflush(stdout);
+  while (!((key = getc(stdin)) == EOF || key == '\n' || key == '\r'))
+    ;
+  printf("\n");
+
+  return exitcode;
+}
diff --git a/os_win32/runcmd_vc10.vcxproj b/os_win32/runcmd_vc10.vcxproj
new file mode 100644 (file)
index 0000000..f254c6f
--- /dev/null
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{11A4B619-D97B-499F-AF17-CF9F80BF70E8}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>runcmd</RootNamespace>
+    <ProjectName>runcmd</ProjectName>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+    <OutDir>.\runcmdu_vc10.d\</OutDir>
+    <IntDir>.\runcmdu_vc10.d\</IntDir>
+    <TargetName>$(ProjectName)u</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+    <OutDir>.\runcmdu_vc10.r\</OutDir>
+    <IntDir>.\runcmdu_vc10.r\</IntDir>
+    <TargetName>$(ProjectName)u</TargetName>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="runcmd.c" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/os_win32/runcmda.exe.manifest b/os_win32/runcmda.exe.manifest
new file mode 100644 (file)
index 0000000..2b57539
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+  <assemblyIdentity
+    version="1.0.0.0"
+    name="runcmda.exe"
+    type="win32"
+  />
+  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+    <security>
+      <requestedPrivileges>
+        <requestedExecutionLevel
+          level="requireAdministrator"
+          uiAccess="false"
+        />
+      </requestedPrivileges>
+    </security>
+  </trustInfo>
+</assembly>
diff --git a/os_win32/runcmdu.exe.manifest b/os_win32/runcmdu.exe.manifest
new file mode 100644 (file)
index 0000000..f6eb707
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+  <assemblyIdentity
+    version="1.0.0.0"
+    name="runcmdu.exe"
+    type="win32"
+  />
+  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+    <security>
+      <requestedPrivileges>
+        <requestedExecutionLevel
+          level="asInvoker"
+          uiAccess="false"
+        />
+      </requestedPrivileges>
+    </security>
+  </trustInfo>
+</assembly>
diff --git a/os_win32/smartctl_vc10.vcxproj b/os_win32/smartctl_vc10.vcxproj
new file mode 100644 (file)
index 0000000..97f5bcb
--- /dev/null
@@ -0,0 +1,304 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{3AFEDCDD-D289-4543-A91D-EFBA6C710247}</ProjectGuid>
+    <RootNamespace>smartctl</RootNamespace>
+    <Keyword>Win32Proj</Keyword>
+    <ProjectName>smartctl</ProjectName>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <CharacterSet>MultiByte</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\smartctl_vc10.d\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\smartctl_vc10.d\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\smartctl_vc10.r\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>.;..\getopt;..\regex;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_DEBUG;HAVE_CONFIG_H;_USE_32BIT_TIME_T;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+      <DisableSpecificWarnings>4250</DisableSpecificWarnings>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Console</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <AdditionalIncludeDirectories>.;..\getopt;..\regex;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>NDEBUG;HAVE_CONFIG_H;_USE_32BIT_TIME_T;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <DisableSpecificWarnings>4250</DisableSpecificWarnings>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
+      <SubSystem>Console</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="daemon_win32.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="hostname_win32.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="syslog_win32.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="wmiquery.cpp" />
+    <ClCompile Include="..\regex\regcomp.c">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\regex\regex.c" />
+    <ClCompile Include="..\regex\regex_internal.c">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\regex\regexec.c">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\getopt\getopt.c" />
+    <ClCompile Include="..\getopt\getopt1.c" />
+    <ClCompile Include="..\atacmdnames.cpp" />
+    <ClCompile Include="..\atacmds.cpp" />
+    <ClCompile Include="..\ataprint.cpp" />
+    <ClCompile Include="..\cciss.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\dev_ata_cmd_set.cpp" />
+    <ClCompile Include="..\dev_interface.cpp" />
+    <ClCompile Include="..\dev_legacy.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\knowndrives.cpp" />
+    <ClCompile Include="..\os_darwin.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_freebsd.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_generic.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_linux.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_netbsd.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_openbsd.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_os2.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_qnxnto.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_solaris.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_win32.cpp" />
+    <ClCompile Include="..\scsiata.cpp" />
+    <ClCompile Include="..\scsicmds.cpp" />
+    <ClCompile Include="..\scsiprint.cpp" />
+    <ClCompile Include="..\smartctl.cpp" />
+    <ClCompile Include="..\smartd.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\utility.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <CustomBuildStep Include="daemon_win32.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="hostname_win32.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="syslog.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <ClInclude Include="wbemcli_small.h" />
+    <ClInclude Include="wmiquery.h" />
+    <ClInclude Include="..\regex\regex.h" />
+    <ClInclude Include="..\regex\regex_internal.h" />
+    <ClInclude Include="..\getopt\getopt.h" />
+    <ClInclude Include="..\atacmdnames.h" />
+    <ClInclude Include="..\atacmds.h" />
+    <ClInclude Include="..\ataprint.h" />
+    <CustomBuildStep Include="..\cciss.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <ClInclude Include="..\cissio_freebsd.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClInclude>
+    <CustomBuild Include="config_vc10.h">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copy %(FullPath) $(IntDir)config.h</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(IntDir)config.h
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)config.h;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copy %(FullPath) $(IntDir)config.h</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(IntDir)config.h
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)config.h;%(Outputs)</Outputs>
+    </CustomBuild>
+    <ClInclude Include="..\csmisas.h" />
+    <ClInclude Include="..\dev_ata_cmd_set.h" />
+    <ClInclude Include="..\dev_interface.h" />
+    <ClInclude Include="..\dev_tunnelled.h" />
+    <ClInclude Include="..\drivedb.h" />
+    <ClInclude Include="..\int64.h" />
+    <ClInclude Include="..\knowndrives.h" />
+    <CustomBuildStep Include="..\megaraid.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_darwin.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_freebsd.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_generic.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_linux.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_netbsd.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_openbsd.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_os2.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_qnxnto.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_solaris.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <ClInclude Include="..\scsicmds.h" />
+    <ClInclude Include="..\scsiprint.h" />
+    <ClInclude Include="..\smartctl.h" />
+    <CustomBuild Include="svnversion_vc10.h">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copy %(FullPath) $(IntDir)svnversion.h</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(IntDir)svnversion.h
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)svnversion.h;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copy %(FullPath) $(IntDir)svnversion.h</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(IntDir)svnversion.h
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)svnversion.h;%(Outputs)</Outputs>
+    </CustomBuild>
+    <ClInclude Include="..\utility.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="installer.nsi" />
+    <None Include="update-smart-drivedb.nsi" />
+    <None Include="..\AUTHORS" />
+    <None Include="..\autogen.sh" />
+    <None Include="..\CHANGELOG" />
+    <None Include="..\config.h.in" />
+    <None Include="..\configure.in" />
+    <None Include="..\do_release" />
+    <None Include="..\Doxyfile" />
+    <None Include="..\INSTALL" />
+    <None Include="..\Makefile.am" />
+    <None Include="..\NEWS" />
+    <None Include="..\README" />
+    <None Include="..\smartctl.8.in" />
+    <None Include="..\smartd.8.in" />
+    <None Include="..\smartd.conf.5.in" />
+    <None Include="..\smartd.initd.in" />
+    <None Include="..\TODO" />
+    <None Include="..\update-smart-drivedb.in" />
+    <None Include="..\WARNINGS" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/os_win32/smartctl_vc10.vcxproj.filters b/os_win32/smartctl_vc10.vcxproj.filters
new file mode 100644 (file)
index 0000000..fbcb4bf
--- /dev/null
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="os_win32">
+      <UniqueIdentifier>{9321e988-dd03-496d-9933-7c8b235a46bf}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="regex">
+      <UniqueIdentifier>{bfbfd4ea-fae3-45ec-9cfb-c5424218c47c}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="getopt">
+      <UniqueIdentifier>{8ff0bf5f-c96e-45c3-bcb4-7450cecfa0d4}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="daemon_win32.cpp">
+      <Filter>os_win32</Filter>
+    </ClCompile>
+    <ClCompile Include="hostname_win32.cpp">
+      <Filter>os_win32</Filter>
+    </ClCompile>
+    <ClCompile Include="syslog_win32.cpp">
+      <Filter>os_win32</Filter>
+    </ClCompile>
+    <ClCompile Include="wmiquery.cpp">
+      <Filter>os_win32</Filter>
+    </ClCompile>
+    <ClCompile Include="..\regex\regcomp.c">
+      <Filter>regex</Filter>
+    </ClCompile>
+    <ClCompile Include="..\regex\regex.c">
+      <Filter>regex</Filter>
+    </ClCompile>
+    <ClCompile Include="..\regex\regex_internal.c">
+      <Filter>regex</Filter>
+    </ClCompile>
+    <ClCompile Include="..\regex\regexec.c">
+      <Filter>regex</Filter>
+    </ClCompile>
+    <ClCompile Include="..\getopt\getopt.c">
+      <Filter>getopt</Filter>
+    </ClCompile>
+    <ClCompile Include="..\getopt\getopt1.c">
+      <Filter>getopt</Filter>
+    </ClCompile>
+    <ClCompile Include="..\atacmdnames.cpp" />
+    <ClCompile Include="..\atacmds.cpp" />
+    <ClCompile Include="..\ataprint.cpp" />
+    <ClCompile Include="..\cciss.cpp" />
+    <ClCompile Include="..\dev_ata_cmd_set.cpp" />
+    <ClCompile Include="..\dev_interface.cpp" />
+    <ClCompile Include="..\dev_legacy.cpp" />
+    <ClCompile Include="..\knowndrives.cpp" />
+    <ClCompile Include="..\os_darwin.cpp" />
+    <ClCompile Include="..\os_freebsd.cpp" />
+    <ClCompile Include="..\os_generic.cpp" />
+    <ClCompile Include="..\os_linux.cpp" />
+    <ClCompile Include="..\os_netbsd.cpp" />
+    <ClCompile Include="..\os_openbsd.cpp" />
+    <ClCompile Include="..\os_os2.cpp" />
+    <ClCompile Include="..\os_qnxnto.cpp" />
+    <ClCompile Include="..\os_solaris.cpp" />
+    <ClCompile Include="..\os_win32.cpp" />
+    <ClCompile Include="..\scsiata.cpp" />
+    <ClCompile Include="..\scsicmds.cpp" />
+    <ClCompile Include="..\scsiprint.cpp" />
+    <ClCompile Include="..\smartctl.cpp" />
+    <ClCompile Include="..\smartd.cpp" />
+    <ClCompile Include="..\utility.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="wbemcli_small.h">
+      <Filter>os_win32</Filter>
+    </ClInclude>
+    <ClInclude Include="wmiquery.h">
+      <Filter>os_win32</Filter>
+    </ClInclude>
+    <ClInclude Include="..\regex\regex.h">
+      <Filter>regex</Filter>
+    </ClInclude>
+    <ClInclude Include="..\regex\regex_internal.h">
+      <Filter>regex</Filter>
+    </ClInclude>
+    <ClInclude Include="..\getopt\getopt.h">
+      <Filter>getopt</Filter>
+    </ClInclude>
+    <ClInclude Include="..\atacmdnames.h" />
+    <ClInclude Include="..\atacmds.h" />
+    <ClInclude Include="..\ataprint.h" />
+    <ClInclude Include="..\cissio_freebsd.h" />
+    <ClInclude Include="..\csmisas.h" />
+    <ClInclude Include="..\dev_ata_cmd_set.h" />
+    <ClInclude Include="..\dev_interface.h" />
+    <ClInclude Include="..\dev_tunnelled.h" />
+    <ClInclude Include="..\drivedb.h" />
+    <ClInclude Include="..\int64.h" />
+    <ClInclude Include="..\knowndrives.h" />
+    <ClInclude Include="..\scsicmds.h" />
+    <ClInclude Include="..\scsiprint.h" />
+    <ClInclude Include="..\smartctl.h" />
+    <ClInclude Include="..\utility.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="installer.nsi">
+      <Filter>os_win32</Filter>
+    </None>
+    <None Include="update-smart-drivedb.nsi">
+      <Filter>os_win32</Filter>
+    </None>
+    <None Include="..\AUTHORS" />
+    <None Include="..\autogen.sh" />
+    <None Include="..\CHANGELOG" />
+    <None Include="..\config.h.in" />
+    <None Include="..\configure.in" />
+    <None Include="..\do_release" />
+    <None Include="..\Doxyfile" />
+    <None Include="..\INSTALL" />
+    <None Include="..\Makefile.am" />
+    <None Include="..\NEWS" />
+    <None Include="..\README" />
+    <None Include="..\smartctl.8.in" />
+    <None Include="..\smartd.8.in" />
+    <None Include="..\smartd.conf.5.in" />
+    <None Include="..\smartd.initd.in" />
+    <None Include="..\TODO" />
+    <None Include="..\update-smart-drivedb.in" />
+    <None Include="..\WARNINGS" />
+  </ItemGroup>
+  <ItemGroup>
+    <CustomBuildStep Include="daemon_win32.h">
+      <Filter>os_win32</Filter>
+    </CustomBuildStep>
+    <CustomBuildStep Include="hostname_win32.h">
+      <Filter>os_win32</Filter>
+    </CustomBuildStep>
+    <CustomBuildStep Include="syslog.h">
+      <Filter>os_win32</Filter>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\cciss.h" />
+    <CustomBuildStep Include="..\megaraid.h" />
+    <CustomBuildStep Include="..\os_darwin.h" />
+    <CustomBuildStep Include="..\os_freebsd.h" />
+    <CustomBuildStep Include="..\os_generic.h" />
+    <CustomBuildStep Include="..\os_linux.h" />
+    <CustomBuildStep Include="..\os_netbsd.h" />
+    <CustomBuildStep Include="..\os_openbsd.h" />
+    <CustomBuildStep Include="..\os_os2.h" />
+    <CustomBuildStep Include="..\os_qnxnto.h" />
+    <CustomBuildStep Include="..\os_solaris.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <CustomBuild Include="config_vc10.h" />
+    <CustomBuild Include="svnversion_vc10.h" />
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/os_win32/smartctl_vc8.vcproj b/os_win32/smartctl_vc8.vcproj
deleted file mode 100644 (file)
index 0e8496a..0000000
+++ /dev/null
@@ -1,1099 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-       ProjectType="Visual C++"
-       Version="8,00"
-       Name="smartctl_vc8"
-       ProjectGUID="{3AFEDCDD-D289-4543-A91D-EFBA6C710247}"
-       RootNamespace="smartctl_vc8"
-       Keyword="Win32Proj"
-       >
-       <Platforms>
-               <Platform
-                       Name="Win32"
-               />
-       </Platforms>
-       <ToolFiles>
-       </ToolFiles>
-       <Configurations>
-               <Configuration
-                       Name="Debug|Win32"
-                       OutputDirectory=".\smartctl_vc8.d"
-                       IntermediateDirectory=".\smartctl_vc8.d"
-                       ConfigurationType="1"
-                       CharacterSet="2"
-                       >
-                       <Tool
-                               Name="VCPreBuildEventTool"
-                       />
-                       <Tool
-                               Name="VCCustomBuildTool"
-                       />
-                       <Tool
-                               Name="VCXMLDataGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCWebServiceProxyGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCMIDLTool"
-                       />
-                       <Tool
-                               Name="VCCLCompilerTool"
-                               Optimization="0"
-                               AdditionalIncludeDirectories=".,..\getopt,..\regex,$(IntDir)"
-                               PreprocessorDefinitions="_DEBUG;HAVE_CONFIG_H;_ERRCODE_DEFINED;errno_t=int;_USE_32BIT_TIME_T;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
-                               MinimalRebuild="true"
-                               BasicRuntimeChecks="3"
-                               RuntimeLibrary="3"
-                               UsePrecompiledHeader="0"
-                               WarningLevel="3"
-                               Detect64BitPortabilityProblems="false"
-                               DebugInformationFormat="4"
-                       />
-                       <Tool
-                               Name="VCManagedResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCPreLinkEventTool"
-                       />
-                       <Tool
-                               Name="VCLinkerTool"
-                               LinkIncremental="2"
-                               GenerateDebugInformation="true"
-                               SubSystem="1"
-                               TargetMachine="1"
-                       />
-                       <Tool
-                               Name="VCALinkTool"
-                       />
-                       <Tool
-                               Name="VCManifestTool"
-                       />
-                       <Tool
-                               Name="VCXDCMakeTool"
-                       />
-                       <Tool
-                               Name="VCBscMakeTool"
-                       />
-                       <Tool
-                               Name="VCFxCopTool"
-                       />
-                       <Tool
-                               Name="VCAppVerifierTool"
-                       />
-                       <Tool
-                               Name="VCWebDeploymentTool"
-                       />
-                       <Tool
-                               Name="VCPostBuildEventTool"
-                       />
-               </Configuration>
-               <Configuration
-                       Name="Release|Win32"
-                       OutputDirectory=".\smartctl_vc8.r"
-                       IntermediateDirectory=".\smartctl_vc8.r"
-                       ConfigurationType="1"
-                       CharacterSet="2"
-                       WholeProgramOptimization="1"
-                       >
-                       <Tool
-                               Name="VCPreBuildEventTool"
-                       />
-                       <Tool
-                               Name="VCCustomBuildTool"
-                       />
-                       <Tool
-                               Name="VCXMLDataGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCWebServiceProxyGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCMIDLTool"
-                       />
-                       <Tool
-                               Name="VCCLCompilerTool"
-                               AdditionalIncludeDirectories=".,..\getopt,..\regex,$(IntDir)"
-                               PreprocessorDefinitions="NDEBUG;HAVE_CONFIG_H;_ERRCODE_DEFINED;errno_t=int;_USE_32BIT_TIME_T;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
-                               RuntimeLibrary="2"
-                               UsePrecompiledHeader="0"
-                               WarningLevel="3"
-                               Detect64BitPortabilityProblems="false"
-                               DebugInformationFormat="3"
-                       />
-                       <Tool
-                               Name="VCManagedResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCPreLinkEventTool"
-                       />
-                       <Tool
-                               Name="VCLinkerTool"
-                               OutputFile="smartctl.exe"
-                               LinkIncremental="1"
-                               GenerateDebugInformation="true"
-                               ProgramDatabaseFile="$(IntDir)\$(TargetName).pdb"
-                               SubSystem="1"
-                               OptimizeReferences="2"
-                               EnableCOMDATFolding="2"
-                               TargetMachine="1"
-                       />
-                       <Tool
-                               Name="VCALinkTool"
-                       />
-                       <Tool
-                               Name="VCManifestTool"
-                       />
-                       <Tool
-                               Name="VCXDCMakeTool"
-                       />
-                       <Tool
-                               Name="VCBscMakeTool"
-                       />
-                       <Tool
-                               Name="VCFxCopTool"
-                       />
-                       <Tool
-                               Name="VCAppVerifierTool"
-                       />
-                       <Tool
-                               Name="VCWebDeploymentTool"
-                       />
-                       <Tool
-                               Name="VCPostBuildEventTool"
-                       />
-               </Configuration>
-       </Configurations>
-       <References>
-       </References>
-       <Files>
-               <Filter
-                       Name="os_win32"
-                       >
-                       <File
-                               RelativePath=".\daemon_win32.cpp"
-                               >
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath=".\daemon_win32.h"
-                               >
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCustomBuildTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCustomBuildTool"
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath=".\hostname_win32.cpp"
-                               >
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath=".\hostname_win32.h"
-                               >
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCustomBuildTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCustomBuildTool"
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath=".\installer.nsi"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\syslog.h"
-                               >
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCustomBuildTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCustomBuildTool"
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath=".\syslog_win32.cpp"
-                               >
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath=".\update-smart-drivedb.nsi"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\wbemcli_small.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\wmiquery.cpp"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\wmiquery.h"
-                               >
-                       </File>
-               </Filter>
-               <Filter
-                       Name="regex"
-                       >
-                       <File
-                               RelativePath="..\regex\regcomp.c"
-                               >
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath="..\regex\regex.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\regex\regex.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\regex\regex_internal.c"
-                               >
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath="..\regex\regex_internal.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\regex\regexec.c"
-                               >
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                       </File>
-               </Filter>
-               <Filter
-                       Name="getopt"
-                       >
-                       <File
-                               RelativePath="..\getopt\getopt.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\getopt\getopt.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\getopt\getopt1.c"
-                               >
-                       </File>
-               </Filter>
-               <File
-                       RelativePath="..\atacmdnames.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\atacmdnames.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\atacmds.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\atacmds.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\ataprint.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\ataprint.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\AUTHORS"
-                       >
-               </File>
-               <File
-                       RelativePath="..\autogen.sh"
-                       >
-               </File>
-               <File
-                       RelativePath="..\cciss.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\cciss.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\CHANGELOG"
-                       >
-               </File>
-               <File
-                       RelativePath="..\config.h.in"
-                       >
-               </File>
-               <File
-                       RelativePath=".\config_vc8.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                                       Description="Copy $(InputPath) $(IntDir)\config.h"
-                                       CommandLine="copy $(InputPath) $(IntDir)\config.h&#x0D;&#x0A;"
-                                       Outputs="$(IntDir)\config.h"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                                       Description="Copy $(InputPath) $(IntDir)\config.h"
-                                       CommandLine="copy $(InputPath) $(IntDir)\config.h&#x0D;&#x0A;"
-                                       Outputs="$(IntDir)\config.h"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\configure.in"
-                       >
-               </File>
-               <File
-                       RelativePath="..\csmisas.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\dev_ata_cmd_set.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\dev_ata_cmd_set.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\dev_interface.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\dev_interface.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\dev_legacy.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\dev_tunnelled.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\do_release"
-                       >
-               </File>
-               <File
-                       RelativePath="..\Doxyfile"
-                       >
-               </File>
-               <File
-                       RelativePath="..\drivedb.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\INSTALL"
-                       >
-               </File>
-               <File
-                       RelativePath="..\int64.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\knowndrives.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\knowndrives.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\Makefile.am"
-                       >
-               </File>
-               <File
-                       RelativePath="..\megaraid.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\NEWS"
-                       >
-               </File>
-               <File
-                       RelativePath="..\os_darwin.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_darwin.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_freebsd.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_freebsd.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_generic.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_generic.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_linux.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_linux.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_netbsd.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_netbsd.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_openbsd.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_openbsd.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_os2.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_os2.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_qnxnto.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_qnxnto.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_solaris.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_solaris.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_win32.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\README"
-                       >
-               </File>
-               <File
-                       RelativePath="..\scsiata.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\scsicmds.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\scsicmds.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\scsiprint.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\scsiprint.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\smartctl.8.in"
-                       >
-               </File>
-               <File
-                       RelativePath="..\smartctl.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\smartctl.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\smartd.8.in"
-                       >
-               </File>
-               <File
-                       RelativePath="..\smartd.conf.5.in"
-                       >
-               </File>
-               <File
-                       RelativePath="..\smartd.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\smartd.initd.in"
-                       >
-               </File>
-               <File
-                       RelativePath=".\svnversion_vc8.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                                       Description="Copy $(InputPath) svnversion.h"
-                                       CommandLine="copy $(InputPath) svnversion.h&#x0D;&#x0A;"
-                                       Outputs="svnversion.h"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                                       Description="Copy $(InputPath) svnversion.h"
-                                       CommandLine="copy $(InputPath) svnversion.h&#x0D;&#x0A;"
-                                       Outputs="svnversion.h"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\TODO"
-                       >
-               </File>
-               <File
-                       RelativePath="..\update-smart-drivedb.in"
-                       >
-               </File>
-               <File
-                       RelativePath="..\utility.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\utility.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\WARNINGS"
-                       >
-               </File>
-       </Files>
-       <Globals>
-       </Globals>
-</VisualStudioProject>
diff --git a/os_win32/smartd_vc10.vcxproj b/os_win32/smartd_vc10.vcxproj
new file mode 100644 (file)
index 0000000..af63ceb
--- /dev/null
@@ -0,0 +1,301 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}</ProjectGuid>
+    <RootNamespace>smartd</RootNamespace>
+    <Keyword>Win32Proj</Keyword>
+    <ProjectName>smartd</ProjectName>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <CharacterSet>MultiByte</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\smartd_vc10.d\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\smartd_vc10.d\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\smartd_vc10.r\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>.;..\getopt;..\regex;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_DEBUG;HAVE_CONFIG_H;_USE_32BIT_TIME_T;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+      <DisableSpecificWarnings>4250</DisableSpecificWarnings>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Console</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <AdditionalIncludeDirectories>.;..\getopt;..\regex;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>NDEBUG;HAVE_CONFIG_H;_USE_32BIT_TIME_T;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <DisableSpecificWarnings>4250</DisableSpecificWarnings>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
+      <SubSystem>Console</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="daemon_win32.cpp" />
+    <ClCompile Include="hostname_win32.cpp" />
+    <ClCompile Include="syslog_win32.cpp" />
+    <ClCompile Include="wmiquery.cpp" />
+    <ClCompile Include="..\regex\regcomp.c">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\regex\regex.c" />
+    <ClCompile Include="..\regex\regex_internal.c">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\regex\regexec.c">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\getopt\getopt.c" />
+    <ClCompile Include="..\getopt\getopt1.c" />
+    <ClCompile Include="..\atacmdnames.cpp" />
+    <ClCompile Include="..\atacmds.cpp" />
+    <ClCompile Include="..\ataprint.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\cciss.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\dev_ata_cmd_set.cpp" />
+    <ClCompile Include="..\dev_interface.cpp" />
+    <ClCompile Include="..\dev_legacy.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\knowndrives.cpp" />
+    <ClCompile Include="..\os_darwin.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_freebsd.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_generic.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_linux.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_netbsd.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_openbsd.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_os2.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_qnxnto.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_solaris.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\os_win32.cpp" />
+    <ClCompile Include="..\scsiata.cpp" />
+    <ClCompile Include="..\scsicmds.cpp" />
+    <ClCompile Include="..\scsiprint.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\smartctl.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\smartd.cpp" />
+    <ClCompile Include="..\utility.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="daemon_win32.h" />
+    <ClInclude Include="hostname_win32.h" />
+    <ClInclude Include="syslog.h" />
+    <ClInclude Include="wbemcli_small.h" />
+    <ClInclude Include="wmiquery.h" />
+    <ClInclude Include="..\regex\regex.h" />
+    <ClInclude Include="..\regex\regex_internal.h" />
+    <ClInclude Include="..\getopt\getopt.h" />
+    <ClInclude Include="..\atacmdnames.h" />
+    <ClInclude Include="..\atacmds.h" />
+    <CustomBuildStep Include="..\ataprint.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\cciss.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <ClInclude Include="..\cissio_freebsd.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClInclude>
+    <CustomBuild Include="config_vc10.h">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copy %(FullPath) $(IntDir)config.h</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(IntDir)config.h
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)config.h;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copy %(FullPath) $(IntDir)config.h</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(IntDir)config.h
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)config.h;%(Outputs)</Outputs>
+    </CustomBuild>
+    <ClInclude Include="..\csmisas.h" />
+    <ClInclude Include="..\dev_ata_cmd_set.h" />
+    <ClInclude Include="..\dev_interface.h" />
+    <ClInclude Include="..\dev_tunnelled.h" />
+    <ClInclude Include="..\drivedb.h" />
+    <ClInclude Include="..\int64.h" />
+    <ClInclude Include="..\knowndrives.h" />
+    <CustomBuildStep Include="..\megaraid.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_darwin.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_freebsd.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_generic.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_linux.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_netbsd.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_openbsd.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_os2.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_qnxnto.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\os_solaris.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <ClInclude Include="..\scsicmds.h" />
+    <CustomBuildStep Include="..\scsiprint.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuildStep Include="..\smartctl.h">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </CustomBuildStep>
+    <CustomBuild Include="svnversion_vc10.h">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copy %(FullPath) $(IntDir)svnversion.h</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(IntDir)svnversion.h
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)svnversion.h;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copy %(FullPath) $(IntDir)svnversion.h</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(IntDir)svnversion.h
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)svnversion.h;%(Outputs)</Outputs>
+    </CustomBuild>
+    <ClInclude Include="..\utility.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="installer.nsi" />
+    <None Include="update-smart-drivedb.nsi" />
+    <None Include="..\AUTHORS" />
+    <None Include="..\autogen.sh" />
+    <None Include="..\CHANGELOG" />
+    <None Include="..\config.h.in" />
+    <None Include="..\configure.in" />
+    <None Include="..\do_release" />
+    <None Include="..\Doxyfile" />
+    <None Include="..\INSTALL" />
+    <None Include="..\Makefile.am" />
+    <None Include="..\NEWS" />
+    <None Include="..\README" />
+    <None Include="..\smartctl.8.in" />
+    <None Include="..\smartd.8.in" />
+    <None Include="..\smartd.conf.5.in" />
+    <None Include="..\smartd.initd.in" />
+    <None Include="..\TODO" />
+    <None Include="..\update-smart-drivedb.in" />
+    <None Include="..\WARNINGS" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/os_win32/smartd_vc10.vcxproj.filters b/os_win32/smartd_vc10.vcxproj.filters
new file mode 100644 (file)
index 0000000..0557738
--- /dev/null
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="os_win32">
+      <UniqueIdentifier>{44bb110e-4d44-4d5e-8186-354210a8d3ba}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="regex">
+      <UniqueIdentifier>{fd3bb1d5-a72e-4f92-84a3-6eac97975ec7}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="getopt">
+      <UniqueIdentifier>{1d1b67d5-219f-4e86-a5ff-9d94f1f751f9}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="daemon_win32.cpp">
+      <Filter>os_win32</Filter>
+    </ClCompile>
+    <ClCompile Include="hostname_win32.cpp">
+      <Filter>os_win32</Filter>
+    </ClCompile>
+    <ClCompile Include="syslog_win32.cpp">
+      <Filter>os_win32</Filter>
+    </ClCompile>
+    <ClCompile Include="wmiquery.cpp">
+      <Filter>os_win32</Filter>
+    </ClCompile>
+    <ClCompile Include="..\regex\regcomp.c">
+      <Filter>regex</Filter>
+    </ClCompile>
+    <ClCompile Include="..\regex\regex.c">
+      <Filter>regex</Filter>
+    </ClCompile>
+    <ClCompile Include="..\regex\regex_internal.c">
+      <Filter>regex</Filter>
+    </ClCompile>
+    <ClCompile Include="..\regex\regexec.c">
+      <Filter>regex</Filter>
+    </ClCompile>
+    <ClCompile Include="..\getopt\getopt.c">
+      <Filter>getopt</Filter>
+    </ClCompile>
+    <ClCompile Include="..\getopt\getopt1.c">
+      <Filter>getopt</Filter>
+    </ClCompile>
+    <ClCompile Include="..\atacmdnames.cpp" />
+    <ClCompile Include="..\atacmds.cpp" />
+    <ClCompile Include="..\ataprint.cpp" />
+    <ClCompile Include="..\cciss.cpp" />
+    <ClCompile Include="..\dev_ata_cmd_set.cpp" />
+    <ClCompile Include="..\dev_interface.cpp" />
+    <ClCompile Include="..\dev_legacy.cpp" />
+    <ClCompile Include="..\knowndrives.cpp" />
+    <ClCompile Include="..\os_darwin.cpp" />
+    <ClCompile Include="..\os_freebsd.cpp" />
+    <ClCompile Include="..\os_generic.cpp" />
+    <ClCompile Include="..\os_linux.cpp" />
+    <ClCompile Include="..\os_netbsd.cpp" />
+    <ClCompile Include="..\os_openbsd.cpp" />
+    <ClCompile Include="..\os_os2.cpp" />
+    <ClCompile Include="..\os_qnxnto.cpp" />
+    <ClCompile Include="..\os_solaris.cpp" />
+    <ClCompile Include="..\os_win32.cpp" />
+    <ClCompile Include="..\scsiata.cpp" />
+    <ClCompile Include="..\scsicmds.cpp" />
+    <ClCompile Include="..\scsiprint.cpp" />
+    <ClCompile Include="..\smartctl.cpp" />
+    <ClCompile Include="..\smartd.cpp" />
+    <ClCompile Include="..\utility.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="daemon_win32.h">
+      <Filter>os_win32</Filter>
+    </ClInclude>
+    <ClInclude Include="hostname_win32.h">
+      <Filter>os_win32</Filter>
+    </ClInclude>
+    <ClInclude Include="syslog.h">
+      <Filter>os_win32</Filter>
+    </ClInclude>
+    <ClInclude Include="wbemcli_small.h">
+      <Filter>os_win32</Filter>
+    </ClInclude>
+    <ClInclude Include="wmiquery.h">
+      <Filter>os_win32</Filter>
+    </ClInclude>
+    <ClInclude Include="..\regex\regex.h">
+      <Filter>regex</Filter>
+    </ClInclude>
+    <ClInclude Include="..\regex\regex_internal.h">
+      <Filter>regex</Filter>
+    </ClInclude>
+    <ClInclude Include="..\getopt\getopt.h">
+      <Filter>getopt</Filter>
+    </ClInclude>
+    <ClInclude Include="..\atacmdnames.h" />
+    <ClInclude Include="..\atacmds.h" />
+    <ClInclude Include="..\cissio_freebsd.h" />
+    <ClInclude Include="..\csmisas.h" />
+    <ClInclude Include="..\dev_ata_cmd_set.h" />
+    <ClInclude Include="..\dev_interface.h" />
+    <ClInclude Include="..\dev_tunnelled.h" />
+    <ClInclude Include="..\drivedb.h" />
+    <ClInclude Include="..\int64.h" />
+    <ClInclude Include="..\knowndrives.h" />
+    <ClInclude Include="..\scsicmds.h" />
+    <ClInclude Include="..\utility.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="installer.nsi">
+      <Filter>os_win32</Filter>
+    </None>
+    <None Include="update-smart-drivedb.nsi">
+      <Filter>os_win32</Filter>
+    </None>
+    <None Include="..\AUTHORS" />
+    <None Include="..\autogen.sh" />
+    <None Include="..\CHANGELOG" />
+    <None Include="..\config.h.in" />
+    <None Include="..\configure.in" />
+    <None Include="..\do_release" />
+    <None Include="..\Doxyfile" />
+    <None Include="..\INSTALL" />
+    <None Include="..\Makefile.am" />
+    <None Include="..\NEWS" />
+    <None Include="..\README" />
+    <None Include="..\smartctl.8.in" />
+    <None Include="..\smartd.8.in" />
+    <None Include="..\smartd.conf.5.in" />
+    <None Include="..\smartd.initd.in" />
+    <None Include="..\TODO" />
+    <None Include="..\update-smart-drivedb.in" />
+    <None Include="..\WARNINGS" />
+  </ItemGroup>
+  <ItemGroup>
+    <CustomBuildStep Include="..\ataprint.h" />
+    <CustomBuildStep Include="..\cciss.h" />
+    <CustomBuildStep Include="..\megaraid.h" />
+    <CustomBuildStep Include="..\os_darwin.h" />
+    <CustomBuildStep Include="..\os_freebsd.h" />
+    <CustomBuildStep Include="..\os_generic.h" />
+    <CustomBuildStep Include="..\os_linux.h" />
+    <CustomBuildStep Include="..\os_netbsd.h" />
+    <CustomBuildStep Include="..\os_openbsd.h" />
+    <CustomBuildStep Include="..\os_os2.h" />
+    <CustomBuildStep Include="..\os_qnxnto.h" />
+    <CustomBuildStep Include="..\os_solaris.h" />
+    <CustomBuildStep Include="..\scsiprint.h" />
+    <CustomBuildStep Include="..\smartctl.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <CustomBuild Include="config_vc10.h" />
+    <CustomBuild Include="svnversion_vc10.h" />
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/os_win32/smartd_vc8.vcproj b/os_win32/smartd_vc8.vcproj
deleted file mode 100644 (file)
index eb9d10c..0000000
+++ /dev/null
@@ -1,1083 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-       ProjectType="Visual C++"
-       Version="8,00"
-       Name="smartd_vc8"
-       ProjectGUID="{C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}"
-       RootNamespace="smartd_vc8"
-       Keyword="Win32Proj"
-       >
-       <Platforms>
-               <Platform
-                       Name="Win32"
-               />
-       </Platforms>
-       <ToolFiles>
-       </ToolFiles>
-       <Configurations>
-               <Configuration
-                       Name="Debug|Win32"
-                       OutputDirectory=".\smartd_vc8.d"
-                       IntermediateDirectory=".\smartd_vc8.d"
-                       ConfigurationType="1"
-                       CharacterSet="2"
-                       >
-                       <Tool
-                               Name="VCPreBuildEventTool"
-                       />
-                       <Tool
-                               Name="VCCustomBuildTool"
-                       />
-                       <Tool
-                               Name="VCXMLDataGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCWebServiceProxyGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCMIDLTool"
-                       />
-                       <Tool
-                               Name="VCCLCompilerTool"
-                               Optimization="0"
-                               AdditionalIncludeDirectories=".,..\getopt,..\regex,$(IntDir)"
-                               PreprocessorDefinitions="_DEBUG;HAVE_CONFIG_H;_ERRCODE_DEFINED;errno_t=int;_USE_32BIT_TIME_T;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
-                               MinimalRebuild="true"
-                               BasicRuntimeChecks="3"
-                               RuntimeLibrary="3"
-                               UsePrecompiledHeader="0"
-                               WarningLevel="3"
-                               Detect64BitPortabilityProblems="false"
-                               DebugInformationFormat="4"
-                       />
-                       <Tool
-                               Name="VCManagedResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCPreLinkEventTool"
-                       />
-                       <Tool
-                               Name="VCLinkerTool"
-                               LinkIncremental="2"
-                               GenerateDebugInformation="true"
-                               SubSystem="1"
-                               TargetMachine="1"
-                       />
-                       <Tool
-                               Name="VCALinkTool"
-                       />
-                       <Tool
-                               Name="VCManifestTool"
-                       />
-                       <Tool
-                               Name="VCXDCMakeTool"
-                       />
-                       <Tool
-                               Name="VCBscMakeTool"
-                       />
-                       <Tool
-                               Name="VCFxCopTool"
-                       />
-                       <Tool
-                               Name="VCAppVerifierTool"
-                       />
-                       <Tool
-                               Name="VCWebDeploymentTool"
-                       />
-                       <Tool
-                               Name="VCPostBuildEventTool"
-                       />
-               </Configuration>
-               <Configuration
-                       Name="Release|Win32"
-                       OutputDirectory=".\smartd_vc8.r"
-                       IntermediateDirectory=".\smartd_vc8.r"
-                       ConfigurationType="1"
-                       CharacterSet="2"
-                       WholeProgramOptimization="1"
-                       >
-                       <Tool
-                               Name="VCPreBuildEventTool"
-                       />
-                       <Tool
-                               Name="VCCustomBuildTool"
-                       />
-                       <Tool
-                               Name="VCXMLDataGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCWebServiceProxyGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCMIDLTool"
-                       />
-                       <Tool
-                               Name="VCCLCompilerTool"
-                               AdditionalIncludeDirectories=".,..\getopt,..\regex,$(IntDir)"
-                               PreprocessorDefinitions="NDEBUG;HAVE_CONFIG_H;_ERRCODE_DEFINED;errno_t=int;_USE_32BIT_TIME_T;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
-                               RuntimeLibrary="2"
-                               UsePrecompiledHeader="0"
-                               WarningLevel="3"
-                               Detect64BitPortabilityProblems="false"
-                               DebugInformationFormat="3"
-                       />
-                       <Tool
-                               Name="VCManagedResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCPreLinkEventTool"
-                       />
-                       <Tool
-                               Name="VCLinkerTool"
-                               OutputFile="smartd.exe"
-                               LinkIncremental="1"
-                               GenerateDebugInformation="true"
-                               ProgramDatabaseFile="$(IntDir)\$(TargetName).pdb"
-                               SubSystem="1"
-                               OptimizeReferences="2"
-                               EnableCOMDATFolding="2"
-                               TargetMachine="1"
-                       />
-                       <Tool
-                               Name="VCALinkTool"
-                       />
-                       <Tool
-                               Name="VCManifestTool"
-                       />
-                       <Tool
-                               Name="VCXDCMakeTool"
-                       />
-                       <Tool
-                               Name="VCBscMakeTool"
-                       />
-                       <Tool
-                               Name="VCFxCopTool"
-                       />
-                       <Tool
-                               Name="VCAppVerifierTool"
-                       />
-                       <Tool
-                               Name="VCWebDeploymentTool"
-                       />
-                       <Tool
-                               Name="VCPostBuildEventTool"
-                       />
-               </Configuration>
-       </Configurations>
-       <References>
-       </References>
-       <Files>
-               <Filter
-                       Name="os_win32"
-                       >
-                       <File
-                               RelativePath=".\daemon_win32.cpp"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\daemon_win32.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\hostname_win32.cpp"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\hostname_win32.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\installer.nsi"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\syslog.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\syslog_win32.cpp"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\update-smart-drivedb.nsi"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\wbemcli_small.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\wmiquery.cpp"
-                               >
-                       </File>
-                       <File
-                               RelativePath=".\wmiquery.h"
-                               >
-                       </File>
-               </Filter>
-               <Filter
-                       Name="regex"
-                       >
-                       <File
-                               RelativePath="..\regex\regcomp.c"
-                               >
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath="..\regex\regex.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\regex\regex.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\regex\regex_internal.c"
-                               >
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath="..\regex\regex_internal.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\regex\regexec.c"
-                               >
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                       </File>
-               </Filter>
-               <Filter
-                       Name="getopt"
-                       >
-                       <File
-                               RelativePath="..\getopt\getopt.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\getopt\getopt.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\getopt\getopt1.c"
-                               >
-                       </File>
-               </Filter>
-               <File
-                       RelativePath="..\atacmdnames.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\atacmdnames.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\atacmds.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\atacmds.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\ataprint.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\ataprint.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\AUTHORS"
-                       >
-               </File>
-               <File
-                       RelativePath="..\autogen.sh"
-                       >
-               </File>
-               <File
-                       RelativePath="..\cciss.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\cciss.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\CHANGELOG"
-                       >
-               </File>
-               <File
-                       RelativePath="..\config.h.in"
-                       >
-               </File>
-               <File
-                       RelativePath=".\config_vc8.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                                       Description="Copy $(InputPath) $(IntDir)\config.h"
-                                       CommandLine="copy $(InputPath) $(IntDir)\config.h&#x0D;&#x0A;"
-                                       Outputs="$(IntDir)\config.h"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                                       Description="Copy $(InputPath) $(IntDir)\config.h"
-                                       CommandLine="copy $(InputPath) $(IntDir)\config.h&#x0D;&#x0A;"
-                                       Outputs="$(IntDir)\config.h"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\configure.in"
-                       >
-               </File>
-               <File
-                       RelativePath="..\csmisas.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\dev_ata_cmd_set.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\dev_ata_cmd_set.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\dev_interface.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\dev_interface.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\dev_legacy.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\dev_tunnelled.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\do_release"
-                       >
-               </File>
-               <File
-                       RelativePath="..\Doxyfile"
-                       >
-               </File>
-               <File
-                       RelativePath="..\drivedb.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\INSTALL"
-                       >
-               </File>
-               <File
-                       RelativePath="..\int64.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\knowndrives.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\knowndrives.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\Makefile.am"
-                       >
-               </File>
-               <File
-                       RelativePath="..\megaraid.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\NEWS"
-                       >
-               </File>
-               <File
-                       RelativePath="..\os_darwin.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_darwin.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_freebsd.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_freebsd.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_generic.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_generic.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_linux.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_linux.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_netbsd.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_netbsd.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_openbsd.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_openbsd.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_os2.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_os2.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_qnxnto.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_qnxnto.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_solaris.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_solaris.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\os_win32.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\README"
-                       >
-               </File>
-               <File
-                       RelativePath="..\scsiata.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\scsicmds.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\scsicmds.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\scsiprint.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\scsiprint.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\smartctl.8.in"
-                       >
-               </File>
-               <File
-                       RelativePath="..\smartctl.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\smartctl.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               ExcludedFromBuild="true"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\smartd.8.in"
-                       >
-               </File>
-               <File
-                       RelativePath="..\smartd.conf.5.in"
-                       >
-               </File>
-               <File
-                       RelativePath="..\smartd.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\smartd.initd.in"
-                       >
-               </File>
-               <File
-                       RelativePath=".\svnversion_vc8.h"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                                       Description="Copy $(InputPath) svnversion.h"
-                                       CommandLine="copy $(InputPath) svnversion.h&#x0D;&#x0A;"
-                                       Outputs="svnversion.h"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                                       Description="Copy $(InputPath) svnversion.h"
-                                       CommandLine="copy $(InputPath) svnversion.h&#x0D;&#x0A;"
-                                       Outputs="svnversion.h"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="..\TODO"
-                       >
-               </File>
-               <File
-                       RelativePath="..\update-smart-drivedb.in"
-                       >
-               </File>
-               <File
-                       RelativePath="..\utility.cpp"
-                       >
-               </File>
-               <File
-                       RelativePath="..\utility.h"
-                       >
-               </File>
-               <File
-                       RelativePath="..\WARNINGS"
-                       >
-               </File>
-       </Files>
-       <Globals>
-       </Globals>
-</VisualStudioProject>
diff --git a/os_win32/smartmontools_vc10.sln b/os_win32/smartmontools_vc10.sln
new file mode 100644 (file)
index 0000000..0cc69fe
--- /dev/null
@@ -0,0 +1,38 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C++ Express 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smartctl", "smartctl_vc10.vcxproj", "{3AFEDCDD-D289-4543-A91D-EFBA6C710247}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smartd", "smartd_vc10.vcxproj", "{C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "syslogevt", "syslogevt_vc10.vcxproj", "{FAB7557B-86EA-405D-B49D-33AB3F4D3E33}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "runcmd", "runcmd_vc10.vcxproj", "{11A4B619-D97B-499F-AF17-CF9F80BF70E8}"
+EndProject
+Global
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution
+               Debug|Win32 = Debug|Win32
+               Release|Win32 = Release|Win32
+       EndGlobalSection
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution
+               {3AFEDCDD-D289-4543-A91D-EFBA6C710247}.Debug|Win32.ActiveCfg = Debug|Win32
+               {3AFEDCDD-D289-4543-A91D-EFBA6C710247}.Debug|Win32.Build.0 = Debug|Win32
+               {3AFEDCDD-D289-4543-A91D-EFBA6C710247}.Release|Win32.ActiveCfg = Release|Win32
+               {3AFEDCDD-D289-4543-A91D-EFBA6C710247}.Release|Win32.Build.0 = Release|Win32
+               {C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}.Debug|Win32.ActiveCfg = Debug|Win32
+               {C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}.Debug|Win32.Build.0 = Debug|Win32
+               {C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}.Release|Win32.ActiveCfg = Release|Win32
+               {C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}.Release|Win32.Build.0 = Release|Win32
+               {FAB7557B-86EA-405D-B49D-33AB3F4D3E33}.Debug|Win32.ActiveCfg = Debug|Win32
+               {FAB7557B-86EA-405D-B49D-33AB3F4D3E33}.Debug|Win32.Build.0 = Debug|Win32
+               {FAB7557B-86EA-405D-B49D-33AB3F4D3E33}.Release|Win32.ActiveCfg = Release|Win32
+               {FAB7557B-86EA-405D-B49D-33AB3F4D3E33}.Release|Win32.Build.0 = Release|Win32
+               {11A4B619-D97B-499F-AF17-CF9F80BF70E8}.Debug|Win32.ActiveCfg = Debug|Win32
+               {11A4B619-D97B-499F-AF17-CF9F80BF70E8}.Debug|Win32.Build.0 = Debug|Win32
+               {11A4B619-D97B-499F-AF17-CF9F80BF70E8}.Release|Win32.ActiveCfg = Release|Win32
+               {11A4B619-D97B-499F-AF17-CF9F80BF70E8}.Release|Win32.Build.0 = Release|Win32
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+EndGlobal
diff --git a/os_win32/smartmontools_vc8.sln b/os_win32/smartmontools_vc8.sln
deleted file mode 100644 (file)
index 77be5f8..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smartctl_vc8", "smartctl_vc8.vcproj", "{3AFEDCDD-D289-4543-A91D-EFBA6C710247}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smartd_vc8", "smartd_vc8.vcproj", "{C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "syslogevt_vc8", "syslogevt_vc8.vcproj", "{FAB7557B-86EA-405D-B49D-33AB3F4D3E33}"
-EndProject
-Global
-       GlobalSection(SolutionConfigurationPlatforms) = preSolution
-               Debug|Win32 = Debug|Win32
-               Release|Win32 = Release|Win32
-       EndGlobalSection
-       GlobalSection(ProjectConfigurationPlatforms) = postSolution
-               {3AFEDCDD-D289-4543-A91D-EFBA6C710247}.Debug|Win32.ActiveCfg = Debug|Win32
-               {3AFEDCDD-D289-4543-A91D-EFBA6C710247}.Debug|Win32.Build.0 = Debug|Win32
-               {3AFEDCDD-D289-4543-A91D-EFBA6C710247}.Release|Win32.ActiveCfg = Release|Win32
-               {3AFEDCDD-D289-4543-A91D-EFBA6C710247}.Release|Win32.Build.0 = Release|Win32
-               {C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}.Debug|Win32.ActiveCfg = Debug|Win32
-               {C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}.Debug|Win32.Build.0 = Debug|Win32
-               {C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}.Release|Win32.ActiveCfg = Release|Win32
-               {C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}.Release|Win32.Build.0 = Release|Win32
-               {FAB7557B-86EA-405D-B49D-33AB3F4D3E33}.Debug|Win32.ActiveCfg = Debug|Win32
-               {FAB7557B-86EA-405D-B49D-33AB3F4D3E33}.Debug|Win32.Build.0 = Debug|Win32
-               {FAB7557B-86EA-405D-B49D-33AB3F4D3E33}.Release|Win32.ActiveCfg = Release|Win32
-               {FAB7557B-86EA-405D-B49D-33AB3F4D3E33}.Release|Win32.Build.0 = Release|Win32
-       EndGlobalSection
-       GlobalSection(SolutionProperties) = preSolution
-               HideSolutionNode = FALSE
-       EndGlobalSection
-EndGlobal
diff --git a/os_win32/syslogevt_vc10.vcxproj b/os_win32/syslogevt_vc10.vcxproj
new file mode 100644 (file)
index 0000000..8654915
--- /dev/null
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{FAB7557B-86EA-405D-B49D-33AB3F4D3E33}</ProjectGuid>
+    <RootNamespace>syslogevt</RootNamespace>
+    <Keyword>Win32Proj</Keyword>
+    <ProjectName>syslogevt</ProjectName>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <CharacterSet>MultiByte</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">syslogevt_vc10.d\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">syslogevt_vc10.d\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">syslogevt_vc10.r\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Console</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <PreprocessorDefinitions>NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <Link>
+      <OutputFile>syslogevt.exe</OutputFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
+      <SubSystem>Console</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="syslogevt.c" />
+  </ItemGroup>
+  <ItemGroup>
+    <CustomBuild Include="syslogevt.mc">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">mc -r $(IntDir) syslogevt.mc</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">mc -r $(IntDir) syslogevt.mc
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)syslogevt.rc;$(IntDir)msg00001.bin;syslogevt.h;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mc -r $(IntDir) syslogevt.mc</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mc -r $(IntDir) syslogevt.mc
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)syslogevt.rc;$(IntDir)msg00001.bin;syslogevt.h;%(Outputs)</Outputs>
+    </CustomBuild>
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/os_win32/syslogevt_vc8.vcproj b/os_win32/syslogevt_vc8.vcproj
deleted file mode 100644 (file)
index b7fe8b7..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-       ProjectType="Visual C++"
-       Version="8,00"
-       Name="syslogevt_vc8"
-       ProjectGUID="{FAB7557B-86EA-405D-B49D-33AB3F4D3E33}"
-       RootNamespace="syslogevt_vc8"
-       Keyword="Win32Proj"
-       >
-       <Platforms>
-               <Platform
-                       Name="Win32"
-               />
-       </Platforms>
-       <ToolFiles>
-       </ToolFiles>
-       <Configurations>
-               <Configuration
-                       Name="Debug|Win32"
-                       OutputDirectory="syslogevt_vc8.d"
-                       IntermediateDirectory="syslogevt_vc8.d"
-                       ConfigurationType="1"
-                       CharacterSet="2"
-                       >
-                       <Tool
-                               Name="VCPreBuildEventTool"
-                       />
-                       <Tool
-                               Name="VCCustomBuildTool"
-                       />
-                       <Tool
-                               Name="VCXMLDataGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCWebServiceProxyGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCMIDLTool"
-                       />
-                       <Tool
-                               Name="VCCLCompilerTool"
-                               Optimization="0"
-                               PreprocessorDefinitions="_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
-                               MinimalRebuild="true"
-                               BasicRuntimeChecks="3"
-                               RuntimeLibrary="3"
-                               UsePrecompiledHeader="0"
-                               WarningLevel="3"
-                               Detect64BitPortabilityProblems="true"
-                               DebugInformationFormat="4"
-                       />
-                       <Tool
-                               Name="VCManagedResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCPreLinkEventTool"
-                       />
-                       <Tool
-                               Name="VCLinkerTool"
-                               LinkIncremental="2"
-                               GenerateDebugInformation="true"
-                               SubSystem="1"
-                               TargetMachine="1"
-                       />
-                       <Tool
-                               Name="VCALinkTool"
-                       />
-                       <Tool
-                               Name="VCManifestTool"
-                       />
-                       <Tool
-                               Name="VCXDCMakeTool"
-                       />
-                       <Tool
-                               Name="VCBscMakeTool"
-                       />
-                       <Tool
-                               Name="VCFxCopTool"
-                       />
-                       <Tool
-                               Name="VCAppVerifierTool"
-                       />
-                       <Tool
-                               Name="VCWebDeploymentTool"
-                       />
-                       <Tool
-                               Name="VCPostBuildEventTool"
-                       />
-               </Configuration>
-               <Configuration
-                       Name="Release|Win32"
-                       OutputDirectory="syslogevt_vc8.r"
-                       IntermediateDirectory="syslogevt_vc8.r"
-                       ConfigurationType="1"
-                       CharacterSet="2"
-                       WholeProgramOptimization="1"
-                       >
-                       <Tool
-                               Name="VCPreBuildEventTool"
-                       />
-                       <Tool
-                               Name="VCCustomBuildTool"
-                       />
-                       <Tool
-                               Name="VCXMLDataGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCWebServiceProxyGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCMIDLTool"
-                       />
-                       <Tool
-                               Name="VCCLCompilerTool"
-                               PreprocessorDefinitions="NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
-                               RuntimeLibrary="2"
-                               UsePrecompiledHeader="0"
-                               WarningLevel="3"
-                               Detect64BitPortabilityProblems="true"
-                               DebugInformationFormat="3"
-                       />
-                       <Tool
-                               Name="VCManagedResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCPreLinkEventTool"
-                       />
-                       <Tool
-                               Name="VCLinkerTool"
-                               OutputFile="syslogevt.exe"
-                               LinkIncremental="1"
-                               GenerateDebugInformation="true"
-                               ProgramDatabaseFile="$(IntDir)\$(TargetName).pdb"
-                               SubSystem="1"
-                               OptimizeReferences="2"
-                               EnableCOMDATFolding="2"
-                               TargetMachine="1"
-                       />
-                       <Tool
-                               Name="VCALinkTool"
-                       />
-                       <Tool
-                               Name="VCManifestTool"
-                       />
-                       <Tool
-                               Name="VCXDCMakeTool"
-                       />
-                       <Tool
-                               Name="VCBscMakeTool"
-                       />
-                       <Tool
-                               Name="VCFxCopTool"
-                       />
-                       <Tool
-                               Name="VCAppVerifierTool"
-                       />
-                       <Tool
-                               Name="VCWebDeploymentTool"
-                       />
-                       <Tool
-                               Name="VCPostBuildEventTool"
-                       />
-               </Configuration>
-       </Configurations>
-       <References>
-       </References>
-       <Files>
-               <File
-                       RelativePath=".\syslogevt.c"
-                       >
-               </File>
-               <File
-                       RelativePath=".\syslogevt.mc"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                                       Description="mc -r $(IntDir) syslogevt.mc"
-                                       CommandLine="mc -r $(IntDir) syslogevt.mc&#x0D;&#x0A;"
-                                       Outputs="$(IntDir)\syslogevt.rc;$(IntDir)\msg00001.bin;syslogevt.h"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               >
-                               <Tool
-                                       Name="VCCustomBuildTool"
-                                       Description="mc -r $(IntDir) syslogevt.mc"
-                                       CommandLine="mc -r $(IntDir) syslogevt.mc&#x0D;&#x0A;"
-                                       Outputs="$(IntDir)\syslogevt.rc;$(IntDir)\msg00001.bin;syslogevt.h"
-                               />
-                       </FileConfiguration>
-               </File>
-       </Files>
-       <Globals>
-       </Globals>
-</VisualStudioProject>
index 11c9243cbc1f229d62400998a1ef3da3f477eb65..f0e681c659ad77c135649815c7d5af0e74e49844 100644 (file)
@@ -13,7 +13,7 @@
 ; You should have received a copy of the GNU General Public License
 ; (for example COPYING); If not, see <http://www.gnu.org/licenses/>.
 ;
-; $Id: update-smart-drivedb.nsi 3296 2011-03-16 22:17:51Z chrfranke $
+; $Id: update-smart-drivedb.nsi 3392 2011-06-29 19:13:22Z chrfranke $
 ;
 
 
@@ -49,7 +49,7 @@ Section ""
   Push $0
   Call Download
   IfErrors 0 endload
-    MessageBox MB_OK "Download failed"
+    MessageBox MB_OK "Download failed" /SD IDOK
     Abort "Download failed"
   endload:
 
@@ -59,7 +59,7 @@ Section ""
     ExecWait '.\smartctl-nc.exe -B drivedb.h.new -P showall' $1
     StrCmp $1 "0" endsyntax
       Rename "drivedb.h.new" "drivedb.h.error"
-      MessageBox MB_OK "drivedb.h.error: rejected by smartctl, probably no longer compatible"
+      MessageBox MB_OK "drivedb.h.error: rejected by smartctl, probably no longer compatible" /SD IDOK
       Abort "drivedb.h.error: rejected by smartctl, probably no longer compatible"
   endsyntax:
 
@@ -69,7 +69,7 @@ Section ""
     Call Cmp
     IfErrors changed 0
       DetailPrint "drivedb.h is already up to date"
-      MessageBox MB_OK "$INSTDIR\drivedb.h is already up to date"
+      MessageBox MB_OK "$INSTDIR\drivedb.h is already up to date" /SD IDOK
       Delete "drivedb.h.new"
       DetailPrint "Create file: drivedb.h.lastcheck"
       FileOpen $1 "drivedb.h.lastcheck" w
@@ -81,7 +81,7 @@ Section ""
 
   endcomp:
   Rename "drivedb.h.new" "drivedb.h"
-  MessageBox MB_OK "$INSTDIR\drivedb.h updated from $0"
+  MessageBox MB_OK "$INSTDIR\drivedb.h updated from $0" /SD IDOK
 
 SectionEnd
 
@@ -124,18 +124,18 @@ FunctionEnd
 ; Compare drivedb.h drivedb.h.new, SetErrors if different
 ; TODO: ignore differences in Id string
 Function Cmp
-    ClearErrors
-    FileOpen $R0 "drivedb.h" r
-    FileOpen $R1 "drivedb.h.new" r
-    readloop:
-      FileRead $R0 $R2
-      FileRead $R1 $R3
-      StrCmp $R2 $R3 0 +2
-    IfErrors 0 readloop
-    FileClose $R0
-    FileClose $R1
-    ClearErrors
+  ClearErrors
+  FileOpen $R0 "drivedb.h" r
+  FileOpen $R1 "drivedb.h.new" r
+  readloop:
+    FileRead $R0 $R2
+    FileRead $R1 $R3
     StrCmp $R2 $R3 0 +2
-      Return
-    SetErrors
+  IfErrors 0 readloop
+  FileClose $R0
+  FileClose $R1
+  ClearErrors
+  StrCmp $R2 $R3 0 +2
+    Return
+  SetErrors
 FunctionEnd
index 13dd9888c2aec5764959fbb7aeae3b96dc10fb0e..730dcb12f75469a3c69ab402b602ebd24a486d73 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef WMIQUERY_H
 #define WMIQUERY_H
 
-#define WMIQUERY_H_CVSID "$Id: wmiquery.h 3243 2011-01-19 20:03:47Z chrfranke $"
+#define WMIQUERY_H_CVSID "$Id: wmiquery.h 3475 2011-11-10 21:43:40Z chrfranke $"
 
 #ifdef HAVE_WBEMCLI_H
 #include <wbemcli.h>
 
 #include <string>
 
-#if !defined(__GNUC__) && !defined(__attribute__)
-#define __attribute__(x)  /**/
+#ifndef __GNUC__
+#define __attribute_format_printf(x, y)  /**/
+#elif defined(__MINGW32__) && __USE_MINGW_ANSI_STDIO
+// Check format of __mingw_*printf() instead of MSVCRT.DLL:*printf()
+#define __attribute_format_printf(x, y)  __attribute__((format (gnu_printf, x, y)))
+#else
+#define __attribute_format_printf(x, y)  __attribute__((format (printf, x, y)))
 #endif
 
 /////////////////////////////////////////////////////////////////////////////
@@ -171,11 +176,11 @@ public:
 
   /// Version of vquery() with printf() formatting.
   bool query(wbem_enumerator & result, const char * qstr, ...) /*const*/
-       __attribute__ ((format (printf, 3, 4)));
+       __attribute_format_printf(3, 4);
 
   /// Version of vquery1() with printf() formatting.
   bool query1(wbem_object & obj, const char * qstr, ...) /*const*/
-       __attribute__ ((format (printf, 3, 4)));
+       __attribute_format_printf(3, 4);
 
 private:
   com_intf_ptr<IWbemServices> m_intf;
index 575161e05ec1b108b6115320c541b3eeba23acad..7ce6d5e5b058de3b7004aa3f102577a9dce01863 100644 (file)
@@ -3,8 +3,8 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2006-10 Douglas Gilbert <dgilbert@interlog.com>
- * Copyright (C) 2009-10 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2006-12 Douglas Gilbert <dgilbert@interlog.com>
+ * Copyright (C) 2009-12 Christian Franke <smartmontools-support@lists.sourceforge.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -62,7 +62,7 @@
 #include "dev_ata_cmd_set.h" // ata_device_with_command_set
 #include "dev_tunnelled.h" // tunnelled_device<>
 
-const char * scsiata_cpp_cvsid = "$Id: scsiata.cpp 3258 2011-02-14 22:31:01Z manfred99 $";
+const char * scsiata_cpp_cvsid = "$Id: scsiata.cpp 3519 2012-03-06 20:01:44Z chrfranke $";
 
 /* This is a slightly stretched SCSI sense "descriptor" format header.
    The addition is to allow the 0x70 and 0x71 response codes. The idea
@@ -114,28 +114,42 @@ class sat_device
 : public tunnelled_device<
     /*implements*/ ata_device
     /*by tunnelling through a*/, scsi_device
-  >
+  >,
+  virtual public /*implements*/ scsi_device
 {
 public:
   sat_device(smart_interface * intf, scsi_device * scsidev,
-    const char * req_type, int passthrulen = 0);
+    const char * req_type, int passthrulen = 0, bool enable_auto = false);
 
   virtual ~sat_device() throw();
 
+  virtual smart_device * autodetect_open();
+
   virtual bool ata_pass_through(const ata_cmd_in & in, ata_cmd_out & out);
 
+  virtual bool scsi_pass_through(scsi_cmnd_io * iop);
+
 private:
   int m_passthrulen;
+  bool m_enable_auto;
 };
 
 
 sat_device::sat_device(smart_interface * intf, scsi_device * scsidev,
-  const char * req_type, int passthrulen /*= 0*/)
-: smart_device(intf, scsidev->get_dev_name(), "sat", req_type),
+  const char * req_type, int passthrulen /* = 0 */, bool enable_auto /* = false */)
+: smart_device(intf, scsidev->get_dev_name(),
+    (enable_auto ? "sat,auto" : "sat"), req_type),
   tunnelled_device<ata_device, scsi_device>(scsidev),
-  m_passthrulen(passthrulen)
+  m_passthrulen(passthrulen),
+  m_enable_auto(enable_auto)
 {
-  set_info().info_name = strprintf("%s [SAT]", scsidev->get_info_name());
+  if (enable_auto)
+    hide_ata(); // Start as SCSI, switch to ATA in autodetect_open()
+  else
+    hide_scsi(); // ATA always
+
+  set_info().info_name = strprintf("%s [%sSAT]", scsidev->get_info_name(),
+                                   (enable_auto ? "SCSI/" : ""));
 }
 
 sat_device::~sat_device() throw()
@@ -421,6 +435,45 @@ bool sat_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out & out)
     return true;
 }
 
+bool sat_device::scsi_pass_through(scsi_cmnd_io * iop)
+{
+  scsi_device * scsidev = get_tunnel_dev();
+  if (!scsidev->scsi_pass_through(iop)) {
+    set_err(scsidev->get_err());
+    return false;
+  }
+  return true;
+}
+
+smart_device * sat_device::autodetect_open()
+{
+  if (!open() || !m_enable_auto)
+    return this;
+
+  scsi_device * scsidev = get_tunnel_dev();
+
+  unsigned char inqdata[36] = {0, };
+  if (scsiStdInquiry(scsidev, inqdata, sizeof(inqdata))) {
+      smart_device::error_info err = scsidev->get_err();
+      close();
+      set_err(err.no, "INQUIRY [SAT]: %s", err.msg.c_str());
+      return this;
+  }
+
+  // Check for SAT "VENDOR"
+  int inqsize = inqdata[4] + 5;
+  bool sat = (inqsize >= 36 && !memcmp(inqdata + 8, "ATA     ", 8));
+
+  // Change interface
+  hide_ata(!sat);
+  hide_scsi(sat);
+
+  set_info().dev_type = (sat ? "sat" : scsidev->get_dev_type());
+  set_info().info_name = strprintf("%s [%s]", scsidev->get_info_name(),
+                                   (sat ? "SAT" : "SCSI"));
+  return this;
+}
+
 } // namespace
 
 /////////////////////////////////////////////////////////////////////////////
@@ -590,7 +643,6 @@ int usbcypress_device::ata_command_interface(smart_command_set command, int sele
     int copydata = 0;
     int outlen = 0;
     int ck_cond = 0;    /* set to 1 to read register(s) back */
-    int protocol = 3;   /* non-data */
     int t_dir = 1;      /* 0 -> to device, 1 -> from device */
     int byte_block = 1; /* 0 -> bytes, 1 -> 512 byte blocks */
     int t_length = 0;   /* 0 -> no data transferred */
@@ -615,7 +667,6 @@ int usbcypress_device::ata_command_interface(smart_command_set command, int sele
     case READ_VALUES:           /* READ DATA */
         feature = ATA_SMART_READ_VALUES;
         sector_count = 1;     /* one (512 byte) block */
-        protocol = 4;   /* PIO data-in */
         t_length = 2;   /* sector count holds count */
         copydata = 512;
         break;
@@ -623,7 +674,6 @@ int usbcypress_device::ata_command_interface(smart_command_set command, int sele
         feature = ATA_SMART_READ_THRESHOLDS;
         sector_count = 1;     /* one (512 byte) block */
         lba_low = 1;
-        protocol = 4;   /* PIO data-in */
         t_length = 2;   /* sector count holds count */
         copydata=512;
         break;
@@ -631,7 +681,6 @@ int usbcypress_device::ata_command_interface(smart_command_set command, int sele
         feature = ATA_SMART_READ_LOG_SECTOR;
         sector_count = 1;     /* one (512 byte) block */
         lba_low = select;
-        protocol = 4;   /* PIO data-in */
         t_length = 2;   /* sector count holds count */
         copydata = 512;
         break;
@@ -639,7 +688,6 @@ int usbcypress_device::ata_command_interface(smart_command_set command, int sele
         feature = ATA_SMART_WRITE_LOG_SECTOR;
         sector_count = 1;     /* one (512 byte) block */
         lba_low = select;
-        protocol = 5;   /* PIO data-out */
         t_length = 2;   /* sector count holds count */
         t_dir = 0;      /* to device */
         outlen = 512;
@@ -647,14 +695,12 @@ int usbcypress_device::ata_command_interface(smart_command_set command, int sele
     case IDENTIFY:
         ata_command = ATA_IDENTIFY_DEVICE;
         sector_count = 1;     /* one (512 byte) block */
-        protocol = 4;   /* PIO data-in */
         t_length = 2;   /* sector count holds count */
         copydata = 512;
         break;
     case PIDENTIFY:
         ata_command = ATA_IDENTIFY_PACKET_DEVICE;
         sector_count = 1;     /* one (512 byte) block */
-        protocol = 4;   /* PIO data-in */
         t_length = 2;   /* sector count (7:0) holds count */
         copydata = 512;
         break;
@@ -1251,13 +1297,19 @@ using namespace sat;
 ata_device * smart_interface::get_sat_device(const char * type, scsi_device * scsidev)
 {
   if (!strncmp(type, "sat", 3)) {
-    int ptlen = 0, n1 = -1, n2 = -1;
-    if (!(((sscanf(type, "sat%n,%d%n", &n1, &ptlen, &n2) == 1 && n2 == (int)strlen(type)) || n1 == (int)strlen(type))
-        && (ptlen == 0 || ptlen == 12 || ptlen == 16))) {
-      set_err(EINVAL, "Option '-d sat,<n>' requires <n> to be 0, 12 or 16");
+    const char * t = type + 3;
+    bool enable_auto = false;
+    if (!strncmp(t, ",auto", 5)) {
+      t += 5;
+      enable_auto = true;
+    }
+    int ptlen = 0, n = -1;
+    if (*t && !(sscanf(t, ",%d%n", &ptlen, &n) == 1 && n == (int)strlen(t)
+                && (ptlen == 0 || ptlen == 12 || ptlen == 16))) {
+      set_err(EINVAL, "Option '-d sat[,auto][,N]' requires N to be 0, 12 or 16");
       return 0;
     }
-    return new sat_device(this, scsidev, type, ptlen);
+    return new sat_device(this, scsidev, type, ptlen, enable_auto);
   }
 
   else if (!strncmp(type, "usbcypress", 10)) {
index 56b146495772aaad6ee01f67b5a67a96e246c085..3b311478857b39b6f2e3458647de0b0e05c3d089 100644 (file)
@@ -7,7 +7,7 @@
  * Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
  *
  * Additional SCSI work:
- * Copyright (C) 2003-10 Douglas Gilbert <dgilbert@interlog.com>
+ * Copyright (C) 2003-11 Douglas Gilbert <dgilbert@interlog.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@
 #ifndef SCSICMDS_H_
 #define SCSICMDS_H_
 
-#define SCSICMDS_H_CVSID "$Id: scsicmds.h 3302 2011-03-25 23:04:36Z dpgilbert $\n"
+#define SCSICMDS_H_CVSID "$Id: scsicmds.h 3413 2011-09-06 21:23:00Z dpgilbert $\n"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -183,11 +183,14 @@ struct scsiNonMediumError {
 #define NON_MEDIUM_ERROR_LPAGE                  0x06
 #define LAST_N_ERROR_LPAGE                      0x07
 #define FORMAT_STATUS_LPAGE                     0x08
+#define LB_PROV_LPAGE                           0x0c   /* SBC-3 */
 #define TEMPERATURE_LPAGE                       0x0d
 #define STARTSTOP_CYCLE_COUNTER_LPAGE           0x0e
 #define APPLICATION_CLIENT_LPAGE                0x0f
 #define SELFTEST_RESULTS_LPAGE                  0x10
+#define SS_MEDIA_LPAGE                          0x11   /* SBC-3 */
 #define BACKGROUND_RESULTS_LPAGE                0x15   /* SBC-3 */
+#define NONVOL_CACHE_LPAGE                      0x17   /* SBC-3 */
 #define PROTOCOL_SPECIFIC_LPAGE                 0x18
 #define IE_LPAGE                                0x2f
 
index d65674ab423a252cf9c2c94ece785a44605a62c2..3a3b95d3be9e0d268a117b566464001fcda4cec9 100644 (file)
@@ -42,7 +42,7 @@
 
 #define GBUF_SIZE 65535
 
-const char * scsiprint_c_cvsid = "$Id: scsiprint.cpp 3307 2011-03-31 14:54:58Z dpgilbert $"
+const char * scsiprint_c_cvsid = "$Id: scsiprint.cpp 3441 2011-10-12 17:22:15Z chrfranke $"
                                  SCSIPRINT_H_CVSID;
 
 
@@ -64,6 +64,9 @@ static int gLastNErrorLPage = 0;
 static int gBackgroundResultsLPage = 0;
 static int gProtocolSpecificLPage = 0;
 static int gTapeAlertsLPage = 0;
+static int gSSMediaLPage = 0;
+
+/* Vendor specific log pages */
 static int gSeagateCacheLPage = 0;
 static int gSeagateFactoryLPage = 0;
 
@@ -124,6 +127,9 @@ static void scsiGetSupportedLogPages(scsi_device * device)
             case TAPE_ALERTS_LPAGE:
                 gTapeAlertsLPage = 1;
                 break;
+            case SS_MEDIA_LPAGE:
+                gSSMediaLPage = 1;
+                break;
             case SEAGATE_CACHE_LPAGE:
                 gSeagateCacheLPage = 1;
                 break;
@@ -517,7 +523,7 @@ static void scsiPrintSeagateFactoryLPage(scsi_device * device)
                 ull |= xp[j];
             }
             if (0 == pc)
-                pout(" = %.2f\n", uint64_to_double(ull) / 60.0 );
+                pout(" = %.2f\n", ull / 60.0 );
             else
                 pout(" = %"PRIu64"\n", ull);
         }
@@ -571,7 +577,7 @@ static void scsiPrintErrorCounterLog(scsi_device * device)
             pout("%s%8"PRIu64" %8"PRIu64"  %8"PRIu64"  %8"PRIu64"   %8"PRIu64, 
                  pageNames[k], ecp->counter[0], ecp->counter[1], 
                  ecp->counter[2], ecp->counter[3], ecp->counter[4]);
-            processed_gb = uint64_to_double(ecp->counter[5]) / 1000000000.0;
+            processed_gb = ecp->counter[5] / 1000000000.0;
             pout("   %12.3f    %8"PRIu64"\n", processed_gb, ecp->counter[6]);
         }
     }
@@ -942,6 +948,63 @@ static int scsiPrintBackgroundResults(scsi_device * device)
     return retval;
 }
 
+// See SCSI Block Commands - 3 (SBC-3) rev 27 (draft) section 6.3.6 .
+// Returns 0 if ok else FAIL* bitmask. Note can have a status entry
+// and up to 2048 events (although would hope to have less). May set
+// FAILLOG if serious errors detected (in the future).
+static int scsiPrintSSMedia(scsi_device * device)
+{
+    int num, err, pc, pl, truncated;
+    int retval = 0;
+    UINT8 * ucp;
+
+    if ((err = scsiLogSense(device, SS_MEDIA_LPAGE, 0, gBuf,
+                            LOG_RESP_LONG_LEN, 0))) {
+        print_on();
+        pout("scsiPrintSSMedia Failed [%s]\n", scsiErrString(err));
+        print_off();
+        return FAILSMART;
+    }
+    if ((gBuf[0] & 0x3f) != SS_MEDIA_LPAGE) {
+        print_on();
+        pout("Solid state media Log Sense Failed, page mismatch\n");
+        print_off();
+        return FAILSMART;
+    }
+    // compute page length
+    num = (gBuf[2] << 8) + gBuf[3] + 4;
+    if (num < 12) {
+        print_on();
+        pout("Solid state media Log Sense length is %d, too short\n", num);
+        print_off();
+        return FAILSMART;
+    }
+    truncated = (num > LOG_RESP_LONG_LEN) ? num : 0;
+    if (truncated)
+        num = LOG_RESP_LONG_LEN;
+    ucp = gBuf + 4;
+    num -= 4;
+    while (num > 3) {
+        pc = (ucp[0] << 8) | ucp[1];
+        // pcb = ucp[2];
+        pl = ucp[3] + 4;
+        switch (pc) {
+        case 1:
+           if (pl < 8) {
+                print_on();
+                pout("Percentage used endurance indicator too short (pl=%d)\n", pl);
+                print_off();
+                return FAILSMART;
+           }
+            pout("SS Media used endurance indicator: %d%%\n", ucp[7]);
+        default:       /* ignore other parameter codes */
+            break;
+        }
+        num -= pl;
+        ucp += pl;
+    }
+    return retval;
+}
 
 static void show_sas_phy_event_info(int peis, unsigned int val,
                                     unsigned thresh_val)
@@ -1076,14 +1139,14 @@ static void show_sas_phy_event_info(int peis, unsigned int val,
 
 static void show_sas_port_param(unsigned char * ucp, int param_len)
 {
-    int j, m, n, nphys, pcb, t, sz, spld_len;
+    int j, m, n, nphys, t, sz, spld_len;
     unsigned char * vcp;
     uint64_t ull;
     unsigned int ui;
     char s[64];
 
     sz = sizeof(s);
-    pcb = ucp[2];
+    // pcb = ucp[2];
     t = (ucp[0] << 8) | ucp[1];
     pout("relative target port id = %d\n", t);
     pout("  generation code = %d\n", ucp[6]);
@@ -1649,6 +1712,16 @@ int scsiPrintMain(scsi_device * device, const scsi_print_options & options)
         }
         any_output = true;
     }   
+    if (options.smart_ss_media_log) {
+        if (! checkedSupportedLogPages)
+            scsiGetSupportedLogPages(device);
+        res = 0;
+        if (gSSMediaLPage)
+            res = scsiPrintSSMedia(device);
+        if (0 != res)
+            failuretest(OPTIONAL_CMD, returnval|=res);
+        any_output = true;
+    }
     if (options.smart_vendor_attrib) {
         if (! checkedSupportedLogPages)
             scsiGetSupportedLogPages(device);
index 638674f81044e47938131f5be57b4399c727fe02..fc332f60cc159bef49286629dea9aee2fd73273e 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef SCSI_PRINT_H_
 #define SCSI_PRINT_H_
 
-#define SCSIPRINT_H_CVSID "$Id: scsiprint.h 3196 2010-10-28 21:31:49Z chrfranke $\n"
+#define SCSIPRINT_H_CVSID "$Id: scsiprint.h 3413 2011-09-06 21:23:00Z dpgilbert $\n"
 
 // Options for scsiPrintMain
 struct scsi_print_options
@@ -40,6 +40,7 @@ struct scsi_print_options
   bool smart_error_log;
   bool smart_selftest_log;
   bool smart_background_log;
+  bool smart_ss_media_log;
 
   bool smart_disable, smart_enable;
   bool smart_auto_save_disable, smart_auto_save_enable;
@@ -58,6 +59,7 @@ struct scsi_print_options
       smart_error_log(false),
       smart_selftest_log(false),
       smart_background_log(false),
+      smart_ss_media_log(false),
       smart_disable(false), smart_enable(false),
       smart_auto_save_disable(false), smart_auto_save_enable(false),
       smart_default_selftest(false),
index 093d16dc978422a25f0b8c45ed6f56260b5ad922..49620a4f298b99bed81d46e35d7b4dc5489ea9f9 100644 (file)
@@ -1,7 +1,7 @@
 .ig
  Copyright (C) 2002-10 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 
- $Id: smartctl.8.in 3320 2011-04-30 20:44:55Z chrfranke $
+ $Id: smartctl.8.in 3519 2012-03-06 20:01:44Z chrfranke $
  
  This program is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the Free
 .SH SYNOPSIS
 .B smartctl [options] device
 
+.\" %IF NOT OS Windows
 .SH FULL PATH
 .B /usr/local/sbin/smartctl
 
+.\" %ENDIF NOT OS Windows
 .SH PACKAGE VERSION
 CURRENT_SVN_VERSION CURRENT_SVN_DATE CURRENT_SVN_REV
 
 .SH DESCRIPTION
+.\" %IF NOT OS ALL
+.\"! [This man page is generated for the OS_MAN_FILTER version of smartmontools.
+.\"! It does not contain info specific to other platforms.]
+.\"! .PP
+.\" %ENDIF NOT OS ALL
 \fBsmartctl\fP controls the Self\-Monitoring, Analysis and Reporting
 Technology (SMART) system built into many ATA\-3 and later ATA, IDE and
 SCSI\-3 hard drives. The purpose of SMART is to monitor the reliability
@@ -58,6 +65,7 @@ the final argument to \fBsmartctl\fP. The command set used by the device
 is often derived from the device path but may need help with the \'\-d\'
 option (for more information see the section on "ATA, SCSI command sets
 and SAT" below). Device paths are as follows:
+.\" %IF OS Linux
 .IP \fBLINUX\fP: 9
 Use the forms \fB"/dev/hd[a\-t]"\fP for IDE/ATA devices, and
 \fB"/dev/sd[a\-z]"\fP for SCSI devices. For SCSI Tape Drives and
@@ -71,29 +79,41 @@ below. For disks behind HighPoint RocketRAID controllers you may need
 you need \fB"/dev/sg[2\-9]"\fP (note that smartmontools interacts with
 the Areca controllers via a SCSI generic device which is different
 than the SCSI device used for reading and writing data)!
+.\" %ENDIF OS Linux
+.\" %IF OS Darwin
 .IP \fBDARWIN\fP: 9
 Use the forms \fB/dev/disk[0\-9]\fP or equivalently \fBdisk[0\-9]\fP or equivalently
 \fB/dev/rdisk[0\-9]\fP.  Long forms are also available: please use \'\-h\' to see some
 examples. Note that there is currently no Darwin SCSI support.
+.\" %ENDIF OS Darwin
+.\" %IF OS FreeBSD
 .IP \fBFREEBSD\fP: 9
 Use the forms \fB"/dev/ad[0\-9]+"\fP for IDE/ATA
 devices and \fB"/dev/da[0\-9]+"\fP or \fB"/dev/pass[0\-9]+"\fP for SCSI devices.
 For SATA devices on AHCI bus use \fB"/dev/ada[0\-9]+"\fP format.
+.\" %ENDIF OS FreeBSD
+.\" %IF OS NetBSD OpenBSD
 .IP \fBNETBSD/OPENBSD\fP: 9
 Use the form \fB"/dev/wd[0\-9]+c"\fP for IDE/ATA
 devices.  For SCSI disk and tape devices, use the device names
 \fB"/dev/sd[0\-9]+c"\fP and \fB"/dev/st[0\-9]+c"\fP respectively.  
 Be sure to specify the correct "whole disk" partition letter for 
 your architecture.
+.\" %ENDIF OS NetBSD OpenBSD
+.\" %IF OS Solaris
 .IP \fBSOLARIS\fP: 9
 Use the forms \fB"/dev/rdsk/c?t?d?s?"\fP for IDE/ATA and SCSI disk
 devices, and \fB"/dev/rmt/*"\fP for SCSI tape devices.
+.\" %ENDIF OS Solaris
+.\" %IF OS Windows
 .IP \fBWINDOWS\ 9x/ME\fP: 9
 Use the forms \fB"/dev/hd[a\-d]"\fP for standard IDE/ATA devices
 accessed via SMARTVSD.VXD, and \fB"/dev/hd[e\-h]"\fP for additional devices
 accessed via a patched SMARTVSE.VXD (see INSTALL file for details).
 Use the form \fB"/dev/scsi[0\-9][0\-f]"\fP for SCSI devices via an aspi dll
 on ASPI adapter 0\-9, ID 0\-15. The prefix \fB"/dev/"\fP is optional.
+.\" %ENDIF OS Windows
+.\" %IF OS Windows Cygwin
 .IP \fBWINDOWS\ NT4/2000/XP/2003/Vista/Win7/2008\fP: 9
 Use the forms \fB"/dev/sd[a\-z]"\fP for IDE/(S)ATA and SCSI disks
 "\\\\.\\PhysicalDrive[0\-25]" (where "a" maps to "0").
@@ -122,10 +142,15 @@ The option \'\-d 3ware,N\' is not necessary on Windows.
 driver use \fB"/dev/csmi[0\-9],N"\fP where N specifies the port behind
 the logical scsi controller "\\\\.\\Scsi[0\-9]:".
 The prefix \fB"/dev/"\fP is optional.
+.\" %ENDIF OS Windows Cygwin
+.\" %IF OS Cygwin
 .IP \fBCYGWIN\fP: 9
 See "WINDOWS NT4/2000/XP/2003/Vista/Win7/2008" above.
+.\" %ENDIF OS Cygwin
+.\" %IF OS OS2
 .IP \fBOS/2,eComStation\fP: 9
 Use the form \fB"/dev/hd[a\-z]"\fP for IDE/ATA devices.
+.\" %ENDIF OS OS2
 .PP
 if \'\-\' is specified as the device path, \fBsmartctl\fP reads and
 interprets it's own debug output from standard input.
@@ -189,7 +214,7 @@ and the SMART options which require support for 48-bit ATA commands.
 Prints all SMART and non-SMART information about the device. For ATA
 devices this is equivalent to
 .nf
-\'\-H \-i \-c \-A \-f brief \-l xerror,error \-l xselftest,selftest
+\'\-H \-i \-g all \-c \-A \-f brief \-l xerror,error \-l xselftest,selftest
 \-l selective \-l directory \-l scttemp \-l scterc \-l sataphy\'.
 .fi
 and for SCSI, this is equivalent to
@@ -215,6 +240,9 @@ For example:
 .nf
 smartctl --scan-open -- -a -W 4,45,50 -m admin@work > smartd.conf
 .fi
+.TP
+.B \-g NAME, \-\-get=NAME
+Get non\-SMART device settings.  See \'\-s, \-\-set\' below for further info.
 
 .TP
 .B RUN\-TIME BEHAVIOR OPTIONS:
@@ -259,12 +287,13 @@ any further commands.
 \fBsmartctl\fP
 from issuing SCSI commands to an ATA device.
 
+.\" %IF NOT OS Darwin
 .I scsi
 \- the device type is SCSI.  This prevents
 \fBsmartctl\fP
 from issuing ATA commands to a SCSI device.
 
-.I sat
+.I sat[,auto][,N]
 \- the device type is SCSI to ATA Translation (SAT).
 This is for ATA disks that have a SCSI to ATA Translation (SAT) Layer
 (SATL) between the disk and the operating system.
@@ -272,6 +301,10 @@ SAT defines two ATA PASS THROUGH SCSI commands, one 12 bytes long and
 the other 16 bytes long.  The default is the 16 byte variant which can be
 overridden with either \'\-d sat,12\' or \'\-d sat,16\'.
 
+If \'-d sat,auto\' is specified, device type SAT (for ATA/SATA disks) is
+only used if the SCSI INQUIRY data reports a SATL (VENDOR: "ATA     ").
+Otherwise device type SCSI (for SCSI/SAS disks) is used.
+
 .I usbcypress
 \- this device type is for ATA disks that are behind a Cypress USB to PATA
 bridge.  This will use the ATACB proprietary scsi pass through command.
@@ -298,6 +331,8 @@ PORT does not exist or is not connected to a disk.
 \- this device type is for SATA disks that are behind a SunplusIT USB to SATA
 bridge.
 
+.\" %ENDIF NOT OS Darwin
+.\" %IF OS Linux
 .I marvell
 \- [Linux only] interact with SATA disks behind Marvell chip-set
 controllers (using the Marvell rather than libata driver).
@@ -320,6 +355,8 @@ For PERC2/3/4 controllers: \fB/dev/megadev0\fP
 .fi
 For PERC5/6 controllers: \fB/dev/megaraid_sas_ioctl_node\fP
 
+.\" %ENDIF OS Linux
+.\" %IF OS FreeBSD Linux
 .I 3ware,N
 \- [FreeBSD and Linux only] the device consists of one or more ATA disks
 connected to a 3ware RAID controller.  The non-negative integer N
@@ -395,20 +432,36 @@ using the character device interface /dev/twl0\-15, /dev/twa0\-15 and /dev/twe0\
 The necessary WRITE LOG commands can not be passed through the SCSI
 interface.
 
+.\" %ENDIF OS FreeBSD Linux
+.\" %IF OS Linux FreeBSD
 .I areca,N
-\- [Linux only] the device consists of one or more SATA disks connected to an
+\- [Linux and FreeBSD only] the device consists of one or more SATA disks connected to an
 Areca SATA RAID controller.  The positive integer N (in the range from 1 to
 24 inclusive) denotes which disk on the controller is monitored.
-Use syntax such as:
+.\" %ENDIF OS Linux FreeBSD
+.\" %IF OS Linux
+On Linux use syntax such as:
 .nf
 \fBsmartctl \-a \-d areca,2 /dev/sg2\fP
 .fi
 .nf
 \fBsmartctl \-a \-d areca,3 /dev/sg3\fP
 .fi
+.\" %ENDIF OS Linux
+.\" %IF OS FreeBSD
+On FreeBSD use syntax such as:
+.nf
+\fBsmartctl \-a \-d areca,2 /dev/arcmsr1\fP
+.fi
+.nf
+\fBsmartctl \-a \-d areca,3 /dev/arcmsr2\fP
+.fi
+.\" %ENDIF OS FreeBSD
 The first line above addresses the second disk on the first Areca RAID controller.
 The second line addresses the third disk on the second Areca RAID
-controller.  To help identify the correct device, use the command:
+controller.  
+.\" %IF OS Linux
+To help identify the correct device on Linus, use the command:
 .nf
 \fBcat /proc/scsi/sg/device_hdr /proc/scsi/sg/devices\fP
 .fi
@@ -417,11 +470,15 @@ to show the SCSI generic devices (one per line, starting with
 smartmontools are the ones with the type field equal to 3.  If the
 incorrect device is addressed, please read the warning/error messages
 carefully.  They should provide hints about what devices to use.
+.\" %ENDIF OS Linux
 
+.\" %IF OS Linux FreeBSD
 Important: the Areca controller must have firmware version 1.46 or
 later.  Lower-numbered firmware versions will give (harmless) SCSI
 error messages and no SMART information.
 
+.\" %ENDIF OS Linux FreeBSD
+.\" %IF OS FreeBSD Linux
 .I cciss,N
 \- [FreeBSD and Linux only] the device consists of one or more SCSI/SAS disks
 connected to a cciss RAID controller.  The non-negative integer N (in the range
@@ -435,26 +492,33 @@ to monitor also SATA disks by specifiying \'\-d sat+cciss,N\'.
 connected to a HighPoint RocketRAID controller.  The integer L is the
 controller id, the integer M is the channel number, and the integer N
 is the PMPort number if it is available.  The allowed values of L are
-from 1 to 4 inclusive, M are from 1 to 8 inclusive and N from 1 to 4
+from 1 to 4 inclusive, M are from 1 to 16 inclusive and N from 1 to 4
 if PMPort available.  And also these values are limited by the model
 of the HighPoint RocketRAID controller.
 Use syntax such as:
+.\" %ENDIF OS FreeBSD Linux
+.\" %IF OS Linux
 .nf
 \fBsmartctl \-a \-d hpt,1/3 /dev/sda\fP    (under Linux)
 .fi
 .nf
 \fBsmartctl \-a \-d hpt,1/2/3 /dev/sda\fP    (under Linux)
 .fi
+.\" %ENDIF OS Linux
+.\" %IF OS FreeBSD
 .nf
 \fBsmartctl \-a \-d hpt,1/3 /dev/hptrr\fP    (under FreeBSD)
 .fi
 .nf
 \fBsmartctl \-a \-d hpt,1/2/3 /dev/hptrr\fP    (under FreeBSD)
 .fi
+.\" %ENDIF OS FreeBSD
+.\" %IF OS FreeBSD Linux
 Note that the /dev/sda\-z form should be the device node which stands for
 the disks derived from the HighPoint RocketRAID controllers under Linux and
 under FreeBSD, it is the character device which the driver registered (eg,
 /dev/hptrr, /dev/hptmv6).
+.\" %ENDIF OS FreeBSD Linux
 .TP
 .B \-T TYPE, \-\-tolerance=TYPE
 [ATA only] Specifies how tolerant \fBsmartctl\fP should be of ATA and SMART
@@ -692,6 +756,67 @@ issue a warning. Use \fIon\fP to clear the GLTSD bit and thus enable
 saving counters to non\-volatile storage. For extreme streaming\-video
 type applications you might consider using \fIoff\fP to set the GLTSD
 bit.
+.TP
+.B \-g NAME, \-\-get=NAME, \-s NAME[,VALUE], \-\-set=NAME[,VALUE]
+[NEW EXPERIMENTAL SMARTCTL FEATURE] Gets/sets non\-SMART device settings.
+Note that the \'\-\-set\' option shares its short option \'\-s\' with
+\'\-\-smart\'.  Valid arguments are:
+
+.I all
+\- Gets all values. This is equivalent to
+.nf
+\'-g aam -g apm -g lookahead -g security -g wcache\'
+.fi
+
+.I aam[,N|off]
+\- [ATA only] Gets/sets the Automatic Acoustic Management (AAM) feature
+(if supported).  A value of 128 sets the most quiet (slowest) mode and 254
+the fastest (loudest) mode, \'off\' disables AAM.  Devices may support
+intermediate levels.  Values below 128 are defined as vendor specific (0)
+or retired (1\-127).  Note that the AAM feature was declared obsolete in
+ATA ACS-2 Revision 4a (Dec 2010).
+
+.I apm[,N|off]
+\- [ATA only] Gets/sets the Advanced Power Management (APM) feature on
+device (if supported).  If a value between 1 and 254 is provided, it will
+attempt to enable APM and set the specified value, \'off\' disables APM.
+Note the actual behavior depends on the drive, for example some drives disable
+APM if their value is set above 128.  Values below 128 are supposed to allow
+drive spindown, values 128 and above adjust only head-parking frequency,
+although the actual behavior defined is also vendor-specific.
+
+.I lookahead[,on|off]
+\- [ATA only] Gets/sets the read look-ahead feature (if supported).
+Read look-ahead is usually enabled by default.
+
+.I security
+\- [ATA only] Gets the status of ATA Security feature (if supported).
+If ATA Security is enabled an ATA user password is set.  The drive will be
+locked on next reset then.
+
+.I security-freeze
+\- [ATA only] Sets ATA Security feature to frozen mode.  This prevents that
+the drive accepts any security commands until next reset.  Note that the
+frozen mode may already be set by BIOS or OS.
+
+.I standby,[N|off]
+\- [ATA only] Sets the standby (spindown) timer and places the drive in the
+IDLE mode.  A value of 0 or \'off\' disables the standby timer.
+Values from 1 to 240 specify timeouts from 5 seconds to 20 minutes in 5
+second increments.  Values from 241 to 251 specify timeouts from 30 minutes
+to 330 minutes in 30 minute increments.  Value 252 specifies 21 minutes.
+Value 253 specifies a vendor specific time between 8 and 12 hours.  Value
+255 specifies 21 minutes and 15 seconds.  Some drives may use a vendor
+specific interpretation for the values.  Note that there is no get option
+because ATA standards do not specify a method to read the standby timer.
+
+.I standby,now
+\- [ATA only] Places the drive in the STANDBY mode.  This usually spins down
+the drive.  The setting of the standby timer is not affected.
+
+.I wcache[,on|off]
+\- [ATA only] Gets/sets the volatile write cache feature (if supported).
+The write cache is usually enabled by default.
 
 .TP
 .B SMART READ AND DISPLAY DATA OPTIONS:
@@ -1035,20 +1160,36 @@ ranges returned by the SCT Status command, \'scttemphist\' prints
 temperature limits and the temperature history table returned by
 the SCT Data Table command, and \'scttemp\' prints both.
 The temperature values are preserved across power cycles.
-The default temperature logging interval is 1 minute and can be
-configured with the \'\-t scttempint,N[,p]\' option, see below.
-The SCT commands are specified in the proposed ATA\-8 Command Set
-(ACS), and are already implemented in some recent ATA\-7 disks.
+The logging interval can be configured with the
+\'\-l scttempint,N[,p]\' option, see below.
+The SCT commands were introduced in ATA\-8 ACS and were also
+supported by in many ATA\-7 disks.
+
+.I scttempint,N[,p]
+\- [ATA only] clears the SCT temperature history table and sets the
+time interval for temperature logging to N minutes.
+If \',p\' is specified, the setting is preserved across power cycles.
+Otherwise, the setting is volatile and will be reverted to the last
+non-volatile setting by the next hard reset.  The default interval
+is vendor specific, typical values are 1, 2, or 5 minutes.
 
 .I scterc[,READTIME,WRITETIME]
+\- [ATA only] prints values and descriptions of the SCT Error Recovery
+Control settings. These are equivalent to TLER (as used by Western
+Digital), CCTL (as used by Samsung and Hitachi) and ERC (as used by
+Seagate). READTIME and WRITETIME arguments (deciseconds) set the
+specified values. Values of 0 disable the feature, other values less
+than 65 are probably not supported. For RAID configurations, this is
+typically set to 70,70 deciseconds.
+
+.I devstat[,PAGE]
 \- [ATA only] [NEW EXPERIMENTAL SMARTCTL FEATURE] prints values
-and descriptions of the SCT Error Recovery Control settings. These
-are equivalent to TLER (as used by Western Digital), CCTL (as used
-by Samsung and Hitachi) and ERC (as used by Seagate). READTIME and
-WRITETIME arguments (deciseconds) set the specified values. Values of 0
-disable the feature, other values less than 65 are probably not
-supported. For RAID configurations, this is typically set to
-70,70 deciseconds.
+and descriptions of the ATA Device Statistics log pages
+(General Purpose Log address 0x04).  If no PAGE number is specified,
+entries from all supported pages are printed.  If PAGE 0 is specified,
+the list of supported pages is printed.  Device Statistics was
+introduced in ATA\-8 ACS and is only supported by some recent devices
+(e.g. Intel 320 and 710 Series SSDs).
 
 .I sataphy[,reset]
 \- [SATA only] prints values and descriptions of the SATA Phy Event
@@ -1087,6 +1228,16 @@ This command:
 .fi
 writes a binary representation of the one sector log 0x11
 (SATA Phy Event Counters) to file log.bin.
+
+.I ssd
+\- [ATA] prints the Solid State Device Statistics log page.
+This has the same effect as \'\-l devstat,7\', see above.
+
+.I ssd
+\- [SCSI] prints the Solid State Media percentage used endurance
+indicator. A value of 0 indicates as new condition while 100
+indicates the device is at the end of its lifetime as projected by the
+manufacturer. The value may reach 255.
 .TP
 .B \-v ID,FORMAT[:BYTEORDER][,NAME], \-\-vendorattribute=ID,FORMAT[:BYTEORDER][,NAME]
 [ATA only] Sets a vendor\-specific raw value print FORMAT, an optional
@@ -1107,7 +1258,9 @@ For example, \'\-v 5,raw48:012345\' prints the raw value of
 attribute 5 with big endian instead of little endian
 byte ordering.
 
-The NAME is a string of letters, digits and underscore.
+The NAME is a string of letters, digits and underscore.  Its length should
+not exceed 23 characters.  The \'\-P showall\' option reports an error if
+this is the case.
 
 .I \-v help
 \- Prints (to STDOUT) a list of all valid arguments to this option,
@@ -1355,7 +1508,8 @@ presets, then exit.
 
 .I showall
 \- list all recognized drives, and the presets that are set for them,
-then exit.
+then exit.  This also checks the drive database regular expressions
+and settings for syntax errors.
 
 The \'\-P showall\' option takes up to two optional arguments to
 match a specific drive type and firmware version. The command:
@@ -1377,16 +1531,43 @@ lists all entries for this MODEL and a specific FIRMWARE version.
 the built in database by default.  If \'+\' is specified, then the new
 entries prepend the built in entries.
 
-If this option is not specified, optional entries are read from the file
-\fB/usr/local/etc/smart_drivedb.h\fP (Windows: \fBEXEDIR/drivedb-add.h\fP).
-.\" BEGIN ENABLE_DRIVEDB
-If \fB/usr/local/share/smartmontools/drivedb.h\fP
-(Windows: \fBEXEDIR/drivedb.h\fP) is present, the
-contents of this file is used instead of the built in table.
-
-Run the script \fB/usr/local/sbin/update-smart-drivedb\fP to update this
-file from the smartmontools SVN repository.
-.\" END ENABLE_DRIVEDB
+Optional entries are read from the file
+.\" %IF NOT OS Windows
+\fB/usr/local/etc/smart_drivedb.h\fP
+.\" %ENDIF NOT OS Windows
+.\" %IF OS ALL
+ (Windows: \fBEXEDIR/drivedb-add.h\fP)
+.\" %ENDIF OS ALL
+.\" %IF OS Windows
+.\"! \fBEXEDIR/drivedb-add.h\fP.
+.\" %ENDIF OS Windows
+.\" %IF ENABLE_DRIVEDB
+if this option is not specified.
+
+If
+.\" %IF NOT OS Windows
+\fB/usr/local/share/smartmontools/drivedb.h\fP
+.\" %ENDIF NOT OS Windows
+.\" %IF OS ALL
+(Windows: \fBEXEDIR/drivedb.h\fP)
+.\" %ENDIF OS ALL
+.\" %IF OS Windows
+.\"! \fBEXEDIR/drivedb.h\fP
+.\" %ENDIF OS Windows
+is present, the contents of this file is used instead of the built in table.
+
+Run
+.\" %IF NOT OS Windows
+\fB/usr/local/sbin/update-smart-drivedb\fP
+.\" %ENDIF NOT OS Windows
+.\" %IF OS ALL
+(Windows: \fBEXEDIR/update-smart-drivedb.exe\fP)
+.\" %ENDIF OS ALL
+.\" %IF OS Windows
+.\"! \fBEXEDIR/update-smart-drivedb.exe\fP
+.\" %ENDIF OS Windows
+to update this file from the smartmontools SVN repository.
+.\" %ENDIF ENABLE_DRIVEDB
 
 The database files use the same C/C++ syntax that is used to initialize
 the built in database array. C/C++ style comments are allowed.
@@ -1609,14 +1790,6 @@ option must be use together with one or more of the \fIselect,N\-M\fP
 options above. The value of this option is preserved between selective
 self\-tests.
 
-.I scttempint,N[,p]
-\- [ATA only] set the time interval for SCT temperature logging to N
-minutes. If \',p\' is specified, the setting is preserved across power
-cycles. Otherwise, the setting is volatile and will be reverted to
-default (1 minute), or last non-volatile setting by the next hard reset.
-This command also clears the temperature history table. See
-\'\-l scttemp\' above for more information about SCT temperature logging.
-
 .I vendor,N
 \- [ATA only] issues the ATA command SMART EXECUTE OFF-LINE IMMEDIATE
 with subcommand N in LBA LOW register. The subcommand is specified as
@@ -1634,6 +1807,14 @@ The subcommand 0x40 (\'\-t vendor,0x40\') clears the timed workload
 related SMART attributes (226, 227, 228).  Note that the raw values of
 these attributes are held at 65535 (0xffff) until the workload timer
 reaches 60 minutes.
+
+.I force
+\- [ATA only] start new self\-test even if another test is already running.
+By default a running self\-test will not be interrupted to begin another
+test.
+
+.I scttempint,N[,p]
+\- is no longer supported, use \'\-l scttempint,N[,p]\' instead, see above.
 .TP
 .B \-C, \-\-captive
 [ATA] Runs self\-tests in captive mode.  This has no effect with \'\-t
@@ -1840,8 +2021,8 @@ Device open failed, device did not return an IDENTIFY DEVICE structure,
 or device is in a low-power mode (see \'\-n\' option above).
 .TP
 .B Bit 2:
-Some SMART command to the disk failed, or there was a checksum error
-in a SMART data structure (see \'\-b\' option above).
+Some SMART or other ATA command to the disk failed, or there was a checksum
+error in a SMART data structure (see \'\-b\' option above).
 .TP
 .B Bit 3:
 SMART status check returned "DISK FAILING".
@@ -1861,7 +2042,7 @@ The device error log contains records of errors.
 The device self\-test log contains records of errors.
 [ATA only] Failed self-tests outdated by a newer successful extended
 self\-test are ignored.
-
+.PP
 To test within the shell for whether or not the different bits are
 turned on or off, you can use the following type of construction (this
 is bash syntax):
@@ -1874,6 +2055,14 @@ This looks at only at bit 3 of the exit status
 $smartstat will be nonzero if SMART status check returned "disk
 failing" and zero otherwise.
 
+This bash script prints all status bits:
+.nf
+status=$?
+for ((i=0; i<8; i++)); do
+  echo "Bit $i: $((status & 2**i && 1))"
+done
+.fi
+
 .PP
 .SH NOTES
 The TapeAlert log page flags are cleared for the initiator when the
@@ -1897,7 +2086,7 @@ The following have made large contributions to smartmontools:
 \fBGuido Guenther\fP (Autoconf/Automake packaging)
 \fBGeoffrey Keating\fP (Darwin ATA interface)
 \fBEduard Martinescu\fP (FreeBSD interface)
-\fBFr\*'ed\*'eric L. W. Meunier\fP (Web site and Mailing list)
+\fBFr\['e]d\['e]ric L. W. Meunier\fP (Web site and Mailing list)
 \fBGabriele Pohl\fP (Web site and Wiki, conversion from CVS to SVN)
 \fBKeiji Sawada\fP (Solaris ATA interface)
 \fBManfred Schwarb\fP (Drive database)
@@ -1941,8 +2130,6 @@ does, a good place to start is with Sections 4.8 and 6.54 of the first
 volume of the \'AT Attachment with Packet Interface\-7\' (ATA/ATAPI\-7)
 specification Revision 4b.  This documents the SMART functionality which the
 \fBsmartmontools\fP utilities provide access to.
-This and other versions of this Specification are available from
-the T13 web site \fBhttp://www.t13.org/\fP .
 
 .fi
 The functioning of SMART was originally defined by the SFF\-8035i
@@ -1955,4 +2142,4 @@ Links to these and other documents may be found on the Links page of the
 
 .SH
 SVN ID OF THIS PAGE:
-$Id: smartctl.8.in 3320 2011-04-30 20:44:55Z chrfranke $
+$Id: smartctl.8.in 3519 2012-03-06 20:01:44Z chrfranke $
index 57e8cbc80f64ea97c226069a70e8a8ea67967dfa..7fad09e8ef880cf6d096f9a920e0d27a011c87f4 100644 (file)
@@ -4,7 +4,7 @@
  * Home page of code is: http://smartmontools.sourceforge.net
  *
  * Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net>
- * Copyright (C) 2008-11 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2008-12 Christian Franke <smartmontools-support@lists.sourceforge.net>
  * Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -55,7 +55,7 @@
 #include "smartctl.h"
 #include "utility.h"
 
-const char * smartctl_cpp_cvsid = "$Id: smartctl.cpp 3316 2011-04-19 19:34:57Z chrfranke $"
+const char * smartctl_cpp_cvsid = "$Id: smartctl.cpp 3517 2012-03-06 19:44:42Z chrfranke $"
   CONFIG_H_CVSID SMARTCTL_H_CVSID;
 
 // Globals to control printing
@@ -73,7 +73,7 @@ static void UsageSummary()
   return;
 }
 
-static std::string getvalidarglist(char opt);
+static std::string getvalidarglist(int opt);
 
 /*  void prints help information for command syntax */
 static void Usage()
@@ -85,9 +85,11 @@ static void Usage()
 "         Display this help and exit\n\n"
 "  -V, --version, --copyright, --license\n"
 "         Print license, copyright, and version information and exit\n\n"
-"  -i, --info                                                       \n"
+"  -i, --info\n"
 "         Show identity information for device\n\n"
-"  -a, --all                                                        \n"
+"  -g NAME, --get=NAME\n"
+"        Get device setting: all, aam, apm, lookahead, security, wcache\n\n"
+"  -a, --all\n"
 "         Show all SMART information for device\n\n"
 "  -x, --xall\n"
 "         Show all information for device\n\n"
@@ -119,6 +121,10 @@ static void Usage()
 "        Enable/disable automatic offline testing on device (on/off)\n\n"
 "  -S VALUE, --saveauto=VALUE                                          (ATA)\n"
 "        Enable/disable Attribute autosave on device (on/off)\n\n"
+"  -s NAME[,VALUE], --set=NAME[,VALUE]\n"
+"        Enable/disable/change device setting: aam,[N|off], apm,[N|off],\n"
+"        lookahead,[on|off], security-freeze, standby,[N|off|now],\n"
+"        wcache,[on|off]\n\n"
   );
   printf(
 "======================================= READ AND DISPLAY DATA OPTIONS =====\n\n"
@@ -132,10 +138,11 @@ static void Usage()
 "        Set output format for attributes to one of: old, brief\n\n"
 "  -l TYPE, --log=TYPE\n"
 "        Show device log. TYPE: error, selftest, selective, directory[,g|s],\n"
+"                               xerror[,N][,error], xselftest[,N][,selftest],\n"
 "                               background, sasphy[,reset], sataphy[,reset],\n"
-"                               scttemp[sts,hist], scterc[,N,M],\n"
-"                               gplog,N[,RANGE], smartlog,N[,RANGE],\n"
-"                               xerror[,N][,error], xselftest[,N][,selftest]\n\n"
+"                               scttemp[sts,hist], scttempint,N[,p],\n"
+"                               scterc[,N,M], devstat[,N], ssd,\n"
+"                               gplog,N[,RANGE], smartlog,N[,RANGE]\n\n"
 "  -v N,OPTION , --vendorattribute=N,OPTION                            (ATA)\n"
 "        Set display OPTION for vendor Attribute N (see man page)\n\n"
 "  -F TYPE, --firmwarebug=TYPE                                         (ATA)\n"
@@ -159,8 +166,8 @@ static void Usage()
          "]\n\n"
 "============================================ DEVICE SELF-TEST OPTIONS =====\n\n"
 "  -t TEST, --test=TEST\n"
-"        Run test. TEST: offline short long conveyance vendor,N select,M-N\n"
-"                        pending,N afterselect,[on|off] scttempint,N[,p]\n\n"
+"        Run test. TEST: offline, short, long, conveyance, force, vendor,N,\n"
+"                        select,M-N, pending,N, afterselect,[on|off]\n\n"
 "  -C, --captive\n"
 "        Do test in captive mode (along with -t)\n\n"
 "  -X, --abort\n"
@@ -171,9 +178,12 @@ static void Usage()
     printf("%s\n", examples.c_str());
 }
 
+// Values for  --long only options, see parse_options()
+enum { opt_scan = 1000, opt_scan_open, opt_set, opt_smart };
+
 /* Returns a string containing a formatted list of the valid arguments
    to the option opt or empty on failure. Note 'v' case different */
-static std::string getvalidarglist(char opt)
+static std::string getvalidarglist(int opt)
 {
   switch (opt) {
   case 'q':
@@ -186,25 +196,36 @@ static std::string getvalidarglist(char opt)
     return "warn, exit, ignore";
   case 'r':
     return "ioctl[,N], ataioctl[,N], scsiioctl[,N]";
-  case 's':
+  case opt_smart:
   case 'o':
   case 'S':
     return "on, off";
   case 'l':
-    return "error, selftest, selective, directory[,g|s], background, scttemp[sts|hist], scterc[,N,M], "
-           "sasphy[,reset], sataphy[,reset], gplog,N[,RANGE], smartlog,N[,RANGE], "
-          "xerror[,N][,error], xselftest[,N][,selftest]";
+    return "error, selftest, selective, directory[,g|s], "
+           "xerror[,N][,error], xselftest[,N][,selftest], "
+           "background, sasphy[,reset], sataphy[,reset], "
+           "scttemp[sts,hist], scttempint,N[,p], "
+           "scterc[,N,M], devstat[,N], ssd, "
+           "gplog,N[,RANGE], smartlog,N[,RANGE]";
+
   case 'P':
     return "use, ignore, show, showall";
   case 't':
-    return "offline, short, long, conveyance, vendor,N, select,M-N, "
-           "pending,N, afterselect,[on|off], scttempint,N[,p]";
+    return "offline, short, long, conveyance, force, vendor,N, select,M-N, "
+           "pending,N, afterselect,[on|off]";
   case 'F':
     return "none, samsung, samsung2, samsung3, swapid";
   case 'n':
     return "never, sleep, standby, idle";
   case 'f':
     return "old, brief";
+  case 'g':
+    return "aam, apm, lookahead, security, wcache";
+  case opt_set:
+    return "aam,[N|off], apm,[N|off], lookahead,[on|off], security-freeze, "
+           "standby,[N|off|now], wcache,[on|off]";
+  case 's':
+    return getvalidarglist(opt_smart)+", "+getvalidarglist(opt_set);
   case 'v':
   default:
     return "";
@@ -213,7 +234,7 @@ static std::string getvalidarglist(char opt)
 
 /* Prints the message "=======> VALID ARGUMENTS ARE: <LIST> \n", where
    <LIST> is the list of valid arguments for option opt. */
-static void printvalidarglistmessage(char opt)
+static void printvalidarglistmessage(int opt)
 {
   if (opt=='v'){
     pout("=======> VALID ARGUMENTS ARE:\n\thelp\n%s\n<=======\n",
@@ -239,15 +260,15 @@ static checksum_err_mode_t checksum_err_mode = CHECKSUM_ERR_WARN;
 
 static void scan_devices(const char * type, bool with_open, char ** argv);
 
+
 /*      Takes command options and sets features to be run */    
 static const char * parse_options(int argc, char** argv,
-                           ata_print_options & ataopts,
-                           scsi_print_options & scsiopts)
+  ata_print_options & ataopts, scsi_print_options & scsiopts,
+  bool & print_type_only)
 {
   // Please update getvalidarglist() if you edit shortopts
-  const char *shortopts = "h?Vq:d:T:b:r:s:o:S:HcAl:iaxv:P:t:CXF:n:B:f:";
+  const char *shortopts = "h?Vq:d:T:b:r:s:o:S:HcAl:iaxv:P:t:CXF:n:B:f:g:";
   // Please update getvalidarglist() if you edit longopts
-  enum { opt_scan = 1000, opt_scan_open = 1001 };
   struct option longopts[] = {
     { "help",            no_argument,       0, 'h' },
     { "usage",           no_argument,       0, 'h' },
@@ -259,7 +280,7 @@ static const char * parse_options(int argc, char** argv,
     { "tolerance",       required_argument, 0, 'T' },
     { "badsum",          required_argument, 0, 'b' },
     { "report",          required_argument, 0, 'r' },
-    { "smart",           required_argument, 0, 's' },
+    { "smart",           required_argument, 0, opt_smart },
     { "offlineauto",     required_argument, 0, 'o' },
     { "saveauto",        required_argument, 0, 'S' },
     { "health",          no_argument,       0, 'H' },
@@ -278,6 +299,8 @@ static const char * parse_options(int argc, char** argv,
     { "nocheck",         required_argument, 0, 'n' },
     { "drivedb",         required_argument, 0, 'B' },
     { "format",          required_argument, 0, 'f' },
+    { "get",             required_argument, 0, 'g' },
+    { "set",             required_argument, 0, opt_set },
     { "scan",            no_argument,       0, opt_scan      },
     { "scan-open",       no_argument,       0, opt_scan_open },
     { 0,                 0,                 0, 0   }
@@ -318,7 +341,10 @@ static const char * parse_options(int argc, char** argv,
       }
       break;
     case 'd':
-      type = (strcmp(optarg, "auto") ? optarg : (char *)0);
+      if (!strcmp(optarg, "test"))
+        print_type_only = true;
+      else
+        type = (strcmp(optarg, "auto") ? optarg : (char *)0);
       break;
     case 'T':
       if (!strcmp(optarg,"normal")) {
@@ -370,17 +396,22 @@ static const char * parse_options(int argc, char** argv,
         free(s);
       }
       break;
+
     case 's':
+    case opt_smart: // --smart
       if (!strcmp(optarg,"on")) {
         ataopts.smart_enable  = scsiopts.smart_enable  = true;
         ataopts.smart_disable = scsiopts.smart_disable = false;
       } else if (!strcmp(optarg,"off")) {
         ataopts.smart_disable = scsiopts.smart_disable = true;
         ataopts.smart_enable  = scsiopts.smart_enable  = false;
+      } else if (optchar == 's') {
+        goto case_s_continued; // --set, see below
       } else {
         badarg = true;
       }
       break;
+
     case 'o':
       if (!strcmp(optarg,"on")) {
         ataopts.smart_auto_offl_enable  = true;
@@ -405,6 +436,7 @@ static const char * parse_options(int argc, char** argv,
       break;
     case 'H':
       ataopts.smart_check_status = scsiopts.smart_check_status = true;
+      scsiopts.smart_ss_media_log = true;
       break;
     case 'F':
       if (!strcmp(optarg,"none")) {
@@ -450,6 +482,9 @@ static const char * parse_options(int argc, char** argv,
         ataopts.sataphy = ataopts.sataphy_reset = true;
       } else if (!strcmp(optarg,"background")) {
         scsiopts.smart_background_log = true;
+      } else if (!strcmp(optarg,"ssd")) {
+        ataopts.devstat_ssd_page = true;
+        scsiopts.smart_ss_media_log = true;
       } else if (!strcmp(optarg,"scterc")) {
         ataopts.sct_erc_get = true;
       } else if (!strcmp(optarg,"scttemp")) {
@@ -459,6 +494,27 @@ static const char * parse_options(int argc, char** argv,
       } else if (!strcmp(optarg,"scttemphist")) {
         ataopts.sct_temp_hist = true;
 
+      } else if (!strncmp(optarg, "scttempint,", sizeof("scstempint,")-1)) {
+        unsigned interval = 0; int n1 = -1, n2 = -1, len = strlen(optarg);
+        if (!(   sscanf(optarg,"scttempint,%u%n,p%n", &interval, &n1, &n2) == 1
+              && 0 < interval && interval <= 0xffff && (n1 == len || n2 == len))) {
+            strcpy(extraerror, "Option -l scttempint,N[,p] must have positive integer N\n");
+            badarg = true;
+        }
+        ataopts.sct_temp_int = interval;
+        ataopts.sct_temp_int_pers = (n2 == len);
+
+      } else if (!strncmp(optarg, "devstat", sizeof("devstat")-1)) {
+        int n1 = -1, n2 = -1, len = strlen(optarg);
+        unsigned val = ~0;
+        sscanf(optarg, "devstat%n,%u%n", &n1, &val, &n2);
+        if (n1 == len)
+          ataopts.devstat_all_pages = true;
+        else if (n2 == len && val <= 255)
+          ataopts.devstat_pages.push_back(val);
+        else
+          badarg = true;
+
       } else if (!strncmp(optarg, "xerror", sizeof("xerror")-1)) {
         int n1 = -1, n2 = -1, len = strlen(optarg);
         unsigned val = 8;
@@ -546,6 +602,7 @@ static const char * parse_options(int argc, char** argv,
       ataopts.smart_selftest_log   = scsiopts.smart_selftest_log  = true;
       ataopts.smart_selective_selftest_log = true;
       /* scsiopts.smart_background_log = true; */
+      scsiopts.smart_ss_media_log = true;
       break;
     case 'x':
       ataopts.drive_info           = scsiopts.drive_info          = true;
@@ -562,7 +619,12 @@ static const char * parse_options(int argc, char** argv,
       ataopts.sct_temp_sts = ataopts.sct_temp_hist = true;
       ataopts.sct_erc_get = true;
       ataopts.sataphy = true;
+      ataopts.get_set_used = true;
+      ataopts.get_aam = ataopts.get_apm = true;
+      ataopts.get_security = true;
+      ataopts.get_lookahead = ataopts.get_wcache = true;
       scsiopts.smart_background_log = true;
+      scsiopts.smart_ss_media_log = true;
       scsiopts.sasphy = true;
       if (!output_format_set)
         ataopts.output_format = 1; // '-f brief'
@@ -616,6 +678,8 @@ static const char * parse_options(int argc, char** argv,
       } else if (!strcmp(optarg,"conveyance")) {
         testcnt++;
         ataopts.smart_selftest_type = CONVEYANCE_SELF_TEST;
+      } else if (!strcmp(optarg,"force")) {
+        ataopts.smart_selftest_force = true;
       } else if (!strcmp(optarg,"afterselect,on")) {
         // scan remainder of disk after doing selected segment
         ataopts.smart_selective_args.scan_after_select = 2;
@@ -662,15 +726,9 @@ static const char * parse_options(int argc, char** argv,
           ataopts.smart_selective_args.num_spans++;
           ataopts.smart_selftest_type = SELECTIVE_SELF_TEST;
         }
-      } else if (!strncmp(optarg, "scttempint,", sizeof("scstempint,")-1)) {
-        unsigned interval = 0; int n1 = -1, n2 = -1, len = strlen(optarg);
-        if (!(   sscanf(optarg,"scttempint,%u%n,p%n", &interval, &n1, &n2) == 1
-              && 0 < interval && interval <= 0xffff && (n1 == len || n2 == len))) {
-            strcpy(extraerror, "Option -t scttempint,N[,p] must have positive integer N\n");
-            badarg = true;
-        }
-        ataopts.sct_temp_int = interval;
-        ataopts.sct_temp_int_pers = (n2 == len);
+      } else if (!strncmp(optarg, "scttempint", sizeof("scstempint")-1)) {
+        strcpy(extraerror, "-t scttempint is no longer supported, use -l scttempint instead\n");
+        badarg = true;
       } else if (!strncmp(optarg, "vendor,", sizeof("vendor,")-1)) {
         unsigned subcmd = ~0U; int n = -1;
         if (!(   sscanf(optarg, "%*[a-z],0x%x%n", &subcmd, &n) == 1
@@ -733,6 +791,97 @@ static const char * parse_options(int argc, char** argv,
       EXIT(0);  
       break;
 
+    case 'g':
+    case_s_continued: // -s, see above
+    case opt_set: // --set
+      {
+        ataopts.get_set_used = true;
+        bool get = (optchar == 'g');
+        char name[16+1]; unsigned val;
+        int n1 = -1, n2 = -1, n3 = -1, len = strlen(optarg);
+        if (sscanf(optarg, "%16[^,=]%n%*[,=]%n%u%n", name, &n1, &n2, &val, &n3) >= 1
+            && (n1 == len || (!get && n2 > 0))) {
+          bool on  = (n2 > 0 && !strcmp(optarg+n2, "on"));
+          bool off = (n2 > 0 && !strcmp(optarg+n2, "off"));
+          if (n3 != len)
+            val = ~0U;
+
+          if (get && !strcmp(name, "all")) {
+            ataopts.get_aam = ataopts.get_apm = true;
+            ataopts.get_security = true;
+            ataopts.get_lookahead = ataopts.get_wcache = true;
+          }
+          else if (!strcmp(name, "aam")) {
+            if (get)
+              ataopts.get_aam = true;
+            else if (off)
+              ataopts.set_aam = -1;
+            else if (val <= 254)
+              ataopts.set_aam = val + 1;
+            else {
+              sprintf(extraerror, "Option -s aam,N must have 0 <= N <= 254\n");
+              badarg = true;
+            }
+          }
+          else if (!strcmp(name, "apm")) {
+            if (get)
+              ataopts.get_apm = true;
+            else if (off)
+              ataopts.set_apm = -1;
+            else if (1 <= val && val <= 254)
+              ataopts.set_apm = val + 1;
+            else {
+              sprintf(extraerror, "Option -s apm,N must have 1 <= N <= 254\n");
+              badarg = true;
+            }
+          }
+          else if (!strcmp(name, "lookahead")) {
+            if (get)
+              ataopts.get_lookahead = true;
+            else if (off)
+              ataopts.set_lookahead = -1;
+            else if (on)
+              ataopts.set_lookahead = 1;
+            else
+              badarg = true;
+          }
+          else if (get && !strcmp(name, "security")) {
+            ataopts.get_security = true;
+          }
+          else if (!get && !strcmp(optarg, "security-freeze")) {
+            ataopts.set_security_freeze = true;
+          }
+          else if (!get && !strcmp(optarg, "standby,now")) {
+              ataopts.set_standby_now = true;
+          }
+          else if (!get && !strcmp(name, "standby")) {
+            if (off)
+              ataopts.set_standby = 0 + 1;
+            else if (val <= 255)
+              ataopts.set_standby = val + 1;
+            else {
+              sprintf(extraerror, "Option -s standby,N must have 0 <= N <= 255\n");
+              badarg = true;
+            }
+          }
+          else if (!strcmp(name, "wcache")) {
+            if (get)
+              ataopts.get_wcache = true;
+            else if (off)
+              ataopts.set_wcache = -1;
+            else if (on)
+              ataopts.set_wcache = 1;
+            else
+              badarg = true;
+          }
+          else
+            badarg = true;
+        }
+        else
+          badarg = true;
+      }
+      break;
+
     case opt_scan:
     case opt_scan_open:
       scan = optchar;
@@ -747,7 +896,7 @@ static const char * parse_options(int argc, char** argv,
       // Check whether the option is a long option that doesn't map to -h.
       if (arg[1] == '-' && optchar != 'h') {
         // Iff optopt holds a valid option then argument must be missing.
-        if (optopt && (strchr(shortopts, optopt) != NULL)) {
+        if (optopt && (optopt >= opt_scan || strchr(shortopts, optopt))) {
           pout("=======> ARGUMENT REQUIRED FOR OPTION: %s\n", arg+2);
           printvalidarglistmessage(optopt);
         } else
@@ -757,7 +906,7 @@ static const char * parse_options(int argc, char** argv,
         UsageSummary();
         EXIT(FAILCMD);
       }
-      if (optopt) {
+      if (0 < optopt && optopt < '~') {
         // Iff optopt holds a valid option then argument must be
         // missing.  Note (BA) this logic seems to fail using Solaris
         // getopt!
@@ -781,7 +930,10 @@ static const char * parse_options(int argc, char** argv,
       // It would be nice to print the actual option name given by the user
       // here, but we just print the short form.  Please fix this if you know
       // a clean way to do it.
-      pout("=======> INVALID ARGUMENT TO -%c: %s\n", optchar, optarg);
+      char optstr[] = { (char)optchar, 0 };
+      pout("=======> INVALID ARGUMENT TO -%s: %s\n",
+        (optchar == opt_set ? "-set" :
+         optchar == opt_smart ? "-smart" : optstr), optarg);
       printvalidarglistmessage(optchar);
       if (extraerror[0])
        pout("=======> %s", extraerror);
@@ -1020,12 +1172,8 @@ static int main_worker(int argc, char **argv)
   // Parse input arguments
   ata_print_options ataopts;
   scsi_print_options scsiopts;
-  const char * type = parse_options(argc, argv, ataopts, scsiopts);
-
-  // '-d test' -> Report result of autodetection
-  bool print_type_only = (type && !strcmp(type, "test"));
-  if (print_type_only)
-    type = 0;
+  bool print_type_only = false;
+  const char * type = parse_options(argc, argv, ataopts, scsiopts, print_type_only);
 
   const char * name = argv[argc-1];
 
index 43c773f24090188596ad6b389d528adf51494c1a..d725f67018b54e29dcef899f724069076916b4dc 100644 (file)
@@ -1,7 +1,7 @@
 .ig
 Copyright (C) 2002-10 Bruce Allen <smartmontools-support@lists.sourceforge.net>
  
-$Id: smartd.8.in 3284 2011-03-04 21:33:35Z chrfranke $
+$Id: smartd.8.in 3497 2011-12-13 20:17:08Z chrfranke $
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -24,13 +24,20 @@ University of California, Santa Cruz. http://ssrc.soe.ucsc.edu/
 .SH SYNOPSIS
 .B smartd [options]
 
+.\" %IF NOT OS Windows
 .SH FULL PATH
 .B /usr/local/sbin/smartd
 
+.\" %ENDIF NOT OS Windows
 .SH PACKAGE VERSION
 CURRENT_SVN_VERSION CURRENT_SVN_DATE CURRENT_SVN_REV
 
 .SH DESCRIPTION
+.\" %IF NOT OS ALL
+.\"! [This man page is generated for the OS_MAN_FILTER version of smartmontools.
+.\"! It does not contain info specific to other platforms.]
+.\"! .PP
+.\" %ENDIF NOT OS ALL
 \fBsmartd\fP is a daemon that monitors the Self-Monitoring, Analysis
 and Reporting Technology (SMART) system built into many ATA-3 and
 later ATA, IDE and SCSI-3 hard drives. The purpose of SMART is to
@@ -69,7 +76,9 @@ can be told to re-read the configuration file by sending it a
 .fi
 \fBkillall -HUP smartd\fP.
 .fi
+.\" %IF OS Windows
 (Windows: See NOTES below.)
+.\" %ENDIF OS Windows
 
 On startup, if \fBsmartd\fP finds a syntax error in the configuration
 file, it will print an error message and then exit. However if
@@ -83,30 +92,45 @@ When \fBsmartd\fP is running in debug mode, the \fBINT\fP signal
 (normally generated from a shell with CONTROL\-C) is treated in the
 same way as a \fBHUP\fP signal: it makes \fBsmartd\fP reload its
 configuration file. To exit \fBsmartd\fP use CONTROL-\e
-(Cygwin: 2x CONTROL\-C, Windows: CONTROL\-Break).
+.\" %IF OS Windows
+(Windows: CONTROL\-Break).
+.\" %ENDIF OS Windows
 
 On startup, in the absence of the configuration file
 \fB/usr/local/etc/smartd.conf\fP, the \fBsmartd\fP daemon first scans for all
 devices that support SMART.  The scanning is done as follows:
+.\" %IF OS Linux
 .IP \fBLINUX:\fP 9
 Examine all entries \fB"/dev/hd[a-t]"\fP for IDE/ATA
 devices, and \fB"/dev/sd[a-z]"\fP, \fB"/dev/sd[a-c][a-z]"\fP
 for SCSI or SATA devices.
+.\" %ENDIF OS Linux
+.\" %IF OS FreeBSD
 .IP \fBFREEBSD:\fP 9
 Authoritative list of disk devices is obtained from SCSI (CAM) and ATA subsystems.
+.\" %ENDIF OS FreeBSD
+.\" %IF OS NetBSD OpenBSD
 .IP \fBNETBSD/OPENBSD:\fP 9
 Authoritative list of disk devices is obtained from sysctl 
 \'hw.disknames\'.
+.\" %ENDIF OS NetBSD OpenBSD
+.\" %IF OS Solaris
 .IP \fBSOLARIS:\fP 9
 Examine all entries \fB"/dev/rdsk/c?t?d?s?"\fP for IDE/ATA and SCSI disk
 devices, and entries \fB"/dev/rmt/*"\fP for SCSI tape devices.
+.\" %ENDIF OS Solaris
+.\" %IF OS Darwin
 .IP \fBDARWIN:\fP 9
 The IOService plane is scanned for ATA block storage devices.
+.\" %ENDIF OS Darwin
+.\" %IF OS Windows
 .IP \fBWINDOWS\ 9x/ME\fP: 9
 Examine all entries \fB"/dev/hd[a-d]"\fP (bitmask
 from "\\\\.\\SMARTVSD") for IDE/ATA devices.
 Examine all entries \fB"/dev/scsi[0\-9][0\-f]"\fP for SCSI devices 
 on ASPI adapter 0\-9, ID 0\-15.
+.\" %ENDIF OS Windows
+.\" %IF OS Windows Cygwin
 .IP \fBWINDOWS\ NT4/2000/XP/2003/Vista/Win7/2008\fP: 9
 Examine all entries \fB"/dev/sd[a-j]"\fP ("\\\\.\\PhysicalDrive[0-9]")
 for IDE/(S)ATA and SCSI disk devices 
@@ -119,10 +143,15 @@ detected behind this controller. Same for a second controller if present.
 [NEW EXPERIMENTAL SMARTD FEATURE] If directive \'\-d csmi\' is specified,
 examine all entries \fB"/dev/csmi[0\-9],N"\fP for drives behind Intel
 Matrix RAID driver.
+.\" %ENDIF OS Windows Cygwin
+.\" %IF OS Cygwin
 .IP \fBCYGWIN\fP: 9
 See "WINDOWS NT4/2000/XP/2003/Vista/Win7/2008" above.
+.\" %ENDIF OS Cygwin
+.\" %IF OS OS2
 .IP \fBOS/2,eComStation\fP: 9
 Use the form \fB"/dev/hd[a\-z]"\fP for IDE/ATA devices.
+.\" %ENDIF OS OS2
 .PP
 \fBsmartd\fP then monitors
 for \fIall\fP possible SMART errors (corresponding to the \fB\'\-a\'\fP
@@ -140,12 +169,12 @@ check cycle attributes are logged as a line of semicolon separated triplets
 of the form "attribute-ID;attribute-norm-value;attribute-raw-value;".
 Each line is led by a date string of the form "yyyy-mm-dd HH:MM:SS" (in UTC).
 
-.\" BEGIN ENABLE_ATTRIBUTELOG
+.\" %IF ENABLE_ATTRIBUTELOG
 If this option is not specified, attribute information is written to files
 \'/usr/local/var/lib/smartmontools/attrlog.MODEL\-SERIAL.ata.csv\'.
 To disable attribute log files, specify this option with an empty string
 argument: \'-A ""\'.
-.\" END ENABLE_ATTRIBUTELOG
+.\" %ENDIF ENABLE_ATTRIBUTELOG
 MODEL and SERIAL are build from drive identify information, invalid
 characters are replaced by underline.
 
@@ -174,13 +203,13 @@ input. This is useful for commands like:
 .B echo /dev/hdb \-m user@home \-M test | smartd \-c \- \-q onecheck
 .fi
 to perform quick and simple checks without a configuration file.
-.\" BEGIN ENABLE_CAPABILITIES
+.\" %IF ENABLE_CAPABILITIES
 .TP
 .B \-C, \-\-capabilities
-Use \fBcapabilities(7)\fP (EXPERIMENTAL).
+Use \fBcapabilities(7)\fP.
 
 Warning: Mail notification does not work when used.
-.\" END ENABLE_CAPABILITIES
+.\" %ENDIF ENABLE_CAPABILITIES
 .TP
 .B \-d, \-\-debug
 Runs \fBsmartd\fP in "debug" mode. In this mode, it displays status
@@ -191,11 +220,13 @@ information about what it is doing than when operating in "daemon"
 mode. In this mode, the \fBQUIT\fP signal (normally generated from a
 terminal with CONTROL\-C) makes \fBsmartd\fP reload its configuration
 file.  Please use CONTROL-\e to exit
-(Cygwin: 2x CONTROL\-C, Windows: CONTROL\-Break).
+.\" %IF OS Windows
+(Windows: CONTROL\-Break).
 
 Windows only: The "debug" mode can be toggled by the command
 \fBsmartd sigusr2\fP. A new console for debug output is opened when
 debug mode is enabled.
+.\" %ENDIF OS Windows
 .TP
 .B \-D, \-\-showdirectives
 Prints a list (to STDOUT) of all the possible Directives which may
@@ -225,7 +256,9 @@ also use:
 .fi
 for the same purpose.
 .fi
+.\" %IF OS Windows
 (Windows: See NOTES below.)
+.\" %ENDIF OS Windows
 .TP
 .B \-l FACILITY, \-\-logfacility=FACILITY
 Uses syslog facility FACILITY to log the messages from \fBsmartd\fP.
@@ -264,11 +297,12 @@ For more detailed information, please refer to the man pages for
 \fBsyslog.conf\fP, \fBsyslogd\fP, and \fBsyslog\fP.  You may also want
 to modify the log rotation configuration files; see the man pages for
 \fBlogrotate\fP and examine your system\'s /etc/logrotate.conf file.
+.\" %IF OS Cygwin
 
-Cygwin: Support for \fBsyslogd\fP as described above is available starting with Cygwin 1.5.15.
-On older releases or if no local \fBsyslogd\fP is running, the \'\-l\' option has no effect.
-In this case, all \fBsyslog\fP messages are written to Windows event log
-or to file \fBC:/CYGWIN_SYSLOG.TXT\fP if the event log is not available.
+Cygwin: If no \fBsyslogd\fP is running, the \'\-l\' option has no effect.
+In this case, all \fBsyslog\fP messages are written to Windows event log.
+.\" %ENDIF OS Cygwin
+.\" %IF OS Windows
 
 Windows: Some \fBsyslog\fP functionality is implemented
 internally in \fBsmartd\fP as follows: If no \'\-l\' option
@@ -286,15 +320,20 @@ should be registered as an event message file to avoid error
 messages from the event viewer. Use \'\fBsyslogevt -r smartd\fP\'
 to register, \'\fBsyslogevt -u smartd\fP\' to unregister and
 \'\fBsyslogevt\fP\' for more help.
+.\" %ENDIF OS Windows
 .TP
 .B \-n, \-\-no\-fork
 Do not fork into background; this is useful when executed from modern
 init methods like initng, minit or supervise.
+.\" %IF OS Cygwin
 
 On Cygwin, this allows running \fBsmartd\fP as service via cygrunsrv,
 see NOTES below.
+.\" %ENDIF OS Cygwin
+.\" %IF OS Windows
 
 On Windows, this option is not available, use \'\-\-service\' instead.
+.\" %ENDIF OS Windows
 .TP
 .B \-p NAME, \-\-pidfile=NAME
 Writes pidfile \fINAME\fP containing the \fBsmartd\fP Process ID
@@ -394,12 +433,12 @@ min and max temperatures (\-W directive), info about last sent warning email
 (\-m directive), and the time of next check of the self-test REGEXP
 (\-s directive) across boot cycles.
 
-.\" BEGIN ENABLE_SAVESTATES
+.\" %IF ENABLE_SAVESTATES
 If this option is not specified, state information is maintained in files
 \'/usr/local/var/lib/smartmontools/smartd.MODEL\-SERIAL.ata.state\'.
 To disable state files, specify this option with an empty string
 argument: \'-s ""\'.
-.\" END ENABLE_SAVESTATES
+.\" %ENDIF ENABLE_SAVESTATES
 MODEL and SERIAL are build from drive identify information, invalid
 characters are replaced by underline.
 
@@ -414,17 +453,14 @@ always (re)written after reading the configuration file, before rereading
 the configuration file (SIGHUP), before smartd shutdown, and after a check
 forced by SIGUSR1. After a normal check cycle, a file is only rewritten if
 an important change (which usually results in a SYSLOG output) occurred.
+.\" %IF OS Windows
 .TP
 .B \-\-service
-Cygwin and Windows only: Enables \fBsmartd\fP to run as a Windows service.
-
-On Cygwin, this option is kept for backward compatibility only.
-It has the same effect as \'\-n, \-\-no\-fork\', see above.
-
-On Windows, this option enables the buildin service support.
+Windows only: Enables \fBsmartd\fP to run as a Windows service.
 The option must be specified in the service command line as the first
 argument. It should not be used from console.
 See NOTES below for details.
+.\" %ENDIF OS Windows
 .TP
 .B \-V, \-\-version, \-\-license, \-\-copyright
 Prints version, copyright, license, home page and SVN revision
@@ -467,1327 +503,8 @@ and stop it by using the command:
 .nf
 .B /usr/local/etc/rc.d/init.d/smartd stop
 .fi
-
-.\" DO NOT MODIFY THIS OR THE FOLLOWING TWO LINES. THIS MATERIAL
-.\" IS AUTOMATICALLY INCLUDED IN THE FILE smartd.conf.5
-.\" STARTINCLUDE
-
-.SH CONFIGURATION FILE /usr/local/etc/smartd.conf
-In the absence of a configuration file, under Linux
-\fBsmartd\fP 
-will try to open the 20 ATA devices 
-.B /dev/hd[a-t] 
-and the 26 SCSI devices
-.B /dev/sd[a-z].
-Under FreeBSD, 
-\fBsmartd\fP
-will try to open all existing ATA devices (with entries in /dev)
-.B /dev/ad[0-9]+
-and all existing SCSI devices (using CAM subsystem).  
-Under NetBSD/OpenBSD, 
-\fBsmartd\fP
-will try to open all existing ATA devices (with entries in /dev)
-.B /dev/wd[0-9]+c
-and all existing SCSI devices
-.B /dev/sd[0-9]+c.
-Under Solaris \fBsmartd\fP will try to open all entries \fB"/dev/rdsk/c?t?d?s?"\fP for IDE/ATA and SCSI disk
-devices, and entries \fB"/dev/rmt/*"\fP for SCSI tape devices.
-Under Windows \fBsmartd\fP will try to open all entries \fB"/dev/hd[a-j]"\fP ("\\\\.\\PhysicalDrive[0-9]")
-for IDE/ATA devices on WinNT4/2000/XP, \fB"/dev/hd[a-d]"\fP
-(bitmask from "\\\\.\\SMARTVSD") for IDE/ATA devices on Win95/98/98SE/ME,
-and \fB"/dev/scsi[0-9][0-7]"\fP (ASPI adapter 0-9, ID 0-7) for SCSI
-devices on all versions of Windows.
-Under Darwin, \fBsmartd\fP will open any ATA block storage device.
-
-This can be annoying if you have an ATA or SCSI device that hangs or
-misbehaves when receiving SMART commands.  Even if this causes no
-problems, you may be annoyed by the string of error log messages about
-block-major devices that can\'t be found, and SCSI devices that can\'t
-be opened.
-
-One can avoid this problem, and gain more control over the types of
-events monitored by
-\fBsmartd\fP,
-by using the configuration file
-.B /usr/local/etc/smartd.conf.
-This file contains a list of devices to monitor, with one device per
-line.  An example file is included with the
-.B smartmontools
-distribution. You will find this sample configuration file in
-\fB/usr/local/share/doc/smartmontools/\fP. For security, the configuration file
-should not be writable by anyone but root. The syntax of the file is as
-follows:
-.IP \(bu 4
-There should be one device listed per line, although you may have
-lines that are entirely comments or white space.
-.IP \(bu 4
-Any text following a hash sign \'#\' and up to the end of the line is
-taken to be a comment, and ignored.
-.IP \(bu 4
-Lines may be continued by using a backslash \'\e\' as the last
-non-whitespace or non-comment item on a line.
-.IP \(bu 4
-Note: a line whose first character is a hash sign \'#\' is treated as
-a white-space blank line, \fBnot\fP as a non-existent line, and will
-\fBend\fP a continuation line.
-.PP 0
-.fi
-Here is an example configuration file.  It\'s for illustrative purposes
-only; please don\'t copy it onto your system without reading to the end
-of the
-.B DIRECTIVES
-Section below!
-
-.nf
-.B ################################################
-.B # This is an example smartd startup config file
-.B # /usr/local/etc/smartd.conf for monitoring three
-.B # ATA disks, three SCSI disks, six ATA disks
-.B # behind two 3ware controllers, three SATA disks
-.B # directly connected to the HighPoint Rocket-
-.B # RAID controller, two SATA disks connected to
-.B # the HighPoint RocketRAID controller via a pmport
-.B # device, four SATA disks connected to an Areca
-.B # RAID controller, and one SATA disk.
-.B #
-.nf
-.B # First ATA disk on two different interfaces. On
-.B # the second disk, start a long self-test every
-.B # Sunday between 3 and 4 am.
-.B #
-.B \ \ /dev/hda -a -m admin@example.com,root@localhost 
-.B \ \ /dev/hdc -a -I 194 -I 5 -i 12 -s L/../../7/03
-.B #
-.nf
-.B # SCSI disks.  Send a TEST warning email to admin on
-.B # startup.
-.B #
-.B \ \ /dev/sda
-.B \ \ /dev/sdb -m admin@example.com -M test
-.B #
-.nf
-.B # Strange device.  It\'s SCSI. Start a scheduled
-.B # long self test between 5 and 6 am Monday/Thursday
-.B \ \ /dev/weird -d scsi -s L/../../(1|4)/05
-.B #
-.nf
-.B # An ATA disk may appear as a SCSI device to the
-.B # OS. If a SCSI to ATA Translation (SAT) layer
-.B # is between the OS and the device then this can be
-.B # flagged with the '-d sat' option. This situation
-.B # may become common with SATA disks in SAS and FC
-.B # environments.
-.B \ \ /dev/sda -a -d sat
-.B #
-.nf
-.B # Three disks connected to a MegaRAID controller
-.B # Start short self-tests daily between 1-2, 2-3, and
-.B # 3-4 am.
-.B \ \ /dev/sda -d megaraid,0 -a -s S/../.././01
-.B \ \ /dev/sda -d megaraid,1 -a -s S/../.././02
-.B \ \ /dev/sda -d megaraid,2 -a -s S/../.././03
-.B
-.B #
-.nf
-.B # Four ATA disks on a 3ware 6/7/8000 controller.
-.B # Start short self-tests daily between midnight and 1am,
-.B # 1-2, 2-3, and 3-4 am.  Starting with the Linux 2.6
-.B # kernel series, /dev/sdX is deprecated in favor of
-.B # /dev/tweN.  For example replace /dev/sdc by /dev/twe0
-.B # and /dev/sdd by /dev/twe1.
-.B \ \ /dev/sdc -d 3ware,0 -a -s S/../.././00
-.B \ \ /dev/sdc -d 3ware,1 -a -s S/../.././01
-.B \ \ /dev/sdd -d 3ware,2 -a -s S/../.././02
-.B \ \ /dev/sdd -d 3ware,3 -a -s S/../.././03
-.B #
-.nf
-.B # Two ATA disks on a 3ware 9000 controller.
-.B # Start long self-tests Sundays between midnight and
-.B # 1am and 2-3 am
-.B \ \ /dev/twa0 -d 3ware,0 -a -s L/../../7/00
-.B \ \ /dev/twa0 -d 3ware,1 -a -s L/../../7/02
-.B #
-.nf
-.B # Two SATA (not SAS) disks on a 3ware 9750 controller.
-.B # Start long self-tests Sundays between midnight and
-.B # 1am and 2-3 am
-.B \ \ /dev/twl0 -d 3ware,0 -a -s L/../../7/00
-.B \ \ /dev/twl0 -d 3ware,1 -a -s L/../../7/02
-.B #
-.nf
-.B # Three SATA disks on a HighPoint RocketRAID controller.
-.B # Start short self-tests daily between 1-2, 2-3, and
-.B # 3-4 am.
-.B # under Linux
-.B \ \ /dev/sde -d hpt,1/1 -a -s S/../.././01
-.B \ \ /dev/sde -d hpt,1/2 -a -s S/../.././02
-.B \ \ /dev/sde -d hpt,1/3 -a -s S/../.././03
-.B # or under FreeBSD
-.B # /dev/hptrr -d hpt,1/1 -a -s S/../.././01
-.B # /dev/hptrr -d hpt,1/2 -a -s S/../.././02
-.B # /dev/hptrr -d hpt,1/3 -a -s S/../.././03
-.B #
-.nf
-.B # Two SATA disks connected to a HighPoint RocketRAID 
-.B # via a pmport device.  Start long self-tests Sundays
-.B # between midnight and 1am and 2-3 am.
-.B # under Linux
-.B \ \ /dev/sde -d hpt,1/4/1 -a -s L/../../7/00
-.B \ \ /dev/sde -d hpt,1/4/2 -a -s L/../../7/02
-.B # or under FreeBSD
-.B # /dev/hptrr -d hpt,1/4/1 -a -s L/../../7/00
-.B # /dev/hptrr -d hpt,1/4/2 -a -s L/../../7/02
-.B #
-.nf
-.B # Three SATA disks connected to an Areca
-.B # RAID controller. Start long self-tests Sundays
-.B # between midnight and 3 am.
-.B \ \ /dev/sg2 -d areca,1 -a -s L/../../7/00
-.B \ \ /dev/sg2 -d areca,2 -a -s L/../../7/01
-.B \ \ /dev/sg2 -d areca,3 -a -s L/../../7/02
-.B #
-.nf
-.B # The following line enables monitoring of the 
-.B # ATA Error Log and the Self-Test Error Log.  
-.B # It also tracks changes in both Prefailure
-.B # and Usage Attributes, apart from Attributes
-.B # 9, 194, and 231, and shows  continued lines:
-.B #
-.B \ \ /dev/hdd\ -l\ error\ \e
-.B \ \ \ \ \ \ \ \ \ \ \ -l\ selftest\ \e
-.B \ \ \ \ \ \ \ \ \ \ \ -t\ \e\ \ \ \ \ \ # Attributes not tracked:
-.B \ \ \ \ \ \ \ \ \ \ \ -I\ 194\ \e\ \ # temperature
-.B \ \ \ \ \ \ \ \ \ \ \ -I\ 231\ \e\ \ # also temperature
-.B \ \ \ \ \ \ \ \ \ \ \ -I 9\ \ \ \ \ \ # power-on hours
-.B #
-.B ################################################
-.fi
-
-.PP 
-.SH CONFIGURATION FILE DIRECTIVES
-.PP
-
-If a non-comment entry in the configuration file is the text string
-.B DEVICESCAN
-in capital letters, then
-\fBsmartd\fP
-will ignore any remaining lines in the configuration file, and will
-scan for devices.
-.B DEVICESCAN
-may optionally be followed by Directives that will apply to all
-devices that are found in the scan.  Please see below for additional
-details.
-
-.sp 2
-The following are the Directives that may appear following the device
-name or
-.B DEVICESCAN
-on any line of the
-.B /usr/local/etc/smartd.conf
-configuration file. Note that
-.B these are NOT command-line options for 
-\fBsmartd\fP.
-The Directives below may appear in any order, following the device
-name. 
-
-.B For an ATA device,
-if no Directives appear, then the device will be monitored
-as if the \'\-a\' Directive (monitor all SMART properties) had been given.
-
-.B If a SCSI disk is listed,
-it will be monitored at the maximum implemented level: roughly
-equivalent to using the \'\-H \-l selftest\' options for an ATA disk.
-So with the exception of \'\-d\', \'\-m\', \'\-l selftest\', \'\-s\', and
-\'\-M\', the Directives below are ignored for SCSI disks.  For SCSI
-disks, the \'\-m\' Directive sends a warning email if the SMART status
-indicates a disk failure or problem, if the SCSI inquiry about disk
-status fails, or if new errors appear in the self-test log.
-
-.B If a 3ware controller is used
-then the corresponding SCSI (/dev/sd?) or character device (/dev/twe?,
-/dev/twa? or /dev/twl?) must be listed, along with the \'\-d 3ware,N\'
-Directive (see below).  The individual ATA disks hosted by the 3ware
-controller appear to \fBsmartd\fP as normal ATA devices.  Hence all
-the ATA directives can be used for these disks (but see note below).
-
-.B If an Areca controller is used
-then the corresponding SCSI generic device (/dev/sg?)  must be listed,
-along with the \'\-d areca,N\' Directive (see below).  The individual
-SATA disks hosted by the Areca controller appear to \fBsmartd\fP as
-normal ATA devices.  Hence all the ATA directives can be used for
-these disks.  Areca firmware version 1.46 or later which supports
-smartmontools must be used; Please see the \fBsmartctl\fP(8) man page
-for further details.
-.TP
-.B \-d TYPE
-Specifies the type of the device.
-The valid arguments to this directive are:
-
-.I auto
-- attempt to guess the device type from the device name or from
-controller type info provided by the operating system or from
-a matching USB ID entry in the drive database.
-This is the default.
-
-.I ata
-\- the device type is ATA.  This prevents
-\fBsmartd\fP
-from issuing SCSI commands to an ATA device.
-
-.I scsi
-\- the device type is SCSI.  This prevents
-\fBsmartd\fP
-from issuing ATA commands to a SCSI device.
-
-.I sat
-\- the device type is SCSI to ATA Translation (SAT).
-This is for ATA disks that have a SCSI to ATA Translation (SAT) Layer
-(SATL) between the disk and the operating system.
-SAT defines two ATA PASS THROUGH SCSI commands, one 12 bytes long and
-the other 16 bytes long.  The default is the 16 byte variant which can be
-overridden with either \'\-d sat,12\' or \'\-d sat,16\'.
-
-.I usbcypress
-\- this device type is for ATA disks that are behind a Cypress USB to PATA
-bridge.  This will use the ATACB proprietary scsi pass through command.
-The default SCSI operation code is 0x24, but although it can be overridden
-with \'\-d usbcypress,0xN\', where N is the scsi operation code,
-you're running the risk of damage to the device or filesystems on it.
-
-.I usbjmicron
-- this device type is for SATA disks that are behind a JMicron USB to
-PATA/SATA bridge.  The 48-bit ATA commands (required e.g. for \'\-l xerror\',
-see below) do not work with all of these bridges and are therefore disabled by
-default.  These commands can be enabled by \'\-d usbjmicron,x\'.
-If two disks are connected to a bridge with two ports, an error message is printed
-if no PORT is specified.
-The port can be specified by \'\-d usbjmicron[,x],PORT\' where PORT is 0
-(master) or 1 (slave).  This is not necessary if the device uses a port
-multiplier to connect multiple disks to one port.  The disks appear under
-separate /dev/ice names then.
-CAUTION: Specifying \',x\' for a device which does not support it results
-in I/O errors and may disconnect the drive.  The same applies if the specified
-PORT does not exist or is not connected to a disk.
-
-.I usbsunplus
-\- this device type is for SATA disks that are behind a SunplusIT USB to SATA
-bridge.
-
-.I marvell
-\- [Linux only] interact with SATA disks behind Marvell chip-set
-controllers (using the Marvell rather than libata driver).
-
-.I megaraid,N
-\- [Linux only] the device consists of one or more SCSI/SAS disks connected
-to a MegaRAID controller.  The non-negative integer N (in the range of 0 to
-127 inclusive) denotes which disk on the controller is monitored.
-This interface will also work for Dell PERC controllers.
-In log files and email messages this disk will be identified as
-megaraid_disk_XXX with XXX in the range from 000 to 127 inclusive.
-Please see the \fBsmartctl\fP(8) man page for further details.
-
-.I 3ware,N
-\- [FreeBSD and Linux only] the device consists of one or more ATA disks
-connected to a 3ware RAID controller.  The non-negative integer N
-(in the range from 0 to 127 inclusive) denotes which disk on the controller
-is monitored.
-In log files and email messages this disk will be identified as 3ware_disk_XXX
-with XXX in the range from 000 to 127 inclusive.
-
-Note that while you may use \fBany\fP of the 3ware SCSI logical devices /dev/tw*
-to address \fBany\fP of the physical disks (3ware ports), error and log
-messages will make the most sense if you always list the 3ware SCSI
-logical device corresponding to the particular physical disks.
-Please see the \fBsmartctl\fP(8) man page for further details.
-
-.I areca,N
-\- [Linux only] the device consists of one or more SATA disks connected to an
-Areca SATA RAID controller.  The positive integer N (in the range from 1 to
-24 inclusive) denotes which disk on the controller is monitored.
-In log files and email messages this disk will be identifed as
-areca_disk_XX with XX in the range from 01 to 24 inclusive.
-Please see the \fBsmartctl\fP(8) man page for further details.
-
-.I cciss,N
-\- [FreeBSD and Linux only] the device consists of one or more SCSI/SAS disks
-connected to a cciss RAID controller.  The non-negative integer N (in the range
-from 0 to 15 inclusive) denotes which disk on the controller is monitored.
-In log files and email messages this disk will be identified as cciss_disk_XX
-with XX in the range from 00 to 15 inclusive.
-Please see the \fBsmartctl\fP(8) man page for further details.
-
-.I hpt,L/M/N
-\- [FreeBSD and Linux only] the device consists of one or more ATA disks
-connected to a HighPoint RocketRAID controller.  The integer L is the
-controller id, the integer M is the channel number, and the integer N
-is the PMPort number if it is available.  The allowed values of L are
-from 1 to 4 inclusive, M are from 1 to 8 inclusive and N from 1 to 4
-if PMPort available.  And also these values are limited by the model
-of the HighPoint RocketRAID controller.
-In log files and email messages this disk will be identified as
-hpt_X/X/X and X/X/X is the same as L/M/N, note if no N indicated, N set
-to the default value 1.
-Please see the \fBsmartctl\fP(8) man page for further details.
-
-.I removable
-\- the device or its media is removable.  This indicates to
-\fBsmartd\fP
-that it should continue (instead of exiting, which is the default
-behavior) if the device does not appear to be present when
-\fBsmartd\fP is started.  This Directive may be used in conjunction
-with the other \'\-d\' Directives.
-.TP
-.B \-n POWERMODE[,N][,q]
-[ATA only] This \'nocheck\' Directive is used to prevent a disk from
-being spun-up when it is periodically polled by \fBsmartd\fP.
-
-ATA disks have five different power states. In order of increasing
-power consumption they are: \'OFF\', \'SLEEP\', \'STANDBY\', \'IDLE\',
-and \'ACTIVE\'.  Typically in the OFF, SLEEP, and STANDBY modes the
-disk\'s platters are not spinning. But usually, in response to SMART
-commands issued by \fBsmartd\fP, the disk platters are spun up.  So if
-this option is not used, then a disk which is in a low\-power mode may
-be spun up and put into a higher\-power mode when it is periodically
-polled by \fBsmartd\fP.
-
-Note that if the disk is in SLEEP mode when \fBsmartd\fP is started,
-then it won't respond to \fBsmartd\fP commands, and so the disk won't
-be registered as a device for \fBsmartd\fP to monitor. If a disk is in
-any other low\-power mode, then the commands issued by \fBsmartd\fP to
-register the disk will probably cause it to spin\-up.
-
-The \'\fB\-n\fP\' (nocheck) Directive specifies if \fBsmartd\fP\'s
-periodic checks should still be carried out when the device is in a
-low\-power mode.  It may be used to prevent a disk from being spun\-up
-by periodic \fBsmartd\fP polling.  The allowed values of POWERMODE
-are:
-
-.I never
-\- \fBsmartd\fP will poll (check) the device regardless of its power
-mode. This may cause a disk which is spun\-down to be spun\-up when
-\fBsmartd\fP checks it.  This is the default behavior if the '\-n'
-Directive is not given.
-
-.I sleep
-\- check the device unless it is in SLEEP mode.
-
-.I standby
-\- check the device unless it is in SLEEP or STANDBY mode.  In
-these modes most disks are not spinning, so if you want to prevent
-a laptop disk from spinning up each time that \fBsmartd\fP polls,
-this is probably what you want.
-
-.I idle
-\- check the device unless it is in SLEEP, STANDBY or IDLE mode.
-In the IDLE state, most disks are still spinning, so this is probably
-not what you want.
-
-Maximum number of skipped checks (in a row) can be specified by
-appending positive number \',N\' to POWERMODE (like \'\-n standby,15\').
-After N checks are skipped in a row, powermode is ignored and the
-check is performed anyway.
-
-When a periodic test is skipped, \fBsmartd\fP normally writes an
-informal log message. The message can be suppressed by appending
-the option \',q\' to POWERMODE (like \'\-n standby,q\').
-This prevents a laptop disk from spinning up due to this message.
-
-Both \',N\' and \',q\' can be specified together.
-.TP
-.B \-T TYPE
-Specifies how tolerant
-\fBsmartd\fP
-should be of SMART command failures.  The valid arguments to this
-Directive are:
-
-.I normal
-\- do not try to monitor the disk if a mandatory SMART command fails, but
-continue if an optional SMART command fails.  This is the default.
-
-.I permissive
-\- try to monitor the disk even if it appears to lack SMART
-capabilities.  This may be required for some old disks (prior to
-ATA\-3 revision 4) that implemented SMART before the SMART standards
-were incorporated into the ATA/ATAPI Specifications.  This may also be
-needed for some Maxtor disks which fail to comply with the ATA
-Specifications and don't properly indicate support for error\- or
-self\-test logging.
-
-[Please see the \fBsmartctl \-T\fP command-line option.]
-.TP
-.B \-o VALUE
-[ATA only] Enables or disables SMART Automatic Offline Testing when
-\fBsmartd\fP
-starts up and has no further effect.  The valid arguments to this
-Directive are \fIon\fP and \fIoff\fP.
-
-The delay between tests is vendor-specific, but is typically four
-hours.
-
-Note that SMART Automatic Offline Testing is \fBnot\fP part of the ATA
-Specification.  Please see the
-.B smartctl \-o
-command-line option documentation for further information about this
-feature.
-.TP
-.B \-S VALUE
-Enables or disables Attribute Autosave when \fBsmartd\fP
-starts up and has no further effect.  The valid arguments to this
-Directive are \fIon\fP and \fIoff\fP.  Also affects SCSI devices.
-[Please see the \fBsmartctl \-S\fP command-line option.]
-.TP
-.B \-H
-[ATA only] Check the SMART health status of the disk.  If any Prefailure
-Attributes are less than or equal to their threshold values, then disk
-failure is predicted in less than 24 hours, and a message at loglevel
-.B \'LOG_CRIT\'
-will be logged to syslog.  [Please see the
-.B smartctl \-H
-command-line option.]
-.TP
-.B \-l TYPE
-Reports increases in the number of errors in one of three SMART logs.  The
-valid arguments to this Directive are:
-
-.I error
-\- [ATA only] report if the number of ATA errors reported in the Summary SMART
-error log has increased since the last check.
-
-.I xerror
-\- [ATA only] [NEW EXPERIMENTAL SMARTD FEATURE] report if the number of ATA
-errors reported in the Extended Comprehensive SMART error log has increased
-since the last check.
-
-If both \'\-l error\' and \'\-l xerror\' are specified, smartd checks
-the maximum of both values.
-
-[Please see the \fBsmartctl \-l xerror\fP command-line option.]
-
-.I selftest
-\- report if the number of failed tests reported in the SMART
-Self-Test Log has increased since the last check, or if the timestamp
-associated with the most recent failed test has increased.  Note that
-such errors will \fBonly\fP be logged if you run self-tests on the
-disk (and it fails a test!).  Self-Tests can be run automatically by
-\fBsmartd\fP: please see the \fB\'\-s\'\fP Directive below.
-Self-Tests can also be run manually by using the \fB\'\-t\ short\'\fP
-and \fB\'\-t\ long\'\fP options of \fBsmartctl\fP and the results of
-the testing can be observed using the \fBsmartctl \'\-l\ selftest\'\fP
-command-line option.
-[Please see the \fBsmartctl \-l\fP and \fB\-t\fP command-line
-options.]
-
-[ATA only] Failed self-tests outdated by a newer successful extended
-self\-test are ignored.
-
-.I scterc,READTIME,WRITETIME
-\- [ATA only] [NEW EXPERIMENTAL SMARTD FEATURE] sets the SCT Error
-Recovery Control settings to the specified values (deciseconds)
-when \fBsmartd\fP starts up and has no further effect.
-Values of 0 disable the feature, other values less than 65 are probably
-not supported.  For RAID configurations, this is typically set to
-70,70 deciseconds.
-[Please see the \fBsmartctl \-l scterc\fP command-line option.]
-
-.TP
-.B \-s REGEXP
-Run Self-Tests or Offline Immediate Tests, at scheduled times.  A
-Self- or Offline Immediate Test will be run at the end of periodic
-device polling, if all 12 characters of the string \fBT/MM/DD/d/HH\fP
-match the extended regular expression \fBREGEXP\fP. Here:
-.RS 7
-.IP \fBT\fP 4
-is the type of the test.  The values that \fBsmartd\fP will try to
-match (in turn) are: \'L\' for a \fBL\fPong Self-Test, \'S\' for a
-\fBS\fPhort Self-Test, \'C\' for a \fBC\fPonveyance Self-Test (ATA
-only), and \'O\' for an \fBO\fPffline Immediate Test (ATA only).  As
-soon as a match is found, the test will be started and no additional
-matches will be sought for that device and that polling cycle.
-
-To run scheduled Selective Self-Tests, use \'n\' for \fBn\fPext span,
-\'r\' to \fBr\fPedo last span, or \'c\' to \fBc\fPontinue with next span
-or redo last span based on status of last test.
-The LBA range is based on the first span from the last test.
-See the \fBsmartctl \-t select,[next|redo|cont]\fP options for
-further info.
-
-[NEW EXPERIMENTAL SMARTD FEATURE] Some disks (e.g. WD) do not preserve
-the selective self test log accross power cycles.  If state persistence
-(\'\-s\' option) is enabled, the last test span is preserved by smartd
-and used if (and only if) the selective self test log is empty.
-
-.IP \fBMM\fP 4
-is the month of the year, expressed with two decimal digits.  The
-range is from 01 (January) to 12 (December) inclusive.  Do \fBnot\fP
-use a single decimal digit or the match will always fail!
-.IP \fBDD\fP 4
-is the day of the month, expressed with two decimal digits. The
-range is from 01 to 31 inclusive.  Do \fBnot\fP
-use a single decimal digit or the match will always fail!
-.IP \fBd\fP 4
-is the day of the week, expressed with one decimal digit.  The
-range is from 1 (Monday) to 7 (Sunday) inclusive.
-.IP \fBHH\fP 4
-is the hour of the day, written with two decimal digits, and given in
-hours after midnight.  The range is 00 (midnight to just before 1am)
-to 23 (11pm to just before midnight) inclusive.  Do \fBnot\fP use a
-single decimal digit or the match will always fail!
-.RE
-.\"  The following two lines are a workaround for a man2html bug.  Please leave them.
-.\" They define a non-existent option; useful because man2html can't correctly reset the margins.
-.TP
-.B \&
-Some examples follow.  In reading these, keep in mind that in extended
-regular expressions a dot \fB\'.\'\fP matches any single character, and
-a parenthetical expression such as \fB\'(A|B|C)\'\fP denotes any one of the three possibilities \fBA\fP,
-\fBB\fP, or \fBC\fP.
-
-To schedule a short Self-Test between 2-3am every morning, use:
-.nf
-\fB \-s S/../.././02\fP
-.fi
-To schedule a long Self-Test between 4-5am every Sunday morning, use:
-.nf
-\fB \-s L/../../7/04\fP
-.fi
-To schedule a long Self-Test between 10-11pm on the first and
-fifteenth day of each month, use:
-.nf
-\fB \-s L/../(01|15)/./22\fP
-.fi
-To schedule an Offline Immediate test after every midnight, 6am,
-noon,and 6pm, plus a Short Self-Test daily at 1-2am and a Long
-Self-Test every Saturday at 3-4am, use:
-.nf
-\fB \-s (O/../.././(00|06|12|18)|S/../.././01|L/../../6/03)\fP
-.fi
-If Long Self-Tests of a large disks take longer than the system uptime,
-a full disk test can be performed by several Selective Self-Tests.
-To setup a full test of a 1TB disk within 20 days (one 50GB span
-each day), run this command once:
-.nf
-  smartctl -t select,0-99999999 /dev/sda
-.fi
-To run the next test spans on Monday-Friday between 12-13am, run smartd
-with this directive:
-.nf
-\fB \-s n/../../[1-5]/12\fP
-.fi
-
-
-Scheduled tests are run immediately following the regularly-scheduled
-device polling, if the current local date, time, and test type, match
-\fBREGEXP\fP.  By default the regularly-scheduled device polling
-occurs every thirty minutes after starting \fBsmartd\fP.  Take caution
-if you use the \'\-i\' option to make this polling interval more than
-sixty minutes: the poll times may fail to coincide with any of the
-testing times that you have specified with \fBREGEXP\fP.  In this case
-the test will be run following the next device polling.
-
-Before running an offline or self-test, \fBsmartd\fP checks to be sure
-that a self-test is not already running.  If a self-test \fBis\fP
-already running, then this running self test will \fBnot\fP be
-interrupted to begin another test.
-
-\fBsmartd\fP will not attempt to run \fBany\fP type of test if another
-test was already started or run in the same hour.
-
-To avoid performance problems during system boot, \fBsmartd\fP will
-not attempt to run any scheduled tests following the very first
-device polling (unless \'\-q onecheck\' is specified).
-
-Each time a test is run, \fBsmartd\fP will log an entry to SYSLOG.
-You can use these or the '-q showtests' command-line option to verify
-that you constructed \fBREGEXP\fP correctly.  The matching order
-(\fBL\fP before \fBS\fP before \fBC\fP before \fBO\fP) ensures that
-if multiple test types are all scheduled for the same hour, the
-longer test type has precedence.  This is usually the desired behavior.
-
-If the scheduled tests are used in conjunction with state persistence
-(\'\-s\' option), smartd will also try to match the hours since last
-shutdown (or 90 days at most). If any test would have been started
-during downtime, the longest (see above) of these tests is run after
-second device polling.
-
-If the \'\-n\' directive is used and any test would have been started
-during disk standby time, the longest of these tests is run when the
-disk is active again.
-
-Unix users: please beware that the rules for extended regular
-expressions [regex(7)] are \fBnot\fP the same as the rules for
-file\-name pattern matching by the shell [glob(7)].  \fBsmartd\fP will
-issue harmless informational warning messages if it detects characters
-in \fBREGEXP\fP that appear to indicate that you have made this
-mistake.
-.TP
-.B \-m ADD
-Send a warning email to the email address \fBADD\fP if the \'\-H\',
-\'\-l\', \'\-f\', \'\-C\', or \'\-O\' Directives detect a failure or a
-new error, or if a SMART command to the disk fails. This Directive
-only works in conjunction with these other Directives (or with the
-equivalent default \'\-a\' Directive).
-
-To prevent your email in-box from getting filled up with warning
-messages, by default only a single warning will be sent for each of
-the enabled alert types, \'\-H\', \'\-l\', \'\-f\', \'\-C\', or
-\'\-O\' even if more than one failure or error is detected or if the
-failure or error persists.  [This behavior can be modified; see the
-\'\-M\' Directive below.]
-
-To send email to more than one user, please use the following "comma
-separated" form for the address: \fBuser1@add1,user2@add2,...,userN@addN\fP
-(with no spaces).
-
-To test that email is being sent correctly, use the \'\-M test\'
-Directive described below to send one test email message on
-\fBsmartd\fP
-startup.
-
-By default, email is sent using the system 
-.B mail
-command.  In order that
-\fBsmartd\fP
-find the mail command (normally /bin/mail) an executable named
-.B \'mail\'
-must be in the path of the shell or environment from which
-\fBsmartd\fP
-was started.  If you wish to specify an explicit path to the mail
-executable (for example /usr/local/bin/mail) or a custom script to
-run, please use the \'\-M exec\' Directive below.
-
-Note that by default under Solaris, in the previous paragraph,
-\'\fBmailx\fP\' and \'\fB/bin/mailx\fP\' are used, since Solaris
-\'/bin/mail\' does not accept a \'\-s\' (Subject) command-line
-argument.
-
-On Windows, the \'\fBBlat\fP\' mailer
-(\fBhttp://blat.sourceforge.net/\fP) is used by default.
-This mailer uses a different command line syntax, see
-\'\-M exec\' below.
-
-Note also that there is a special argument
-.B <nomailer>
-which can be given to the \'\-m\' Directive in conjunction with the \'\-M
-exec\' Directive. Please see below for an explanation of its effect.
-
-If the mailer or the shell running it produces any STDERR/STDOUT
-output, then a snippet of that output will be copied to SYSLOG.  The
-remainder of the output is discarded. If problems are encountered in
-sending mail, this should help you to understand and fix them.  If
-you have mail problems, we recommend running \fBsmartd\fP in debug
-mode with the \'-d\' flag, using the \'-M test\' Directive described
-below.
-
-The following extension is available on Windows:
-By specifying \'\fBmsgbox\fP\' as a mail address, a warning
-"email" is displayed as a message box on the screen.
-Using both \'\fBmsgbox\fP\' and regular mail addresses is possible,
-if \'\fBmsgbox\fP\' is the first word in the comma separated list.
-With \'\fBsysmsgbox\fP\', a system modal (always on top) message box
-is used. If running as a service, a service notification message box
-(always shown on current visible desktop) is used.
-.TP
-.B \-M TYPE
-These Directives modify the behavior of the
-\fBsmartd\fP
-email warnings enabled with the \'\-m\' email Directive described above.
-These \'\-M\' Directives only work in conjunction with the \'\-m\'
-Directive and can not be used without it.
-
-Multiple \-M Directives may be given.  If more than one of the
-following three \-M Directives are given (example: \-M once \-M daily)
-then the final one (in the example, \-M daily) is used.
-
-The valid arguments to the \-M Directive are (one of the following
-three):
-
-.I once
-\- send only one warning email for each type of disk problem detected.  This
-is the default unless state persistence (\'\-s\' option) is enabled.
-
-.I daily
-\- send additional warning reminder emails, once per day, for each type
-of disk problem detected.  This is the default if state persistence
-(\'\-s\' option) is enabled.
-
-.I diminishing
-\- send additional warning reminder emails, after a one-day interval,
-then a two-day interval, then a four-day interval, and so on for each
-type of disk problem detected. Each interval is twice as long as the
-previous interval.
-
-In addition, one may add zero or more of the following Directives:
-
-.I test
-\- send a single test email
-immediately upon
-\fBsmartd\fP
-startup.  This allows one to verify that email is delivered correctly.
-Note that if this Directive is used,
-\fBsmartd\fP
-will also send the normal email warnings that were enabled with the \'\-m\' Directive,
-in addition to the single test email!
-
-.I exec PATH
-\- run the executable PATH instead of the default mail command, when
-\fBsmartd\fP
-needs to send email.  PATH must point to an executable binary file or
-script.
-
-By setting PATH to point to a customized script, you can make
-\fBsmartd\fP perform useful tricks when a disk problem is detected
-(beeping the console, shutting down the machine, broadcasting warnings
-to all logged-in users, etc.)  But please be careful. \fBsmartd\fP
-will \fBblock\fP until the executable PATH returns, so if your
-executable hangs, then \fBsmartd\fP will also hang. Some sample
-scripts are included in
-/usr/local/share/doc/smartmontools/examplescripts/.
-
-The return status of the executable is recorded by \fBsmartd\fP in
-SYSLOG. The executable is not expected to write to STDOUT or
-STDERR.  If it does, then this is interpreted as indicating that
-something is going wrong with your executable, and a fragment of this
-output is logged to SYSLOG to help you to understand the problem.
-Normally, if you wish to leave some record behind, the executable
-should send mail or write to a file or device.
-
-Before running the executable, \fBsmartd\fP sets a number of
-environment variables.  These environment variables may be used to
-control the executable\'s behavior.  The environment variables
-exported by \fBsmartd\fP are:
-.RS 7
-.IP \fBSMARTD_MAILER\fP 4
-is set to the argument of \-M exec, if present or else to \'mail\'
-(examples: /bin/mail, mail).
-.IP \fBSMARTD_DEVICE\fP 4
-is set to the device path (examples: /dev/hda, /dev/sdb).
-.IP \fBSMARTD_DEVICETYPE\fP 4
-is set to the device type specified by \'-d\' directive or
-\'auto\' if none.
-.IP \fBSMARTD_DEVICESTRING\fP 4
-is set to the device description.  For SMARTD_DEVICETYPE of ata or
-scsi, this is the same as SMARTD_DEVICE.  For 3ware RAID controllers,
-the form used is \'/dev/sdc [3ware_disk_01]\'.  For HighPoint
-RocketRAID controller, the form is \'/dev/sdd [hpt_1/1/1]\' under Linux
-or \'/dev/hptrr [hpt_1/1/1]\' under FreeBSD.  For Areca controllers, the
-form is \'/dev/sg2 [areca_disk_09]\'.  In these cases the device string
-contains a space and is NOT quoted.  So to use $SMARTD_DEVICESTRING in a
-bash script you should probably enclose it in double quotes.
-.IP \fBSMARTD_FAILTYPE\fP 4
-gives the reason for the warning or message email.  The possible values that
-it takes and their meanings are:
-.nf
-.fi
-\fIEmailTest\fP: this is an email test message.
-.nf
-.fi
-\fIHealth\fP: the SMART health status indicates imminent failure.
-.nf
-.fi
-\fIUsage\fP: a usage Attribute has failed.
-.nf
-.fi
-\fISelfTest\fP: the number of self-test failures has increased.
-.nf
-.fi
-\fIErrorCount\fP: the number of errors in the ATA error log has increased.
-.nf
-.fi
-\fICurrentPendingSector\fP: one of more disk sectors could not be
-read and are marked to be reallocated (replaced with spare sectors).
-.nf
-.fi
-\fIOfflineUncorrectableSector\fP: during off\-line testing, or self\-testing,
-one or more disk sectors could not be read.
-.nf
-.fi
-\fITemperature\fP: Temperature reached critical limit (see \-W directive).
-.nf
-.fi
-\fIFailedHealthCheck\fP: the SMART health status command failed.
-.nf
-.fi
-\fIFailedReadSmartData\fP: the command to read SMART Attribute data failed.
-.nf
-.fi
-\fIFailedReadSmartErrorLog\fP: the command to read the SMART error log failed.
-.nf
-.fi
-\fIFailedReadSmartSelfTestLog\fP: the command to read the SMART self-test log failed.
-.nf
-.fi
-\fIFailedOpenDevice\fP: the open() command to the device failed.
-.IP \fBSMARTD_ADDRESS\fP 4
-is determined by the address argument ADD of the \'\-m\' Directive.
-If ADD is \fB<nomailer>\fP, then \fBSMARTD_ADDRESS\fP is not set.
-Otherwise, it is set to the comma-separated-list of email addresses
-given by the argument ADD, with the commas replaced by spaces
-(example:admin@example.com root).  If more than one email address is
-given, then this string will contain space characters and is NOT
-quoted, so to use it in a bash script you may want to enclose it in
-double quotes.
-.IP \fBSMARTD_MESSAGE\fP 4
-is set to the one sentence summary warning email message string from
-\fBsmartd\fP. 
-This message string contains space characters and is NOT quoted. So to
-use $SMARTD_MESSAGE in a bash script you should probably enclose it in
-double quotes.
-.IP \fBSMARTD_FULLMESSAGE\fP 4
-is set to the contents of the entire email warning message string from
-\fBsmartd\fP. 
-This message string contains space and return characters and is NOT quoted. So to
-use $SMARTD_FULLMESSAGE in a bash script you should probably enclose it in
-double quotes.
-.IP \fBSMARTD_TFIRST\fP 4
-is a text string giving the time and date at which the first problem
-of this type was reported. This text string contains space characters
-and no newlines, and is NOT quoted. For example:
-.nf
-.fi
-Sun Feb  9 14:58:19 2003 CST
-.IP \fBSMARTD_TFIRSTEPOCH\fP 4
-is an integer, which is the unix epoch (number of seconds since Jan 1,
-1970) for \fBSMARTD_TFIRST\fP.
-.RE
-.\"  The following two lines are a workaround for a man2html bug.  Please leave them.
-.\" They define a non-existent option; useful because man2html can't correctly reset the margins.
-.TP
-.B \&
-The shell which is used to run PATH is system-dependent. For vanilla
-Linux/glibc it\'s bash. For other systems, the man page for
-\fBpopen\fP(3) should say what shell is used.
-
-If the \'\-m ADD\' Directive is given with a normal address argument,
-then the executable pointed to by PATH will be run in a shell with
-STDIN receiving the body of the email message, and with the same
-command-line arguments:
-.nf
--s "$SMARTD_SUBJECT" $SMARTD_ADDRESS
-.fi
-that would normally be provided to \'mail\'.  Examples include:
-.nf
-.B -m user@home -M exec /bin/mail
-.B -m admin@work -M exec /usr/local/bin/mailto
-.B -m root -M exec /Example_1/bash/script/below
-.fi
-
-Note that on Windows, the syntax of the \'\fBBlat\fP\' mailer is
-used:
-.nf
-- -q -subject "$SMARTD_SUBJECT" -to "$SMARTD_ADDRESS"
-.fi
-
-If the \'\-m ADD\' Directive is given with the special address argument
-.B <nomailer>
-then the executable pointed to by PATH is run in a shell with
-.B no
-STDIN and
-.B no
-command-line arguments, for example:
-.nf
-.B -m <nomailer> -M exec /Example_2/bash/script/below
-.fi
-If the executable produces any STDERR/STDOUT output, then \fBsmartd\fP
-assumes that something is going wrong, and a snippet of that output
-will be copied to SYSLOG.  The remainder of the output is then
-discarded.
-
-Some EXAMPLES of scripts that can be used with the \'\-M exec\'
-Directive are given below. Some sample scripts are also included in
-/usr/local/share/doc/smartmontools/examplescripts/.
-.TP
-.B \-f
-[ATA only] Check for \'failure\' of any Usage Attributes.  If these
-Attributes are less than or equal to the threshold, it does NOT indicate
-imminent disk failure.  It "indicates an advisory condition where the usage
-or age of the device has exceeded its intended design life period."
-[Please see the \fBsmartctl \-A\fP command-line option.]
-.TP
-.B \-p
-[ATA only] Report anytime that a Prefail Attribute has changed
-its value since the last check, 30 minutes ago. [Please see the
-.B smartctl \-A
-command-line option.]
-.TP
-.B \-u
-[ATA only] Report anytime that a Usage Attribute has changed its value
-since the last check, 30 minutes ago. [Please see the
-.B smartctl \-A
-command-line option.]
-.TP
-.B \-t
-[ATA only] Equivalent to turning on the two previous flags \'\-p\' and \'\-u\'.
-Tracks changes in \fIall\fP device Attributes (both Prefailure and
-Usage). [Please see the \fBsmartctl\fP \-A command-line option.]
-.TP
-.B \-i ID
-[ATA only] Ignore device Attribute number \fBID\fP when checking for failure
-of Usage Attributes.  \fBID\fP must be a decimal integer in the range
-from 1 to 255.  This Directive modifies the behavior of the \'\-f\'
-Directive and has no effect without it.
-
-This is useful, for example, if you have a very old disk and don\'t
-want to keep getting messages about the hours-on-lifetime Attribute
-(usually Attribute 9) failing.  This Directive may appear multiple
-times for a single device, if you want to ignore multiple Attributes.
-.TP
-.B \-I ID
-[ATA only] Ignore device Attribute \fBID\fP when tracking changes in the
-Attribute values.  \fBID\fP must be a decimal integer in the range
-from 1 to 255.  This Directive modifies the behavior of the \'\-p\',
-\'\-u\', and \'\-t\' tracking Directives and has no effect without one
-of them.
-
-This is useful, for example, if one of the device Attributes is the disk
-temperature (usually Attribute 194 or 231). It\'s annoying to get reports
-each time the temperature changes.  This Directive may appear multiple
-times for a single device, if you want to ignore multiple Attributes.
-.TP
-.B \-r ID[!]
-[ATA only] When tracking, report the \fIRaw\fP value of Attribute \fBID\fP
-along with its (normally reported) \fINormalized\fP value.  \fBID\fP must
-be a decimal integer in the range from 1 to 255.  This Directive modifies
-the behavior of the \'\-p\', \'\-u\', and \'\-t\' tracking Directives
-and has no effect without one of them.  This Directive may be given
-multiple times.
-
-A common use of this Directive is to track the device Temperature
-(often ID=194 or 231).
-
-If the optional flag \'!\' is appended, a change of the Normalized
-value is considered critical.  The report will be logged as LOG_CRIT
-and a warning email will be sent if \'-m\' is specified.
-.TP
-.B \-R ID[!]
-[ATA only] When tracking, report whenever the \fIRaw\fP value of Attribute
-\fBID\fP changes.  (Normally \fBsmartd\fP only tracks/reports changes
-of the \fINormalized\fP Attribute values.)  \fBID\fP must be a decimal
-integer in the range from 1 to 255.  This Directive modifies the
-behavior of the \'\-p\', \'\-u\', and \'\-t\' tracking Directives and
-has no effect without one of them.  This Directive may be given
-multiple times.
-
-If this Directive is given, it automatically implies the \'\-r\'
-Directive for the same Attribute, so that the Raw value of the
-Attribute is reported.
-
-A common use of this Directive is to track the device Temperature
-(often ID=194 or 231).  It is also useful for understanding how
-different types of system behavior affects the values of certain
-Attributes.
-
-If the optional flag \'!\' is appended, a change of the Raw
-value is considered critical.  The report will be logged as
-LOG_CRIT and a warning email will be sent if \'-m\' is specified.
-An example is \'-R 5!\' to warn when new sectors are reallocated.
-.TP
-.B \-C ID[+]
-[ATA only] Report if the current number of pending sectors is
-non-zero.  Here \fBID\fP is the id number of the Attribute whose raw
-value is the Current Pending Sector count.  The allowed range of
-\fBID\fP is 0 to 255 inclusive.  To turn off this reporting, use
-ID\ =\ 0.  If the \fB\-C ID\fP option is not given, then it defaults to
-\fB\-C 197\fP (since Attribute 197 is generally used to monitor
-pending sectors).  If the name of this Attribute is changed by a
-\'\-v 197,FORMAT,NAME\' directive, the default is changed to
-\fB\-C 0\fP.
-
-If \'+\' is specified, a report is only printed if the number of sectors
-has increased between two check cycles. Some disks do not reset this
-attribute when a bad sector is reallocated.
-See also \'\-v 197,increasing\' below.
-
-A pending sector is a disk sector (containing 512 bytes of your data)
-which the device would like to mark as ``bad" and reallocate.
-Typically this is because your computer tried to read that sector, and
-the read failed because the data on it has been corrupted and has
-inconsistent Error Checking and Correction (ECC) codes.  This is
-important to know, because it means that there is some unreadable data
-on the disk.  The problem of figuring out what file this data belongs
-to is operating system and file system specific.  You can typically
-force the sector to reallocate by writing to it (translation: make the
-device substitute a spare good sector for the bad one) but at the
-price of losing the 512 bytes of data stored there.
-.TP
-.B \-U ID[+]
-[ATA only] Report if the number of offline uncorrectable sectors is
-non-zero.  Here \fBID\fP is the id number of the Attribute whose raw
-value is the Offline Uncorrectable Sector count.  The allowed range of
-\fBID\fP is 0 to 255 inclusive.  To turn off this reporting, use
-ID\ =\ 0.  If the \fB\-U ID\fP option is not given, then it defaults to
-\fB\-U 198\fP (since Attribute 198 is generally used to monitor
-offline uncorrectable sectors).  If the name of this Attribute is changed
-by a \'\-v 198,FORMAT,NAME\' (except \'\-v 198,FORMAT,Offline_Scan_UNC_SectCt\'),
-directive, the default is changed to \fB\-U 0\fP.
-
-If \'+\' is specified, a report is only printed if the number of sectors
-has increased since the last check cycle. Some disks do not reset this
-attribute when a bad sector is reallocated.
-See also \'\-v 198,increasing\' below.
-
-An offline uncorrectable sector is a disk sector which was not
-readable during an off\-line scan or a self\-test.  This is important
-to know, because if you have data stored in this disk sector, and you
-need to read it, the read will fail.  Please see the previous \'\-C\'
-option for more details.
-.TP
-.B \-W DIFF[,INFO[,CRIT]]
-Report if the current temperature had changed by at least \fBDIFF\fP
-degrees since last report, or if new min or max temperature is detected.
-Report or Warn if the temperature is greater or equal than one of
-\fBINFO\fP or \fBCRIT\fP degrees Celsius.
-If the limit \fBCRIT\fP is reached, a message with loglevel
-\fB\'LOG_CRIT\'\fP will be logged to syslog and a warning email
-will be send if '-m' is specified. If only the limit \fBINFO\fP is
-reached, a message with loglevel \fB\'LOG_INFO\'\fP will be logged.
-
-If this directive is used in conjunction with state persistence
-(\'\-s\' option), the min and max temperature values are preserved
-across boot cycles. The minimum temperature value is not updated
-during the first 30 minutes after startup.
-
-To disable any of the 3 reports, set the corresponding limit to 0.
-Trailing zero arguments may be omitted. By default, all temperature
-reports are disabled (\'-W 0\').
-
-To track temperature changes of at least 2 degrees, use:
-.nf
-\fB \-W 2
-.fi
-To log informal messages on temperatures of at least 40 degrees, use:
-.nf
-\fB \-W 0,40
-.fi
-For warning messages/mails on temperatures of at least 45 degrees, use:
-.nf
-\fB \-W 0,0,45
-.fi
-To combine all of the above reports, use:
-.nf
-\fB \-W 2,40,45
-.fi
-
-For ATA devices, smartd interprets Attribute 194 as Temperature Celsius
-by default. This can be changed to Attribute 9 or 220 by the drive
-database or by the \'-v\' directive, see below.
-.TP
-.B \-F TYPE
-[ATA only] Modifies the behavior of \fBsmartd\fP to compensate for
-some known and understood device firmware bug.  The arguments to this
-Directive are exclusive, so that only the final Directive given is
-used.  The valid values are:
-
-.I none
-\- Assume that the device firmware obeys the ATA specifications.  This
-is the default, unless the device has presets for \'\-F\' in the
-device database.
-
-.I samsung
-\- In some Samsung disks (example: model SV4012H Firmware Version:
-RM100\-08) some of the two\- and four\-byte quantities in the SMART data
-structures are byte\-swapped (relative to the ATA specification).
-Enabling this option tells \fBsmartd\fP to evaluate these quantities
-in byte\-reversed order.  Some signs that your disk needs this option
-are (1) no self\-test log printed, even though you have run self\-tests;
-(2) very large numbers of ATA errors reported in the ATA error log;
-(3) strange and impossible values for the ATA error log timestamps.
-
-.I samsung2
-\- In some Samsung disks the number of ATA errors reported is byte swapped.
-Enabling this option tells \fBsmartd\fP to evaluate this quantity in
-byte\-reversed order.
-
-.I samsung3
-\- Some Samsung disks (at least SP2514N with Firmware VF100\-37) report
-a self\-test still in progress with 0% remaining when the test was already
-completed. If this directive is specified, \fBsmartd\fP will not skip the
-next scheduled self\-test (see Directive \'\-s\' above) in this case.
-
-Note that an explicit \'\-F\' Directive will over\-ride any preset
-values for \'\-F\' (see the \'\-P\' option below).
-
-
-[Please see the \fBsmartctl \-F\fP command-line option.]
-.TP
-.B \-v ID,FORMAT[:BYTEORDER][,NAME]
-[ATA only] Sets a vendor\-specific raw value print FORMAT, an optional
-BYTEORDER and an optional NAME for Attribute ID.
-This directive may be used multiple times.
-Please see \fBsmartctl -v\fP command-line option for further details.
-
-The following arguments affect smartd warning output:
-
-.I 197,increasing
-\- Raw Attribute number 197 (Current Pending Sector Count) is not
-reset if uncorrectable sectors are reallocated.  This sets \'-C 197+\'
-if no other \'-C\' directive is specified.
-
-.I 198,increasing
-\- Raw Attribute number 198 (Offline Uncorrectable Sector Count) is not
-reset if uncorrectable sector are reallocated.  This sets \'-U 198+\'
-if no other \'-U\' directive is specified.
-.TP
-.B \-P TYPE
-[ATA only] Specifies whether \fBsmartd\fP should use any preset options
-that are available for this drive.
-The valid arguments to this Directive are:
-
-.I use
-\- use any presets that are available for this drive.  This is the default.
-
-.I ignore
-\- do not use any presets for this drive.
-
-.I show
-\- show the presets listed for this drive in the database.
-
-.I showall
-\- show the presets that are available for all drives and then exit.
-
-[Please see the
-.B smartctl \-P
-command-line option.]
-.TP
-.B \-a
-Equivalent to turning on all of the following Directives: 
-.B \'\-H\' 
-to check the SMART health status,
-.B \'\-f\' 
-to report failures of Usage (rather than Prefail) Attributes,
-.B \'\-t\' 
-to track changes in both Prefailure and Usage Attributes,
-.B \'\-l\ selftest\' 
-to report increases in the number of Self-Test Log errors,
-.B \'\-l\ error\' 
-to report increases in the number of ATA errors,
-.B \'\-C 197\'
-to report nonzero values of the current pending sector count, and
-.B \'\-U 198\'
-to report nonzero values of the offline pending sector count.
-
-Note that \-a is the default for ATA devices.  If none of these other
-Directives is given, then \-a is assumed.
-.TP
-.B #
-Comment: ignore the remainder of the line.
-.TP
-.B \e
-Continuation character: if this is the last non-white or non-comment
-character on a line, then the following line is a continuation of the current
-one.
-.PP
-If you are not sure which Directives to use, I suggest experimenting
-for a few minutes with
-.B smartctl
-to see what SMART functionality your disk(s) support(s).  If you do
-not like voluminous syslog messages, a good choice of
-\fBsmartd\fP
-configuration file Directives might be:
-.nf
-.B \-H \-l\ selftest \-l\ error \-f.
-.fi
-If you want more frequent information, use:
-.B -a.
-
-.TP
-.B ADDITIONAL DETAILS ABOUT DEVICESCAN
-If a non-comment entry in the configuration file is the text
-string \fBDEVICESCAN\fP in capital letters, then \fBsmartd\fP will
-ignore any remaining lines in the configuration file, and will scan
-for devices.
-
-[NEW EXPERIMENTAL SMARTD FEATURE] Configuration entries for devices
-not found by the platform\-specific device scanning may precede the
-\fBDEVICESCAN\fP entry.
-
-If \fBDEVICESCAN\fP is not followed by any Directives, then smartd
-will scan for both ATA and SCSI devices, and will monitor all possible
-SMART properties of any devices that are found.
-
-\fBDEVICESCAN\fP may optionally be followed by any valid Directives,
-which will be applied to all devices that are found in the scan.  For
-example
-.nf
-.B DEVICESCAN -m root@example.com
-.fi
-will scan for all devices, and then monitor them.  It will send one
-email warning per device for any problems that are found.
-.nf
-.B  DEVICESCAN -d ata -m root@example.com
-.fi
-will do the same, but restricts the scan to ATA devices only.  
-.nf
-.B  DEVICESCAN -H -d ata -m root@example.com
-.fi
-will do the same, but only monitors the SMART health status of the
-devices, (rather than the default \-a, which monitors all SMART
-properties).
-
-.TP
-.B EXAMPLES OF SHELL SCRIPTS FOR \'\-M exec\'
-These are two examples of shell scripts that can be used with the \'\-M
-exec PATH\' Directive described previously.  The paths to these scripts
-and similar executables is the PATH argument to the \'\-M exec PATH\'
-Directive.
-
-Example 1: This script is for use with \'\-m ADDRESS -M exec PATH\'.  It appends
-the output of
-.B smartctl -a
-to the output of the smartd email warning message and sends it to ADDRESS.
-
-.nf
-\fB
-#! /bin/bash
-
-# Save the email message (STDIN) to a file:
-cat > /root/msg
-
-# Append the output of smartctl -a to the message:
-/usr/local/sbin/smartctl -a -d $SMART_DEVICETYPE $SMARTD_DEVICE >> /root/msg
-# Now email the message to the user at address ADD:
-/bin/mail -s "$SMARTD_SUBJECT" $SMARTD_ADDRESS < /root/msg
-\fP
-.fi
-
-Example 2: This script is for use with \'\-m <nomailer> \-M exec
-PATH\'. It warns all users about a disk problem, waits 30 seconds, and
-then powers down the machine.
-
-.nf
-\fB
-#! /bin/bash
-
-# Warn all users of a problem
-wall \'Problem detected with disk: \' "$SMARTD_DEVICESTRING"
-wall \'Warning message from smartd is: \' "$SMARTD_MESSAGE"
-wall \'Shutting down machine in 30 seconds... \'
-# Wait half a minute
-sleep 30
-# Power down the machine
-/sbin/shutdown -hf now
-\fP
-.fi
-
-Some example scripts are distributed with the smartmontools package,
-in /usr/local/share/doc/smartmontools/examplescripts/.
-
-Please note that these scripts typically run as root, so any files
-that they read/write should not be writable by ordinary users or
-reside in directories like /tmp that are writable by ordinary users
-and may expose your system to symlink attacks.
-
-As previously described, if the scripts write to STDOUT or STDERR,
-this is interpreted as indicating that there was an internal error
-within the script, and a snippet of STDOUT/STDERR is logged to SYSLOG.
-The remainder is flushed.
-
-.\" ENDINCLUDE
-.\" DO NOT MODIFY THIS OR PREVIOUS/NEXT LINES. THIS DEFINES THE 
-.\" END OF THE INCLUDE SECTION FOR smartd.conf.5
-
+.SH CONFIGURATION
+The syntax of the smartd.conf(5) file is discussed separately.
 .SH NOTES
 \fBsmartd\fP
 will make log entries at loglevel 
@@ -1838,6 +555,7 @@ should not be ignored: they mean that the disk is failing.  Use the
 .B smartctl
 utility to investigate. 
 
+.\" %IF OS Solaris
 Under Solaris with the default \fB/etc/syslog.conf\fP configuration,
 messages below loglevel \fBLOG_NOTICE\fP will \fBnot\fP be recorded.
 Hence all \fBsmartd\fP messages with loglevel \fBLOG_INFO\fP will be
@@ -1854,9 +572,22 @@ to read:
 Alternatively, you can use a local facility to log messages: please
 see the \fBsmartd\fP '-l' command-line option described above.
 
-On Cygwin and Windows, the log messages are written to the event log
-or to a file. See documentation of the '-l FACILITY' option above for
-details.
+.\" %ENDIF OS Solaris
+.\" %IF OS Cygwin
+The Cygwin Version of \fBsmartd\fP can be run as a service via the
+cygrunsrv tool. The start-up script provides Cygwin-specific commands
+to install and remove the service:
+.nf
+.B /usr/local/etc/rc.d/init.d/smartd install [options]
+.B /usr/local/etc/rc.d/init.d/smartd remove
+.fi
+The service can be started and stopped by the start-up script as usual
+(see \fBEXAMPLES\fP above).
+
+.\" %ENDIF OS Cygwin
+.\" %IF OS Windows
+On Windows, the log messages are written to the event log or to a file.
+See documentation of the '-l FACILITY' option above for details.
 
 On Windows, the following built-in commands can be used to control
 \fBsmartd\fP, if running as a daemon:
@@ -1873,25 +604,11 @@ On Windows, the following built-in commands can be used to control
 
 \'\fBsmartd sigusr2\fP\' \- toggle debug mode
 
-On WinNT4/2000/XP, \fBsmartd\fP can also be run as a Windows service:
-
-
-The Cygwin Version of \fBsmartd\fP can be run as a service via the
-cygrunsrv tool. The start-up script provides Cygwin-specific commands
-to install and remove the service:
-.nf
-.B /usr/local/etc/rc.d/init.d/smartd install [options]
-.B /usr/local/etc/rc.d/init.d/smartd remove
-.fi
-The service can be started and stopped by the start-up script as usual
-(see \fBEXAMPLES\fP above).
-
-
 The Windows Version of \fBsmartd\fP has buildin support for services:
 
 \'\fBsmartd install [options]\fP\' installs a service
 named "smartd" (display name "SmartD Service") using the command line
-\'/installpath/smartd.exe --service [options]\'.
+\'/INSTALLPATH/smartd.exe \-\-service [options]\'.
 
 \'\fBsmartd remove\fP\' can later be used to remove the service entry
 from registry.
@@ -1916,6 +633,7 @@ Continuing a still running service (\'\fBnet continue smartd\fP\' without
 preceding \'\fBnet pause smartd\fP\') does not reread configuration but
 checks disks immediately (like \fBSIGUSR1\fP).
 
+.\" %ENDIF OS Windows
 .SH LOG TIMESTAMP TIMEZONE
 
 When \fBsmartd\fP makes log entries, these are time-stamped.  The time
@@ -2013,7 +731,7 @@ The following have made large contributions to smartmontools:
 \fBGuido Guenther\fP (Autoconf/Automake packaging)
 \fBGeoffrey Keating\fP (Darwin ATA interface)
 \fBEduard Martinescu\fP (FreeBSD interface)
-\fBFr\*'ed\*'eric L. W. Meunier\fP (Web site and Mailing list)
+\fBFr\['e]d\['e]ric L. W. Meunier\fP (Web site and Mailing list)
 \fBGabriele Pohl\fP (Web site and Wiki, conversion from CVS to SVN)
 \fBKeiji Sawada\fP (Solaris ATA interface)
 \fBManfred Schwarb\fP (Drive database)
@@ -2058,8 +776,6 @@ does, a good place to start is with Sections 4.8 and 6.54 of the first
 volume of the \'AT Attachment with Packet Interface\-7\' (ATA/ATAPI\-7)
 specification Revision 4b.  This documents the SMART functionality which the
 \fBsmartmontools\fP utilities provide access to.
-This and other versions of this Specification are available from
-the T13 web site \fBhttp://www.t13.org/\fP .
 
 .fi
 The functioning of SMART was originally defined by the SFF\-8035i
@@ -2072,4 +788,4 @@ Links to these and other documents may be found on the Links page of the
 
 .SH
 SVN ID OF THIS PAGE:
-$Id: smartd.8.in 3284 2011-03-04 21:33:35Z chrfranke $
+$Id: smartd.8.in 3497 2011-12-13 20:17:08Z chrfranke $
index caa91a660bf97fbf19c3a7a777339655f9c1e23f..daccfc71d5ddc20427cbf53ddf9562c1f84e8731 100644 (file)
@@ -1,7 +1,7 @@
 .ig
 Copyright (C) 2002-10 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 
-$Id: smartd.conf.5.in 3284 2011-03-04 21:33:35Z chrfranke $
+$Id: smartd.conf.5.in 3519 2012-03-06 20:01:44Z chrfranke $
 
 This program is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License as published by the Free
@@ -21,13 +21,20 @@ California, Santa Cruz. http://ssrc.soe.ucsc.edu/
 .SH NAME
 \fBsmartd.conf\fP \- SMART Disk Monitoring Daemon Configuration File\fP
 
+.\" %IF NOT OS Windows
 .SH FULL PATH
 .B /usr/local/etc/smartd.conf
 
+.\" %ENDIF NOT OS Windows
 .SH PACKAGE VERSION
 CURRENT_SVN_VERSION CURRENT_SVN_DATE CURRENT_SVN_REV
 
 .SH DESCRIPTION
+.\" %IF NOT OS ALL
+.\"! [This man page is generated for the OS_MAN_FILTER version of smartmontools.
+.\"! It does not contain info specific to other platforms.]
+.\"! .PP
+.\" %ENDIF NOT OS ALL
 \fB/usr/local/etc/smartd.conf\fP is the configuration file for the \fBsmartd\fP
 daemon, which monitors the Self-Monitoring, Analysis and Reporting
 Technology (SMART) system built into many ATA-3 and later ATA, IDE and
@@ -42,36 +49,44 @@ re-read the configuration file. This signal can be generated by typing
 \fB\<CONTROL-C\>\fP in the terminal window where \fBsmartd\fP is
 running.
 
-.\" DO NOT MODIFY THIS OR THE FOLLOWING TWO LINES. WHAT FOLLOWS
-.\" IS AUTOMATICALLY INCLUDED FROM THE FILE smartd.8.in
-.\" STARTINCLUDE
-
 .SH CONFIGURATION FILE /usr/local/etc/smartd.conf
-In the absence of a configuration file, under Linux
-\fBsmartd\fP 
-will try to open the 20 ATA devices 
+In the absence of a configuration file
+\fBsmartd\fP will try to open all available devices.
+.\" %IF OS Linux
+Ubder linux will try to open the 20 ATA devices
 .B /dev/hd[a-t] 
 and the 26 SCSI devices
 .B /dev/sd[a-z].
+.\" %ENDIF OS Linux
+.\" %IF OS FreeBSD
 Under FreeBSD, 
 \fBsmartd\fP
-will try to open all existing ATA devices (with entries in /dev)
+will try to open all existing ATA/SATA devices (using ATA subsystem)
 .B /dev/ad[0-9]+
-and all existing SCSI devices (using CAM subsystem).  
+and all existing SCSI/SAS/AHCI devices (using CAM subsystem).
+.\" %ENDIF OS FreeBSD
+.\" %IF OS NetBSD OpenBSD
 Under NetBSD/OpenBSD, 
 \fBsmartd\fP
 will try to open all existing ATA devices (with entries in /dev)
 .B /dev/wd[0-9]+c
 and all existing SCSI devices
 .B /dev/sd[0-9]+c.
+.\" %ENDIF OS NetBSD OpenBSD
+.\" %IF OS Solaris
 Under Solaris \fBsmartd\fP will try to open all entries \fB"/dev/rdsk/c?t?d?s?"\fP for IDE/ATA and SCSI disk
 devices, and entries \fB"/dev/rmt/*"\fP for SCSI tape devices.
+.\" %ENDIF OS Solaris
+.\" %IF OS Windows
 Under Windows \fBsmartd\fP will try to open all entries \fB"/dev/hd[a-j]"\fP ("\\\\.\\PhysicalDrive[0-9]")
 for IDE/ATA devices on WinNT4/2000/XP, \fB"/dev/hd[a-d]"\fP
 (bitmask from "\\\\.\\SMARTVSD") for IDE/ATA devices on Win95/98/98SE/ME,
 and \fB"/dev/scsi[0-9][0-7]"\fP (ASPI adapter 0-9, ID 0-7) for SCSI
 devices on all versions of Windows.
+.\" %ENDIF OS Windows
+.\" %IF OS Darwin
 Under Darwin, \fBsmartd\fP will open any ATA block storage device.
+.\" %ENDIF OS Darwin
 
 This can be annoying if you have an ATA or SCSI device that hangs or
 misbehaves when receiving SMART commands.  Even if this causes no
@@ -154,6 +169,7 @@ Section below!
 .B \ \ /dev/sda -a -d sat
 .B #
 .nf
+.\" %IF OS Linux
 .B # Three disks connected to a MegaRAID controller
 .B # Start short self-tests daily between 1-2, 2-3, and
 .B # 3-4 am.
@@ -162,6 +178,7 @@ Section below!
 .B \ \ /dev/sda -d megaraid,2 -a -s S/../.././03
 .B
 .B #
+.\" %ENDIF OS Linux
 .nf
 .B # Four ATA disks on a 3ware 6/7/8000 controller.
 .B # Start short self-tests daily between midnight and 1am,
@@ -192,33 +209,48 @@ Section below!
 .B # Three SATA disks on a HighPoint RocketRAID controller.
 .B # Start short self-tests daily between 1-2, 2-3, and
 .B # 3-4 am.
+.\" %IF OS Linux
 .B # under Linux
 .B \ \ /dev/sde -d hpt,1/1 -a -s S/../.././01
 .B \ \ /dev/sde -d hpt,1/2 -a -s S/../.././02
 .B \ \ /dev/sde -d hpt,1/3 -a -s S/../.././03
-.B # or under FreeBSD
-.B # /dev/hptrr -d hpt,1/1 -a -s S/../.././01
-.B # /dev/hptrr -d hpt,1/2 -a -s S/../.././02
-.B # /dev/hptrr -d hpt,1/3 -a -s S/../.././03
+.\" %ENDIF OS Linux
+.\" %IF OS FreeBSD
+.B # under FreeBSD
+.B  /dev/hptrr -d hpt,1/1 -a -s S/../.././01
+.B  /dev/hptrr -d hpt,1/2 -a -s S/../.././02
+.B  /dev/hptrr -d hpt,1/3 -a -s S/../.././03
+.\" %ENDIF OS FreeBSD
 .B #
 .nf
 .B # Two SATA disks connected to a HighPoint RocketRAID 
 .B # via a pmport device.  Start long self-tests Sundays
 .B # between midnight and 1am and 2-3 am.
+.\" %IF OS Linux
 .B # under Linux
 .B \ \ /dev/sde -d hpt,1/4/1 -a -s L/../../7/00
 .B \ \ /dev/sde -d hpt,1/4/2 -a -s L/../../7/02
-.B # or under FreeBSD
-.B # /dev/hptrr -d hpt,1/4/1 -a -s L/../../7/00
-.B # /dev/hptrr -d hpt,1/4/2 -a -s L/../../7/02
+.\" %ENDIF OS Linux
+.\" %IF OS FreeBSD
+.B # under FreeBSD
+.B \ \ /dev/hptrr -d hpt,1/4/1 -a -s L/../../7/00
+.B \ \ /dev/hptrr -d hpt,1/4/2 -a -s L/../../7/02
 .B #
+.\" %ENDIF OS FreeBSD
 .nf
 .B # Three SATA disks connected to an Areca
 .B # RAID controller. Start long self-tests Sundays
 .B # between midnight and 3 am.
+.\" %IF OS Linux
 .B \ \ /dev/sg2 -d areca,1 -a -s L/../../7/00
 .B \ \ /dev/sg2 -d areca,2 -a -s L/../../7/01
 .B \ \ /dev/sg2 -d areca,3 -a -s L/../../7/02
+.\" %ENDIF OS Linux
+.\" %IF OS FreeBSD
+.B \ \ /dev/arcmsr0 -d areca,1 -a -s L/../../7/00
+.B \ \ /dev/arcmsr0 -d areca,2 -a -s L/../../7/01
+.B \ \ /dev/arcmsr0 -d areca,3 -a -s L/../../7/02
+.\" %ENDIF OS FreeBSD
 .B #
 .nf
 .B # The following line enables monitoring of the 
@@ -252,10 +284,40 @@ may optionally be followed by Directives that will apply to all
 devices that are found in the scan.  Please see below for additional
 details.
 
+[NEW EXPERIMENTAL SMARTD FEATURE] If an entry in the configuration file
+starts with
+.B DEFAULT
+instead of a device name, then all directives in this entry are set
+as defaults for the next device entries.
+
+This configuration:
+
+.nf
+\ \ DEFAULT -a -R5! -W 2,40,45 -I 194 -s L/../../7/00 -m admin@example.com
+\ \ /dev/sda
+\ \ /dev/sdb
+\ \ /dev/sdc
+\ \ DEFAULT -H -m admin@example.com
+\ \ /dev/sdd
+\ \ /dev/sde -d removable
+.fi
+
+has the same effect as:
+
+.nf
+\ \ /dev/sda -a -R5! -W 2,40,45 -I 194 -s L/../../7/00 -m admin@example.com
+\ \ /dev/sdb -a -R5! -W 2,40,45 -I 194 -s L/../../7/00 -m admin@example.com
+\ \ /dev/sdc -a -R5! -W 2,40,45 -I 194 -s L/../../7/00 -m admin@example.com
+\ \ /dev/sdd -H -m admin@example.com
+\ \ /dev/sde -d removable -H -m admin@example.com
+.fi
+
 .sp 2
 The following are the Directives that may appear following the device
 name or
 .B DEVICESCAN
+or
+.B DEFAULT
 on any line of the
 .B /usr/local/etc/smartd.conf
 configuration file. Note that
@@ -284,14 +346,16 @@ Directive (see below).  The individual ATA disks hosted by the 3ware
 controller appear to \fBsmartd\fP as normal ATA devices.  Hence all
 the ATA directives can be used for these disks (but see note below).
 
+.\" %IF OS Linux FreeBSD
 .B If an Areca controller is used
-then the corresponding SCSI generic device (/dev/sg?)  must be listed,
-along with the \'\-d areca,N\' Directive (see below).  The individual
-SATA disks hosted by the Areca controller appear to \fBsmartd\fP as
-normal ATA devices.  Hence all the ATA directives can be used for
+then the corresponding device (SCSI /dev/sg? on Linux or /dev/arcmsr0 on 
+FreeBSD) must be listed, along with the \'\-d areca,N\' Directive (see below).
+The individual SATA disks hosted by the Areca controller appear to \fBsmartd\fP
+as normal ATA devices.  Hence all the ATA directives can be used for
 these disks.  Areca firmware version 1.46 or later which supports
 smartmontools must be used; Please see the \fBsmartctl\fP(8) man page
 for further details.
+.\" %ENDIF OS Linux FreeBSD
 .TP
 .B \-d TYPE
 Specifies the type of the device.
@@ -308,12 +372,13 @@ This is the default.
 \fBsmartd\fP
 from issuing SCSI commands to an ATA device.
 
+.\" %IF NOT OS Darwin
 .I scsi
 \- the device type is SCSI.  This prevents
 \fBsmartd\fP
 from issuing ATA commands to a SCSI device.
 
-.I sat
+.I sat[,auto][,N]
 \- the device type is SCSI to ATA Translation (SAT).
 This is for ATA disks that have a SCSI to ATA Translation (SAT) Layer
 (SATL) between the disk and the operating system.
@@ -321,6 +386,10 @@ SAT defines two ATA PASS THROUGH SCSI commands, one 12 bytes long and
 the other 16 bytes long.  The default is the 16 byte variant which can be
 overridden with either \'\-d sat,12\' or \'\-d sat,16\'.
 
+If \'-d sat,auto\' is specified, device type SAT (for ATA/SATA disks) is
+only used if the SCSI INQUIRY data reports a SATL (VENDOR: "ATA     ").
+Otherwise device type SCSI (for SCSI/SAS disks) is used.
+
 .I usbcypress
 \- this device type is for ATA disks that are behind a Cypress USB to PATA
 bridge.  This will use the ATACB proprietary scsi pass through command.
@@ -347,6 +416,8 @@ PORT does not exist or is not connected to a disk.
 \- this device type is for SATA disks that are behind a SunplusIT USB to SATA
 bridge.
 
+.\" %ENDIF NOT OS Darwin
+.\" %IF OS Linux
 .I marvell
 \- [Linux only] interact with SATA disks behind Marvell chip-set
 controllers (using the Marvell rather than libata driver).
@@ -360,6 +431,8 @@ In log files and email messages this disk will be identified as
 megaraid_disk_XXX with XXX in the range from 000 to 127 inclusive.
 Please see the \fBsmartctl\fP(8) man page for further details.
 
+.\" %ENDIF OS Linux
+.\" %IF OS FreeBSD Linux
 .I 3ware,N
 \- [FreeBSD and Linux only] the device consists of one or more ATA disks
 connected to a 3ware RAID controller.  The non-negative integer N
@@ -374,14 +447,18 @@ messages will make the most sense if you always list the 3ware SCSI
 logical device corresponding to the particular physical disks.
 Please see the \fBsmartctl\fP(8) man page for further details.
 
+.\" %ENDIF OS FreeBSD Linux
+.\" %IF OS Linux FreeBSD
 .I areca,N
-\- [Linux only] the device consists of one or more SATA disks connected to an
+\- [Linux and FreeBSD only] the device consists of one or more SATA disks connected to an
 Areca SATA RAID controller.  The positive integer N (in the range from 1 to
 24 inclusive) denotes which disk on the controller is monitored.
 In log files and email messages this disk will be identifed as
 areca_disk_XX with XX in the range from 01 to 24 inclusive.
 Please see the \fBsmartctl\fP(8) man page for further details.
 
+.\" %ENDIF OS Linux FreeBSD
+.\" %IF OS FreeBSD Linux
 .I cciss,N
 \- [FreeBSD and Linux only] the device consists of one or more SCSI/SAS disks
 connected to a cciss RAID controller.  The non-negative integer N (in the range
@@ -395,7 +472,7 @@ Please see the \fBsmartctl\fP(8) man page for further details.
 connected to a HighPoint RocketRAID controller.  The integer L is the
 controller id, the integer M is the channel number, and the integer N
 is the PMPort number if it is available.  The allowed values of L are
-from 1 to 4 inclusive, M are from 1 to 8 inclusive and N from 1 to 4
+from 1 to 4 inclusive, M are from 1 to 16 inclusive and N from 1 to 4
 if PMPort available.  And also these values are limited by the model
 of the HighPoint RocketRAID controller.
 In log files and email messages this disk will be identified as
@@ -403,6 +480,7 @@ hpt_X/X/X and X/X/X is the same as L/M/N, note if no N indicated, N set
 to the default value 1.
 Please see the \fBsmartctl\fP(8) man page for further details.
 
+.\" %ENDIF OS FreeBSD Linux
 .I removable
 \- the device or its media is removable.  This indicates to
 \fBsmartd\fP
@@ -528,9 +606,8 @@ valid arguments to this Directive are:
 error log has increased since the last check.
 
 .I xerror
-\- [ATA only] [NEW EXPERIMENTAL SMARTD FEATURE] report if the number of ATA
-errors reported in the Extended Comprehensive SMART error log has increased
-since the last check.
+\- [ATA only] report if the number of ATA errors reported in the Extended
+Comprehensive SMART error log has increased since the last check.
 
 If both \'\-l error\' and \'\-l xerror\' are specified, smartd checks
 the maximum of both values.
@@ -552,7 +629,44 @@ command-line option.
 options.]
 
 [ATA only] Failed self-tests outdated by a newer successful extended
-self\-test are ignored.
+self\-test are ignored.  The warning email counter is reset if the
+number of failed self tests dropped to 0.  This typically happens when
+an extended self\-test is run after all bad sectors have been reallocated.
+
+.I offlinests[,ns]
+\- [ATA only] report if the Offline Data Collection status has changed
+since the last check.  The report will be logged as LOG_CRIT if the new
+status indicates an error.  With some drives the status often changes,
+therefore \'\-l offlinests\' is not enabled by '\-a\' Directive.
+.\" %IF NOT OS Cygwin Windows
+.\"! Appending \',ns\' (no standby) to this directive is not implemented
+.\"! on OS_MAN_FILTER.
+.\" %ENDIF NOT OS Cygwin Windows
+.\" %IF OS Cygwin Windows
+
+[Windows and Cygwin only] If \',ns\' (no standby) is appended to this
+directive, smartd disables system auto standby as long as an Offline
+Data Collection is in progress. See \'\-l selfteststs,ns\' below.
+.\" %ENDIF OS Cygwin Windows
+
+.I selfteststs[,ns]
+\- [ATA only] report if the Self-Test execution status has changed
+since the last check.  The report will be logged as LOG_CRIT if the new
+status indicates an error.
+.\" %IF NOT OS Cygwin Windows
+.\"! Appending \',ns\' (no standby) to this directive is not implemented
+.\"! on OS_MAN_FILTER.
+.\" %ENDIF NOT OS Cygwin Windows
+.\" %IF OS Cygwin Windows
+
+[Windows and Cygwin only] If \',ns\' (no standby) is appended to this
+directive, smartd disables system auto standby as long as a Self-Test
+is in progress.  This prevents that a Self-Test is aborted because the
+OS sets the system to a standby/sleep mode when idle.  Smartd check
+interval (\'\-i\' option) should be shorter than the configured idle
+timeout.  Auto standby is not disabled if the system is running on
+battery.
+.\" %ENDIF OS Cygwin Windows
 
 .I scterc,READTIME,WRITETIME
 \- [ATA only] [NEW EXPERIMENTAL SMARTD FEATURE] sets the SCT Error
@@ -563,6 +677,32 @@ not supported.  For RAID configurations, this is typically set to
 70,70 deciseconds.
 [Please see the \fBsmartctl \-l scterc\fP command-line option.]
 
+.TP
+.B -e NAME[,VALUE]
+[NEW EXPERIMENTAL SMARTD FEATURE] Sets non\-SMART device settings
+when \fBsmartd\fP starts up and has no further effect.
+[Please see the \fBsmartctl \-\-set\fP command-line option.]
+Valid arguments are:
+
+.I aam,[N|off]
+\- [ATA only] Sets the Automatic Acoustic Management (AAM) feature.
+
+.I apm,[N|off]
+\- [ATA only] Sets the Advanced Power Management (APM) feature.
+
+.I lookahead,[on|off]
+\- [ATA only] Sets the read look-ahead feature.
+
+.I security-freeze
+\- [ATA only] Sets ATA Security feature to frozen mode.
+
+.I standby,[N|off]
+\- [ATA only] Sets the standby (spindown) timer and places the drive in the
+IDLE mode.
+
+.I wcache,[on|off]
+\- [ATA only] Sets the volatile write cache feature.
+
 .TP
 .B \-s REGEXP
 Run Self-Tests or Offline Immediate Tests, at scheduled times.  A
@@ -729,16 +869,20 @@ was started.  If you wish to specify an explicit path to the mail
 executable (for example /usr/local/bin/mail) or a custom script to
 run, please use the \'\-M exec\' Directive below.
 
+.\" %IF OS Solaris
 Note that by default under Solaris, in the previous paragraph,
 \'\fBmailx\fP\' and \'\fB/bin/mailx\fP\' are used, since Solaris
 \'/bin/mail\' does not accept a \'\-s\' (Subject) command-line
 argument.
 
+.\" %ENDIF OS Solaris
+.\" %IF OS Windows
 On Windows, the \'\fBBlat\fP\' mailer
 (\fBhttp://blat.sourceforge.net/\fP) is used by default.
 This mailer uses a different command line syntax, see
 \'\-M exec\' below.
 
+.\" %ENDIF OS Windows
 Note also that there is a special argument
 .B <nomailer>
 which can be given to the \'\-m\' Directive in conjunction with the \'\-M
@@ -751,6 +895,7 @@ sending mail, this should help you to understand and fix them.  If
 you have mail problems, we recommend running \fBsmartd\fP in debug
 mode with the \'-d\' flag, using the \'-M test\' Directive described
 below.
+.\" %IF OS Windows
 
 The following extension is available on Windows:
 By specifying \'\fBmsgbox\fP\' as a mail address, a warning
@@ -758,8 +903,13 @@ By specifying \'\fBmsgbox\fP\' as a mail address, a warning
 Using both \'\fBmsgbox\fP\' and regular mail addresses is possible,
 if \'\fBmsgbox\fP\' is the first word in the comma separated list.
 With \'\fBsysmsgbox\fP\', a system modal (always on top) message box
-is used. If running as a service, a service notification message box
-(always shown on current visible desktop) is used.
+is used.
+
+If running as a service, a service notification message box
+(always shown on current visible desktop) is used.  Please note that
+service notification message boxes are no longer supported on Windows
+Vista/2008 or later.
+.\" %ENDIF OS Windows
 .TP
 .B \-M TYPE
 These Directives modify the behavior of the
@@ -790,6 +940,9 @@ then a two-day interval, then a four-day interval, and so on for each
 type of disk problem detected. Each interval is twice as long as the
 previous interval.
 
+If a disk problem is no longer detected, the internal email counter is
+reset.  If the problem reappears a new warning email is sent immediately.
+
 In addition, one may add zero or more of the following Directives:
 
 .I test
@@ -844,7 +997,7 @@ scsi, this is the same as SMARTD_DEVICE.  For 3ware RAID controllers,
 the form used is \'/dev/sdc [3ware_disk_01]\'.  For HighPoint
 RocketRAID controller, the form is \'/dev/sdd [hpt_1/1/1]\' under Linux
 or \'/dev/hptrr [hpt_1/1/1]\' under FreeBSD.  For Areca controllers, the
-form is \'/dev/sg2 [areca_disk_09]\'.  In these cases the device string
+form is \'/dev/sg2 [areca_disk_09]\' on Linux or  \'/dev/arcmsr0 [areca_disk_09]\' on FreeBSD.  In these cases the device string
 contains a space and is NOT quoted.  So to use $SMARTD_DEVICESTRING in a
 bash script you should probably enclose it in double quotes.
 .IP \fBSMARTD_FAILTYPE\fP 4
@@ -945,12 +1098,14 @@ that would normally be provided to \'mail\'.  Examples include:
 .B -m root -M exec /Example_1/bash/script/below
 .fi
 
+.\" %IF OS Windows
 Note that on Windows, the syntax of the \'\fBBlat\fP\' mailer is
 used:
 .nf
 - -q -subject "$SMARTD_SUBJECT" -to "$SMARTD_ADDRESS"
 .fi
 
+.\" %ENDIF OS Windows
 If the \'\-m ADD\' Directive is given with the special address argument
 .B <nomailer>
 then the executable pointed to by PATH is run in a shell with
@@ -1071,6 +1226,10 @@ has increased between two check cycles. Some disks do not reset this
 attribute when a bad sector is reallocated.
 See also \'\-v 197,increasing\' below.
 
+The warning email counter is reset if the number of pending sectors
+dropped to 0.  This typically happens when all pending sectors have
+been reallocated or could be read again.
+
 A pending sector is a disk sector (containing 512 bytes of your data)
 which the device would like to mark as ``bad" and reallocate.
 Typically this is because your computer tried to read that sector, and
@@ -1099,6 +1258,10 @@ has increased since the last check cycle. Some disks do not reset this
 attribute when a bad sector is reallocated.
 See also \'\-v 198,increasing\' below.
 
+The warning email counter is reset if the number of offline uncorrectable
+sectors dropped to 0.  This typically happens when all offline uncorrectable
+sectors have been reallocated or could be read again.
+
 An offline uncorrectable sector is a disk sector which was not
 readable during an off\-line scan or a self\-test.  This is important
 to know, because if you have data stored in this disk sector, and you
@@ -1115,6 +1278,9 @@ If the limit \fBCRIT\fP is reached, a message with loglevel
 will be send if '-m' is specified. If only the limit \fBINFO\fP is
 reached, a message with loglevel \fB\'LOG_INFO\'\fP will be logged.
 
+The warning email counter is reset if the temperature dropped below
+\fBINFO\fP or \fBCRIT\fP-5 if \fBINFO\fP is not specified.
+
 If this directive is used in conjunction with state persistence
 (\'\-s\' option), the min and max temperature values are preserved
 across boot cycles. The minimum temperature value is not updated
@@ -1230,10 +1396,12 @@ to check the SMART health status,
 to report failures of Usage (rather than Prefail) Attributes,
 .B \'\-t\' 
 to track changes in both Prefailure and Usage Attributes,
-.B \'\-l\ selftest\' 
-to report increases in the number of Self-Test Log errors,
-.B \'\-l\ error\' 
+.B \'\-l\ error\'
 to report increases in the number of ATA errors,
+.B \'\-l\ selftest\'
+to report increases in the number of Self-Test Log errors,
+.B \'\-l\ selfteststs\'
+to report changes of Self-Test execution status,
 .B \'\-C 197\'
 to report nonzero values of the current pending sector count, and
 .B \'\-U 198\'
@@ -1270,9 +1438,8 @@ string \fBDEVICESCAN\fP in capital letters, then \fBsmartd\fP will
 ignore any remaining lines in the configuration file, and will scan
 for devices.
 
-[NEW EXPERIMENTAL SMARTD FEATURE] Configuration entries for devices
-not found by the platform\-specific device scanning may precede the
-\fBDEVICESCAN\fP entry.
+Configuration entries for devices not found by the platform\-specific
+device scanning may precede the \fBDEVICESCAN\fP entry.
 
 If \fBDEVICESCAN\fP is not followed by any Directives, then smartd
 will scan for both ATA and SCSI devices, and will monitor all possible
@@ -1358,10 +1525,6 @@ this is interpreted as indicating that there was an internal error
 within the script, and a snippet of STDOUT/STDERR is logged to SYSLOG.
 The remainder is flushed.
 
-.\" ENDINCLUDE
-.\" DO NOT MODIFY THIS OR PREVIOUS/NEXT LINES. THIS DEFINES THE 
-.\" END OF THE INCLUDED SECTION FROM smartd.8.in
-
 .PP
 .SH AUTHOR
 \fBBruce Allen\fP smartmontools\-support@lists.sourceforge.net
@@ -1378,7 +1541,7 @@ The following have made large contributions to smartmontools:
 \fBGuido Guenther\fP (Autoconf/Automake packaging)
 \fBGeoffrey Keating\fP (Darwin ATA interface)
 \fBEduard Martinescu\fP (FreeBSD interface)
-\fBFr\*'ed\*'eric L. W. Meunier\fP (Web site and Mailing list)
+\fBFr\['e]d\['e]ric L. W. Meunier\fP (Web site and Mailing list)
 \fBGabriele Pohl\fP (Web site and Wiki, conversion from CVS to SVN)
 \fBKeiji Sawada\fP (Solaris ATA interface)
 \fBManfred Schwarb\fP (Drive database)
@@ -1412,4 +1575,4 @@ SEE ALSO:
 
 .SH
 SVN ID OF THIS PAGE:
-$Id: smartd.conf.5.in 3284 2011-03-04 21:33:35Z chrfranke $
+$Id: smartd.conf.5.in 3519 2012-03-06 20:01:44Z chrfranke $
index f4c0cf0cfb900e8d3dfd3c5ca186f05a0cc7993b..0e124ecc3ad6ae91cea1454201094adccbbeee69 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net>
  * Copyright (C) 2000    Michael Cornwell <cornwell@acm.org>
  * Copyright (C) 2008    Oliver Bock <brevilo@users.sourceforge.net>
- * Copyright (C) 2008-11 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2008-12 Christian Franke <smartmontools-support@lists.sourceforge.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -71,9 +71,6 @@ typedef int pid_t;
 #endif // _WIN32
 
 #ifdef __CYGWIN__
-// From <windows.h>:
-// BOOL WINAPI FreeConsole(void);
-extern "C" int __stdcall FreeConsole(void);
 #include <io.h> // setmode()
 #endif // __CYGWIN__
 
@@ -111,12 +108,7 @@ extern "C" int __stdcall FreeConsole(void);
 #define SIGQUIT SIGBREAK
 #define SIGQUIT_KEYNAME "CONTROL-Break"
 #else  // _WIN32
-#ifdef __CYGWIN__
-// 2x CONTROL-C simulates missing SIGQUIT via keyboard
-#define SIGQUIT_KEYNAME "2x CONTROL-C"
-#else // __CYGWIN__
 #define SIGQUIT_KEYNAME "CONTROL-\\"
-#endif // __CYGWIN__
 #endif // _WIN32
 
 #if defined (__SVR4) && defined (__sun)
@@ -125,7 +117,7 @@ extern "C" int getdomainname(char *, int); // no declaration in header files!
 
 #define ARGUSED(x) ((void)(x))
 
-const char * smartd_cpp_cvsid = "$Id: smartd.cpp 3349 2011-05-27 21:46:31Z chrfranke $"
+const char * smartd_cpp_cvsid = "$Id: smartd.cpp 3513 2012-02-15 21:57:21Z chrfranke $"
   CONFIG_H_CVSID;
 
 // smartd exit codes
@@ -214,7 +206,7 @@ static volatile int caughtsigEXIT=0;
 
 // This function prints either to stdout or to the syslog as needed.
 static void PrintOut(int priority, const char *fmt, ...)
-                     __attribute__ ((format(printf, 2, 3)));
+                     __attribute_format_printf(2, 3);
 
 // Attribute monitoring flags.
 // See monitor_attr_flags below.
@@ -265,6 +257,10 @@ struct dev_config
   bool selftest;                          // Monitor number of selftest errors
   bool errorlog;                          // Monitor number of ATA errors
   bool xerrorlog;                         // Monitor number of ATA errors (Extended Comprehensive error log)
+  bool offlinests;                        // Monitor changes in offline data collection status
+  bool offlinests_ns;                     // Disable auto standby if in progress
+  bool selfteststs;                       // Monitor changes in self-test execution status
+  bool selfteststs_ns;                    // Disable auto standby if in progress
   bool permissive;                        // Ignore failed SMART commands
   char autosave;                          // 1=disable, 2=enable Autosave Attributes
   char autoofflinetest;                   // 1=disable, 2=enable Auto Offline Test
@@ -286,6 +282,13 @@ struct dev_config
   bool emailtest;                         // Send test email?
 
   // ATA ONLY
+  int set_aam; // disable(-1), enable(1..255->0..254) Automatic Acoustic Management
+  int set_apm; // disable(-1), enable(2..255->1..254) Advanced Power Management
+  int set_lookahead; // disable(-1), enable(1) read look-ahead
+  int set_standby; // set(1..255->0..254) standby timer
+  bool set_security_freeze; // Freeze ATA security
+  int set_wcache; // disable(-1), enable(1) write cache
+
   bool sct_erc_set;                       // set SCT ERC to:
   unsigned short sct_erc_readtime;        // ERC read time (deciseconds)
   unsigned short sct_erc_writetime;       // ERC write time (deciseconds)
@@ -311,6 +314,8 @@ dev_config::dev_config()
   selftest(false),
   errorlog(false),
   xerrorlog(false),
+  offlinests(false),  offlinests_ns(false),
+  selfteststs(false), selfteststs_ns(false),
   permissive(false),
   autosave(0),
   autoofflinetest(0),
@@ -325,6 +330,11 @@ dev_config::dev_config()
   tempinfo(0), tempcrit(0),
   emailfreq(0),
   emailtest(false),
+  set_aam(0), set_apm(0),
+  set_lookahead(0),
+  set_standby(0),
+  set_security_freeze(false),
+  set_wcache(0),
   sct_erc_set(false),
   sct_erc_readtime(0), sct_erc_writetime(0),
   curr_pending_id(0), offl_pending_id(0),
@@ -421,6 +431,8 @@ struct temp_dev_state
   uint64_t num_sectors;                   // Number of sectors
   ata_smart_values smartval;              // SMART data
   ata_smart_thresholds_pvt smartthres;    // SMART thresholds
+  bool offline_started;                   // true if offline data collection was started
+  bool selftest_started;                  // true if self-test was started
 
   temp_dev_state();
 };
@@ -440,7 +452,9 @@ temp_dev_state::temp_dev_state()
   TempPageSupported(false),
   SuppressReport(false),
   modese_len(0),
-  num_sectors(0)
+  num_sectors(0),
+  offline_started(false),
+  selftest_started(false)
 {
   memset(&smartval, 0, sizeof(smartval));
   memset(&smartthres, 0, sizeof(smartthres));
@@ -890,7 +904,7 @@ static char *dnsdomain(const char *hostname)
 #define EBUFLEN 1024
 
 static void MailWarning(const dev_config & cfg, dev_state & state, int which, const char *fmt, ...)
-                        __attribute__ ((format (printf, 4, 5)));
+                        __attribute_format_printf(4, 5);
 
 // If either address or executable path is non-null then send and log
 // a warning email, or execute executable
@@ -940,7 +954,7 @@ static void MailWarning(const dev_config & cfg, dev_state & state, int which, co
              which, (int)sizeof(whichfail));
     return;
   }
-  
+
   // Return if a single warning mail has been sent.
   if ((cfg.emailfreq==1) && mail->logged)
     return;
@@ -1229,7 +1243,7 @@ static void MailWarning(const dev_config & cfg, dev_state & state, int which, co
     rc = daemon_spawn(command, stdinbuf, strlen(stdinbuf), stdoutbuf, sizeof(stdoutbuf));
     if (rc >= 0 && stdoutbuf[0])
       PrintOut(LOG_CRIT,"%s %s to %s produced unexpected output (%d bytes) to STDOUT/STDERR:\n%s\n",
-        newwarn, executable, newadd, strlen(stdoutbuf), stdoutbuf);
+        newwarn, executable, newadd, (int)strlen(stdoutbuf), stdoutbuf);
     if (rc != 0)
       PrintOut(LOG_CRIT,"%s %s to %s: failed, exit status %d\n",
         newwarn, executable, newadd, rc);
@@ -1243,6 +1257,34 @@ static void MailWarning(const dev_config & cfg, dev_state & state, int which, co
   mail->logged++;
 }
 
+static void reset_warning_mail(const dev_config & cfg, dev_state & state, int which, const char *fmt, ...)
+                               __attribute_format_printf(4, 5);
+
+static void reset_warning_mail(const dev_config & cfg, dev_state & state, int which, const char *fmt, ...)
+{
+  if (!(0 <= which && which < SMARTD_NMAIL))
+    return;
+
+  // Return if no mail sent yet
+  mailinfo & mi = state.maillog[which];
+  if (!mi.logged)
+    return;
+
+  // Format & print message
+  char msg[256];
+  va_list ap;
+  va_start(ap, fmt);
+  vsnprintf(msg, sizeof(msg), fmt, ap);
+  va_end(ap);
+
+  PrintOut(LOG_INFO, "Device: %s, %s, warning condition reset after %d email%s\n", cfg.name.c_str(),
+           msg, mi.logged, (mi.logged==1 ? "" : "s"));
+
+  // Clear mail counter and timestamps
+  mi = mailinfo();
+  state.must_write = true;
+}
+
 #ifndef _WIN32
 
 // Output multiple lines via separate syslog(3) calls.
@@ -1399,11 +1441,6 @@ static void DaemonInit()
   for (i=getdtablesize();i>=0;--i)
     close(i);
   
-#ifdef __CYGWIN__
-  // Cygwin's setsid() does not detach the process from Windows console
-  FreeConsole();
-#endif // __CYGWIN__
-
 #define NO_warn_unused_result(cmd) { if (cmd) {} ; }
 
   // redirect any IO attempts to /dev/null for stdin
@@ -1476,8 +1513,11 @@ static void Directives()
            "  -n MODE No check if: never, sleep[,N][,q], standby[,N][,q], idle[,N][,q]\n"
            "  -H      Monitor SMART Health Status, report if failed\n"
            "  -s REG  Do Self-Test at time(s) given by regular expression REG\n"
-           "  -l TYPE Monitor SMART log.  Type is one of: error, selftest, xerror\n"
+           "  -l TYPE Monitor SMART log or self-test status:\n"
+           "          error, selftest, xerror, offlinests[,ns], selfteststs[,ns]\n"
            "  -l scterc,R,W  Set SCT Error Recovery Control\n"
+           "  -e      Change device setting: aam,[N|off], apm,[N|off], lookahead,[on|off],\n"
+           "          security-freeze, standby,[N|off], wcache,[on|off]\n"
            "  -f      Monitor 'Usage' Attributes, report failures\n"
            "  -m ADD  Send email warning to address ADD\n"
            "  -M TYPE Modify email warning behavior (see man page)\n"
@@ -1493,7 +1533,7 @@ static void Directives()
            "  -W D,I,C Monitor Temperature D)ifference, I)nformal limit, C)ritical limit\n"
            "  -v N,ST Modifies labeling of Attribute N (see man page)  \n"
            "  -P TYPE Drive-specific presets: use, ignore, show, showall\n"
-           "  -a      Default: -H -f -t -l error -l selftest -C 197 -U 198\n"
+           "  -a      Default: -H -f -t -l error -l selftest -l selfteststs -C 197 -U 198\n"
            "  -F TYPE Firmware bug workaround: none, samsung, samsung2, samsung3\n"
            "   #      Comment: text after a hash sign is ignored\n"
            "   \\      Line continuation character\n"
@@ -1553,7 +1593,7 @@ static void Usage()
   PrintOut(LOG_INFO,"        [default is %s]\n\n", configfile);
 #ifdef HAVE_LIBCAP_NG
   PrintOut(LOG_INFO,"  -C, --capabilities\n");
-  PrintOut(LOG_INFO,"        Use capabilities (EXPERIMENTAL).\n"
+  PrintOut(LOG_INFO,"        Use capabilities.\n"
                     "        Warning: Mail notification does not work when used.\n\n");
 #endif
   PrintOut(LOG_INFO,"  -d, --debug\n");
@@ -1658,6 +1698,18 @@ static int SelfTestErrorCount(ata_device * device, const char * name,
 #define SELFTEST_ERRORCOUNT(x) (x & 0xff)
 #define SELFTEST_ERRORHOURS(x) ((x >> 8) & 0xffff)
 
+// Check offline data collection status
+static inline bool is_offl_coll_in_progress(unsigned char status)
+{
+  return ((status & 0x7f) == 0x03);
+}
+
+// Check self-test execution status
+static inline bool is_self_test_in_progress(unsigned char status)
+{
+  return ((status >> 4) == 0xf);
+}
+
 // Log offline data collection status
 static void log_offline_data_coll_status(const char * name, unsigned char status)
 {
@@ -1665,7 +1717,7 @@ static void log_offline_data_coll_status(const char * name, unsigned char status
   switch (status & 0x7f) {
     case 0x00: msg = "was never started"; break;
     case 0x02: msg = "was completed without error"; break;
-    case 0x03: msg = (status == 0x03 ? "is in progress" : 0); break;
+    case 0x03: msg = "is in progress"; break;
     case 0x04: msg = "was suspended by an interrupting command from host"; break;
     case 0x05: msg = "was aborted by an interrupting command from host"; break;
     case 0x06: msg = "was aborted by the device with a fatal error"; break;
@@ -1750,6 +1802,23 @@ static void finish_device_scan(dev_config & cfg, dev_state & state)
     state.scheduled_test_next_check = time(0);
 }
 
+// Common function to format result message for ATA setting
+static void format_set_result_msg(std::string & msg, const char * name, bool ok,
+                                  int set_option = 0, bool has_value = false)
+{
+  if (!msg.empty())
+    msg += ", ";
+  msg += name;
+  if (!ok)
+    msg += ":--";
+  else if (set_option < 0)
+    msg += ":off";
+  else if (has_value)
+    msg += strprintf(":%d", set_option-1);
+  else if (set_option > 0)
+    msg += ":on";
+}
+
 
 // TODO: Add '-F swapid' directive
 const bool fix_swapped_id = false;
@@ -1808,7 +1877,8 @@ static int ATADeviceScan(dev_config & cfg, dev_state & state, ata_device * atade
     if (!dbentry)
       PrintOut(LOG_INFO, "Device: %s, not found in smartd database.\n", name);
     else {
-      PrintOut(LOG_INFO, "Device: %s, found in smartd database.\n", name);
+      PrintOut(LOG_INFO, "Device: %s, found in smartd database%s%s\n",
+        name, (*dbentry->modelfamily ? ": " : "."), (*dbentry->modelfamily ? dbentry->modelfamily : ""));
       if (*dbentry->warningmsg)
         PrintOut(LOG_CRIT, "Device: %s, WARNING: %s\n", name, dbentry->warningmsg);
     }
@@ -1891,6 +1961,7 @@ static int ATADeviceScan(dev_config & cfg, dev_state & state, ata_device * atade
   bool smart_val_ok = false;
   if (   cfg.autoofflinetest || cfg.selftest
       || cfg.errorlog        || cfg.xerrorlog
+      || cfg.offlinests      || cfg.selfteststs
       || cfg.usagefailed     || cfg.prefail  || cfg.usage
       || cfg.tempdiff        || cfg.tempinfo || cfg.tempcrit
       || cfg.curr_pending_id || cfg.offl_pending_id         ) {
@@ -1929,6 +2000,25 @@ static int ATADeviceScan(dev_config & cfg, dev_state & state, ata_device * atade
       PrintOut(LOG_CRIT, "Device: %s, can't monitor Temperature, ignoring -W Directive\n", name);
       cfg.tempdiff = cfg.tempinfo = cfg.tempcrit = 0;
     }
+
+    // Report ignored '-r' or '-R' directives
+    for (int id = 1; id <= 255; id++) {
+      if (cfg.monitor_attr_flags.is_set(id, MONITOR_RAW_PRINT)) {
+        char opt = (!cfg.monitor_attr_flags.is_set(id, MONITOR_RAW) ? 'r' : 'R');
+        const char * excl = (cfg.monitor_attr_flags.is_set(id,
+          (opt == 'r' ? MONITOR_AS_CRIT : MONITOR_RAW_AS_CRIT)) ? "!" : "");
+
+        int idx = ata_find_attr_index(id, state.smartval);
+        if (idx < 0)
+          PrintOut(LOG_INFO,"Device: %s, no Attribute %d, ignoring -%c %d%s\n", name, id, opt, id, excl);
+        else {
+          bool prefail = !!ATTRIBUTE_FLAGS_PREFAILURE(state.smartval.vendor_attributes[idx].flags);
+          if (!((prefail && cfg.prefail) || (!prefail && cfg.usage)))
+            PrintOut(LOG_INFO,"Device: %s, not monitoring %s Attributes, ignoring -%c %d%s\n", name,
+                     (prefail ? "Prefailure" : "Usage"), opt, id, excl);
+        }
+      }
+    }
   }
   
   // enable/disable automatic on-line testing
@@ -2023,7 +2113,18 @@ static int ATADeviceScan(dev_config & cfg, dev_state & state, ata_device * atade
     else
       state.ataerrorcount = errcnt2;
   }
-  
+
+  // capability check: self-test and offline data collection status
+  if (cfg.offlinests || cfg.selfteststs) {
+    if (!(cfg.permissive || (smart_val_ok && state.smartval.offline_data_collection_capability))) {
+      if (cfg.offlinests)
+        PrintOut(LOG_INFO, "Device: %s, no SMART Offline Data Collection capability, ignoring -l offlinests (override with -T permissive)\n", name);
+      if (cfg.selfteststs)
+        PrintOut(LOG_INFO, "Device: %s, no SMART Self-test capability, ignoring -l selfteststs (override with -T permissive)\n", name);
+      cfg.offlinests = cfg.selfteststs = false;
+    }
+  }
+
   // capabilities check -- does it support powermode?
   if (cfg.powermode) {
     int powermode = ataCheckPowerMode(atadev);
@@ -2039,6 +2140,40 @@ static int ATADeviceScan(dev_config & cfg, dev_state & state, ata_device * atade
     }
   }
 
+  // Apply ATA settings
+  std::string msg;
+
+  if (cfg.set_aam)
+    format_set_result_msg(msg, "AAM", (cfg.set_aam > 0 ?
+      ata_set_features(atadev, ATA_ENABLE_AAM, cfg.set_aam-1) :
+      ata_set_features(atadev, ATA_DISABLE_AAM)), cfg.set_aam, true);
+
+  if (cfg.set_apm)
+    format_set_result_msg(msg, "APM", (cfg.set_apm > 0 ?
+      ata_set_features(atadev, ATA_ENABLE_APM, cfg.set_apm-1) :
+      ata_set_features(atadev, ATA_DISABLE_APM)), cfg.set_apm, true);
+
+  if (cfg.set_lookahead)
+    format_set_result_msg(msg, "Rd-ahead", ata_set_features(atadev,
+      (cfg.set_lookahead > 0 ? ATA_ENABLE_READ_LOOK_AHEAD : ATA_DISABLE_READ_LOOK_AHEAD)),
+      cfg.set_lookahead);
+
+  if (cfg.set_wcache)
+    format_set_result_msg(msg, "Wr-cache", ata_set_features(atadev,
+      (cfg.set_wcache > 0? ATA_ENABLE_WRITE_CACHE : ATA_DISABLE_WRITE_CACHE)), cfg.set_wcache);
+
+  if (cfg.set_security_freeze)
+    format_set_result_msg(msg, "Security freeze",
+      ata_nodata_command(atadev, ATA_SECURITY_FREEZE_LOCK));
+
+  if (cfg.set_standby)
+    format_set_result_msg(msg, "Standby",
+      ata_nodata_command(atadev, ATA_IDLE, cfg.set_standby-1), cfg.set_standby, true);
+
+  // Report as one log entry
+  if (!msg.empty())
+    PrintOut(LOG_INFO, "Device: %s, ATA settings applied: %s\n", name, msg.c_str());
+
   // set SCT Error Recovery Control if requested
   if (cfg.sct_erc_set) {
     if (!isSCTErrorRecoveryControlCapable(&drive))
@@ -2055,6 +2190,7 @@ static int ATADeviceScan(dev_config & cfg, dev_state & state, ata_device * atade
   // If no tests available or selected, return
   if (!(   cfg.smartcheck  || cfg.selftest
         || cfg.errorlog    || cfg.xerrorlog
+        || cfg.offlinests  || cfg.selfteststs
         || cfg.usagefailed || cfg.prefail  || cfg.usage
         || cfg.tempdiff    || cfg.tempinfo || cfg.tempcrit)) {
     CloseDevice(atadev, name);
@@ -2093,12 +2229,65 @@ static int ATADeviceScan(dev_config & cfg, dev_state & state, ata_device * atade
 // please.
 static int SCSIDeviceScan(dev_config & cfg, dev_state & state, scsi_device * scsidev)
 {
-  int k, err;
+  int k, err, req_len, avail_len, version, len;
   const char *device = cfg.name.c_str();
   struct scsi_iec_mode_page iec;
   UINT8  tBuf[64];
+  UINT8  inqBuf[96];
+  UINT8  vpdBuf[252];
+  char lu_id[64];
 
   // Device must be open
+  memset(inqBuf, 0, 96);
+  req_len = 36;
+  if ((err = scsiStdInquiry(scsidev, inqBuf, req_len))) {
+    /* Marvell controllers fail on a 36 bytes StdInquiry, but 64 suffices */
+    req_len = 64;
+    if ((err = scsiStdInquiry(scsidev, inqBuf, req_len))) {
+      PrintOut(LOG_INFO, "Device: %s, Both 36 and 64 byte INQUIRY failed; "
+              "skip device\n", device);
+      return 2;
+    }
+  }
+  version = inqBuf[2];
+  avail_len = inqBuf[4] + 5;
+  len = (avail_len < req_len) ? avail_len : req_len;
+  if (len < 36) {
+    PrintOut(LOG_INFO, "Device: %s, INQUIRY response less than 36 bytes; "
+            "skip device\n", device);
+    return 2;
+  }
+
+  int pdt = inqBuf[0] & 0x1f;
+
+  if (! ((0 == pdt) || (4 == pdt) || (5 == pdt) || (7 == pdt) ||
+         (0xe == pdt))) {
+    PrintOut(LOG_INFO, "Device: %s, not a disk like device [PDT=0x%x], "
+             "skip\n", device, pdt);
+    return 2;
+  }
+  lu_id[0] = '\0';
+  if ((version >= 0x4) && (version < 0x8)) {
+    /* SPC-2 to SPC-5 */
+    if (0 == (err = scsiInquiryVpd(scsidev, 0x83, vpdBuf, sizeof(vpdBuf)))) {
+      len = vpdBuf[3];
+      scsi_decode_lu_dev_id(vpdBuf + 4, len, lu_id, sizeof(lu_id), NULL);
+    }
+  } 
+
+  unsigned int lb_size;
+  char si_str[64];
+  uint64_t capacity = scsiGetSize(scsidev, &lb_size);
+
+  if (capacity)
+    format_capacity(si_str, sizeof(si_str), capacity);
+  else
+    si_str[0] = '\0';
+  PrintOut(LOG_INFO, "Device: %s, [%.8s %.16s %.4s]%s%s%s%s\n",
+          device, (char *)&inqBuf[8], (char *)&inqBuf[16],
+          (char *)&inqBuf[32],
+          (lu_id[0] ? ", lu id: " : ""), (lu_id[0] ? lu_id : ""),
+          (si_str[0] ? ", " : ""), (si_str[0] ? si_str : ""));
 
   // check that device is ready for commands. IE stores its stuff on
   // the media.
@@ -2223,6 +2412,9 @@ static int SCSIDeviceScan(dev_config & cfg, dev_state & state, scsi_device * scs
     PrintOut(LOG_INFO, "Device: %s, attribute log not yet supported for SCSI; ignoring -A option.\n", device);
   }
 
+  // Make sure that init_standby_check() ignores SCSI devices
+  cfg.offlinests_ns = cfg.selfteststs_ns = false;
+
   // close file descriptor
   CloseDevice(scsidev, device);
 
@@ -2240,7 +2432,9 @@ static void CheckSelfTestLogs(const dev_config & cfg, dev_state & state, int new
   if (newi<0)
     // command failed
     MailWarning(cfg, state, 8, "Device: %s, Read SMART Self-Test Log Failed", name);
-  else {      
+  else {
+    reset_warning_mail(cfg, state, 8, "Read SMART Self-Test Log worked again");
+
     // old and new error counts
     int oldc=state.selflogcount;
     int newc=SELFTEST_ERRORCOUNT(newi);
@@ -2273,9 +2467,13 @@ static void CheckSelfTestLogs(const dev_config & cfg, dev_state & state, int new
     }
 
     // Print info if error entries have disappeared
-    if (oldc > newc)
+    // or newer successful successful extended self-test exits
+    if (oldc > newc) {
       PrintOut(LOG_INFO, "Device: %s, Self-Test Log error count decreased from %d to %d\n",
                name, oldc, newc);
+      if (newc == 0)
+        reset_warning_mail(cfg, state, 3, "Self-Test Log does no longer report errors");
+    }
 
     // Needed since self-test error count may DECREASE.  Hour might
     // also have changed.
@@ -2596,9 +2794,12 @@ static int DoATASelfTest(const dev_config & cfg, dev_state & state, ata_device *
     return retval;
   }
 
-  if (testtype != 'O')
-    // Log next self-test execution status
-    state.smartval.self_test_exec_status = 0xff;
+  // Report recent test start to do_disable_standby_check()
+  // and force log of next test status
+  if (testtype == 'O')
+    state.offline_started = true;
+  else
+    state.selftest_started = true;
 
   PrintOut(LOG_INFO, "Device: %s, starting scheduled %sTest.\n", name, testname);
   return 0;
@@ -2617,8 +2818,10 @@ static void check_pending(const dev_config & cfg, dev_state & state,
 
   // No report if no sectors pending.
   uint64_t rawval = ata_get_attr_raw_value(smartval.vendor_attributes[i], cfg.attribute_defs);
-  if (rawval == 0)
+  if (rawval == 0) {
+    reset_warning_mail(cfg, state, mailtype, "No more %s", msg);
     return;
+  }
 
   // If attribute is not reset, report only sector count increases.
   uint64_t prev_rawval = ata_get_attr_raw_value(state.smartval.vendor_attributes[i], cfg.attribute_defs);
@@ -2712,6 +2915,11 @@ static void CheckTemperature(const dev_config & cfg, dev_state & state, unsigned
     PrintOut(LOG_INFO, "Device: %s, Temperature %u Celsius reached limit of %u Celsius (Min/Max %s%s/%u%s)\n",
       cfg.name.c_str(), currtemp, cfg.tempinfo, fmt_temp(state.tempmin, buf), minchg, state.tempmax, maxchg);
   }
+  else if (cfg.tempcrit) {
+    unsigned char limit = (cfg.tempinfo ? cfg.tempinfo : cfg.tempcrit-5);
+    if (currtemp < limit)
+      reset_warning_mail(cfg, state, 12, "Temperature %u Celsius dropped below %u Celsius", currtemp, limit);
+  }
 }
 
 // Check normalized and raw attribute values.
@@ -2829,8 +3037,10 @@ static int ATACheckDevice(const dev_config & cfg, dev_state & state, ata_device
     PrintOut(LOG_INFO, "Device: %s, open() failed: %s\n", name, atadev->get_errmsg());
     MailWarning(cfg, state, 9, "Device: %s, unable to open device", name);
     return 1;
-  } else if (debugmode)
+  }
+  if (debugmode)
     PrintOut(LOG_INFO,"Device: %s, opened ATA device\n", name);
+  reset_warning_mail(cfg, state, 9, "open device worked again");
 
   // user may have requested (with the -n Directive) to leave the disk
   // alone if it is in idle or sleeping mode.  In this case check the
@@ -2922,7 +3132,8 @@ static int ATACheckDevice(const dev_config & cfg, dev_state & state, ata_device
   // Check everything that depends upon SMART Data (eg, Attribute values)
   if (   cfg.usagefailed || cfg.prefail || cfg.usage
       || cfg.curr_pending_id || cfg.offl_pending_id
-      || cfg.tempdiff || cfg.tempinfo || cfg.tempcrit || cfg.selftest) {
+      || cfg.tempdiff || cfg.tempinfo || cfg.tempcrit
+      || cfg.selftest ||  cfg.offlinests || cfg.selfteststs) {
 
     // Read current attribute values.
     ata_smart_values curval;
@@ -2932,6 +3143,8 @@ static int ATACheckDevice(const dev_config & cfg, dev_state & state, ata_device
       state.must_write = true;
     }
     else {
+      reset_warning_mail(cfg, state, 6, "read SMART Attribute Data worked again");
+
       // look for current or offline pending sectors
       if (cfg.curr_pending_id)
         check_pending(cfg, state, cfg.curr_pending_id, cfg.curr_pending_incr, curval, 10,
@@ -2947,33 +3160,38 @@ static int ATACheckDevice(const dev_config & cfg, dev_state & state, ata_device
       if (cfg.tempdiff || cfg.tempinfo || cfg.tempcrit)
         CheckTemperature(cfg, state, ata_return_temperature_value(&curval, cfg.attribute_defs), 0);
 
+      // look for failed usage attributes, or track usage or prefail attributes
       if (cfg.usagefailed || cfg.prefail || cfg.usage) {
-
-        // look for failed usage attributes, or track usage or prefail attributes
         for (int i = 0; i < NUMBER_ATA_SMART_ATTRIBUTES; i++) {
           check_attribute(cfg, state,
                           curval.vendor_attributes[i],
                           state.smartval.vendor_attributes[i],
                           i, state.smartthres.thres_entries);
         }
+      }
 
-        if (cfg.selftest) {
-          // Log changes of offline data collection and self-test execution status
-          if (   curval.offline_data_collection_status
-                 != state.smartval.offline_data_collection_status
-              || (firstpass && (debugmode || (curval.offline_data_collection_status & 0x7d))))
-            log_offline_data_coll_status(name, curval.offline_data_collection_status);
-
-          if (   curval.self_test_exec_status != state.smartval.self_test_exec_status
-              || (firstpass && (debugmode || curval.self_test_exec_status != 0x00)))
-            log_self_test_exec_status(name, curval.self_test_exec_status);
-        }
+      // Log changes of offline data collection status
+      if (cfg.offlinests) {
+        if (   curval.offline_data_collection_status
+                != state.smartval.offline_data_collection_status
+            || state.offline_started // test was started in previous call
+            || (firstpass && (debugmode || (curval.offline_data_collection_status & 0x7d))))
+          log_offline_data_coll_status(name, curval.offline_data_collection_status);
+      }
 
-       // Save the new values into *drive for the next time around
-       state.smartval = curval;
+      // Log changes of self-test execution status
+      if (cfg.selfteststs) {
+        if (   curval.self_test_exec_status != state.smartval.self_test_exec_status
+            || state.selftest_started // test was started in previous call
+            || (firstpass && (debugmode || curval.self_test_exec_status != 0x00)))
+          log_self_test_exec_status(name, curval.self_test_exec_status);
       }
+
+      // Save the new values for the next time around
+      state.smartval = curval;
     }
   }
+  state.offline_started = state.selftest_started = false;
   
   // check if number of selftest errors has increased (note: may also DECREASE)
   if (cfg.selftest)
@@ -3088,6 +3306,84 @@ static int SCSICheckDevice(const dev_config & cfg, dev_state & state, scsi_devic
     return 0;
 }
 
+// 0=not used, 1=not disabled, 2=disable rejected by OS, 3=disabled
+static int standby_disable_state = 0;
+
+static void init_disable_standby_check(dev_config_vector & configs)
+{
+  // Check for '-l offlinests,ns' or '-l selfteststs,ns' directives
+  bool sts1 = false, sts2 = false;
+  for (unsigned i = 0; i < configs.size() && !(sts1 || sts2); i++) {
+    const dev_config & cfg = configs.at(i);
+    if (cfg.offlinests_ns)
+      sts1 = true;
+    if (cfg.selfteststs_ns)
+      sts2 = true;
+  }
+
+  // Check for support of disable auto standby
+  // Reenable standby if smartd.conf was reread
+  if (sts1 || sts2 || standby_disable_state == 3) {
+   if (!smi()->disable_system_auto_standby(false)) {
+      if (standby_disable_state == 3)
+        PrintOut(LOG_CRIT, "System auto standby enable failed: %s\n", smi()->get_errmsg());
+      if (sts1 || sts2) {
+        PrintOut(LOG_INFO, "Disable auto standby not supported, ignoring ',ns' from %s%s%s\n",
+          (sts1 ? "-l offlinests,ns" : ""), (sts1 && sts2 ? " and " : ""), (sts2 ? "-l selfteststs,ns" : ""));
+        sts1 = sts2 = false;
+      }
+    }
+  }
+
+  standby_disable_state = (sts1 || sts2 ? 1 : 0);
+}
+
+static void do_disable_standby_check(const dev_config_vector & configs, const dev_state_vector & states)
+{
+  if (!standby_disable_state)
+    return;
+
+  // Check for just started or still running self-tests
+  bool running = false;
+  for (unsigned i = 0; i < configs.size() && !running; i++) {
+    const dev_config & cfg = configs.at(i); const dev_state & state = states.at(i);
+
+    if (   (   cfg.offlinests_ns
+            && (state.offline_started ||
+                is_offl_coll_in_progress(state.smartval.offline_data_collection_status)))
+        || (   cfg.selfteststs_ns
+            && (state.selftest_started ||
+                is_self_test_in_progress(state.smartval.self_test_exec_status)))         )
+      running = true;
+    // state.offline/selftest_started will be reset after next logging of test status
+  }
+
+  // Disable/enable auto standby and log state changes
+  if (!running) {
+    if (standby_disable_state != 1) {
+      if (!smi()->disable_system_auto_standby(false))
+        PrintOut(LOG_CRIT, "Self-test(s) completed, system auto standby enable failed: %s\n",
+                 smi()->get_errmsg());
+      else
+        PrintOut(LOG_INFO, "Self-test(s) completed, system auto standby enabled\n");
+      standby_disable_state = 1;
+    }
+  }
+  else if (!smi()->disable_system_auto_standby(true)) {
+    if (standby_disable_state != 2) {
+      PrintOut(LOG_INFO, "Self-test(s) in progress, system auto standby disable rejected: %s\n",
+               smi()->get_errmsg());
+      standby_disable_state = 2;
+    }
+  }
+  else {
+    if (standby_disable_state != 3) {
+      PrintOut(LOG_INFO, "Self-test(s) in progress, system auto standby disabled\n");
+      standby_disable_state = 3;
+    }
+  }
+}
+
 // Checks the SMART status of all ATA and SCSI devices
 static void CheckDevicesOnce(const dev_config_vector & configs, dev_state_vector & states,
                              smart_device_list & devices, bool firstpass, bool allow_selftests)
@@ -3101,6 +3397,8 @@ static void CheckDevicesOnce(const dev_config_vector & configs, dev_state_vector
     else if (dev->is_scsi())
       SCSICheckDevice(cfg, state, dev->to_scsi(), allow_selftests);
   }
+
+  do_disable_standby_check(configs, states);
 }
 
 // Set if Initialize() was called
@@ -3182,7 +3480,8 @@ static time_t dosleep(time_t wakeuptime, bool & sigwakeup)
   }
   
   // sleep until we catch SIGUSR1 or have completed sleeping
-  while (timenow<wakeuptime && !caughtsigUSR1 && !caughtsigHUP && !caughtsigEXIT){
+  int addtime = 0;
+  while (timenow < wakeuptime+addtime && !caughtsigUSR1 && !caughtsigHUP && !caughtsigEXIT) {
     
     // protect user again system clock being adjusted backwards
     if (wakeuptime>timenow+checktime){
@@ -3191,7 +3490,7 @@ static time_t dosleep(time_t wakeuptime, bool & sigwakeup)
     }
     
     // Exit sleep when time interval has expired or a signal is received
-    sleep(wakeuptime-timenow);
+    sleep(wakeuptime+addtime-timenow);
 
 #ifdef _WIN32
     // toggle debug mode?
@@ -3202,6 +3501,19 @@ static time_t dosleep(time_t wakeuptime, bool & sigwakeup)
 #endif
 
     timenow=time(NULL);
+
+    // Actual sleep time too long?
+    if (!addtime && timenow > wakeuptime+60) {
+      if (debugmode)
+        PrintOut(LOG_INFO, "Sleep time was %d seconds too long, assuming wakeup from standby mode.\n",
+          (int)(timenow-wakeuptime));
+      // Wait another 20 seconds to avoid I/O errors during disk spin-up
+      addtime = timenow-wakeuptime+20;
+      // Use next wake-up-time if close
+      int nextcheck = checktime - addtime % checktime;
+      if (nextcheck <= 20)
+        addtime += nextcheck;
+    }
   }
  
   // if we caught a SIGUSR1 then print message and clear signal
@@ -3250,6 +3562,9 @@ static void printoutvaliddirectiveargs(int priority, char d)
     break;
   case 'F':
     PrintOut(priority, "none, samsung, samsung2, samsung3");
+  case 'e':
+    PrintOut(priority, "aam,[N|off], apm,[N|off], lookahead,[on|off], "
+                       "security-freeze, standby,[N|off], wcache,[on|off]");
     break;
   }
 }
@@ -3439,6 +3754,18 @@ static int ParseToken(char * token, dev_config & cfg)
     } else if (!strcmp(arg, "xerror")) {
       // track changes in Extended Comprehensive SMART error log
       cfg.xerrorlog = true;
+    } else if (!strcmp(arg, "offlinests")) {
+      // track changes in offline data collection status
+      cfg.offlinests = true;
+    } else if (!strcmp(arg, "offlinests,ns")) {
+      // track changes in offline data collection status, disable auto standby
+      cfg.offlinests = cfg.offlinests_ns = true;
+    } else if (!strcmp(arg, "selfteststs")) {
+      // track changes in self-test execution status
+      cfg.selfteststs = true;
+    } else if (!strcmp(arg, "selfteststs,ns")) {
+      // track changes in self-test execution status, disable auto standby
+      cfg.selfteststs = cfg.selfteststs_ns = true;
     } else if (!strncmp(arg, "scterc,", sizeof("scterc,")-1)) {
         // set SCT Error Recovery Control
         unsigned rt = ~0, wt = ~0; int nc = -1;
@@ -3462,6 +3789,7 @@ static int ParseToken(char * token, dev_config & cfg)
     cfg.usage = true;
     cfg.selftest = true;
     cfg.errorlog = true;
+    cfg.selfteststs = true;
     break;
   case 'o':
     // automatic offline testing enable/disable
@@ -3655,6 +3983,73 @@ static int ParseToken(char * token, dev_config & cfg)
       badarg = 1;
     }
     break;
+
+  case 'e':
+    // Various ATA settings
+    if (!(arg = strtok(NULL, delim))) {
+      missingarg = true;
+    }
+    else {
+      char arg2[16+1]; unsigned val;
+      int n1 = -1, n2 = -1, n3 = -1, len = strlen(arg);
+      if (sscanf(arg, "%16[^,=]%n%*[,=]%n%u%n", arg2, &n1, &n2, &val, &n3) >= 1
+          && (n1 == len || n2 > 0)) {
+        bool on  = (n2 > 0 && !strcmp(arg+n2, "on"));
+        bool off = (n2 > 0 && !strcmp(arg+n2, "off"));
+        if (n3 != len)
+          val = ~0U;
+
+        if (!strcmp(arg2, "aam")) {
+          if (off)
+            cfg.set_aam = -1;
+          else if (val <= 254)
+            cfg.set_aam = val + 1;
+          else
+            badarg = true;
+        }
+        else if (!strcmp(arg2, "apm")) {
+          if (off)
+            cfg.set_apm = -1;
+          else if (1 <= val && val <= 254)
+            cfg.set_apm = val + 1;
+          else
+            badarg = true;
+        }
+        else if (!strcmp(arg2, "lookahead")) {
+          if (off)
+            cfg.set_lookahead = -1;
+          else if (on)
+            cfg.set_lookahead = 1;
+          else
+            badarg = true;
+        }
+        else if (!strcmp(arg, "security-freeze")) {
+          cfg.set_security_freeze = true;
+        }
+        else if (!strcmp(arg2, "standby")) {
+          if (off)
+            cfg.set_standby = 0 + 1;
+          else if (val <= 255)
+            cfg.set_standby = val + 1;
+          else
+            badarg = true;
+        }
+        else if (!strcmp(arg2, "wcache")) {
+          if (off)
+            cfg.set_wcache = -1;
+          else if (on)
+            cfg.set_wcache = 1;
+          else
+            badarg = true;
+        }
+        else
+          badarg = true;
+      }
+      else
+        badarg = true;
+    }
+    break;
+
   default:
     // Directive not recognized
     PrintOut(LOG_CRIT,"File %s line %d (drive %s): unknown Directive: %s\n",
@@ -3687,63 +4082,60 @@ static int ParseToken(char * token, dev_config & cfg)
 //
 // Return values are:
 //  1: parsed a normal line
-//  0: found comment or blank line
+//  0: found DEFAULT setting or comment or blank line
 // -1: found SCANDIRECTIVE line
 // -2: found an error
 //
 // Note: this routine modifies *line from the caller!
-static int ParseConfigLine(dev_config_vector & conf_entries, int /*entry*/, int lineno, /*const*/ char * line)
+static int ParseConfigLine(dev_config_vector & conf_entries, dev_config & default_conf, int lineno, /*const*/ char * line)
 {
-  char *token=NULL;
-  char *name=NULL;
   const char *delim = " \n\t";
-  int devscan=0;
 
   // get first token: device name. If a comment, skip line
-  if (!(name=strtok(line,delim)) || *name=='#') {
+  const char * name = strtok(line, delim);
+  if (!name || *name == '#')
     return 0;
-  }
 
-  // Have we detected the SCANDIRECTIVE directive?
-  if (!strcmp(SCANDIRECTIVE,name)){
-    devscan=1;
+  // Check device name for DEFAULT or DEVICESCAN
+  int retval;
+  if (!strcmp("DEFAULT", name)) {
+    retval = 0;
+    // Restart with empty defaults
+    default_conf = dev_config();
   }
-  
-  // We've got a legit entry, make space to store it
-  conf_entries.push_back( dev_config() );
-  dev_config & cfg = conf_entries.back();
+  else {
+    retval = (!strcmp(SCANDIRECTIVE, name) ? -1 : 1);
+    // Init new entry with current defaults
+    conf_entries.push_back(default_conf);
+  }
+  dev_config & cfg = (retval ? conf_entries.back() : default_conf);
 
   cfg.name = name; // Later replaced by dev->get_info().info_name
   cfg.dev_name = name; // If DEVICESCAN later replaced by get->dev_info().dev_name
-
-  // Store line number, and by default check for both device types.
-  cfg.lineno=lineno;
+  cfg.lineno = lineno;
 
   // parse tokens one at a time from the file.
-  while ((token=strtok(NULL,delim))){
-    int retval=ParseToken(token,cfg);
-    
-    if (retval==0)
-      // No tokens left:
-      break;
-    
-    if (retval>0) {
-      // Parsed token  
-#if (0)
-      PrintOut(LOG_INFO,"Parsed token %s\n",token);
-#endif
-      continue;
-    }
-    
-    if (retval<0) {
+  while (char * token = strtok(0, delim)) {
+    int rc = ParseToken(token, cfg);
+    if (rc < 0)
       // error found on the line
       return -2;
-    }
+
+    if (rc == 0)
+      // No tokens left
+      break;
+
+    // PrintOut(LOG_INFO,"Parsed token %s\n",token);
   }
-  
+
+  // Don't perform checks below for DEFAULT entries
+  if (retval == 0)
+    return retval;
+
   // If NO monitoring directives are set, then set all of them.
   if (!(   cfg.smartcheck  || cfg.selftest
         || cfg.errorlog    || cfg.xerrorlog
+        || cfg.offlinests  || cfg.selfteststs
         || cfg.usagefailed || cfg.prefail  || cfg.usage
         || cfg.tempdiff    || cfg.tempinfo || cfg.tempcrit)) {
     
@@ -3756,6 +4148,7 @@ static int ParseConfigLine(dev_config_vector & conf_entries, int /*entry*/, int
     cfg.usage = true;
     cfg.selftest = true;
     cfg.errorlog = true;
+    cfg.selfteststs = true;
   }
   
   // additional sanity check. Has user set -M options without -m?
@@ -3777,10 +4170,7 @@ static int ParseConfigLine(dev_config_vector & conf_entries, int /*entry*/, int
     cfg.emailaddress.clear();
   }
 
-  if (devscan)
-    return -1;
-  else
-    return 1;
+  return retval;
 }
 
 // Parses a configuration file.  Return values are:
@@ -3815,12 +4205,15 @@ static int ParseConfigFile(dev_config_vector & conf_entries)
   else // read from stdin ('-c -' option)
     f.open(stdin);
 
+  // Start with empty defaults
+  dev_config default_conf;
+
   // No configuration file found -- use fake one
   int entry = 0;
   if (!f) {
     char fakeconfig[] = SCANDIRECTIVE" -a"; // TODO: Remove this hack, build cfg_entry.
 
-    if (ParseConfigLine(conf_entries, entry, 0, fakeconfig) != -1)
+    if (ParseConfigLine(conf_entries, default_conf, 0, fakeconfig) != -1)
       throw std::logic_error("Internal error parsing "SCANDIRECTIVE);
     return 0;
   }
@@ -3852,7 +4245,7 @@ static int ParseConfigFile(dev_config_vector & conf_entries)
     // are we at the end of the file?
     if (!code){
       if (cont) {
-        scandevice = ParseConfigLine(conf_entries, entry, contlineno, fullline);
+        scandevice = ParseConfigLine(conf_entries, default_conf, contlineno, fullline);
         // See if we found a SCANDIRECTIVE directive
         if (scandevice==-1)
           return 0;
@@ -3906,7 +4299,7 @@ static int ParseConfigFile(dev_config_vector & conf_entries)
     }
 
     // Not a continuation line. Parse it
-    scandevice = ParseConfigLine(conf_entries, entry, contlineno, fullline);
+    scandevice = ParseConfigLine(conf_entries, default_conf, contlineno, fullline);
 
     // did we find a scandevice directive?
     if (scandevice==-1)
@@ -3938,21 +4331,20 @@ static void PrintValidArgs(char opt)
   PrintOut(LOG_CRIT, " <=======\n");
 }
 
-// Return true if absolute path name
-static bool is_abs_path(const char * path)
+#ifndef _WIN32
+// Report error and exit if specified path is not absolute.
+static void check_abs_path(char option, const std::string & path)
 {
-  if (*path == '/')
-    return true;
-#if defined(_WIN32) || defined(__CYGWIN__)
-  if (*path == '\\')
-    return true;
-  int n = -1;
-  sscanf(path, "%*1[A-Za-z]:%*1[/\\]%n", &n);
-  if (n > 0)
-    return true;
-#endif
-  return false;
+  if (path.empty() || path[0] == '/')
+    return;
+
+  debugmode = 1;
+  PrintHead();
+  PrintOut(LOG_CRIT, "=======> INVALID ARGUMENT TO -%c: %s <=======\n\n", option, path.c_str());
+  PrintOut(LOG_CRIT, "Error: relative path names are not allowed\n\n");
+  EXIT(EXIT_BADCMD);
 }
+#endif // !_WIN32
 
 // Parses input line, prints usage message and
 // version/license/copyright messages
@@ -3982,15 +4374,14 @@ static void ParseOpts(int argc, char **argv)
     { "interval",       required_argument, 0, 'i' },
 #ifndef _WIN32
     { "no-fork",        no_argument,       0, 'n' },
+#else
+    { "service",        no_argument,       0, 'n' },
 #endif
     { "pidfile",        required_argument, 0, 'p' },
     { "report",         required_argument, 0, 'r' },
     { "savestates",     required_argument, 0, 's' },
     { "attributelog",   required_argument, 0, 'A' },
     { "drivedb",        required_argument, 0, 'B' },
-#if defined(_WIN32) || defined(__CYGWIN__)
-    { "service",        no_argument,       0, 'n' },
-#endif
     { "version",        no_argument,       0, 'V' },
     { "license",        no_argument,       0, 'V' },
     { "copyright",      no_argument,       0, 'V' },
@@ -4237,25 +4628,14 @@ static void ParseOpts(int argc, char **argv)
     EXIT(EXIT_BADCMD);
   }
 
-  // absolute path is required due to chdir('/') after fork().
-  if (!state_path_prefix.empty() && !debugmode && !is_abs_path(state_path_prefix.c_str())) {
-    debugmode=1;
-    PrintHead();
-    PrintOut(LOG_CRIT, "=======> INVALID CHOICE OF OPTIONS: -s <======= \n\n");
-    PrintOut(LOG_CRIT, "Error: relative path %s is only allowed in debug (-d) mode\n\n",
-      state_path_prefix.c_str());
-    EXIT(EXIT_BADCMD);
-  }
-
-  // absolute path is required due to chdir('/') after fork().
-  if (!attrlog_path_prefix.empty() && !debugmode && !is_abs_path(attrlog_path_prefix.c_str())) {
-    debugmode=1;
-    PrintHead();
-    PrintOut(LOG_CRIT, "=======> INVALID CHOICE OF OPTIONS: -s <======= \n\n");
-    PrintOut(LOG_CRIT, "Error: relative path %s is only allowed in debug (-d) mode\n\n",
-      attrlog_path_prefix.c_str());
-    EXIT(EXIT_BADCMD);
+#ifndef _WIN32
+  if (!debugmode) {
+    // absolute path names are required due to chdir('/') after fork().
+    check_abs_path('p', pid_file);
+    check_abs_path('s', state_path_prefix);
+    check_abs_path('A', attrlog_path_prefix);
   }
+#endif
 
   // Read or init drive database
   if (!no_defaultdb) {
@@ -4466,6 +4846,8 @@ static void RegisterDevices(const dev_config_vector & conf_entries, smart_device
       }
     }
   }
+
+  init_disable_standby_check(configs);
 }
 
 
@@ -4531,19 +4913,6 @@ static int main_worker(int argc, char **argv)
     // Should we (re)read the config file?
     if (firstpass || caughtsigHUP){
       if (!firstpass) {
-#ifdef __CYGWIN__
-        // Workaround for missing SIGQUIT via keyboard on Cygwin
-        if (caughtsigHUP==2) {
-          // Simulate SIGQUIT if another SIGINT arrives soon
-          caughtsigHUP=0;
-          sleep(1);
-          if (caughtsigHUP==2) {
-            caughtsigEXIT=SIGQUIT;
-            continue;
-          }
-          caughtsigHUP=2;
-        }
-#endif
         // Write state files
         if (!state_path_prefix.empty())
           write_all_dev_states(configs, states);
index 04399dee8f7e26f96e1403d8c64a7013e254b46b..cac843201888b704880a4a26ed0f77f01657b351 100644 (file)
@@ -1,71 +1,70 @@
 #!/bin/sh
-# $FreeBSD: ports/sysutils/smartmontools/files/smartd.in,v 1.2 2010/03/27 00:15:05 dougb Exp $
 
+# $FreeBSD: ports/sysutils/smartmontools/files/smartd.in,v 1.4 2012/02/15 08:46:57 dougb Exp $
+#
 # PROVIDE: smartd
-# REQUIRE: DAEMON
-# BEFORE: LOGIN
+# REQUIRE: LOGIN
 # KEYWORD: shutdown nojail
-
+#
 # Define these smartd_* variables in one of these files:
-#       /etc/rc.conf
-#       /etc/rc.conf.local
-#       /etc/rc.conf.d/smartd
+#      /etc/rc.conf
+#      /etc/rc.conf.local
+#      /etc/rc.conf.d/smartd
 #
 # DO NOT CHANGE THESE DEFAULT VALUES HERE
-#
-smartd_enable="${smartd_enable-NO}"
-smartd_pidfile="/var/run/smartd.pid"
 
 . /etc/rc.subr
 
-name="smartd"
-rcvar=`set_rcvar`
+name=smartd
+rcvar=smartd_enable
+
+load_rc_config smartd
+
+: ${smartd_enable:="NO"}
+
+required_files=${smartd_config:="/usr/local/etc/smartd.conf"}
+pidfile=${smartd_pidfile:="/var/run/smartd.pid"}
+
 command="/usr/local/sbin/smartd"
+command_args="-c ${required_files} -p ${pidfile}"
+
 extra_commands="reload report"
 reload_cmd="smartd_reload"
 report_cmd="smartd_report"
 
-smartd_reload()
-{
-    rc_pid=$(check_pidfile $pidfile $command)
-    if [ -z "$rc_pid" ]; then
-        [ -n "$rc_fast" ] && return 0
-        _run_rc_notrunning
-        return 1
-    fi
-    echo 'Reloading smartd.'
-    kill -HUP $rc_pid
-}
+start_precmd=smartd_prestart
 
-smartd_report()
+smartd_prestart()
 {
-    rc_pid=$(check_pidfile $pidfile $command)
-    if [ -z "$rc_pid" ]; then
-        [ -n "$rc_fast" ] && return 0
-        _run_rc_notrunning
-        return 1
-    fi
-    echo 'Checking SMART devices now.'
-    kill -USR1 $rc_pid
+       case "${smartd_flags}" in
+       -p*|*-p*)
+       err 1 'smartd_flags includes the -p option, use smartd_pidfile instead'
+               ;;
+       esac
 }
 
-load_rc_config $name
+smartd_reload()
+{
+       local status
 
-: ${smartd_config="/usr/local/etc/smartd.conf"}
-: ${smartd_flags="-c ${smartd_config}"}
+       if ! status=`run_rc_command status 2>&1`; then
+               echo $status
+               return 1
+       fi
+       echo 'Reloading smartd.'
+       kill -HUP $rc_pid
+}
 
-pidfile="${smartd_pidfile}"
-required_files="${smartd_config}"
+smartd_report()
+{
+       local status
 
-case "${smartd_flags}" in
-*-p\ *)
-        echo "ERROR: \$smartd_flags includes -p option." \
-                "Please use \$smartd_pidfile instead."
-        exit 1
-        ;;
-*)
-        smartd_flags="-p ${pidfile} ${smartd_flags}"
-        ;;
-esac
+       if ! status=`run_rc_command status 2>&1`; then
+               echo $status
+               return 1
+       fi
+       echo 'Checking SMART devices now.'
+       kill -USR1 $rc_pid
+}
 
 run_rc_command "$1"
index 9d37aab5e134b9f52d047308c3a5385fe147be95..d7bb7bde3535dc3f7dc7fbf31f3d33ee1564296b 100644 (file)
@@ -3,8 +3,8 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net>
- * Copyright (C) 2008-11 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2002-12 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2008-12 Christian Franke <smartmontools-support@lists.sourceforge.net>
  * Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -53,7 +53,7 @@
 #include "atacmds.h"
 #include "dev_interface.h"
 
-const char * utility_cpp_cvsid = "$Id: utility.cpp 3305 2011-03-30 21:32:05Z chrfranke $"
+const char * utility_cpp_cvsid = "$Id: utility.cpp 3500 2012-01-01 18:03:36Z chrfranke $"
                                  UTILITY_H_CVSID INT64_H_CVSID;
 
 const char * packet_types[] = {
@@ -91,7 +91,7 @@ std::string format_version_info(const char * prog_name, bool full /*= false*/)
       "(build date "__DATE__")" // checkout without expansion of Id keywords
 #endif
       " [%s] "BUILD_INFO"\n"
-    "Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net\n",
+    "Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net\n",
     prog_name, smi()->get_os_version_str().c_str()
   );
   if (!full)
@@ -101,7 +101,8 @@ std::string format_version_info(const char * prog_name, bool full /*= false*/)
     "\n"
     "%s comes with ABSOLUTELY NO WARRANTY. This is free\n"
     "software, and you are welcome to redistribute it under\n"
-    "the terms of the GNU General Public License Version 2.\n"
+    "the terms of the GNU General Public License; either\n"
+    "version 2, or (at your option) any later version.\n"
     "See http://www.gnu.org for further details.\n"
     "\n",
     prog_name
index e9dfb352cc879ac912bdd3ed8d765b35432355de..5635655f408b7351fe6fd6418c32ecf1fecda679 100644 (file)
--- a/utility.h
+++ b/utility.h
@@ -26,7 +26,7 @@
 #ifndef UTILITY_H_
 #define UTILITY_H_
 
-#define UTILITY_H_CVSID "$Id: utility.h 3305 2011-03-30 21:32:05Z chrfranke $"
+#define UTILITY_H_CVSID "$Id: utility.h 3475 2011-11-10 21:43:40Z chrfranke $"
 
 #include <time.h>
 #include <sys/types.h> // for regex.h (according to POSIX)
 #include <string.h>
 #include <string>
 
-#if !defined(__GNUC__) && !defined(__attribute__)
-#define __attribute__(x)  /**/
+#ifndef __GNUC__
+#define __attribute_format_printf(x, y)  /**/
+#elif defined(__MINGW32__) && __USE_MINGW_ANSI_STDIO
+// Check format of __mingw_*printf() instead of MSVCRT.DLL:*printf()
+#define __attribute_format_printf(x, y)  __attribute__((format (gnu_printf, x, y)))
+#define HAVE_WORKING_SNPRINTF 1
+#else
+#define __attribute_format_printf(x, y)  __attribute__((format (printf, x, y)))
 #endif
 
 // Make version information string
@@ -45,13 +51,13 @@ std::string format_version_info(const char * prog_name, bool full = false);
 
 // return (v)sprintf() formated std::string
 std::string strprintf(const char * fmt, ...)
-    __attribute__ ((format (printf, 1, 2)));
+    __attribute_format_printf(1, 2);
 std::string vstrprintf(const char * fmt, va_list ap);
 
 #ifndef HAVE_WORKING_SNPRINTF
 // Substitute by safe replacement functions
 int safe_snprintf(char *buf, int size, const char *fmt, ...)
-    __attribute__ ((format (printf, 3, 4)));
+    __attribute_format_printf(3, 4);
 int safe_vsnprintf(char *buf, int size, const char *fmt, va_list ap);
 #define snprintf  safe_snprintf
 #define vsnprintf safe_vsnprintf
@@ -75,7 +81,7 @@ void dateandtimezoneepoch(char *buffer, time_t tval);
 // itself is defined differently in smartctl and smartd.  So the
 // function definition(s) are in smartd.c and in smartctl.c.
 void pout(const char *fmt, ...)  
-     __attribute__ ((format (printf, 1, 2)));
+    __attribute_format_printf(1, 2);
 
 // replacement for perror() with redirected output.
 void syserror(const char *message);