Imported Upstream version 5.42+svn3521

This commit is contained in:
Giuseppe Iuculano 2012-03-07 23:23:28 +01:00
parent a7e8ffec30
commit d008864df4
51 changed files with 5718 additions and 4833 deletions

441
CHANGELOG
View File

@ -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,

41
COPYING
View File

@ -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.
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.)
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.
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.
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
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.

85
INSTALL
View File

@ -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:

View 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

39
NEWS
View File

@ -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
-----------------------------------------------------------

View 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];
{
// 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;
}
}
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;
}
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;
}

View 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
@ -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

View 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

View 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)
{ }
};

View File

@ -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

View File

@ -18,13 +18,13 @@
# 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

235
cissio_freebsd.h Normal file
View File

@ -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()

View 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

View 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)

View 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
@ -18,20 +18,14 @@
#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,10 +209,15 @@ protected:
private:
smart_interface * m_intf;
device_info m_info;
ata_device * m_ata_ptr;
scsi_device * m_scsi_ptr;
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;
// Prevent copy/assigment
smart_device(const smart_device &);
void operator=(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).

575
drivedb.h

File diff suppressed because it is too large Load Diff

26
int64.h
View File

@ -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

View 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;
}
}

View 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

View 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;
}

View 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)

View 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;

View 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,

View 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
; Install runcmda.exe if missing
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
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

83
os_win32/runcmd.c Normal file
View File

@ -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;
}

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

File diff suppressed because it is too large Load Diff

View File

@ -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>

View File

@ -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>

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,13 @@

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}"
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_vc8", "smartd_vc8.vcproj", "{C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smartd", "smartd_vc10.vcxproj", "{C0762191-C2AC-40B6-A2EB-F1658BBDC4C6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "syslogevt_vc8", "syslogevt_vc8.vcproj", "{FAB7557B-86EA-405D-B49D-33AB3F4D3E33}"
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
@ -25,6 +27,10 @@ Global
{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

View File

@ -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>

View File

@ -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>

View 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

View 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>
@ -28,8 +28,13 @@
#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;

View 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)) {

View 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

View 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);

View 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),

View 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
@ -25,13 +25,20 @@
.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.
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.
Run the script \fB/usr/local/sbin/update-smart-drivedb\fP to update this
file from the smartmontools SVN repository.
.\" END ENABLE_DRIVEDB
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 $

View 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];

File diff suppressed because it is too large Load Diff

View 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 $

File diff suppressed because it is too large Load Diff

View 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"
start_precmd=smartd_prestart
smartd_prestart()
{
case "${smartd_flags}" in
-p*|*-p*)
err 1 'smartd_flags includes the -p option, use smartd_pidfile instead'
;;
esac
}
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
local status
if ! status=`run_rc_command status 2>&1`; then
echo $status
return 1
fi
echo 'Reloading smartd.'
kill -HUP $rc_pid
}
smartd_report()
{
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
local status
if ! status=`run_rc_command status 2>&1`; then
echo $status
return 1
fi
echo 'Checking SMART devices now.'
kill -USR1 $rc_pid
}
load_rc_config $name
: ${smartd_config="/usr/local/etc/smartd.conf"}
: ${smartd_flags="-c ${smartd_config}"}
pidfile="${smartd_pidfile}"
required_files="${smartd_config}"
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
run_rc_command "$1"

View 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

View File

@ -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)
@ -36,8 +36,14 @@
#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);