Imported Upstream version 6.4+svn4109

This commit is contained in:
Jonathan Dowland 2015-11-18 21:45:13 +00:00
parent 1d06b804d7
commit 3d8ad6fa45
37 changed files with 2401 additions and 1138 deletions

37
AUTHORS
View File

@ -1,39 +1,40 @@
$Id: AUTHORS 3751 2013-01-18 21:19:43Z chrfranke $ $Id: AUTHORS 4101 2015-05-30 17:52:05Z chrfranke $
This code was originally developed as a Senior Thesis by Michael Developers / Maintainers / Contributors:
Cornwell at the Concurrent Systems Laboratory (now part of the Storage
Systems Research Center), Jack Baskin School of Engineering, University
of California, Santa Cruz. http://ssrc.soe.ucsc.edu/
This package is meant to be an up-to-date replacement for the Raghava Aditya <...>
ucsc-smartsuite and smartsuite packages, and is derived from that code. Bruce Allen <...>
Erik Inge Bolsø <...>
Maintainers / Developers:
Bruce Allen <smartmontools-support@lists.sourceforge.net>
Erik Inge Bolsø <knan@mo.himolde.no>
Stanislav Brabec <sbrabec@suse.cz> Stanislav Brabec <sbrabec@suse.cz>
Peter Cassidy <pcassidy@mac.com> Peter Cassidy <pcassidy@mac.com>
Praveen Chidambaram <bunchofmails@gmail.com> Praveen Chidambaram <bunchofmails@gmail.com>
Yuri Dario <mc6530@mclink.it> Yuri Dario <mc6530@mclink.it>
Casper Dik <casper@holland.sun.com> Casper Dik <...>
Christian Franke <franke@computer.org> Christian Franke <franke@computer.org>
Guilhem Frézou <guilhem.frezou@catii.fr> Guilhem Frézou <...>
Douglas Gilbert <dgilbert@interlog.com> Douglas Gilbert <dgilbert@interlog.com>
Guido Guenther <agx@sigxcpu.org> Guido Guenther <agx@sigxcpu.org>
Jordan Hargrave <jordan_hargrave@dell.com> Jordan Hargrave <jordan_hargrave@dell.com>
Joerg Hering <hering.ruegen@gmx.de> Joerg Hering <...>
Geoff Keating <geoffk@geoffk.org> Geoff Keating <geoffk@geoffk.org>
Dr. David Kirkby <drkirkby@ntlworld.com> Dr. David Kirkby <...>
Dan Lukes <dan+smartmontools.changelog@obluda.cz>
Kai Mäkisara <kai.makisara@kolumbus.fi> Kai Mäkisara <kai.makisara@kolumbus.fi>
Nidhi Malhotra <nidhi.malhotra@pmcs.com>
Eduard Martinescu <martines@rochester.rr.com> Eduard Martinescu <martines@rochester.rr.com>
Frédéric L. W. Meunier <http://www.pervalidus.net/contact.html> Frédéric L. W. Meunier <...>
Alex Samorukov <samm@os2.kiev.ua> Alex Samorukov <samm@os2.kiev.ua>
Keiji Sawada <card_captor@users.sourceforge.net> Keiji Sawada <card_captor@users.sourceforge.net>
Manfred Schwarb <manfred99@gmx.ch> Manfred Schwarb <manfred99@gmx.ch>
Tomas Smetana <tsmetana@redhat.com> Tomas Smetana <tsmetana@redhat.com>
David Snyder <dasnyderx@yahoo.com> David Snyder <dasnyderx@yahoo.com>
Sergey Svishchev <svs@ropnet.ru> Sergey Svishchev <svs@ropnet.ru>
Phil Williams <phil@subbacultcha.demon.co.uk> Tommy Vestermark <tommy.vestermark@gmail.com>
Roger Willcocks <roger@filmlight.ltd.uk>
Phil Williams <...>
Hank Wu <hank@areca.com.tw>
Shengfeng Zhou <linux@highpoint-tech.com> Shengfeng Zhou <linux@highpoint-tech.com>
Richard Zybert <richard.zybert@zybert.co.uk> Richard Zybert <richard.zybert@zybert.co.uk>
The first smartmontools code was derived from the smartsuite package,
written by Michael Cornwell and Andre Hedrick.

422
ChangeLog
View File

@ -1,4 +1,424 @@
$Id: ChangeLog 4002 2014-10-07 11:11:49Z samm2 $ $Id: ChangeLog 4109 2015-06-04 16:30:15Z chrfranke $
2015-06-04 Christian Franke <franke@computer.org>
smartmontools 6.4
2015-06-03 Christian Franke <franke@computer.org>
drivedb.h:
- InnoDisk iCF 9000 CompactFlash Cards
- SanDisk based SSDs: ReadyCache SSD
- Seagate Barracuda 7200.14 (AF): Apple OEM
- USB: Toshiba Canvio Basics (0x0480:0xa200)
ataprint.cpp: Read General Purpose Log Directory only if GPL
feature set is supported. Improve support check of old logs
for older drives which return empty SMART Log Directory.
2015-06-01 Christian Franke <franke@computer.org>
Makefile.am, smartd.8.in: Hide initscript documentation if
initscriptdir is not configured.
smartd.conf.5.in: Remove outdated info about default shell.
2015-05-30 Christian Franke <franke@computer.org>
Fixes for aacraid patch:
aacraid.h: Fix _WIN32/_WIN64 checks.
os_win32.cpp: Clarify copyright info in GPL header.
Improve source code formatting.
Fix build on Cygwin. Fix HKEY leak.
Fix member initialization order.
Fix info_name and dev_type parameter order.
Improve error handling. Avoid unsafe sprintf().
Remove unused variables. Add help text.
Use 0 as number of first aacraid controller as on Linux.
smartctl.8.in, smartd.conf.5.in: Update '-d aacraid' documentation.
AUTHORS: Add Nidhi Malhotra.
2015-05-30 Nidhi Malhotra <nidhi.malhotra@pmcs.com>
aacraid.h, os_win32.cpp:
Add aacraid support for Windows (ticket #496).
2015-05-27 Christian Franke <franke@computer.org>
INSTALL: Update ./configure description.
Remove info about old Linux kernel series.
Update Windows info.
2015-05-19 Christian Franke <franke@computer.org>
ataprint.cpp: Print the Additional Product Identifier (OEM Id)
regardless of '-q noserial' option.
smartctl.8.in, smartd.conf.5.in: Clarify '-H' option and directive.
2015-05-17 Christian Franke <franke@computer.org>
drivedb.h:
- USB: ViPowER USB3.0 Storage (0x0350:0x0038)
- USB: Buffalo DriveStation HD-LBU2 (0x0411:0x01ea)
- USB: Toshiba Stor.E Basics; (0x0480:0xa00e)
- USB: Toshiba Canvio Desktop (0x0480:0xd011)
- USB: Samsung M3 Portable USB 3.0 (0x04e8:0x61b3)
- USB: Iomega (0x059b:0x0575)
- USB: Genesys Logic GL3310 (0x05e3:0x0731)
- USB: Freecom HD (0x07ab:0xfcd6)
- USB: Apricorn SATA Wire (0x0984:0x0040)
- USB: WD My Passport (0x1058:0x0830)
- USB: WD My Book: Merge entries, add 0x1058:0x0900, 0x1058:0x1104
- USB: Initio (0x13fd:0x3940)
- USB: Super Top (0x14cd:0x6116): change to -d sat
- USB: JMicron (0x152d:0x2590) (ticket #550)
- USB: ASMedia ASM1053/1153 (0x174c:0x1[01]53)
- USB: Verbatim Pocket Hard Drive (0x18a5:0x0237)
- USB: Verbatim External Hard Drive (0x18a5:0x0400)
- USB: VIA VL701 (0x2109:0x0701)
- USB: Unknown (0x2537:0x106[68])
- USB: Hitachi Touro Mobile (0x4971:0x1020)
2015-05-16 Christian Franke <franke@computer.org>
drivedb.h:
- Samsung SpinPoint T166: 250GB
- Seagate Samsung SpinPoint M8 (AF): Rename, add Apple OEM
- Seagate Samsung SpinPoint M9T
- Seagate Samsung SpinPoint M9TU (USB)
- Hitachi/HGST Travelstar Z5K320
- HGST Travelstar Z5K1000
- HGST Deskstar NAS: 128MB cache variants
- HGST Ultrastar He6
- Toshiba 2.5" HDD MK..51GSY
- Toshiba 2.5" HDD MK..61GSY[N]: -v 9,minutes
- Toshiba 2.5" HDD MK..61GSYB
- Toshiba 2.5" HDD MK..75GSX
- Toshiba 2.5" HDD MQ01ABB...
- Toshiba 2.5" HDD MQ01ABC...
- Toshiba 2.5" HDD MQ01ABF...
- Toshiba 2.5" HDD MQ01UBB... (USB 3.0)
- Toshiba 3.5" MD04ACA... Enterprise HDD
- Toshiba 3.5" DT01ABA... Desktop HDD
- Seagate Laptop Thin HDD: 7200 rpm variants
- Seagate Constellation ES.2 (SATA 6Gb/s): HP OEM
- Seagate Constellation.2 (SATA): HP OEM
- Seagate Enterprise Capacity 3.5 HDD
- Seagate Archive HDD
- Western Digital AV-GP (AF): 500MB, EURX variants
- Western Digital Red Pro
- Western Digital Purple
2015-05-14 Christian Franke <franke@computer.org>
drivedb.h:
- Crucial/Micron MX100/MX200/M5x0/M600 Client SSDs:
MX200 *00 sizes (ticket #545)
- Samsung based SSDs: PM851, SM841N, 850 EVO
- Marvell based SanDisk SSDs: Extreme Pro, Ultra II (ticket #544)
- Marvell based SanDisk SSDs: X110 mSATA, X300
- SanDisk based SSDs: pSSD (USB), U110
- USB: Samsung D3 Station 4TB (0x04e8:0x6125) (ticket #549)
- USB: Seagate Backup Plus USB 3.0 (0x0bc2:0xa003)
- USB: Seagate Backup Plus Desktop USB 3.0 5TB (0x0bc2:0xab31)
- USB: JMicron (0x152d:0x3569) (ticket #546)
2015-05-10 Christian Franke <franke@computer.org>
scsicmds.cpp, scsicmds.h: Remove unused functions
scsiReceiveDiagnostic() and scsiSmartIBMOfflineTest().
Found by cppcheck.
2015-05-05 Christian Franke <franke@computer.org>
ataprint.cpp: Print ACS-3 device statistics DSN flags.
Print device statistics page numbers in hex.
smartctl.cpp: Allow hex argument for '-l devstat,PAGE'.
2015-05-02 Christian Franke <franke@computer.org>
ataprint.cpp: Print Transport Type for PATA and PCIe.
Print diagnostic values if SATA version or speed is unknown.
smartctl.8.in, smartd.8.in: Add Volker Kuhlmann to AUTHORS section.
2015-05-01 Christian Franke <franke@computer.org>
ataidentify.cpp: ACS-3/4 updates.
ataprint.cpp: Add recent ACS-3/4 minor revisions.
Add ACS-4 log 0x0f. Add ACS-4 device statistics values and
vendor specific statistics page.
2015-04-28 Christian Franke <franke@computer.org>
os_win32/installer.nsi: Fix possible loss of user PATH environment
variable with length greater than NSIS max string length.
2015-04-26 Christian Franke <franke@computer.org>
do_release: New Signing Key.
Makefile.am: Use make variables instead of autoconf variables
if possible.
2015-04-24 Christian Franke <franke@computer.org>
smartctl.8.in, smartd.8.in: Rework AUTHORS section.
INSTALL, Makefile.am, os_win32/installer.nsi:
Remove WARNINGS file.
WARNINGS: Remove this file.
2015-04-23 Christian Franke <franke@computer.org>
configure.ac: Add '--with-systemdenvfile=auto' option as new default.
Remove no longer needed ENABLE_CAPABILITIES conditional.
Makefile.am: Silence build of smartd.service file.
Integrate all ENABLE_* conditionals in MAN_FILTER script.
2015-04-21 Christian Franke <franke@computer.org>
configure.ac: Print 'deprecated' warning for '--disable-drivedb',
'--enable-savestates', '--enable-attributelog' options.
Add 'yes|no' support to corresponding '--with-...' options.
2015-04-19 Christian Franke <franke@computer.org>
AUTHORS: Remove smartmontools-support list address.
Remove defunct mail addresses. Update smartsuite info.
Add recent contributors.
README: Refer to AUTHORS.
2015-04-18 Christian Franke <franke@computer.org>
os_win32.cpp: Add SAT autodetection based on vendor string from
IOCTL_STORAGE_QUERY_PROPERTY.
smartd.cpp: If SMART ENABLE command failed, continue if SMART is
already enabled.
2015-04-17 Christian Franke <franke@computer.org>
os_win32.cpp: Detect SAT layer of certain Intel AHCI drivers.
2015-04-15 Christian Franke <franke@computer.org>
smartctl.8.in, smartd.8.in, update-smart-drivedb.8.in:
Add REPORTING BUGS section.
smartctl.8.in, smartd.8.in:
Rename RETURN VALUE section to EXIT STATUS.
smartd.8.in: Remove no longer used exit status 9.
2015-04-14 Christian Franke <franke@computer.org>
autogen.sh: automake 1.15 works.
Print 'deprecated' warning if automake < 1.10 is used.
2015-04-08 Christian Franke <franke@computer.org>
configure.ac: Print 'deprecated' warning if autoconf 2.5x or
--with-docdir option is used.
Add comments to fix vim syntax coloring.
smartctl.8.in, smartd.8.in, smartd.conf.5.in:
Remove EXPERIMENTAL notes for features added before 6.3.
2015-03-29 Christian Franke <franke@computer.org>
ataprint.cpp: Read only required log pages of Extended Comprehensive
Error log. This adds support for logs with many pages (ticket #498).
atacmds.cpp, atacmds.h, smartd.cpp: Add 'page' parameter to function
ataReadExtErrorLog().
2015-03-22 Christian Franke <franke@computer.org>
os_linux.cpp, smartctl.8.in, smartd.8.in, smartd.conf, smartd.conf.5.in,
smartd.cpp: Remove old Linux IDE device names (/dev/hdX) in man pages
and help texts.
2015-03-21 Christian Franke <franke@computer.org>
smartd.8.in, smartd.cpp: Clarify smartd '--capabilities' option
(ticket #523).
2015-03-20 Christian Franke <franke@computer.org>
drivedb.h:
- Crucial/Micron MX100/MX200/M5x0/M600 Client SSDs: Rename, add MX200
- Sandforce Driven SSDs: ATP Velocity MIV, Mushkin Chronos Enhanced
- Indilinx Barefoot 3 based SSDs: OCZ VERTEX 460, OCZ AMD Radeon R7
- Intel 530 Series SSDs: mSATA variant
- JMicron based SSDs: ADATA SP310
- Plextor M3/M5/M6 Series SSDs: Rename, add M6M, M6S
2015-03-13 Douglas Gilbert <dgilbert@interlog.com>
scsiata.cpp
- SCSI to ATA translation: from SAT-2 and later a SAT layer may
return ATA registers via fixed format sense data. Change to
additionally accept (partial) fixed format sense. In response
to ticket #296 and FreeBSD Bug 191717.
2015-03-10 Douglas Gilbert <dgilbert@interlog.com>
scsicmds.cpp, scsiprint.cpp
- SCSI: when READ DEFECT yields sense of "... defect list not found"
bypass the corresponding report quietly. (ticket #343)
2015-02-08 Christian Franke <franke@computer.org>
drivedb.h:
- USB: Buffalo Drivestation Duo (0x0411:0x01ce)
- USB: Toshiba Canvio Basics (0x0480:0x0201, 0xa00d)
- USB: Toshiba Stor.E Basics (0x0480:0xa00c)
- USB: Toshiba Canvio ALU (0x0480:0xa100)
- USB: Toshiba Canvio Desktop (0x0480:0xd000)
- USB: Samsung S2 Portable (0x04e8:0x1f0a)
- USB: Samsung S3 Portable (0x04e8:0x61c8)
- USB: LaCie Rugged Triple Interface (0x059f:0x100c)
- USB: Initio (0x13fd:0x3910)
- USB: ASMedia (0x174c:0x5516)
- USB: Innostor IS611 (0x1f75:0x0611)
2015-02-02 Christian Franke <franke@computer.org>
drivedb.h:
- USB: Seagate FreeAgent XTreme (0x0bc2:0x3101)
- USB: Seagate Expansion Portable (0x0bc2:0x232[01])
- USB: Seagate Expansion External (0x0bc2:0x3321)
- USB: Seagate FreeAgent GoFlex (0x0bc2:0x5070, 0x50a7, 0x6121)
- USB: Seagate Slim Portable Drive (0x0bc2:0xab00) (ticket #517)
- USB: Seagate Backup Plus Slim (0x0bc2:0xab21)
- USB: ADATA HD650 (0x125f:0xa35a)
- USB: JMicron JMS567 (0x152d:0x3562) (ticket #508)
- USB: Innostor IS621 (0x1f75:0x0621) (ticket #517)
2015-01-25 Christian Franke <franke@computer.org>
drivedb.h:
- JMicron based SSDs: Transcend SSD340 (ticket #348)
- SiliconMotion based SSDs: Transcend SSD370 (ticket #468)
2015-01-24 Christian Franke <franke@computer.org>
os_win32.cpp: Add Windows 10 to get_os_version_str().
2015-01-01 Christian Franke <franke@computer.org>
Happy New Year! Update copyright year in version info.
2014-12-13 Christian Franke <franke@computer.org>
drivedb.h:
- USB: SanDisk SDCZ80 Flash Drive (0x0781:0x5580)
- USB: WD My Passport: Merge entries, add 0x1058:0x0810
- USB: WD Elements Desktop: Merge entries, add 0x1058:0x107c
- USB: WD Elements: Merge entries
- USB: JMicron JMS539 (0x152d:0x0539): 2.06 and 28.03 support SAT
(ticket #504)
- USB: JMicron JMS567 (0x152d:0x0567) (ticket #504)
- USB: JMicron JMS566 (0x152d:0x2566)
- USB: Hitachi Touro (0x4971:0x1014)
2014-12-13 Christian Franke <franke@computer.org>
utility.cpp, utility.h: Remove unused functions Calloc() and
CheckFree().
2014-12-10 Christian Franke <franke@computer.org>
drivedb.h:
- Western Digital Blue: Rename, *AZLX variant
- Western Digital RE4: *FBYZ variant
- Western Digital Green: Rename, add 5TB, 6TB
- Western Digital AV: Rename, add 1TB, *BUCT variant
- Western Digital Red: Rename, add 750GB, 5TB, 6TB
- Western Digital Black Mobile
2014-12-08 Christian Franke <franke@computer.org>
drivedb.h:
- Hitachi Travelstar 5K500.B: *SA00 variant
- Hitachi/HGST Travelstar Z5K500: Hitachi variant, Apple OEM
- HGST Travelstar 5K1000
- HGST Travelstar 5K1500
- Hitachi Travelstar 7K500: *A360 variant
- Hitachi CinemaStar 5K320
- Hitachi Deskstar 7K1000.C: SATA 6Gb/s variants
- HGST Deskstar NAS
- Hitachi/HGST Ultrastar 7K4000: Rename, add HGST
- HGST MegaScale 4000
2014-12-07 Christian Franke <franke@computer.org>
os_linux.cpp: Fix fd leak in megasas_dcmd_cmd(). Found by cppcheck.
2014-12-07 Christian Franke <franke@computer.org>
drivedb.h:
- Crucial/Micron MX100/M500/M510/M550/M600 Client SSDs: M600 EE variant
- SandForce Driven SSDs: Kingston KC300 180GB
- Indilinx Barefoot 3 based SSDs: OCZ Vector 150
- JMicron based SSDs: Kingston SSDNow V+
- Plextor M3/M5 (Pro) Series SSDs: M5P
- Samsung based SSDs: 850 PRO, SM853T Series
2014-12-06 Christian Franke <franke@computer.org>
Makefile.am: Add quotes to parameters of INSTALL commands to allow path
names with spaces (this is supported since automake 1.8).
update-smart-drivedb.in: Add quotes to SMARTCTL variable (ticket #502).
2014-11-30 Christian Franke <franke@computer.org>
drivedb.h:
- Crucial/Micron RealSSD m4/C400/P400: C400 *MAM variant
- Crucial/Micron MX100/M500/M510/M550/M600 Client SSDs: Rename,
add Crucial M500/M550, Micron M600
- SandForce Driven SSDs: ADATA SX900 (ticket #490), Mushkin Atlas
- Intel 311/313 Series SSDs: Rename, add 311 Series
2014-11-30 Christian Franke <franke@computer.org>
drivedb.h: USB: Prolific PL2571, PL2771, PL2775 (0x067b:0x2.7.)
(ticket #499).
smartctl.8.in, smartd.conf.5.in: Update '-d usbprolific' documentation.
2014-11-29 Christian Franke <franke@computer.org>
smartctl.8.in, smartd.8.in, smartd.conf.5.in, update-smart-drivedb.8.in:
Add package title to page header. Move PACKAGE VERSION section to bottom
of page. Remove SVN ID section header.
2014-11-29 Tommy Vestermark <tommy.vestermark@gmail.com>
scsiata.cpp: Add DATA OUT support for Prolific (ticket #482).
Add more ATA output registers. SCT commands are now supported.
2014-11-29 Christian Franke <franke@computer.org>
os_win32.cpp: Add strnicmp() compatibility macro for newer Cygwin
releases.
2014-11-16 Tommy Vestermark <tommy.vestermark@gmail.com>
drivedb.h: USB: Prolific PL2773 (0x067b:0x2773) (ticket #482).
2014-11-16 Christian Franke <franke@computer.org>
Create branches RELEASE_6_[1-3]_DRIVEDB with last drivedb.h file
compatible with smartmontools 6.[1-3].
2014-11-10 Tommy Vestermark <tommy.vestermark@gmail.com>
scsiata.cpp: Add class usbprolific_device to support Prolific PL2773
USB bridges (ticket #482).
smartctl.8.in, smartd.conf.5.in: Document '-d usbprolific'.
2014-11-09 Roger Willcocks <roger@filmlight.ltd.uk>
os_linux.cpp: linux_aacraid_device: Fix ioctl data count
if dxfer_len == 0. Return scsi sense data. Together these
allow the SMART STATUS command to operate correctly.
Improve SRB status checks.
linux_ata_device: Fix very old bug in the error handling
of HDIO_DRIVE_TASKFILE.
2014-10-07 Alex Samorukov <samm@os2.kiev.ua> 2014-10-07 Alex Samorukov <samm@os2.kiev.ua>

228
INSTALL
View File

@ -1,7 +1,7 @@
Smartmontools installation instructions Smartmontools installation instructions
======================================= =======================================
$Id: INSTALL 3935 2014-07-05 16:28:06Z chrfranke $ $Id: INSTALL 4094 2015-05-27 21:41:17Z chrfranke $
Please also see the smartmontools home page: Please also see the smartmontools home page:
http://smartmontools.sourceforge.net/ http://smartmontools.sourceforge.net/
@ -32,49 +32,6 @@ Table of contents:
kernel version greater than or equal to 2.2.14. So any recent kernel version greater than or equal to 2.2.14. So any recent
Linux distribution should support smartmontools. Linux distribution should support smartmontools.
There are two parts of smartmontools that may require a patched or
nonstandard kernel:
(1) To get the ATA RETURN SMART STATUS command, the kernel needs
to support the HDIO_DRIVE_TASK ioctl().
(2) To run Selective Self-tests, the kernel needs to support the
HDIO_DRIVE_TASKFILE ioctl().
If your kernel does not support one or both of these ioctls, then
smartmontools will "mostly" work. The things that don't work will
give you harmless warning messages.
For item (1) above, any 2.4 or 2.6 series kernel will provide
HDIO_DRIVE_TASK support. Some 2.2.20 and later kernels also
provide this support IF they're properly patched and
configured. [Andre Hedrick's IDE patches may be found at
http://www.nic.funet.fi/pub/linux/kernel/people/hedrick/ide-2.2.20/
or are available from your local kernel.org mirror. They are not
updated for 2.2.21 or later, and may contain a few bugs.].
If the configuration option CONFIG_IDE_TASK_IOCTL
exists in your 2.2.X kernel source code tree, then your 2.2.X
kernel will probably support this ioctl. [Note that this kernel
configuration option does NOT need to be enabled. Its presence
merely indicates that the required HDIO_DRIVE_TASK ioctl() is
supported.]
For item (2) above, your kernel must be configured with the kernel
configuration option CONFIG_IDE_TASKFILE_IO enabled. This
configuration option is present in all 2.4 and 2.6 series
kernels. Some 2.2.20 and later kernels also provide this support
IF they're properly patched and configured as described above.
Please see FAQ section of the URL above for additional details.
If you are using 3ware controllers, for full functionality you
must either use version 1.02.00.037 or greater of the 3w-xxxx
driver, or patch earlier 3ware 3w-xxxx drivers. See
http://smartmontools.sourceforge.net/3w-xxxx.txt
for the patch. The version 1.02.00.037 3w-xxxx.c driver was
incorporated into kernel 2.4.23-bk2 on 3 December 2003 and into
kernel 2.6.0-test5-bk11 on 23 September 2003.
B) FreeBSD B) FreeBSD
For FreeBSD support, a 5-current kernel that includes ATAng is For FreeBSD support, a 5-current kernel that includes ATAng is
@ -106,9 +63,9 @@ Table of contents:
F) Windows F) Windows
The code was tested on Windows XP SP3, 2003, Vista, Windows 7 and The code was tested on Windows XP SP3, 2003, Vista, Windows 7, 8, 8.1
Windows 8 Release Preview. Support von Windows 9x/ME and NT4 was removed and Windows 10 Release Preview. Support von Windows 9x/ME and NT4 was
after smartmontools 5.43. removed after smartmontools 5.43.
ATA or SATA devices are supported if the device driver implements ATA or SATA devices are supported if the device driver implements
the SMART IOCTLs or IOCTL_IDE_PASS_THROUGH or IOCTL_ATA_PASS_THROUGH. the SMART IOCTLs or IOCTL_IDE_PASS_THROUGH or IOCTL_ATA_PASS_THROUGH.
@ -179,7 +136,7 @@ Table of contents:
The code was tested on eComStation 1.1, but it should work on all versions The code was tested on eComStation 1.1, but it should work on all versions
of OS/2. of OS/2.
Innotek LibC 0.5 runtime is required. Innotek LibC 0.5 runtime is required.
Currently only ATA disks are supported, SCSI support will be added. Only ATA disks are supported.
[2] Installing from SVN [2] Installing from SVN
======================= =======================
@ -210,22 +167,31 @@ Table of contents:
make install (you may need to be root to do this) make install (you may need to be root to do this)
As shown (with no options to ./configure) this defaults to the As shown (with no options to ./configure) this defaults to the
following set of installation directories: following set of installation directories and other settings:
--prefix=/usr/local --prefix=/usr/local
--sbindir=/usr/local/sbin --exec-prefix='${prefix}'
--sysconfdir=/usr/local/etc --sbindir='${exec_prefix}/sbin'
--mandir=/usr/local/share/man --sysconfdir='${prefix}/etc'
--docdir=/usr/local/share/doc/smartmontools --localstatedir='${prefix}/var'
--with-exampledir=/usr/local/share/doc/smartmontools/examplescripts --datarootdir='${prefix}/share'
--with-drivedbdir=/usr/local/share/smartmontools --datadir='${datarootdir}'
--with-initscriptdir=auto --mandir='${datarootdir}/man'
--with-systemdsystemunitdir=auto --docdir='${datarootdir}/doc/smartmontools'
--enable-drivedb
--disable-attributelog
--disable-sample --disable-sample
--disable-savestates --with-systemdsystemunitdir=auto
--with-libcap-ng=auto --with-systemdenvfile=auto
--with-initscriptdir=auto
--with-exampledir='${docdir}/examplescripts'
--with-drivedbdir='${datadir}/smartmontools'
--with-smartdscriptdir='${sysconfdir}'
--with-smartdplugindir='${smartdscriptdir}/smartd_warning.d'
--without-savestates
--without-attributelog
--with-os-deps='os_linux.o dev_areca.o' (platform specific)
--without-selinux --without-selinux
--with-libcap-ng=auto
--with-working-snprintf
These will usually not overwrite existing "distribution" installations on These will usually not overwrite existing "distribution" installations on
Linux Systems since the FHS reserves this area for use by the system Linux Systems since the FHS reserves this area for use by the system
@ -415,35 +381,17 @@ To compile the Windows release with MinGW gcc on MSYS, use:
Instead of using "make install", copy the .exe files into Instead of using "make install", copy the .exe files into
some directory in the PATH. some directory in the PATH.
Cross-compile statically linked 32-bit version with MinGW-w64: Cross-compile statically linked 32-bit and 64-bit versions with MinGW-w64:
./configure --build=$(./config.guess) \ ./configure --build=$(./config.guess) \
--host=i686-w64-mingw32 \ --host=i686-w64-mingw32 \
LDFLAGS=-static LDFLAGS=-static
Tested on Cygwin and Debian Linux.
Cross-compile statically linked 64-bit version with MinGW-w64:
./configure --build=$(./config.guess) \ ./configure --build=$(./config.guess) \
--host=x86_64-w64-mingw32 \ --host=x86_64-w64-mingw32 \
LDFLAGS=-static LDFLAGS=-static
Tested on Cygwin and Debian Linux with MinGW-w64 from Tested on Cygwin, Debian and Fedora.
http://mingw-w64.sourceforge.net/.
Cross-compile on Cygwin with old gcc-mingw 3.x:
./configure --build=$(./config.guess) \
--host=i686-pc-mingw32 \
CC='gcc-3 -mno-cygwin' \
CXX='g++-3 -mno-cygwin' \
CXXFLAGS='-g -O2 -Wall -W -Wno-format'
Cross-compile on Debian Linux with gcc-mingw32:
./configure --build=$(./config.guess) \
--host=i586-mingw32msvc
To build the Windows binary distribution, use: To build the Windows binary distribution, use:
@ -472,7 +420,8 @@ To create a Windows installer, use:
download location. download location.
It is also possible to (cross-)build the installer on Linux. It is also possible to (cross-)build the installer on Linux.
This was successfully tested on Debian with package "nsis". This was successfully tested on Debian and Fedora with package
"nsis".
To create a combined 32-/64-bit installer, use this in 32-bit build To create a combined 32-/64-bit installer, use this in 32-bit build
directory if 64-build directory is at ../build64: directory if 64-build directory is at ../build64:
@ -488,14 +437,6 @@ To both create and run the (interactive) installer, use:
The binary distribution includes all documentation files converted The binary distribution includes all documentation files converted
to DOS text file format and *.html and *.txt preformatted man pages. to DOS text file format and *.html and *.txt preformatted man pages.
The tools unix2dos.exe (package cygutils) and zip.exe (package zip
or a native Win32 release of Info-ZIP, http://www.info-zip.org) are
necessary but may be not installed by Cygwin's default settings.
The event message file tool syslogevt.exe (see smartd man page) is
included in the binary distribution if message compiler (windmc)
and resource compiler (windres) are available. This may be disabled
by passing 'WINDMC=no' to configure.
To prepare os_win32 directory for MS Visual Studio C++ 2010 [Express], To prepare os_win32 directory for MS Visual Studio C++ 2010 [Express],
use the following on MSYS or Cygwin: use the following on MSYS or Cygwin:
@ -506,9 +447,9 @@ use the following on MSYS or Cygwin:
The MSVC project files (os_win32/vc10/*) are included in SVN (but not The MSVC project files (os_win32/vc10/*) are included in SVN (but not
in source tarball). The target config-vc10 from a Makefile configured in source tarball). The target config-vc10 from a Makefile configured
for MinGW creates os_win32/vc10/{config,svnversion}.h from for MinGW creates os_win32/vc10/{config.h,smart*.rc,svnversion.h}.
./{config,svnversion}.h. The configure skript must be run outside The configure skript must be run outside of the source directory to
of the source directory to avoid inclusion of the original config.h. avoid inclusion of the original config.h.
[11] Guidelines for OS/2, eComStation [11] Guidelines for OS/2, eComStation
@ -567,8 +508,8 @@ man smartd.conf
man smartctl man smartctl
man smartd man smartd
/usr/sbin/smartctl -s on -o on -S on /dev/hda (only root can do this) /usr/sbin/smartctl -s on -o on -S on /dev/sda (only root can do this)
/usr/sbin/smartctl -a /dev/hda (only root can do this) /usr/sbin/smartctl -a /dev/sda (only root can do this)
Note that the default location for the manual pages are Note that the default location for the manual pages are
/usr/share/man/man5 and /usr/share/man/man8. If "man" doesn't find /usr/share/man/man5 and /usr/share/man/man8. If "man" doesn't find
@ -587,22 +528,30 @@ The following files are installed if ./configure has no options:
/usr/local/sbin/smartd [Executable daemon] /usr/local/sbin/smartd [Executable daemon]
/usr/local/sbin/update-smart-drivedb [Drive database update script] /usr/local/sbin/update-smart-drivedb [Drive database update script]
/usr/local/etc/smartd.conf [Configuration file for smartd daemon] /usr/local/etc/smartd.conf [Configuration file for smartd daemon]
/usr/local/etc/rc.d/init.d/smartd [Init/Startup script for smartd] /usr/local/etc/smartd_warning.sh [Warning skript for smartd daemon]
/usr/local/share/man/man5/smartd.conf.5 [Manual page] /usr/local/share/man/man5/smartd.conf.5 [Manual page]
/usr/local/share/man/man8/smartctl.8 [Manual page] /usr/local/share/man/man8/smartctl.8 [Manual page]
/usr/local/share/man/man8/smartd.8 [Manual page] /usr/local/share/man/man8/smartd.8 [Manual page]
/usr/local/share/man/man8/update-smart-drivedb.8 [Manual page]
/usr/local/share/doc/smartmontools/AUTHORS [Information about the authors and developers] /usr/local/share/doc/smartmontools/AUTHORS [Information about the authors and developers]
/usr/local/share/doc/smartmontools/ChangeLog [A log of changes. Also see SVN] /usr/local/share/doc/smartmontools/ChangeLog [A log of changes. Also see SVN]
/usr/local/share/doc/smartmontools/COPYING [GNU General Public License Version 2] /usr/local/share/doc/smartmontools/COPYING [GNU General Public License Version 2]
/usr/local/share/doc/smartmontools/INSTALL [Installation instructions: what you're reading!] /usr/local/share/doc/smartmontools/INSTALL [Installation instructions: what you're reading!]
/usr/local/share/doc/smartmontools/NEWS [Significant bugs discovered in old versions] /usr/local/share/doc/smartmontools/NEWS [Significant enhancements and fixes]
/usr/local/share/doc/smartmontools/README [Overview] /usr/local/share/doc/smartmontools/README [Overview]
/usr/local/share/doc/smartmontools/TODO [Things that need to be done/fixed] /usr/local/share/doc/smartmontools/TODO [Things that need to be done/fixed]
/usr/local/share/doc/smartmontools/WARNINGS [Systems where lockups or other serious problems were reported]
/usr/local/share/doc/smartmontools/smartd.conf [Example configuration file for smartd] /usr/local/share/doc/smartmontools/smartd.conf [Example configuration file for smartd]
/usr/local/share/doc/smartmontools/examplescripts/ [Executable scripts for -M exec of smartd.conf (4 files)] /usr/local/share/doc/smartmontools/examplescripts/ [Executable scripts for -M exec of smartd.conf (4 files)]
/usr/local/share/smartmontools/drivedb.h [Drive database] /usr/local/share/smartmontools/drivedb.h [Drive database]
Due to checks done by '--with-systemdsystemunitdir=auto' and '--with-initscriptdir=auto',
one of the following files may also be installed:
/usr/local/lib/systemd/system/smartd.service [Systemd service file for smartd]
/usr/local/etc/rc.d/init.d/smartd [Init/Startup script for smartd]
/usr/local/etc/init.d/smartd [Init/Startup script for smartd]
/usr/local/etc/rc.d/smartd [Init/Startup script for smartd]
If /usr/local/etc/smartd.conf exists and differs from the If /usr/local/etc/smartd.conf exists and differs from the
default then the default configuration file is installed as default then the default configuration file is installed as
/usr/local/etc/smartd.conf.sample instead. /usr/local/etc/smartd.conf.sample instead.
@ -640,52 +589,23 @@ a documentation file doc/latex/refman.pdf:
=========================================================== ===========================================================
When you type: When you type:
./configure [options] ./configure --help
there are six particularly important variables that affect where the a description of available configure options is printed
smartmontools software is installed. The variables are listed here, [with defaults in square brackets]. See also section [3] above.
with their default values in square brackets, and the quantities that
they affect described following that. This is a very wide table: please read
it in a wide window.
OPTIONS DEFAULT AFFECTS
------- ------- -------
--prefix /usr/local Please see below
--sbindir ${prefix}/sbin Directory for smartd/smartctl executables;
Contents of smartd/smartctl man pages
--docdir ${prefix}/share/doc/smartmontools Location of the documentation
(autoconf >= 2.60 only, see also --with-docdir below)
--mandir ${prefix}/share/man Directory for smartctl/smartd/smartd.conf man pages
--sysconfdir ${prefix}/etc Directory for smartd.conf;
Contents of smartd executable;
Contents of smartd/smartd.conf man pages;
Directory for rc.d/init.d/smartd init script
--with-initscriptdir auto Location of init scripts
--with-systemdsystemunitdir auto Location of systemd service files
--with-systemdenvfile ${sysconfdir}/sysconfig/smartmontools Path of environment file for system service
--with-docdir ${prefix}/share/doc/smartmontools Location of the documentation
--with-exampledir ${docdir}/examplescripts Location of example scripts
--enable-sample --disable-sample Adds the string '.sample' to the names of the smartd.conf file and the smartd RC file
--with-os-deps os_<guessed>.o OS dependent module(s)
--with-selinux --without-selinux Enables SELinux support. If smartmontools has to create the /dev/tw[ae] device
nodes for 3ware/AMCC controllers, this option ensures that the nodes are created
with correct SELinux file contexts.
--with-libcap-ng --with-libcap-ng=auto Enables/disables libcap-ng support. If enabled and libcap-ng is
available, option --capabilities is added to smartd.
--disable-drivedb --enable-drivedb Disables default drive database file '${drivedbdir}/drivedb.h'
--with-drivedbdir ${prefix}/share/smartmontools Directory for 'drivedb.h' (implies --enable-drivedb)
--with-smartdscriptdir ${sysconfdir} Directory for 'smartd_warning.sh' script
--with-smartdplugindir ${sysconfdir}/smartd_warning.d Directory for 'smartd_warning.sh' plugin scripts
--enable-savestates --disable-savestates Enables default smartd state files '${savestates}MODEL-SERIAL.ata.state'
--with-savestates ${prefix}/var/lib/smartmontools/smartd. Prefix for smartd state files (implies --enable-savestates)
--enable-attributelog --disable-attributelog Enables default smartd attribute log files
--with-attributelog ${prefix}/var/lib/smartmontools/attrlog. Prefix for smartd attribute log files (implies --enable-attributelog)
--with-working-snprintf MinGW:guessed,others:yes Function snprintf() handles output truncation as specified by C99
Please note that in previous versions of smartmontools (<= 5.39) the The following old configure options are deprecated and will be removed
default for --with-docdir was in a future release of smartmontools:
${prefix}/share/doc/smartmontools-VERSION
This was changed to make it consistent with the default of the Old option Replacement
new --docdir option added in autoconf 2.60. --with-docdir=DIR --docdir=DIR (autoconf >= 2.60)
--enable-drivedb [no option needed]
--disable-drivedb --without-drivedbdir
--enable-savestates --with-savestates[=yes]
--disable-savestates [no option needed]
--enable-attrbutelog --with-attributelog[=yes]
--disable-savestates [no option needed]
The defaults for --with-initscriptdir and --with-systemdsystemunitdir are The defaults for --with-initscriptdir and --with-systemdsystemunitdir are
guessed such that the following rules apply: guessed such that the following rules apply:
@ -732,30 +652,6 @@ else
--with-initscriptdir [disabled] --with-initscriptdir [disabled]
--with-systemdsystemunitdir [disabled] --with-systemdsystemunitdir [disabled]
This is useful for test installs in a harmless subdirectory somewhere.
Here are the four possible cases for the four variables above:
Case 1:
--prefix not set
--variable not set
===> VARIABLE gets default value above
Case 2:
--prefix set
--variable not set
===> VARIABLE gets PREFIX/ prepended to default value above
Case 3:
--prefix not set
--variable set
===> VARIABLE gets value that is set
Case 4:
--prefix is set
--variable is set
===> PREFIX is IGNORED, VARIABLE gets value that is set
Here are the differences with and without --enable-sample, assuming Here are the differences with and without --enable-sample, assuming
that initscript location is set and no other options specified that initscript location is set and no other options specified

View File

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
# #
# $Id: Makefile.am 3957 2014-07-18 18:39:06Z chrfranke $ # $Id: Makefile.am 4102 2015-06-01 19:25:47Z chrfranke $
# #
@SET_MAKE@ @SET_MAKE@
@ -78,8 +78,8 @@ smartctl_SOURCES = \
utility.cpp \ utility.cpp \
utility.h utility.h
smartctl_LDADD = @os_deps@ @os_libs@ smartctl_LDADD = $(os_deps) $(os_libs)
smartctl_DEPENDENCIES = @os_deps@ smartctl_DEPENDENCIES = $(os_deps)
EXTRA_smartctl_SOURCES = \ EXTRA_smartctl_SOURCES = \
os_darwin.cpp \ os_darwin.cpp \
@ -138,8 +138,8 @@ smartd_SOURCES = \
utility.cpp \ utility.cpp \
utility.h utility.h
smartd_LDADD = @os_deps@ @os_libs@ @CAPNG_LDADD@ smartd_LDADD = $(os_deps) $(os_libs) $(CAPNG_LDADD)
smartd_DEPENDENCIES = @os_deps@ smartd_DEPENDENCIES = $(os_deps)
EXTRA_smartd_SOURCES = \ EXTRA_smartd_SOURCES = \
os_darwin.cpp \ os_darwin.cpp \
@ -255,8 +255,8 @@ endif
all-local: $(extra_MANS) all-local: $(extra_MANS)
install-man: $(extra_MANS) install-man: $(extra_MANS)
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(mandir)/man4 $(mkinstalldirs) '$(DESTDIR)$(mandir)/man4'
$(mkinstalldirs) $(DESTDIR)$(mandir)/man1m $(mkinstalldirs) '$(DESTDIR)$(mandir)/man1m'
for i in $(extra_MANS); do \ for i in $(extra_MANS); do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \ else file=$$i; fi; \
@ -264,8 +264,8 @@ install-man: $(extra_MANS)
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst"; \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(mandir)/man$$ext/$$inst'"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(mandir)/man$$ext/$$inst"; \
done done
uninstall-man: uninstall-man:
@$(NORMAL_UNINSTALL) @$(NORMAL_UNINSTALL)
@ -276,8 +276,8 @@ uninstall-man:
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst"; \ echo " rm -f '$(DESTDIR)$(mandir)/man$$ext/$$inst'"; \
rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst; \ rm -f "$(DESTDIR)$(mandir)/man$$ext/$$inst"; \
done done
else else
# For systems that adopts traditional manner # For systems that adopts traditional manner
@ -302,7 +302,6 @@ docs_DATA = \
NEWS \ NEWS \
README \ README \
TODO \ TODO \
WARNINGS \
smartd.conf smartd.conf
examplesdir=$(exampledir) examplesdir=$(exampledir)
@ -320,7 +319,7 @@ sysconf_DATA = smartd.conf
# If modified smartd.conf exists install smartd.conf.sample instead # If modified smartd.conf exists install smartd.conf.sample instead
install-sysconfDATA: $(sysconf_DATA) install-sysconfDATA: $(sysconf_DATA)
$(mkinstalldirs) $(DESTDIR)$(sysconfdir) $(mkinstalldirs) '$(DESTDIR)$(sysconfdir)'
@s="$(srcdir)/smartd.conf"; \ @s="$(srcdir)/smartd.conf"; \
f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \ f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \
if test -z "$(smartd_suffix)" && test -f "$$f"; then \ if test -z "$(smartd_suffix)" && test -f "$$f"; then \
@ -332,7 +331,7 @@ install-sysconfDATA: $(sysconf_DATA)
f="$$f".sample; \ f="$$f".sample; \
fi; \ fi; \
fi; \ fi; \
echo " $(INSTALL_DATA) $$s $$f"; \ echo " $(INSTALL_DATA) '$$s' '$$f'"; \
$(INSTALL_DATA) "$$s" "$$f" $(INSTALL_DATA) "$$s" "$$f"
# If smartd.conf.sample exists preserve smartd.conf # If smartd.conf.sample exists preserve smartd.conf
@ -345,7 +344,7 @@ uninstall-sysconfDATA:
echo "************************************************************"; \ echo "************************************************************"; \
f="$$f".sample; \ f="$$f".sample; \
fi; \ fi; \
echo " rm -f $$f"; \ echo " rm -f '$$f'"; \
rm -f "$$f" rm -f "$$f"
smartdscript_SCRIPTS = smartd_warning.sh smartdscript_SCRIPTS = smartd_warning.sh
@ -491,10 +490,10 @@ uninstall-initdDATA-darwin:
else else
initd_DATA = @initdfile@ initd_DATA = $(initdfile)
@initdfile@: $(srcdir)/@initdfile@.in Makefile $(initdfile): $(srcdir)/$(initdfile).in Makefile
sed "s|/usr/local/sbin/|$(sbindir)/|g" $(srcdir)/@initdfile@.in > $@ sed 's|/usr/local/sbin/|$(sbindir)/|g' $(srcdir)/$(initdfile).in > $@
initd_install_name = smartd$(smartd_suffix) initd_install_name = smartd$(smartd_suffix)
@ -502,12 +501,11 @@ initd_DATA_install = install-initdDATA-generic
initd_DATA_uninstall = uninstall-initdDATA-generic initd_DATA_uninstall = uninstall-initdDATA-generic
install-initdDATA-generic: $(initd_DATA) install-initdDATA-generic: $(initd_DATA)
$(mkinstalldirs) $(DESTDIR)$(initddir) $(mkinstalldirs) '$(DESTDIR)$(initddir)'
$(INSTALL_SCRIPT) $(top_builddir)/@initdfile@ $(DESTDIR)$(initddir)/smartd$(smartd_suffix) $(INSTALL_SCRIPT) '$(top_builddir)/$(initdfile)' '$(DESTDIR)$(initddir)/smartd$(smartd_suffix)'
uninstall-initdDATA-generic: uninstall-initdDATA-generic:
rm -rf $(DESTDIR)$(initddir)/$(initd_install_name) rm -f '$(DESTDIR)$(initddir)/$(initd_install_name)'
endif endif
else else
@ -527,7 +525,8 @@ systemdsystemunit_DATA = smartd.service
endif endif
smartd.service: smartd.service.in Makefile smartd.service: smartd.service.in Makefile
cat $(srcdir)/smartd.service.in | \ @echo ' cat $(srcdir)/smartd.service.in | $$(SMARTD_SERVICE_FILTER) > $@'
@cat $(srcdir)/smartd.service.in | \
sed 's|/usr/local/sbin/smartd|$(sbindir)/smartd|' | \ sed 's|/usr/local/sbin/smartd|$(sbindir)/smartd|' | \
if test -n '$(systemdenvfile)'; then \ if test -n '$(systemdenvfile)'; then \
sed 's|/usr/local/etc/sysconfig/smartmontools|$(systemdenvfile)|'; \ sed 's|/usr/local/etc/sysconfig/smartmontools|$(systemdenvfile)|'; \
@ -542,7 +541,7 @@ smartd.service: smartd.service.in Makefile
installdirs-local: installdirs-local:
@for d in '$(smartdplugindir)' '$(savestatesdir)' '$(attributelogdir)'; do \ @for d in '$(smartdplugindir)' '$(savestatesdir)' '$(attributelogdir)'; do \
test -n "$$d" || continue; \ test -n "$$d" || continue; \
echo "$(mkinstalldirs) $(DESTDIR)$$d"; \ echo " $(mkinstalldirs) '$(DESTDIR)$$d'"; \
$(mkinstalldirs) "$(DESTDIR)$$d" || exit 1; \ $(mkinstalldirs) "$(DESTDIR)$$d" || exit 1; \
done done
@ -551,37 +550,12 @@ install-data-local: installdirs-local
# #
# Build man pages # Build man pages
# #
if ENABLE_CAPABILITIES
MAN_CAPABILITIES = cat
else
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 '/^\.\\" %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 '/^\.\\" %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 '/^\.\\" %IF ENABLE_ATTRIBUTELOG/,/^\.\\" %ENDIF ENABLE_ATTRIBUTELOG/ s,^,.\\"\# ,'
endif
MAN_FILTER = \ MAN_FILTER = \
sed -e 's|CURRENT_SVN_VERSION|$(releaseversion)|g' \ sed -e 's|CURRENT_SVN_VERSION|$(releaseversion)|g' \
-e "s|CURRENT_SVN_DATE|`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`|g" \ -e "s|CURRENT_SVN_DATE|`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`|g" \
-e "s|CURRENT_SVN_REV|`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`|g" \ -e "s|CURRENT_SVN_REV|`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`|g" \
-e 's|/usr/local/share/man/|$(mandir)/|g' \ -e 's|/usr/local/share/man/|$(mandir)/|g' \
-e 's|/usr/local/sbin/|$(sbindir)/|g' \ -e 's|/usr/local/sbin/|$(sbindir)/|g' \
-e 's|/usr/local/etc/rc\.d/init.d/|$(initddir)/|g' \
-e 's|/usr/local/share/doc/smartmontools/examplescripts/|!exampledir!|g' \ -e 's|/usr/local/share/doc/smartmontools/examplescripts/|!exampledir!|g' \
-e 's|/usr/local/share/doc/smartmontools/|$(docsdir)/|g' \ -e 's|/usr/local/share/doc/smartmontools/|$(docsdir)/|g' \
-e 's|!exampledir!|$(exampledir)/|g' \ -e 's|!exampledir!|$(exampledir)/|g' \
@ -591,16 +565,37 @@ MAN_FILTER = \
-e 's|\\fBmail\\fP|\\fB$(os_mailer)\\fP|g' \ -e 's|\\fBmail\\fP|\\fB$(os_mailer)\\fP|g' \
-e 's|\\'\''mail\\'\''|\\'\''$(os_mailer)\\'\''|g' \ -e 's|\\'\''mail\\'\''|\\'\''$(os_mailer)\\'\''|g' \
-e 's|/usr/bin/mail|/usr/bin/$(os_mailer)|g' \ -e 's|/usr/bin/mail|/usr/bin/$(os_mailer)|g' \
-e 's|RELEASE_6_0_DRIVEDB|@DRIVEDB_BRANCH@|g' | \ -e 's|RELEASE_6_0_DRIVEDB|$(DRIVEDB_BRANCH)|g' | \
if test -n '$(drivedbdir)'; then \
sed 's|/usr/local/share/smartmontools/drivedb\.h|$(drivedbdir)/drivedb.h|g' ; \
else \
sed '/^\.\\" %IF ENABLE_DRIVEDB/,/^\.\\" %ENDIF ENABLE_DRIVEDB/ s,^,.\\"\# ,' ; \
fi | \
if test -n '$(initddir)'; then \
sed 's|/usr/local/etc/rc\.d/init\.d/|$(initddir)/|g' ; \
else \
sed '/^\.\\" %IF ENABLE_INITSCRIPT/,/^\.\\" %ENDIF ENABLE_INITSCRIPT/ s,^,.\\"\# ,' ; \
fi | \
if test -n '$(savestates)'; then \
sed 's|/usr/local/var/lib/smartmontools/smartd\.|$(savestates)|g' ; \
else \
sed '/^\.\\" %IF ENABLE_SAVESTATES/,/^\.\\" %ENDIF ENABLE_SAVESTATES/ s,^,.\\"\# ,' ; \
fi | \
if test -n '$(attributelog)'; then \
sed 's|/usr/local/var/lib/smartmontools/attrlog\.|$(attributelog)|g' ; \
else \
sed '/^\.\\" %IF ENABLE_ATTRIBUTELOG/,/^\.\\" %ENDIF ENABLE_ATTRIBUTELOG/ s,^,.\\"\# ,' ; \
fi | \
if test -n '$(smartdplugindir)'; then \ if test -n '$(smartdplugindir)'; then \
sed 's|/usr/local/etc/smartd_warning\.d|$(smartdplugindir)|g' ; \ sed 's|/usr/local/etc/smartd_warning\.d|$(smartdplugindir)|g' ; \
else \ else \
sed '/^\.\\" %IF ENABLE_SMARTDPLUGINDIR/,/^\.\\" %ENDIF ENABLE_SMARTDPLUGINDIR/ s,^,.\\"\# ,' ; \ sed '/^\.\\" %IF ENABLE_SMARTDPLUGINDIR/,/^\.\\" %ENDIF ENABLE_SMARTDPLUGINDIR/ s,^,.\\"\# ,' ; \
fi | \ fi | \
$(MAN_ATTRIBUTELOG) | \ if test -n '$(CAPNG_LDADD)'; then \
$(MAN_CAPABILITIES) | \ cat; \
$(MAN_DRIVEDB) | \ else \
$(MAN_SAVESTATES) | \ sed '/^\.\\" %IF ENABLE_CAPABILITIES/,/^\.\\" %ENDIF ENABLE_CAPABILITIES/ s,^,.\\"\# ,' ; \
fi | \
if test -n '$(os_man_filter)'; then \ if test -n '$(os_man_filter)'; then \
sed -e 's,OS_MAN_FILTER,$(os_man_filter),g' \ 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 NOT OS .*$(os_man_filter)/,/^.\\" %ENDIF NOT OS .*$(os_man_filter)/ s,^,.\\"\# ,' \
@ -773,7 +768,6 @@ FILES_WIN32 = \
$(docdir_win32)/NEWS.txt \ $(docdir_win32)/NEWS.txt \
$(docdir_win32)/README.txt \ $(docdir_win32)/README.txt \
$(docdir_win32)/TODO.txt \ $(docdir_win32)/TODO.txt \
$(docdir_win32)/WARNINGS.txt \
$(docdir_win32)/checksums$(win_bits).txt \ $(docdir_win32)/checksums$(win_bits).txt \
$(docdir_win32)/smartd.conf \ $(docdir_win32)/smartd.conf \
$(docdir_win32)/smartctl.8.html \ $(docdir_win32)/smartctl.8.html \

30
NEWS
View File

@ -1,11 +1,37 @@
smartmontools NEWS smartmontools NEWS
------------------ ------------------
$Id: NEWS 3979 2014-08-15 11:09:41Z samm2 $ $Id: NEWS 4109 2015-06-04 16:30:15Z chrfranke $
The most up-to-date version of this file is: The most up-to-date version of this file is:
http://sourceforge.net/p/smartmontools/code/HEAD/tree/trunk/smartmontools/NEWS http://sourceforge.net/p/smartmontools/code/HEAD/tree/trunk/smartmontools/NEWS
- darwin: '-S' command implemented, '-l devstat' should work now Date 2015-06-04
Summary: smartmontools release 6.4
-----------------------------------------------------------
- Device type '-d usbprolific' for Prolific PL2571/277x USB bridges.
- SAT: Support for ATA registers returned in fixed format sense data.
- smartctl '-i' and '--identify': ATA ACS-4 and SATA 3.2 enhancements.
- smartctl '-l xerror': Support for logs with more than 255 pages.
- smartctl '-l devstat': Prints ACS-3 DSN flags.
- smartctl '-l devstat': Read via SMART command if GP log is not
available.
- smartctl '-l scttempsts': Prints SCT SMART STATUS (ACS-4) and
vendor specific SCT bytes.
- configure option '--with-systemdenvfile=auto' as new default.
- configure options '--disable-drivedb', '--enable-savestates'
and '--enable-attributelog' are deprecated.
- Corresponding '--with-*' options are enhanced accordingly.
- Configure option '--with-docdir' is deprecated.
- autoconf < 2.60 and automake < 1.10 are deprecated.
(all of the above still work but a warning is printed if used)
- HDD, SSD and USB additions to drive database.
- Linux: AACRAID fixes, SMART STATUS should work now.
- Linux: '/dev/megaraid_sas_ioctl_node' fd leak fix.
- Darwin: '-S' command implemented, '-l devstat' should work now.
- Cygwin: Compile fix.
- Windows: Device type '-d aacraid' for AACRAID controllers.
- Windows: SAT autodetection based on IOCTL_STORAGE_QUERY_PROPERTY.
- Windows installer: Fix possible loss of user PATH environment variable.
Date 2014-07-26 Date 2014-07-26
Summary: smartmontools release 6.3 Summary: smartmontools release 6.3

16
README
View File

@ -3,7 +3,7 @@ smartmontools - S.M.A.R.T. utility toolset for Darwin/Mac
OSX, FreeBSD, Linux, NetBSD, OpenBSD, Solaris, and Windows. OSX, FreeBSD, Linux, NetBSD, OpenBSD, Solaris, and Windows.
========================================================== ==========================================================
$Id: README 3949 2014-07-13 17:23:40Z chrfranke $ $Id: README 4063 2015-04-19 17:34:25Z chrfranke $
== HOME == == HOME ==
The home for smartmontools is located at: The home for smartmontools is located at:
@ -19,8 +19,8 @@ You will find a mailing list for support and other questions at:
== COPYING == == COPYING ==
Copyright (C) 2002-9 Bruce Allen <smartmontools-support@lists.sourceforge.net> Copyright (C) 2002-9 Bruce Allen
Copyright (C) 2004-14 Christian Franke <smartmontools-support@lists.sourceforge.net> Copyright (C) 2004-15 Christian Franke
This program is free software; you can redistribute it and/or modify it 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 under the terms of the GNU General Public License as published by the Free
@ -32,10 +32,7 @@ example COPYING). If not, see <http://www.gnu.org/licenses/>.
== CREDITS == == CREDITS ==
This code was originally developed as a Senior Thesis by Michael Cornwell See AUTHORS file.
at the Concurrent Systems Laboratory (now part of the Storage Systems
Research Center), Jack Baskin School of Engineering, University of
California, Santa Cruz. http://ssrc.soe.ucsc.edu/
== OVERVIEW == == OVERVIEW ==
@ -85,11 +82,8 @@ Refer to the "INSTALL" file for detailed installation instructions.
== GETTING STARTED == == GETTING STARTED ==
To examine SMART data from a disk, try: To examine SMART data from a disk, try:
smartctl -a /dev/hda
for ATA disks, or
smartctl -a /dev/sda smartctl -a /dev/sda
for SCSI disks. See the manual page 'man smartctl' for more See the manual page 'man smartctl' for more information.
information.
To start automatic monitoring of your disks with the smartd daemon, To start automatic monitoring of your disks with the smartd daemon,
try: try:

View File

@ -1,4 +0,0 @@
$Id: WARNINGS 3904 2014-06-15 14:21:15Z chrfranke $
This file is no longer maintained, please see:
http://www.smartmontools.org/wiki/Warnings

View File

@ -1,5 +1,6 @@
/* aacraid.h /* aacraid.h
* Copyright (C) 2014 Raghava Aditya <Raghava.Aditya@pmcs.com> * Copyright (C) 2014 Raghava Aditya <Raghava.Aditya@pmcs.com>
* Copyright (C) 2015 Nidhi Malhotra <Nidhi.Malhotra@pmcs.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -12,8 +13,8 @@
*/ */
// Check windows // Check windows
#if _WIN32 || _WIN64 #if defined(_WIN32) || defined(_WIN64)
#if _WIN64 #ifdef _WIN64
#define ENVIRONMENT64 #define ENVIRONMENT64
#else #else
#define ENVIRONMENT32 #define ENVIRONMENT32
@ -32,10 +33,18 @@
#define METHOD_BUFFERED 0 #define METHOD_BUFFERED 0
#define METHOD_NEITHER 3 #define METHOD_NEITHER 3
#if defined(_WIN32) || defined(_WIN64)
#define FSAMPCTL_SCSI_BASE IOCTL_SCSI_BASE
#define ARCIOCTL_SEND_RAW_SRB CTL_CODE(FSAMPCTL_SCSI_BASE, 2201, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define AACRAID_SAS_SIGNATURE "ARCSAS"
#define SRB_FLAGS_DATA_IN 0x00000040
#define SRB_FLAGS_DATA_OUT 0x00000080
#define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000
#else
#define CTL_CODE(function, method) ((4<< 16) | ((function) << 2) | (method) ) #define CTL_CODE(function, method) ((4<< 16) | ((function) << 2) | (method) )
#define FSACTL_SEND_RAW_SRB CTL_CODE(2067, METHOD_BUFFERED) #define FSACTL_SEND_RAW_SRB CTL_CODE(2067, METHOD_BUFFERED)
#endif
#define SRB_FUNCTION_EXECUTE_SCSI 0X00 #define SRB_FUNCTION_EXECUTE_SCSI 0X00
#define SRB_DataIn 0x0040 #define SRB_DataIn 0x0040
@ -67,6 +76,45 @@ typedef struct {
user_sgentry32 sg32[1]; user_sgentry32 sg32[1];
} user_sgmap32; } user_sgmap32;
#if defined(_WIN32) || defined(_WIN64)
typedef struct _SCSI_REQUEST_BLOCK {
USHORT Length; // offset 0
UCHAR Function; // offset 2
UCHAR SrbStatus; // offset 3
UCHAR ScsiStatus; // offset 4
UCHAR PathId; // offset 5
UCHAR TargetId; // offset 6
UCHAR Lun; // offset 7
UCHAR QueueTag; // offset 8
UCHAR QueueAction; // offset 9
UCHAR CdbLength; // offset a
UCHAR SenseInfoBufferLength; // offset b
ULONG SrbFlags; // offset c
ULONG DataTransferLength; // offset 10
ULONG TimeOutValue; // offset 14
PVOID DataBuffer; // offset 18
PVOID SenseInfoBuffer; // offset 1c
struct _SCSI_REQUEST_BLOCK *NextSrb; // offset 20
PVOID OriginalRequest; // offset 24
PVOID SrbExtension; // offset 28
union {
ULONG InternalStatus; // offset 2c
ULONG QueueSortKey; // offset 2c
};
#if defined(_WIN64)
//
// Force PVOID alignment of Cdb
//
ULONG Reserved;
#endif
UCHAR Cdb[16]; // offset 30
} SCSI_REQUEST_BLOCK, *PSCSI_REQUEST_BLOCK;
#define SCSI_REQUEST_BLOCK_SIZE sizeof(SCSI_REQUEST_BLOCK)
#else
typedef struct { typedef struct {
uint32_t function; //SRB_FUNCTION_EXECUTE_SCSI 0x00 uint32_t function; //SRB_FUNCTION_EXECUTE_SCSI 0x00
uint32_t channel; //bus uint32_t channel; //bus
@ -103,3 +151,4 @@ typedef struct {
uint32_t sense_data_size; uint32_t sense_data_size;
uint8_t sense_data[30]; uint8_t sense_data[30];
} user_aac_reply; } user_aac_reply;
#endif

View File

@ -4,7 +4,7 @@
* Home page of code is: http://smartmontools.sourceforge.net * Home page of code is: http://smartmontools.sourceforge.net
* *
* Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 2008-14 Christian Franke <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2008-15 Christian Franke <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org> * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
* Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org>
* *
@ -35,7 +35,7 @@
#include "utility.h" #include "utility.h"
#include "dev_ata_cmd_set.h" // for parsed_ata_device #include "dev_ata_cmd_set.h" // for parsed_ata_device
const char * atacmds_cpp_cvsid = "$Id: atacmds.cpp 3998 2014-10-06 15:20:25Z chrfranke $" const char * atacmds_cpp_cvsid = "$Id: atacmds.cpp 4048 2015-03-29 16:09:04Z chrfranke $"
ATACMDS_H_CVSID; ATACMDS_H_CVSID;
// Print ATA debug messages? // Print ATA debug messages?
@ -1466,9 +1466,9 @@ static void fix_exterrlog_lba(ata_smart_exterrlog * log, unsigned nsectors)
// Read Extended Comprehensive Error Log // Read Extended Comprehensive Error Log
bool ataReadExtErrorLog(ata_device * device, ata_smart_exterrlog * log, bool ataReadExtErrorLog(ata_device * device, ata_smart_exterrlog * log,
unsigned nsectors, firmwarebug_defs firmwarebugs) unsigned page, unsigned nsectors, firmwarebug_defs firmwarebugs)
{ {
if (!ataReadLogExt(device, 0x03, 0x00, 0, log, nsectors)) if (!ataReadLogExt(device, 0x03, 0x00, page, log, nsectors))
return false; return false;
check_multi_sector_sum(log, nsectors, "SMART Extended Comprehensive Error Log Structure"); check_multi_sector_sum(log, nsectors, "SMART Extended Comprehensive Error Log Structure");

View File

@ -4,7 +4,7 @@
* Home page of code is: http://smartmontools.sourceforge.net * Home page of code is: http://smartmontools.sourceforge.net
* *
* Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 2008-14 Christian Franke <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2008-15 Christian Franke <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org> * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -25,7 +25,7 @@
#ifndef ATACMDS_H_ #ifndef ATACMDS_H_
#define ATACMDS_H_ #define ATACMDS_H_
#define ATACMDS_H_CVSID "$Id: atacmds.h 3998 2014-10-06 15:20:25Z chrfranke $" #define ATACMDS_H_CVSID "$Id: atacmds.h 4048 2015-03-29 16:09:04Z chrfranke $"
#include "dev_interface.h" // ata_device #include "dev_interface.h" // ata_device
@ -786,7 +786,7 @@ bool ataReadSmartLog(ata_device * device, unsigned char logaddr,
void * data, unsigned nsectors); void * data, unsigned nsectors);
// Read SMART Extended Comprehensive Error Log // Read SMART Extended Comprehensive Error Log
bool ataReadExtErrorLog(ata_device * device, ata_smart_exterrlog * log, bool ataReadExtErrorLog(ata_device * device, ata_smart_exterrlog * log,
unsigned nsectors, firmwarebug_defs firwarebugs); unsigned page, unsigned nsectors, firmwarebug_defs firmwarebugs);
// Read SMART Extended Self-test Log // Read SMART Extended Self-test Log
bool ataReadExtSelfTestLog(ata_device * device, ata_smart_extselftestlog * log, bool ataReadExtSelfTestLog(ata_device * device, ata_smart_extselftestlog * log,
unsigned nsectors); unsigned nsectors);

View File

@ -3,7 +3,7 @@
* *
* Home page of code is: http://smartmontools.sourceforge.net * Home page of code is: http://smartmontools.sourceforge.net
* *
* Copyright (C) 2012-13 Christian Franke <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2012-15 Christian Franke
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -18,7 +18,7 @@
#include "config.h" #include "config.h"
#include "ataidentify.h" #include "ataidentify.h"
const char * ataidentify_cpp_cvsid = "$Id: ataidentify.cpp 3851 2013-08-17 20:10:11Z chrfranke $" const char * ataidentify_cpp_cvsid = "$Id: ataidentify.cpp 4074 2015-05-01 16:03:50Z chrfranke $"
ATAIDENTIFY_H_CVSID; ATAIDENTIFY_H_CVSID;
#include "int64.h" #include "int64.h"
@ -33,7 +33,8 @@ const char * ataidentify_cpp_cvsid = "$Id: ataidentify.cpp 3851 2013-08-17 20:10
// Tables 16 and 18 of T13/1532D (ATA/ATAPI-7) Volume 1 Revision 4b, April 21, 2004 // Tables 16 and 18 of T13/1532D (ATA/ATAPI-7) Volume 1 Revision 4b, April 21, 2004
// Tables 29 and 39 of T13/1699-D (ATA8-ACS) Revision 6a, September 6, 2008 // Tables 29 and 39 of T13/1699-D (ATA8-ACS) Revision 6a, September 6, 2008
// Tables 50 and 61 of T13/2015-D (ACS-2) Revision 7, June 22, 2011 // Tables 50 and 61 of T13/2015-D (ACS-2) Revision 7, June 22, 2011
// Tables 51 and 56 of T13/2161-D (ACS-3) Revision 4g, February 27, 2013 // Tables 45 and 50 of T13/2161-D (ACS-3) Revision 5, October 28, 2013
// Table 44 of T13/BSR INCITS 529 (ACS-4) Revision 08, April 28, 2015 (ATAPI removed)
const char * const identify_descriptions[] = { const char * const identify_descriptions[] = {
" 0 General configuration", " 0 General configuration",
@ -42,7 +43,7 @@ const char * const identify_descriptions[] = {
". 14 ATAPI: Must be set to 0", ". 14 ATAPI: Must be set to 0",
". 13 ATAPI: Reserved", ". 13 ATAPI: Reserved",
". 12:8 ATAPI: Command set: 0x05 = CD/DVD", ". 12:8 ATAPI: Command set: 0x05 = CD/DVD",
". 7 Removable media device", ". 7 Removable media device [OBS-8]",
". 6 ATA: Not removable controller and/or device [OBS-6]", ". 6 ATA: Not removable controller and/or device [OBS-6]",
". 5:3 ATA: Vendor specific [RET-3]", ". 5:3 ATA: Vendor specific [RET-3]",
". 6:5 ATAPI: DRQ after PACKET cmd: 0x0 = 3ms, 0x2 = 50us", ". 6:5 ATAPI: DRQ after PACKET cmd: 0x0 = 3ms, 0x2 = 50us",
@ -88,7 +89,8 @@ const char * const identify_descriptions[] = {
". 10 IORDY may be disabled", ". 10 IORDY may be disabled",
". 9 LBA supported", ". 9 LBA supported",
". 8 DMA supported", ". 8 DMA supported",
". 7:0 Vendor specific [RET-4]", ". 7:2 Reserved", // ATA-3: Vendor specific, ATA-8: Retired
". 1:0 Long Phy Sector Alignment Error reporting", // ACS-2
" 50 Capabilities", " 50 Capabilities",
". 15:14 Must be set to 0x1", ". 15:14 Must be set to 0x1",
@ -116,7 +118,9 @@ const char * const identify_descriptions[] = {
". 14 OVERWRITE EXT supported", ". 14 OVERWRITE EXT supported",
". 13 CRYPTO SCRAMBLE EXT supported", ". 13 CRYPTO SCRAMBLE EXT supported",
". 12 Sanitize Device feature set supported", ". 12 Sanitize Device feature set supported",
". 11:9 Reserved", ". 11 Cmds during sanitize as specified by this standard", // ACS-3
". 10 SANITIZE ANTIFREEZE LOCK EXT supported", // ACS-3
". 9 Reserved",
". 8 Bits 7:0 are valid", ". 8 Bits 7:0 are valid",
". 7:0 Current sectors per DRQ on READ/WRITE MULTIPLE", ". 7:0 Current sectors per DRQ on READ/WRITE MULTIPLE",
@ -157,8 +161,8 @@ const char * const identify_descriptions[] = {
". 5 Trimmed LBA range(s) returning zeroed data supported", ". 5 Trimmed LBA range(s) returning zeroed data supported",
". 4 Device encrypts all user data", ". 4 Device encrypts all user data",
". 3 Extended number of user addressable sectors supported", ". 3 Extended number of user addressable sectors supported",
". 2 All write cache is non-volatile", ". 2 All write cache is non-volatile", // ACS-3
". 1:0 Reserved", ". 1:0 Zoned Capabilities", // ACS-4
" 70 Reserved", " 70 Reserved",
" 71-74 ATA: Reserved for IDENTIFY PACKET DEVICE", " 71-74 ATA: Reserved for IDENTIFY PACKET DEVICE",
@ -216,7 +220,8 @@ const char * const identify_descriptions[] = {
". 0 Must be set to 0", ". 0 Must be set to 0",
" 80 Major version number", " 80 Major version number",
". 15:11 Reserved", ". 15:12 Reserved",
". 11 ACS-4 supported",
". 10 ACS-3 supported", ". 10 ACS-3 supported",
". 9 ACS-2 supported", ". 9 ACS-2 supported",
". 8 ATA8-ACS supported", ". 8 ATA8-ACS supported",
@ -257,7 +262,7 @@ const char * const identify_descriptions[] = {
". 10 48-bit Address feature set supported", ". 10 48-bit Address feature set supported",
". 9 AAM feature set supported [OBS-ACS-2]", ". 9 AAM feature set supported [OBS-ACS-2]",
". 8 SET MAX security extension supported [OBS-ACS-3]", ". 8 SET MAX security extension supported [OBS-ACS-3]",
". 7 Reserved for Address Offset Reserved Area Boot Method", ". 7 Reserved for Addr Offset Resvd Area Boot [OBS-ACS-3]",
". 6 SET FEATURES subcommand required to spin-up", ". 6 SET FEATURES subcommand required to spin-up",
". 5 PUIS feature set supported", ". 5 PUIS feature set supported",
". 4 Removable Media Status Notification supported [OBS-8]", ". 4 Removable Media Status Notification supported [OBS-8]",
@ -278,7 +283,7 @@ const char * const identify_descriptions[] = {
". 5 GPL feature set supported", ". 5 GPL feature set supported",
". 4 Streaming feature set supported [OBS-ACS-3]", ". 4 Streaming feature set supported [OBS-ACS-3]",
". 3 Media Card Pass Through Command supported [OBS-ACS-2]", ". 3 Media Card Pass Through Command supported [OBS-ACS-2]",
". 2 Media serial number supported", // ACS-3 r3 or later: Reserved ". 2 Media serial number supported [RES-ACS-3]",
". 1 SMART self-test supported", ". 1 SMART self-test supported",
". 0 SMART error logging supported", ". 0 SMART error logging supported",
@ -309,7 +314,7 @@ const char * const identify_descriptions[] = {
". 10 48-bit Address features set supported", ". 10 48-bit Address features set supported",
". 9 AAM feature set enabled [OBS-ACS-2]", ". 9 AAM feature set enabled [OBS-ACS-2]",
". 8 SET MAX security extension enabled [OBS-ACS-3]", ". 8 SET MAX security extension enabled [OBS-ACS-3]",
". 7 Reserved for Address Offset Reserved Area Boot Method", ". 7 Reserved for Addr Offset Resvd Area Boot [OBS-ACS-3]",
". 6 SET FEATURES subcommand required to spin-up", ". 6 SET FEATURES subcommand required to spin-up",
". 5 PUIS feature set enabled", ". 5 PUIS feature set enabled",
". 4 Removable Media Status Notification enabled [OBS-8]", ". 4 Removable Media Status Notification enabled [OBS-8]",
@ -353,9 +358,18 @@ const char * const identify_descriptions[] = {
". 0 Ultra DMA mode 0 supported", ". 0 Ultra DMA mode 0 supported",
" 89 SECURITY ERASE UNIT time", " 89 SECURITY ERASE UNIT time",
". 15 Bits 14:8 of value are valid", // ACS-3
". 14:0 SECURITY ERASE UNIT time value", // value*2 minutes
" 90 ENHANCED SECURITY ERASE UNIT time", " 90 ENHANCED SECURITY ERASE UNIT time",
". 15 Bits 14:8 of value are valid", // ACS-3
". 14:0 ENHANCED SECURITY ERASE UNIT time value", // value*2 minutes
" 91 Current APM level", " 91 Current APM level",
" 92 Master password revision code", ". 15:8 Reserved", // ACS-3
". 7:0 Current APM level value",
" 92 Master Password Identifier", // ATA-7: Master Password Revision Code
" 93 Hardware reset result (PATA)", " 93 Hardware reset result (PATA)",
". 15:14 Must be set to 0x1", ". 15:14 Must be set to 0x1",
@ -393,7 +407,7 @@ const char * const identify_descriptions[] = {
"107 Inter-seek delay for ISO 7779 acoustic testing", "107 Inter-seek delay for ISO 7779 acoustic testing",
"108-111 64-bit World Wide Name", "108-111 64-bit World Wide Name",
"112-115 Reserved for a 128-bit World Wide Name", "112-115 Reserved", // ATA-7: Reserved for world wide name extension to 128 bits
"116 Reserved for TLC [OBS-ACS-3]", "116 Reserved for TLC [OBS-ACS-3]",
"117-118 Logical sector size (DWord)", "117-118 Logical sector size (DWord)",
@ -459,7 +473,7 @@ const char * const identify_descriptions[] = {
". 15:4 Reserved", ". 15:4 Reserved",
". 3:0 Nominal form factor: -, 5.25, 3.5, 2.5, 1.8, <1.8", ". 3:0 Nominal form factor: -, 5.25, 3.5, 2.5, 1.8, <1.8",
"169 Data Set Management support", "169 DATA SET MANAGEMENT command support",
". 15:1 Reserved", ". 15:1 Reserved",
". 0 Trim bit in DATA SET MANAGEMENT command supported", ". 0 Trim bit in DATA SET MANAGEMENT command supported",
@ -468,7 +482,7 @@ const char * const identify_descriptions[] = {
"176-205 Current media serial number (String)", "176-205 Current media serial number (String)",
"206 SCT Command Transport", "206 SCT Command Transport",
". 15:12 Vendor Specific", ". 15:12 Vendor specific",
". 11:8 Reserved", ". 11:8 Reserved",
". 7 Reserved for Serial ATA", ". 7 Reserved for Serial ATA",
". 6 Reserved", ". 6 Reserved",
@ -479,7 +493,7 @@ const char * const identify_descriptions[] = {
". 1 SCT Read/Write Long supported [OBS-ACS-2]", ". 1 SCT Read/Write Long supported [OBS-ACS-2]",
". 0 SCT Command Transport supported", ". 0 SCT Command Transport supported",
"207-208 Reserved for CE-ATA", "207-208 Reserved", // ATA-8: Reserved for CE-ATA
"209 Alignment of logical sectors", "209 Alignment of logical sectors",
". 15:14 Must be set to 0x1", ". 15:14 Must be set to 0x1",
@ -512,8 +526,9 @@ const char * const identify_descriptions[] = {
"221 Reserved", "221 Reserved",
"222 Transport major version number", "222 Transport major version number",
". 15:12 Transport type: 0x0 = Parallel, 0x1 = Serial", ". 15:12 Transport: 0x0 = Parallel, 0x1 = Serial, 0xe = PCIe", // PCIe: ACS-4
". 11:7 Reserved | Reserved", ". 11:8 Reserved | Reserved",
". 7 Reserved | SATA 3.2",
". 6 Reserved | SATA 3.1", ". 6 Reserved | SATA 3.1",
". 5 Reserved | SATA 3.0", ". 5 Reserved | SATA 3.0",
". 4 Reserved | SATA 2.6", ". 4 Reserved | SATA 2.6",

View File

@ -3,8 +3,8 @@
* *
* Home page of code is: http://smartmontools.sourceforge.net * Home page of code is: http://smartmontools.sourceforge.net
* *
* Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2002-11 Bruce Allen
* Copyright (C) 2008-14 Christian Franke <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2008-15 Christian Franke
* Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org> * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -40,7 +40,7 @@
#include "utility.h" #include "utility.h"
#include "knowndrives.h" #include "knowndrives.h"
const char * ataprint_cpp_cvsid = "$Id: ataprint.cpp 3999 2014-10-06 15:57:52Z chrfranke $" const char * ataprint_cpp_cvsid = "$Id: ataprint.cpp 4104 2015-06-03 18:50:39Z chrfranke $"
ATAPRINT_H_CVSID; ATAPRINT_H_CVSID;
@ -460,7 +460,7 @@ static const char * get_ata_minor_version(const ata_identify_device * drive)
// Table 10 of X3T13/2008D (ATA-3) Revision 7b, January 27, 1997 // Table 10 of X3T13/2008D (ATA-3) Revision 7b, January 27, 1997
// Table 28 of T13/1410D (ATA/ATAPI-6) Revision 3b, February 26, 2002 // Table 28 of T13/1410D (ATA/ATAPI-6) Revision 3b, February 26, 2002
// Table 31 of T13/1699-D (ATA8-ACS) Revision 6a, September 6, 2008 // Table 31 of T13/1699-D (ATA8-ACS) Revision 6a, September 6, 2008
// Table 45 of T13/BSR INCITS 529 (ACS-4) Revision 04, August 25, 2014 // Table 46 of T13/BSR INCITS 529 (ACS-4) Revision 08, April 28, 2015
switch (drive->minor_rev_num) { switch (drive->minor_rev_num) {
case 0x0001: return "ATA-1 X3T9.2/781D prior to revision 4"; case 0x0001: return "ATA-1 X3T9.2/781D prior to revision 4";
case 0x0002: return "ATA-1 published, ANSI X3.221-1994"; case 0x0002: return "ATA-1 published, ANSI X3.221-1994";
@ -511,12 +511,16 @@ static const char * get_ata_minor_version(const ata_identify_device * drive)
case 0x0052: return "ATA8-ACS T13/1699-D revision 3b"; case 0x0052: return "ATA8-ACS T13/1699-D revision 3b";
case 0x005e: return "ACS-4 T13/BSR INCITS 529 revision 5";
case 0x006d: return "ACS-3 T13/2161-D revision 5"; case 0x006d: return "ACS-3 T13/2161-D revision 5";
case 0x0082: return "ACS-2 published, ANSI INCITS 482-2012"; case 0x0082: return "ACS-2 published, ANSI INCITS 482-2012";
case 0x0107: return "ATA8-ACS T13/1699-D revision 2d"; case 0x0107: return "ATA8-ACS T13/1699-D revision 2d";
case 0x010a: return "ACS-3 published, ANSI INCITS 522-2014";
case 0x0110: return "ACS-2 T13/2015-D revision 3"; case 0x0110: return "ACS-2 T13/2015-D revision 3";
case 0x011b: return "ACS-3 T13/2161-D revision 4"; case 0x011b: return "ACS-3 T13/2161-D revision 4";
@ -525,13 +529,22 @@ static const char * get_ata_minor_version(const ata_identify_device * drive)
} }
} }
static const char * get_sata_version(const ata_identify_device * drive) static const char * get_pata_version(unsigned short word222, char (& buf)[32])
{
switch (word222 & 0x0fff) {
default: snprintf(buf, sizeof(buf),
"Unknown (0x%03x)", word222 & 0x0fff); return buf;
case 0x001:
case 0x003: return "ATA8-APT";
case 0x002: return "ATA/ATAPI-7";
}
}
static const char * get_sata_version(unsigned short word222, char (& buf)[32])
{ {
unsigned short word222 = drive->words088_255[222-88];
if ((word222 & 0xf000) != 0x1000)
return 0;
switch (find_msb(word222 & 0x0fff)) { switch (find_msb(word222 & 0x0fff)) {
default: return "SATA >3.2"; default: snprintf(buf, sizeof(buf),
"SATA >3.2 (0x%03x)", word222 & 0x0fff); return buf;
case 7: return "SATA 3.2"; case 7: return "SATA 3.2";
case 6: return "SATA 3.1"; case 6: return "SATA 3.1";
case 5: return "SATA 3.0"; case 5: return "SATA 3.0";
@ -540,7 +553,7 @@ static const char * get_sata_version(const ata_identify_device * drive)
case 2: return "SATA II Ext"; case 2: return "SATA II Ext";
case 1: return "SATA 1.0a"; case 1: return "SATA 1.0a";
case 0: return "ATA8-AST"; case 0: return "ATA8-AST";
case -1: return 0; case -1: return "Unknown";
} }
} }
@ -549,7 +562,10 @@ static const char * get_sata_speed(int level)
if (level <= 0) if (level <= 0)
return 0; return 0;
switch (level) { switch (level) {
default: return ">6.0 Gb/s"; default: return ">6.0 Gb/s (7)";
case 6: return ">6.0 Gb/s (6)";
case 5: return ">6.0 Gb/s (5)";
case 4: return ">6.0 Gb/s (4)";
case 3: return "6.0 Gb/s"; case 3: return "6.0 Gb/s";
case 2: return "3.0 Gb/s"; case 2: return "3.0 Gb/s";
case 1: return "1.5 Gb/s"; case 1: return "1.5 Gb/s";
@ -588,6 +604,7 @@ static void print_drive_info(const ata_identify_device * drive,
pout("Model Family: %s\n", dbentry->modelfamily); pout("Model Family: %s\n", dbentry->modelfamily);
pout("Device Model: %s\n", infofound(model)); pout("Device Model: %s\n", infofound(model));
if (!dont_print_serial_number) { if (!dont_print_serial_number) {
pout("Serial Number: %s\n", infofound(serial)); pout("Serial Number: %s\n", infofound(serial));
@ -595,16 +612,17 @@ static void print_drive_info(const ata_identify_device * drive,
int naa = ata_get_wwn(drive, oui, unique_id); int naa = ata_get_wwn(drive, oui, unique_id);
if (naa >= 0) if (naa >= 0)
pout("LU WWN Device Id: %x %06x %09" PRIx64 "\n", naa, oui, unique_id); pout("LU WWN Device Id: %x %06x %09" PRIx64 "\n", naa, oui, unique_id);
// Additional Product Identifier (OEM Id) string in words 170-173
// (e08130r1, added in ACS-2 Revision 1, December 17, 2008)
if (0x2020 <= drive->words088_255[170-88] && drive->words088_255[170-88] <= 0x7e7e) {
char add[8+1];
ata_format_id_string(add, (const unsigned char *)(drive->words088_255+170-88), sizeof(add)-1);
if (add[0])
pout("Add. Product Id: %s\n", add);
}
} }
// Additional Product Identifier (OEM Id) string in words 170-173
// (e08130r1, added in ACS-2 Revision 1, December 17, 2008)
if (0x2020 <= drive->words088_255[170-88] && drive->words088_255[170-88] <= 0x7e7e) {
char add[8+1];
ata_format_id_string(add, (const unsigned char *)(drive->words088_255+170-88), sizeof(add)-1);
if (add[0])
pout("Add. Product Id: %s\n", add);
}
pout("Firmware Version: %s\n", infofound(firmware)); pout("Firmware Version: %s\n", infofound(firmware));
if (sizes.capacity) { if (sizes.capacity) {
@ -678,15 +696,30 @@ static void print_drive_info(const ata_identify_device * drive,
} }
pout("ATA Version is: %s\n", infofound(ataver.c_str())); pout("ATA Version is: %s\n", infofound(ataver.c_str()));
// If SATA drive print SATA version and speed // Print Transport specific version
const char * sataver = get_sata_version(drive); char buf[32] = "";
if (sataver) { unsigned short word222 = drive->words088_255[222-88];
const char * maxspeed = get_sata_maxspeed(drive); if (word222 != 0x0000 && word222 != 0xffff) switch (word222 >> 12) {
const char * curspeed = get_sata_curspeed(drive); case 0x0: // PATA
pout("SATA Version is: %s%s%s%s%s%s\n", sataver, pout("Transport Type: Parallel, %s\n", get_pata_version(word222, buf));
(maxspeed ? ", " : ""), (maxspeed ? maxspeed : ""), break;
(curspeed ? " (current: " : ""), (curspeed ? curspeed : ""), case 0x1: // SATA
(curspeed ? ")" : "")); {
const char * sataver = get_sata_version(word222, buf);
const char * maxspeed = get_sata_maxspeed(drive);
const char * curspeed = get_sata_curspeed(drive);
pout("SATA Version is: %s%s%s%s%s%s\n", sataver,
(maxspeed ? ", " : ""), (maxspeed ? maxspeed : ""),
(curspeed ? " (current: " : ""), (curspeed ? curspeed : ""),
(curspeed ? ")" : ""));
}
break;
case 0xe: // PCIe (ACS-4)
pout("Transport Type: PCIe (0x%03x)\n", word222 & 0x0fff);
break;
default:
pout("Transport Type: Unknown (0x%04x)\n", word222);
break;
} }
// print current time and date and timezone // print current time and date and timezone
@ -1149,7 +1182,7 @@ static unsigned GetNumLogSectors(const ata_smart_log_directory * logdir, unsigne
// Get name of log. // Get name of log.
static const char * GetLogName(unsigned logaddr) static const char * GetLogName(unsigned logaddr)
{ {
// Table 201 of T13/BSR INCITS 529 (ACS-4) Revision 04, August 25, 2014 // Table 205 of T13/BSR INCITS 529 (ACS-4) Revision 08, April 28, 2015
// Table 112 of Serial ATA Revision 3.2, August 7, 2013 // Table 112 of Serial ATA Revision 3.2, August 7, 2013
switch (logaddr) { switch (logaddr) {
case 0x00: return "Log Directory"; case 0x00: return "Log Directory";
@ -1167,6 +1200,7 @@ static const char * GetLogName(unsigned logaddr)
case 0x0c: return "Pending Defects log"; // ACS-4 case 0x0c: return "Pending Defects log"; // ACS-4
case 0x0d: return "LPS Mis-alignment log"; // ACS-2 case 0x0d: return "LPS Mis-alignment log"; // ACS-2
case 0x0f: return "Sense Data for Successful NCQ Cmds log"; // ACS-4
case 0x10: return "SATA NCQ Queued Error log"; case 0x10: return "SATA NCQ Queued Error log";
case 0x11: return "SATA Phy Event Counters log"; case 0x11: return "SATA Phy Event Counters log";
//case 0x12: return "SATA NCQ Queue Management log"; // SATA 3.0/3.1 //case 0x12: return "SATA NCQ Queue Management log"; // SATA 3.0/3.1
@ -1205,7 +1239,7 @@ static const char * get_log_rw(unsigned logaddr)
{ {
if ( ( logaddr <= 0x08) if ( ( logaddr <= 0x08)
|| (0x0c <= logaddr && logaddr <= 0x0d) || (0x0c <= logaddr && logaddr <= 0x0d)
|| (0x10 <= logaddr && logaddr <= 0x14) || (0x0f <= logaddr && logaddr <= 0x14)
|| (0x19 == logaddr) || (0x19 == logaddr)
|| (0x20 <= logaddr && logaddr <= 0x25) || (0x20 <= logaddr && logaddr <= 0x25)
|| (0x30 == logaddr)) || (0x30 == logaddr))
@ -1335,9 +1369,8 @@ static void PrintLogPages(const char * type, const unsigned char * data,
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// Device statistics (Log 0x04) // Device statistics (Log 0x04)
// See Section A.5 of // Section A.5 of T13/2161-D (ACS-3) Revision 5, October 28, 2013
// ATA/ATAPI Command Set - 3 (ACS-3) // Section 9.5 of T13/BSR INCITS 529 (ACS-4) Revision 08, April 28, 2015
// T13/2161-D Revision 2, February 21, 2012.
struct devstat_entry_info struct devstat_entry_info
{ {
@ -1353,12 +1386,15 @@ const devstat_entry_info devstat_info_0x00[] = {
const devstat_entry_info devstat_info_0x01[] = { const devstat_entry_info devstat_info_0x01[] = {
{ 2, "General Statistics" }, { 2, "General Statistics" },
{ 4, "Lifetime Power-On Resets" }, { 4, "Lifetime Power-On Resets" },
{ 4, "Power-on Hours" }, // spec says no flags(?) { 4, "Power-on Hours" },
{ 6, "Logical Sectors Written" }, { 6, "Logical Sectors Written" },
{ 6, "Number of Write Commands" }, { 6, "Number of Write Commands" },
{ 6, "Logical Sectors Read" }, { 6, "Logical Sectors Read" },
{ 6, "Number of Read Commands" }, { 6, "Number of Read Commands" },
{ 6, "Date and Time TimeStamp" }, // ACS-3 { 6, "Date and Time TimeStamp" }, // ACS-3
{ 4, "Pending Error Count" }, // ACS-4
{ 2, "Workload Utilization" }, // ACS-4
{ 6, "Utilization Usage Rate" }, // ACS-4 (TODO: field provides 3 values)
{ 0, 0 } { 0, 0 }
}; };
@ -1378,6 +1414,7 @@ const devstat_entry_info devstat_info_0x03[] = {
{ 4, "Read Recovery Attempts" }, { 4, "Read Recovery Attempts" },
{ 4, "Number of Mechanical Start Failures" }, { 4, "Number of Mechanical Start Failures" },
{ 4, "Number of Realloc. Candidate Logical Sectors" }, // ACS-3 { 4, "Number of Realloc. Candidate Logical Sectors" }, // ACS-3
{ 4, "Number of High Priority Unload Events" }, // ACS-3
{ 0, 0 } { 0, 0 }
}; };
@ -1434,24 +1471,32 @@ const devstat_entry_info * devstat_infos[] = {
const int num_devstat_infos = sizeof(devstat_infos)/sizeof(devstat_infos[0]); const int num_devstat_infos = sizeof(devstat_infos)/sizeof(devstat_infos[0]);
static void print_device_statistics_page(const unsigned char * data, int page, static const char * get_device_statistics_page_name(int page)
bool & need_trailer) {
if (page < num_devstat_infos)
return devstat_infos[page][0].name;
if (page == 0xff)
return "Vendor Specific Statistics"; // ACS-4
return "Unknown Statistics";
}
static void print_device_statistics_page(const unsigned char * data, int page)
{ {
const devstat_entry_info * info = (page < num_devstat_infos ? devstat_infos[page] : 0); const devstat_entry_info * info = (page < num_devstat_infos ? devstat_infos[page] : 0);
const char * name = (info ? info[0].name : "Unknown Statistics"); const char * name = get_device_statistics_page_name(page);
// Check page number in header // Check page number in header
static const char line[] = " ===== = = == "; static const char line[] = " ===== = = === == ";
if (!data[2]) { if (!data[2]) {
pout("%3d%s%s (empty) ==\n", page, line, name); pout("0x%02x%s%s (empty) ==\n", page, line, name);
return; return;
} }
if (data[2] != page) { if (data[2] != page) {
pout("%3d%s%s (invalid page %d in header) ==\n", page, line, name, data[2]); pout("0x%02x%s%s (invalid page 0x%02x in header) ==\n", page, line, name, data[2]);
return; return;
} }
pout("%3d%s%s (rev %d) ==\n", page, line, name, data[0]); pout("0x%02x%s%s (rev %d) ==\n", page, line, name, data[0] | (data[1] << 8));
// Print entries // Print entries
for (int i = 1, offset = 8; offset < 512-7; i++, offset+=8) { for (int i = 1, offset = 8; offset < 512-7; i++, offset+=8) {
@ -1466,7 +1511,7 @@ static void print_device_statistics_page(const unsigned char * data, int page,
// Stop if unknown entries contain garbage data due to buggy firmware // Stop if unknown entries contain garbage data due to buggy firmware
if (!info && (data[offset+5] || data[offset+6])) { if (!info && (data[offset+5] || data[offset+6])) {
pout("%3d 0x%03x - - [Trailing garbage ignored]\n", page, offset); pout("0x%02x 0x%03x - - [Trailing garbage ignored]\n", page, offset);
break; break;
} }
@ -1493,15 +1538,17 @@ static void print_device_statistics_page(const unsigned char * data, int page,
valstr[0] = '-'; valstr[1] = 0; valstr[0] = '-'; valstr[1] = 0;
} }
pout("%3d 0x%03x %d%c %15s%c %s\n", pout("0x%02x 0x%03x %d %15s %c%c%c%c %s\n",
page, offset, page, offset,
abs(size), abs(size),
(flags & 0x1f ? '+' : ' '), // unknown flags
valstr, valstr,
(flags & 0x20 ? '~' : ' '), // normalized flag (flags & 0x20 ? 'N' : '-'), // normalized statistics
(info ? info[i].name : "Unknown")); (flags & 0x10 ? 'D' : '-'), // supports DSN (ACS-3)
if (flags & 0x20) (flags & 0x08 ? 'C' : '-'), // monitored condition met (ACS-3)
need_trailer = true; (flags & 0x07 ? '+' : ' '), // reserved flags
(info ? info[i].name :
page == 0xff ? "Vendor Specific" // ACS-4
: "Unknown" ));
} }
} }
@ -1518,13 +1565,13 @@ static bool print_device_statistics(ata_device * device, unsigned nsectors,
else else
rc = ataReadSmartLog(device, 0x04, page_0, 1); rc = ataReadSmartLog(device, 0x04, page_0, 1);
if (!rc) { if (!rc) {
pout("Read Device Statistics page 0 failed\n\n"); pout("Read Device Statistics page 0x00 failed\n\n");
return false; return false;
} }
unsigned char nentries = page_0[8]; unsigned char nentries = page_0[8];
if (!(page_0[2] == 0 && nentries > 0)) { if (!(page_0[2] == 0 && nentries > 0)) {
pout("Device Statistics page 0 is invalid (page=%d, nentries=%d)\n\n", page_0[2], nentries); pout("Device Statistics page 0x00 is invalid (page=0x%02x, nentries=%d)\n\n", page_0[2], nentries);
return false; return false;
} }
@ -1543,14 +1590,14 @@ static bool print_device_statistics(ata_device * device, unsigned nsectors,
// Add manually specified pages // Add manually specified pages
bool print_page_0 = false; bool print_page_0 = false;
for (i = 0; i < single_pages.size() || ssd_page; i++) { for (i = 0; i < single_pages.size() || ssd_page; i++) {
int page = (i < single_pages.size() ? single_pages[i] : 7); int page = (i < single_pages.size() ? single_pages[i] : 0x07);
if (!page) if (!page)
print_page_0 = true; print_page_0 = true;
else if (page >= (int)nsectors) else if (page >= (int)nsectors)
pout("Device Statistics Log has only %u pages\n", nsectors); pout("Device Statistics Log has only 0x%02x pages\n", nsectors);
else else
pages.push_back(page); pages.push_back(page);
if (page == 7) if (page == 0x07)
ssd_page = false; ssd_page = false;
} }
@ -1558,11 +1605,10 @@ static bool print_device_statistics(ata_device * device, unsigned nsectors,
if (print_page_0) { if (print_page_0) {
pout("Device Statistics (%s Log 0x04) supported pages\n", pout("Device Statistics (%s Log 0x04) supported pages\n",
use_gplog ? "GP" : "SMART"); use_gplog ? "GP" : "SMART");
pout("Page Description\n"); pout("Page Description\n");
for (i = 0; i < nentries; i++) { for (i = 0; i < nentries; i++) {
int page = page_0[8+1+i]; int page = page_0[8+1+i];
pout("%3d %s\n", page, pout("0x%02x %s\n", page, get_device_statistics_page_name(page));
(page < num_devstat_infos ? devstat_infos[page][0].name : "Unknown Statistics"));
} }
pout("\n"); pout("\n");
} }
@ -1571,8 +1617,7 @@ static bool print_device_statistics(ata_device * device, unsigned nsectors,
if (!pages.empty()) { if (!pages.empty()) {
pout("Device Statistics (%s Log 0x04)\n", pout("Device Statistics (%s Log 0x04)\n",
use_gplog ? "GP" : "SMART"); use_gplog ? "GP" : "SMART");
pout("Page Offset Size Value Description\n"); pout("Page Offset Size Value Flags Description\n");
bool need_trailer = false;
int max_page = 0; int max_page = 0;
if (!use_gplog) if (!use_gplog)
@ -1584,8 +1629,8 @@ static bool print_device_statistics(ata_device * device, unsigned nsectors,
raw_buffer pages_buf((max_page+1) * 512); raw_buffer pages_buf((max_page+1) * 512);
if (!use_gplog && !ataReadSmartLog(device, 0x04, pages_buf.data(), max_page+1)) { if (!use_gplog && !ataReadSmartLog(device, 0x04, pages_buf.data(), max_page+1)) {
pout("Read Device Statistics pages 0-%d failed\n\n", max_page); pout("Read Device Statistics pages 0x00-0x%02x failed\n\n", max_page);
return false; return false;
} }
@ -1593,7 +1638,7 @@ static bool print_device_statistics(ata_device * device, unsigned nsectors,
int page = pages[i]; int page = pages[i];
if (use_gplog) { if (use_gplog) {
if (!ataReadLogExt(device, 0x04, 0, page, pages_buf.data(), 1)) { if (!ataReadLogExt(device, 0x04, 0, page, pages_buf.data(), 1)) {
pout("Read Device Statistics page %d failed\n\n", page); pout("Read Device Statistics page 0x%02x failed\n\n", page);
return false; return false;
} }
} }
@ -1601,12 +1646,12 @@ static bool print_device_statistics(ata_device * device, unsigned nsectors,
continue; continue;
int offset = (use_gplog ? 0 : page * 512); int offset = (use_gplog ? 0 : page * 512);
print_device_statistics_page(pages_buf.data() + offset, page, need_trailer); print_device_statistics_page(pages_buf.data() + offset, page);
} }
if (need_trailer) pout("%32s|||_ C monitored condition met\n", "");
pout("%30s|_ ~ normalized value\n", ""); pout("%32s||__ D supports DSN\n", "");
pout("\n"); pout("%32s|___ N normalized value\n\n", "");
} }
return true; return true;
@ -1832,7 +1877,9 @@ static int PrintSmartErrorlog(const ata_smart_errorlog *data,
} }
// Print SMART Extended Comprehensive Error Log (GP Log 0x03) // Print SMART Extended Comprehensive Error Log (GP Log 0x03)
static int PrintSmartExtErrorLog(const ata_smart_exterrlog * log, static int PrintSmartExtErrorLog(ata_device * device,
const firmwarebug_defs & firmwarebugs,
const ata_smart_exterrlog * log,
unsigned nsectors, unsigned max_errors) unsigned nsectors, unsigned max_errors)
{ {
pout("SMART Extended Comprehensive Error Log Version: %u (%u sectors)\n", pout("SMART Extended Comprehensive Error Log Version: %u (%u sectors)\n",
@ -1893,11 +1940,30 @@ static int PrintSmartExtErrorLog(const ata_smart_exterrlog * log,
"DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,\n" "DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,\n"
"SS=sec, and sss=millisec. It \"wraps\" after 49.710 days.\n\n"); "SS=sec, and sss=millisec. It \"wraps\" after 49.710 days.\n\n");
// Recently read log page
ata_smart_exterrlog log_buf;
unsigned log_buf_page = ~0;
// Iterate through circular buffer in reverse direction // Iterate through circular buffer in reverse direction
for (unsigned i = 0, errnum = log->device_error_count; for (unsigned i = 0, errnum = log->device_error_count;
i < errcnt; i++, errnum--, erridx = (erridx > 0 ? erridx - 1 : nentries - 1)) { i < errcnt; i++, errnum--, erridx = (erridx > 0 ? erridx - 1 : nentries - 1)) {
const ata_smart_exterrlog_error_log & entry = log[erridx / 4].error_logs[erridx % 4]; // Read log page if needed
const ata_smart_exterrlog * log_p;
unsigned page = erridx / 4;
if (page == 0)
log_p = log;
else {
if (page != log_buf_page) {
memset(&log_buf, 0, sizeof(log_buf));
if (!ataReadExtErrorLog(device, &log_buf, page, 1, firmwarebugs))
break;
log_buf_page = page;
}
log_p = &log_buf;
}
const ata_smart_exterrlog_error_log & entry = log_p->error_logs[erridx % 4];
// Skip unused entries // Skip unused entries
if (!nonempty(&entry, sizeof(entry))) { if (!nonempty(&entry, sizeof(entry))) {
@ -3086,7 +3152,8 @@ int ataPrintMain (ata_device * device, const ata_print_options & options)
// If GP Log is supported use smart log directory for // If GP Log is supported use smart log directory for
// error and selftest log support check. // error and selftest log support check.
if ( isGeneralPurposeLoggingCapable(&drive) bool gp_log_supported = !!isGeneralPurposeLoggingCapable(&drive);
if ( gp_log_supported
&& ( options.smart_error_log || options.smart_selftest_log && ( options.smart_error_log || options.smart_selftest_log
|| options.retry_error_log || options.retry_selftest_log)) || options.retry_error_log || options.retry_selftest_log))
need_smart_logdir = true; need_smart_logdir = true;
@ -3110,6 +3177,10 @@ int ataPrintMain (ata_device * device, const ata_print_options & options)
if (need_gp_logdir) { if (need_gp_logdir) {
if (firmwarebugs.is_set(BUG_NOLOGDIR)) if (firmwarebugs.is_set(BUG_NOLOGDIR))
gplogdir = fake_logdir(&gplogdir_buf, options); gplogdir = fake_logdir(&gplogdir_buf, options);
else if (!gp_log_supported && !is_permissive()) {
if (options.gp_logdir)
pout("General Purpose Log Directory not supported\n\n");
}
else if (ataReadLogDirectory(device, &gplogdir_buf, true)) { else if (ataReadLogDirectory(device, &gplogdir_buf, true)) {
pout("Read GP Log Directory failed\n\n"); pout("Read GP Log Directory failed\n\n");
failuretest(OPTIONAL_CMD, returnval|=FAILSMART); failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
@ -3182,17 +3253,16 @@ int ataPrintMain (ata_device * device, const ata_print_options & options)
unsigned nsectors = GetNumLogSectors(gplogdir, 0x03, true); unsigned nsectors = GetNumLogSectors(gplogdir, 0x03, true);
if (!nsectors) if (!nsectors)
pout("SMART Extended Comprehensive Error Log (GP Log 0x03) not supported\n\n"); pout("SMART Extended Comprehensive Error Log (GP Log 0x03) not supported\n\n");
else if (nsectors >= 256)
pout("SMART Extended Comprehensive Error Log size %u not supported\n\n", nsectors);
else { else {
raw_buffer log_03_buf(nsectors * 512); // Read only first sector to get error count and index
ata_smart_exterrlog * log_03 = (ata_smart_exterrlog *)log_03_buf.data(); // Print function will read more sectors as needed
if (!ataReadExtErrorLog(device, log_03, nsectors, firmwarebugs)) { ata_smart_exterrlog log_03; memset(&log_03, 0, sizeof(log_03));
if (!ataReadExtErrorLog(device, &log_03, 0, 1, firmwarebugs)) {
pout("Read SMART Extended Comprehensive Error Log failed\n\n"); pout("Read SMART Extended Comprehensive Error Log failed\n\n");
failuretest(OPTIONAL_CMD, returnval|=FAILSMART); failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
} }
else { else {
if (PrintSmartExtErrorLog(log_03, nsectors, options.smart_ext_error_log)) if (PrintSmartExtErrorLog(device, firmwarebugs, &log_03, nsectors, options.smart_ext_error_log))
returnval |= FAILERR; returnval |= FAILERR;
ok = true; ok = true;
} }
@ -3208,9 +3278,10 @@ int ataPrintMain (ata_device * device, const ata_print_options & options)
// Print SMART error log // Print SMART error log
if (do_smart_error_log) { if (do_smart_error_log) {
if (!( ( smartlogdir && GetNumLogSectors(smartlogdir, 0x01, false)) if (!( GetNumLogSectors(smartlogdir, 0x01, false)
|| (!smartlogdir && isSmartErrorLogCapable(&smartval, &drive) ) || ( !(smartlogdir && gp_log_supported)
|| is_permissive() )) { && isSmartErrorLogCapable(&smartval, &drive))
|| is_permissive() )) {
pout("SMART Error Log not supported\n\n"); pout("SMART Error Log not supported\n\n");
} }
else { else {
@ -3261,9 +3332,10 @@ int ataPrintMain (ata_device * device, const ata_print_options & options)
// Print SMART self-test log // Print SMART self-test log
if (do_smart_selftest_log) { if (do_smart_selftest_log) {
if (!( ( smartlogdir && GetNumLogSectors(smartlogdir, 0x06, false)) if (!( GetNumLogSectors(smartlogdir, 0x06, false)
|| (!smartlogdir && isSmartTestLogCapable(&smartval, &drive) ) || ( !(smartlogdir && gp_log_supported)
|| is_permissive() )) { && isSmartTestLogCapable(&smartval, &drive))
|| is_permissive() )) {
pout("SMART Self-test Log not supported\n\n"); pout("SMART Self-test Log not supported\n\n");
} }
else { else {

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# $Id: autogen.sh 3917 2014-06-20 19:57:41Z chrfranke $ # $Id: autogen.sh 4053 2015-04-14 20:18:50Z chrfranke $
# #
# Generate ./configure from config.in and Makefile.in from Makefile.am. # Generate ./configure from config.in and Makefile.in from Makefile.am.
# This also adds files like missing,depcomp,install-sh to the source # This also adds files like missing,depcomp,install-sh to the source
@ -39,20 +39,20 @@ typep()
} }
test -x "$AUTOMAKE" || test -x "$AUTOMAKE" ||
AUTOMAKE=`typep automake-1.14` || AUTOMAKE=`typep automake-1.15` || AUTOMAKE=`typep automake-1.14` ||
AUTOMAKE=`typep automake-1.13` || AUTOMAKE=`typep automake-1.12` || AUTOMAKE=`typep automake-1.13` || AUTOMAKE=`typep automake-1.12` ||
AUTOMAKE=`typep automake-1.11` || AUTOMAKE=`typep automake-1.10` || AUTOMAKE=`typep automake-1.11` || AUTOMAKE=`typep automake-1.10` ||
AUTOMAKE=`typep automake-1.9` || AUTOMAKE=`typep automake-1.8` || AUTOMAKE=`typep automake-1.9` || AUTOMAKE=`typep automake-1.8` ||
AUTOMAKE=`typep automake-1.7` || AUTOMAKE=`typep automake17` || AUTOMAKE=`typep automake-1.7` || AUTOMAKE=`typep automake17` ||
{ {
echo echo
echo "You must have at least GNU Automake 1.7 (up to 1.14) installed" echo "You must have at least GNU Automake 1.7 (up to 1.15) installed"
echo "in order to bootstrap smartmontools from SVN. Download the" echo "in order to bootstrap smartmontools from SVN. Download the"
echo "appropriate package for your distribution, or the source tarball" echo "appropriate package for your distribution, or the source tarball"
echo "from ftp://ftp.gnu.org/gnu/automake/ ." echo "from ftp://ftp.gnu.org/gnu/automake/ ."
echo echo
echo "Also note that support for new Automake series (anything newer" echo "Also note that support for new Automake series (anything newer"
echo "than 1.14) is only added after extensive tests. If you live in" echo "than 1.15) is only added after extensive tests. If you live in"
echo "the bleeding edge, you should know what you're doing, mainly how" echo "the bleeding edge, you should know what you're doing, mainly how"
echo "to test it before the developers. Be patient." echo "to test it before the developers. Be patient."
exit 1; exit 1;
@ -97,7 +97,7 @@ case "$ver" in
# OK # OK
;; ;;
1.14|1.14.1) 1.14|1.14.1|1.15)
# TODO: Enable 'subdir-objects' in configure.ac # TODO: Enable 'subdir-objects' in configure.ac
# For now, suppress 'subdir-objects' forward-incompatibility warning # For now, suppress 'subdir-objects' forward-incompatibility warning
test -n "$warnings" || amwarnings="--warnings=no-unsupported" test -n "$warnings" || amwarnings="--warnings=no-unsupported"
@ -108,6 +108,14 @@ case "$ver" in
echo "Please report success/failure to the smartmontools-support mailing list." echo "Please report success/failure to the smartmontools-support mailing list."
esac esac
# Warn if Automake version is too old
case "$ver" in
1.[789]|1.[789].*)
echo "WARNING:"
echo "The use of GNU Automake version $ver is deprecated. Support for Automake"
echo "versions 1.7 - 1.9.x will be removed in a future release of smartmontools."
esac
# Install pkg-config macros # Install pkg-config macros
# (Don't use 'aclocal -I m4 --install' to keep support for automake < 1.10) # (Don't use 'aclocal -I m4 --install' to keep support for automake < 1.10)
test -d m4 || mkdir m4 || exit 1 test -d m4 || mkdir m4 || exit 1

View File

@ -1,14 +1,14 @@
# #
# $Id: configure.ac 3977 2014-07-26 11:03:24Z chrfranke $ # $Id: configure.ac 4109 2015-06-04 16:30:15Z chrfranke $
# #
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50) AC_PREREQ(2.50)
AC_INIT(smartmontools, 6.4, smartmontools-support@lists.sourceforge.net) AC_INIT(smartmontools, 6.4, smartmontools-support@lists.sourceforge.net)
AC_CONFIG_SRCDIR(smartctl.cpp) AC_CONFIG_SRCDIR(smartctl.cpp)
smartmontools_cvs_tag=`echo '$Id: configure.ac 3977 2014-07-26 11:03:24Z chrfranke $'` smartmontools_cvs_tag=`echo '$Id: configure.ac 4109 2015-06-04 16:30:15Z chrfranke $'`
smartmontools_release_date=2014-07-26 smartmontools_release_date=2015-06-04
smartmontools_release_time="09:49:11 UTC" smartmontools_release_time="16:29:41 UTC"
AC_DEFINE_UNQUOTED(SMARTMONTOOLS_CONFIGURE_ARGS, "$ac_configure_args", [smartmontools Configure Arguments]) AC_DEFINE_UNQUOTED(SMARTMONTOOLS_CONFIGURE_ARGS, "$ac_configure_args", [smartmontools Configure Arguments])
AC_DEFINE_UNQUOTED(SMARTMONTOOLS_RELEASE_DATE, "$smartmontools_release_date", [smartmontools Release Date]) AC_DEFINE_UNQUOTED(SMARTMONTOOLS_RELEASE_DATE, "$smartmontools_release_date", [smartmontools Release Date])
@ -149,16 +149,9 @@ AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS) AC_SUBST(LDFLAGS)
AC_SUBST(ASFLAGS) AC_SUBST(ASFLAGS)
AC_ARG_WITH(systemdenvfile,
[AS_HELP_STRING([--with-systemdenvfile=@<:@FILE|no@:>@],
[Path of systemd EnvironmentFile (implies --with-systemdsystemunitdir=yes) [SYSCONFDIR/sysconfig/smartmontools]])],
[systemdenvfile=; test "$withval" != "no" && systemdenvfile="$withval"; systemd_default=yes],
[systemdenvfile='${sysconfdir}/sysconfig/smartmontools'; systemd_default=auto])
AC_SUBST(systemdenvfile)
AC_ARG_WITH(systemdsystemunitdir, AC_ARG_WITH(systemdsystemunitdir,
[AS_HELP_STRING([--with-systemdsystemunitdir@<:@=DIR|auto|yes|no@:>@], [Location of systemd service files [auto]])], [AS_HELP_STRING([--with-systemdsystemunitdir@<:@=DIR|auto|yes|no@:>@], [Location of systemd service files [auto]])],
[], [with_systemdsystemunitdir=$systemd_default]) [], [with_systemdsystemunitdir=auto])
systemdsystemunitdir= systemdsystemunitdir=
case "$with_systemdsystemunitdir" in case "$with_systemdsystemunitdir" in
@ -179,6 +172,30 @@ esac
AC_SUBST(systemdsystemunitdir) AC_SUBST(systemdsystemunitdir)
AM_CONDITIONAL(INSTALL_SYSTEMDUNIT, [test -n "$systemdsystemunitdir"]) AM_CONDITIONAL(INSTALL_SYSTEMDUNIT, [test -n "$systemdsystemunitdir"])
AC_ARG_WITH(systemdenvfile,
[AS_HELP_STRING([--with-systemdenvfile@<:@=FILE|auto|yes|no@:>@], [Path of systemd EnvironmentFile [auto]])],
[], [with_systemdenvfile=auto])
systemdenvfile=
case "$with_systemdenvfile:$cross_compiling:$systemdsystemunitdir" in
auto:no:?*|yes:*:?*)
AC_MSG_CHECKING([for path of systemd EnvironmentFile])
for dir in sysconfig default; do
if test -d /etc/$dir; then
systemdenvfile='${sysconfdir}'/$dir/smartmontools
break
fi
done
AC_MSG_RESULT([${systemdenvfile:-no}])
case "$with_systemdenvfile:$systemdenvfile" in
yes:) AC_MSG_ERROR([Path of systemd EnvironmentFile not found]) ;;
esac ;;
auto:*|no:*) ;;
*:*:) AC_MSG_ERROR([Location of systemd service files not found]) ;;
*) systemdenvfile="$with_systemdenvfile"
esac
AC_SUBST(systemdenvfile)
AC_ARG_WITH(initscriptdir, AC_ARG_WITH(initscriptdir,
[AS_HELP_STRING([--with-initscriptdir@<:@=DIR|auto|yes|no@:>@], [Location of init scripts [auto]])], [AS_HELP_STRING([--with-initscriptdir@<:@=DIR|auto|yes|no@:>@], [Location of init scripts [auto]])],
[], [with_initscriptdir=auto]) [], [with_initscriptdir=auto])
@ -214,8 +231,9 @@ case "${host}" in
esac esac
AC_SUBST(initdfile) AC_SUBST(initdfile)
autoconf_25x=${docdir:-yes}
AC_ARG_WITH(docdir, AC_ARG_WITH(docdir,
[AS_HELP_STRING([--with-docdir=DIR], [Location of documentation [DATADIR/doc/smartmontools]])], [AS_HELP_STRING([--with-docdir=DIR], [Deprecated (use --docdir=DIR instead)])],
[docdir="$withval"], [docdir="$withval"],
[ if test -z "$docdir"; then [ if test -z "$docdir"; then
# autoconf 2.5x without '--docdir' support # autoconf 2.5x without '--docdir' support
@ -229,16 +247,18 @@ AC_ARG_WITH(exampledir,
[exampledir="$withval"], [exampledir='${docdir}/examplescripts']) [exampledir="$withval"], [exampledir='${docdir}/examplescripts'])
AC_SUBST(exampledir) AC_SUBST(exampledir)
used_deprecated_option=no
AC_ARG_ENABLE(drivedb, AC_ARG_ENABLE(drivedb,
[AS_HELP_STRING([--disable-drivedb], [Disables drive database file])], [AS_HELP_STRING([--disable-drivedb], [Deprecated (use --without-drivedbdir instead)])],
[], [enable_drivedb=yes]) [used_deprecated_option=yes], [enable_drivedb=yes])
drivedbdir=
AC_ARG_WITH(drivedbdir, AC_ARG_WITH(drivedbdir,
[AS_HELP_STRING([--with-drivedbdir=DIR], [Location of drive database file [DATADIR/smartmontools]])], [AS_HELP_STRING([--with-drivedbdir=@<:@DIR|no@:>@], [Location of drive database file [DATADIR/smartmontools]])],
[drivedbdir="$withval"; enable_drivedb=yes], [test "$withval" != "no" && drivedbdir="$withval"],
[drivedbdir=; test "$enable_drivedb" = "yes" && drivedbdir='${datadir}/${PACKAGE}']) [test "$enable_drivedb" != "no" && drivedbdir='${datadir}/${PACKAGE}'])
AC_SUBST(drivedbdir) AC_SUBST(drivedbdir)
AM_CONDITIONAL(ENABLE_DRIVEDB, [test "$enable_drivedb" = "yes"]) AM_CONDITIONAL(ENABLE_DRIVEDB, [test -n "$drivedbdir"])
AC_ARG_WITH(smartdscriptdir, AC_ARG_WITH(smartdscriptdir,
[AS_HELP_STRING([--with-smartdscriptdir=DIR], [Location of smartd_warning.sh script [SYSCONFDIR]])], [AS_HELP_STRING([--with-smartdscriptdir=DIR], [Location of smartd_warning.sh script [SYSCONFDIR]])],
@ -252,29 +272,35 @@ AC_ARG_WITH(smartdplugindir,
[smartdplugindir='${smartdscriptdir}/smartd_warning.d']) [smartdplugindir='${smartdscriptdir}/smartd_warning.d'])
AC_SUBST(smartdplugindir) AC_SUBST(smartdplugindir)
AC_ARG_ENABLE(savestates, [AS_HELP_STRING([--enable-savestates], [Enables default smartd state files])]) AC_ARG_ENABLE(savestates,
[AS_HELP_STRING([--enable-savestates], [Deprecated (use --with-savestates@<:@=yes@:>@ instead)])],
[used_deprecated_option=yes], [enable_savestates=no])
savestates='${localstatedir}/lib/${PACKAGE}/smartd.'
AC_ARG_WITH(savestates, AC_ARG_WITH(savestates,
[AS_HELP_STRING([--with-savestates=PREFIX], [AS_HELP_STRING([--with-savestates@<:@=PREFIX|yes|no@:>@],
[Prefix for default smartd state files (implies --enable-savestates) [LOCALSTATEDIR/lib/smartmontools/smartd.]])], [Enable default smartd state files [no] (yes=LOCALSTATEDIR/lib/smartmontools/smartd.)])],
[savestates="$withval"; enable_savestates="yes"], [case "$withval" in yes) ;; no) savestates= ;; *) savestates="$withval" ;; esac],
[savestates=; test "$enable_savestates" = "yes" && savestates='${localstatedir}/lib/${PACKAGE}/smartd.']) [test "$enable_savestates" != "yes" && savestates=])
savestatesdir="${savestates%/*}" savestatesdir="${savestates%/*}"
AC_SUBST(savestates) AC_SUBST(savestates)
AC_SUBST(savestatesdir) AC_SUBST(savestatesdir)
AM_CONDITIONAL(ENABLE_SAVESTATES, [test "$enable_savestates" = "yes"]) AM_CONDITIONAL(ENABLE_SAVESTATES, [test -n "$savestates"])
AC_ARG_ENABLE(attributelog, [AS_HELP_STRING([--enable-attributelog], [Enables default smartd attribute log files])]) AC_ARG_ENABLE(attributelog,
[AS_HELP_STRING([--enable-attributelog], [Deprecated (use --with-attributelog@<:@=yes@:>@ instead)])],
[used_deprecated_option=yes], [enable_attributelog=no])
attributelog='${localstatedir}/lib/${PACKAGE}/attrlog.'
AC_ARG_WITH(attributelog, AC_ARG_WITH(attributelog,
[AS_HELP_STRING([--with-attributelog=PREFIX], [AS_HELP_STRING([--with-attributelog@<:@=PREFIX|yes|no@:>@],
[Prefix for default smartd attribute log files (implies --enable-attributelog) [LOCALSTATEDIR/lib/smartmontools/attrlog.]])], [Enable default smartd attribute log files [no] (yes=LOCALSTATEDIR/lib/smartmontools/attrlog.)])],
[attributelog="$withval"; enable_attributelog="yes"], [case "$withval" in yes) ;; no) attributelog= ;; *) attributelog="$withval" ;; esac],
[attributelog=; test "$enable_attributelog" = "yes" && attributelog='${localstatedir}/lib/${PACKAGE}/attrlog.']) [test "$enable_attributelog" != "yes" && attributelog=])
attributelogdir="${attributelog%/*}" attributelogdir="${attributelog%/*}"
AC_SUBST(attributelog) AC_SUBST(attributelog)
AC_SUBST(attributelogdir) AC_SUBST(attributelogdir)
AM_CONDITIONAL(ENABLE_ATTRIBUTELOG, [test "$enable_attributelog" = "yes"]) AM_CONDITIONAL(ENABLE_ATTRIBUTELOG, [test -n "$attributelog"])
AC_ARG_ENABLE(sample, AC_ARG_ENABLE(sample,
[AS_HELP_STRING([--enable-sample], [Enables appending .sample to the installed smartd rc script and configuration file])], [AS_HELP_STRING([--enable-sample], [Enables appending .sample to the installed smartd rc script and configuration file])],
@ -311,7 +337,7 @@ AC_ARG_WITH(libcap-ng,
use_libcap_ng=no use_libcap_ng=no
if test "$with_libcap_ng" != "no"; then if test "$with_libcap_ng" != "no"; then
AC_CHECK_LIB(cap-ng, capng_clear, AC_CHECK_LIB(cap-ng, capng_clear,
[AC_DEFINE(HAVE_LIBCAP_NG, 1, [Define to 1 if you have the `cap-ng' library (-lcap-ng).]) [AC_DEFINE(HAVE_LIBCAP_NG, 1, [Define to 1 if you have the `cap-ng' library (-lcap-ng).]) dnl `vim syntax
CAPNG_LDADD="-lcap-ng"; use_libcap_ng=yes]) CAPNG_LDADD="-lcap-ng"; use_libcap_ng=yes])
if test "$use_libcap_ng" = "yes"; then if test "$use_libcap_ng" = "yes"; then
@ -323,7 +349,6 @@ fi
AC_MSG_CHECKING([whether to use libcap-ng]) AC_MSG_CHECKING([whether to use libcap-ng])
AC_SUBST(CAPNG_LDADD) AC_SUBST(CAPNG_LDADD)
AM_CONDITIONAL(ENABLE_CAPABILITIES, [test "$use_libcap_ng" = "yes"])
AC_MSG_RESULT([$use_libcap_ng]) AC_MSG_RESULT([$use_libcap_ng])
# Assume broken snprintf only on Windows with MSVCRT (MinGW without ANSI stdio support) # Assume broken snprintf only on Windows with MSVCRT (MinGW without ANSI stdio support)
@ -357,11 +382,11 @@ AC_ARG_WITH(working-snprintf,
[libc_have_working_snprintf=$withval]) [libc_have_working_snprintf=$withval])
if test "$libc_have_working_snprintf" = "yes"; then if test "$libc_have_working_snprintf" = "yes"; then
AC_DEFINE(HAVE_WORKING_SNPRINTF, 1, [Define to 1 if the `snprintf' function is sane]) AC_DEFINE(HAVE_WORKING_SNPRINTF, 1, [Define to 1 if the `snprintf' function is sane.]) dnl `vim syntax
fi fi
if test "$prefix" = "NONE"; then if test "$prefix" = "NONE"; then
dnl no prefix and no mandir, so use ${prefix}/share/man as default # Fix mandir default set by autoconf 2.5x
if test "$mandir" = '${prefix}/man'; then if test "$mandir" = '${prefix}/man'; then
AC_SUBST([mandir], ['${prefix}/share/man']) AC_SUBST([mandir], ['${prefix}/share/man'])
fi fi
@ -620,3 +645,20 @@ case "$host_os" in
;; ;;
esac esac
echo "-----------------------------------------------------------------------------" >&AS_MESSAGE_FD echo "-----------------------------------------------------------------------------" >&AS_MESSAGE_FD
if test "$autoconf_25x" = "yes"; then
echo "WARNING:" >&AS_MESSAGE_FD
echo "Support for old autoconf 2.5x versions will be removed in a future" >&AS_MESSAGE_FD
echo "release of smartmontools." >&AS_MESSAGE_FD
elif test "${with_docdir+set}" = "set"; then
echo "WARNING:" >&AS_MESSAGE_FD
echo "Option --with-docdir is deprecated and will be removed in a future" >&AS_MESSAGE_FD
echo "release of smartmontools. Use --docdir instead." >&AS_MESSAGE_FD
fi
if test "$used_deprecated_option" = "yes"; then
echo "WARNING:" >&AS_MESSAGE_FD
echo "Options --disable-drivedb, --enable-savestates, --enable-attributelog are" >&AS_MESSAGE_FD
echo "deprecated and will be removed in a future release of smartmontools." >&AS_MESSAGE_FD
echo "Use --without-drivedb, --with-savestates, --with-attributelog instead." >&AS_MESSAGE_FD
fi

View File

@ -1,10 +1,9 @@
#!/bin/bash #!/bin/bash
# #
# do a smartmontools release # do a smartmontools release
# (C) 2003-11 Bruce Allen <ballen4705@users.sourceforge.net>, # (C) 2003-11 Bruce Allen, Guido Guenther
# Guido Guenther <agx@sigxcpu.org> # (C) 2006-15 Christian Franke
# (C) 2006-13 Christian Franke <smartmontools-support@lists.sourceforge.net> # $Id: do_release 4071 2015-04-26 18:25:12Z chrfranke $
# $Id: do_release 3765 2013-02-05 17:17:13Z chrfranke $
# Notes on generating releases: # Notes on generating releases:
# (1) update NEWS # (1) update NEWS
@ -15,8 +14,8 @@
set -e set -e
# Smartmontools Signing Key (through 2014) # Smartmontools Signing Key (through 2016)
KEYID=0x8F6ED8AA KEYID=0xC4A4903A
inc_release() inc_release()
{ {

809
drivedb.h

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
* *
* Copyright (C) 2003-11 Bruce Allen <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2003-11 Bruce Allen <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 2003-11 Doug Gilbert <dgilbert@interlog.com> * Copyright (C) 2003-11 Doug Gilbert <dgilbert@interlog.com>
* Copyright (C) 2008-14 Christian Franke <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2008-15 Christian Franke <smartmontools-support@lists.sourceforge.net>
* *
* Original AACRaid code: * Original AACRaid code:
* Copyright (C) 2014 Raghava Aditya <raghava.aditya@pmcs.com> * Copyright (C) 2014 Raghava Aditya <raghava.aditya@pmcs.com>
@ -99,7 +99,7 @@
#define ARGUSED(x) ((void)(x)) #define ARGUSED(x) ((void)(x))
const char * os_linux_cpp_cvsid = "$Id: os_linux.cpp 3900 2014-05-01 17:08:59Z chrfranke $" const char * os_linux_cpp_cvsid = "$Id: os_linux.cpp 4047 2015-03-22 16:16:24Z chrfranke $"
OS_LINUX_H_CVSID; OS_LINUX_H_CVSID;
extern unsigned char failuretest_permissive; extern unsigned char failuretest_permissive;
@ -194,11 +194,11 @@ bool linux_smart_device::close()
// examples for smartctl // examples for smartctl
static const char smartctl_examples[] = static const char smartctl_examples[] =
"=================================================== SMARTCTL EXAMPLES =====\n\n" "=================================================== SMARTCTL EXAMPLES =====\n\n"
" smartctl --all /dev/hda (Prints all SMART information)\n\n" " smartctl --all /dev/sda (Prints all SMART information)\n\n"
" smartctl --smart=on --offlineauto=on --saveauto=on /dev/hda\n" " smartctl --smart=on --offlineauto=on --saveauto=on /dev/sda\n"
" (Enables SMART on first disk)\n\n" " (Enables SMART on first disk)\n\n"
" smartctl --test=long /dev/hda (Executes extended disk self-test)\n\n" " smartctl --test=long /dev/sda (Executes extended disk self-test)\n\n"
" smartctl --attributes --log=selftest --quietmode=errorsonly /dev/hda\n" " smartctl --attributes --log=selftest --quietmode=errorsonly /dev/sda\n"
" (Prints Self-Test & Attribute errors)\n" " (Prints Self-Test & Attribute errors)\n"
" smartctl --all --device=3ware,2 /dev/sda\n" " smartctl --all --device=3ware,2 /dev/sda\n"
" smartctl --all --device=3ware,2 /dev/twe0\n" " smartctl --all --device=3ware,2 /dev/twe0\n"
@ -378,7 +378,7 @@ int linux_ata_device::ata_command_interface(smart_command_set command, int selec
memcpy(task+sizeof(ide_task_request_t), data, 512); memcpy(task+sizeof(ide_task_request_t), data, 512);
if ((retval=ioctl(get_fd(), HDIO_DRIVE_TASKFILE, task))) { if ((retval=ioctl(get_fd(), HDIO_DRIVE_TASKFILE, task))) {
if (retval==-EINVAL) if (errno==-EINVAL)
pout("Kernel lacks HDIO_DRIVE_TASKFILE support; compile kernel with CONFIG_IDE_TASKFILE_IO set\n"); pout("Kernel lacks HDIO_DRIVE_TASKFILE support; compile kernel with CONFIG_IDE_TASKFILE_IO set\n");
return -1; return -1;
} }
@ -406,7 +406,7 @@ int linux_ata_device::ata_command_interface(smart_command_set command, int selec
buff[5]=normal_hi; buff[5]=normal_hi;
if ((retval=ioctl(get_fd(), HDIO_DRIVE_TASK, buff))) { if ((retval=ioctl(get_fd(), HDIO_DRIVE_TASK, buff))) {
if (retval==-EINVAL) { if (errno==-EINVAL) {
pout("Error SMART Status command via HDIO_DRIVE_TASK failed"); pout("Error SMART Status command via HDIO_DRIVE_TASK failed");
pout("Rebuild older linux 2.2 kernels with HDIO_DRIVE_TASK support added\n"); pout("Rebuild older linux 2.2 kernels with HDIO_DRIVE_TASK support added\n");
} }
@ -1002,7 +1002,7 @@ bool linux_aacraid_device::scsi_pass_through(scsi_cmnd_io *iop)
uint8_t aBuff[sizeof(user_aac_srb64) + sizeof(user_aac_reply)] = {0,}; uint8_t aBuff[sizeof(user_aac_srb64) + sizeof(user_aac_reply)] = {0,};
pSrb = (user_aac_srb64*)aBuff; pSrb = (user_aac_srb64*)aBuff;
pReply = (user_aac_reply*)(aBuff+sizeof(user_aac_srb64)); pSrb->count = sizeof(user_aac_srb64) - sizeof(user_sgentry64);
#elif defined(ENVIRONMENT32) #elif defined(ENVIRONMENT32)
//Create user 32 bit request //Create user 32 bit request
@ -1010,8 +1010,7 @@ bool linux_aacraid_device::scsi_pass_through(scsi_cmnd_io *iop)
uint8_t aBuff[sizeof(user_aac_srb32) + sizeof(user_aac_reply)] = {0,}; uint8_t aBuff[sizeof(user_aac_srb32) + sizeof(user_aac_reply)] = {0,};
pSrb = (user_aac_srb32*)aBuff; pSrb = (user_aac_srb32*)aBuff;
pReply = (user_aac_reply*)(aBuff+sizeof(user_aac_srb32)); pSrb->count = sizeof(user_aac_srb32) - sizeof(user_sgentry32);
#endif #endif
pSrb->function = SRB_FUNCTION_EXECUTE_SCSI; pSrb->function = SRB_FUNCTION_EXECUTE_SCSI;
@ -1048,33 +1047,60 @@ bool linux_aacraid_device::scsi_pass_through(scsi_cmnd_io *iop)
pSrb->sg64.sg64[0].addr64.hi32 = ((intptr_t)iop->dxferp) >> 32; pSrb->sg64.sg64[0].addr64.hi32 = ((intptr_t)iop->dxferp) >> 32;
pSrb->sg64.sg64[0].length = (uint32_t)iop->dxfer_len; pSrb->sg64.sg64[0].length = (uint32_t)iop->dxfer_len;
pSrb->count = sizeof(user_aac_srb64) + pSrb->count += pSrb->sg64.count * sizeof(user_sgentry64);
(sizeof(user_sgentry64)*(pSrb->sg64.count-1));
#elif defined(ENVIRONMENT32) #elif defined(ENVIRONMENT32)
pSrb->sg32.count = 1; pSrb->sg32.count = 1;
pSrb->sg32.sg32[0].addr32 = (intptr_t)iop->dxferp; pSrb->sg32.sg32[0].addr32 = (intptr_t)iop->dxferp;
pSrb->sg32.sg32[0].length = (uint32_t)iop->dxfer_len; pSrb->sg32.sg32[0].length = (uint32_t)iop->dxfer_len;
pSrb->count = sizeof(user_aac_srb32) + pSrb->count += pSrb->sg32.count * sizeof(user_sgentry32);
(sizeof(user_sgentry32)*(pSrb->sg32.count-1));
#endif #endif
} }
pReply = (user_aac_reply*)(aBuff+pSrb->count);
memcpy(pSrb->cdb,iop->cmnd,iop->cmnd_len); memcpy(pSrb->cdb,iop->cmnd,iop->cmnd_len);
int rc = 0; int rc = 0;
errno = 0; errno = 0;
rc = ioctl(get_fd(),FSACTL_SEND_RAW_SRB,pSrb); rc = ioctl(get_fd(),FSACTL_SEND_RAW_SRB,pSrb);
if(rc!= 0 || pReply->srb_status != 0x01) {
if(pReply->srb_status == 0x08) { if (rc != 0)
return set_err(EIO, "aacraid: Device %d %d does not exist\n" ,aLun,aId ); return set_err(errno, "aacraid send_raw_srb: %d.%d = %s",
} aLun, aId, strerror(errno));
return set_err((errno ? errno : EIO), "aacraid result: %d.%d = %d/%d",
aLun, aId, errno, /* see kernel aacraid.h and MSDN SCSI_REQUEST_BLOCK documentation */
pReply->srb_status); #define SRB_STATUS_SUCCESS 0x1
#define SRB_STATUS_ERROR 0x4
#define SRB_STATUS_NO_DEVICE 0x08
#define SRB_STATUS_SELECTION_TIMEOUT 0x0a
#define SRB_STATUS_AUTOSENSE_VALID 0x80
iop->scsi_status = pReply->scsi_status;
if (pReply->srb_status == (SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_ERROR)
&& iop->scsi_status == SCSI_STATUS_CHECK_CONDITION) {
memcpy(iop->sensep, pReply->sense_data, pReply->sense_data_size);
iop->resp_sense_len = pReply->sense_data_size;
return true; /* request completed with sense data */
}
switch (pReply->srb_status & 0x3f) {
case SRB_STATUS_SUCCESS:
return true; /* request completed successfully */
case SRB_STATUS_NO_DEVICE:
return set_err(EIO, "aacraid: Device %d %d does not exist", aLun, aId);
case SRB_STATUS_SELECTION_TIMEOUT:
return set_err(EIO, "aacraid: Device %d %d not responding", aLun, aId);
default:
return set_err(EIO, "aacraid result: %d.%d = 0x%x",
aLun, aId, pReply->srb_status);
} }
return true;
} }
@ -2675,8 +2701,7 @@ std::string linux_smart_interface::get_app_examples(const char * appname)
} }
// we are going to take advantage of the fact that Linux's devfs will only // we are going to take advantage of the fact that Linux's devfs will only
// have device entries for devices that exist. So if we get the equivalent of // have device entries for devices that exist.
// ls /dev/hd[a-t], we have all the ATA devices on the system
bool linux_smart_interface::get_dev_list(smart_device_list & devlist, bool linux_smart_interface::get_dev_list(smart_device_list & devlist,
const char * pattern, bool scan_ata, bool scan_scsi, const char * pattern, bool scan_ata, bool scan_scsi,
const char * req_type, bool autodetect) const char * req_type, bool autodetect)
@ -2922,6 +2947,7 @@ linux_smart_interface::megasas_dcmd_cmd(int bus_no, uint32_t opcode, void *buf,
} }
int r = ioctl(fd, MEGASAS_IOC_FIRMWARE, &ioc); int r = ioctl(fd, MEGASAS_IOC_FIRMWARE, &ioc);
::close(fd);
if (r < 0) { if (r < 0) {
return (r); return (r);
} }

View File

@ -3,8 +3,13 @@
* *
* Home page of code is: http://smartmontools.sourceforge.net * Home page of code is: http://smartmontools.sourceforge.net
* *
* Copyright (C) 2004-14 Christian Franke <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2004-15 Christian Franke
* Copyright (C) 2012 Hank Wu <hank@areca.com.tw> *
* Original AACRaid code:
* Copyright (C) 2015 Nidhi Malhotra <nidhi.malhotra@pmcs.com>
*
* Original Areca code:
* Copyright (C) 2012 Hank Wu <hank@areca.com.tw>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -69,13 +74,17 @@
#endif #endif
#ifndef _WIN32 #ifndef _WIN32
// csmisas.h requires _WIN32 but w32api-headers no longer define it on Cygwin // csmisas.h and aacraid.h require _WIN32 but w32api-headers no longer define it on Cygwin
// (aacraid.h also checks for _WIN64 which is also set on Cygwin x64)
#define _WIN32 #define _WIN32
#endif #endif
// CSMI support // CSMI support
#include "csmisas.h" #include "csmisas.h"
// aacraid support
#include "aacraid.h"
// Silence -Wunused-local-typedefs warning from g++ >= 4.8 // Silence -Wunused-local-typedefs warning from g++ >= 4.8
#if __GNUC__ >= 4 #if __GNUC__ >= 4
#define ATTR_UNUSED __attribute__((unused)) #define ATTR_UNUSED __attribute__((unused))
@ -95,7 +104,14 @@
#define SELECT_WIN_32_64(x32, x64) (x64) #define SELECT_WIN_32_64(x32, x64) (x64)
#endif #endif
const char * os_win32_cpp_cvsid = "$Id: os_win32.cpp 3923 2014-06-25 17:10:46Z chrfranke $"; // Cygwin does no longer provide strn?icmp() compatibility macros
// MSVCRT does not provide strn?casecmp()
#if defined(__CYGWIN__) && !defined(stricmp)
#define stricmp strcasecmp
#define strnicmp strncasecmp
#endif
const char * os_win32_cpp_cvsid = "$Id: os_win32.cpp 4098 2015-05-30 16:37:37Z chrfranke $";
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Windows I/O-controls, some declarations are missing in the include files // Windows I/O-controls, some declarations are missing in the include files
@ -306,6 +322,10 @@ ASSERT_SIZEOF(CSMI_SAS_DRIVER_INFO_BUFFER, 204);
ASSERT_SIZEOF(CSMI_SAS_PHY_INFO_BUFFER, 2080); ASSERT_SIZEOF(CSMI_SAS_PHY_INFO_BUFFER, 2080);
ASSERT_SIZEOF(CSMI_SAS_STP_PASSTHRU_BUFFER, 168); ASSERT_SIZEOF(CSMI_SAS_STP_PASSTHRU_BUFFER, 168);
// aacraid struct
ASSERT_SIZEOF(SCSI_REQUEST_BLOCK, SELECT_WIN_32_64(64, 88));
} // extern "C" } // extern "C"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -492,6 +512,34 @@ private:
ata_smart_values m_smart_buf; ata_smart_values m_smart_buf;
}; };
/////////////////////////////////////////////////////////////////////////////
//// PMC aacraid Support
class win_aacraid_device
:public /*implements*/ scsi_device,
public /*extends*/ win_smart_device
{
public:
win_aacraid_device(smart_interface *intf, const char *dev_name,unsigned int ctrnum, unsigned int target, unsigned int lun);
virtual ~win_aacraid_device() throw();
virtual bool open();
virtual bool scsi_pass_through(struct scsi_cmnd_io *iop);
private:
//Device Host number
int m_ctrnum;
//Channel(Lun) of the device
int m_lun;
//Id of the device
int m_target;
};
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/// Areca RAID support /// Areca RAID support
@ -647,6 +695,7 @@ std::string win_smart_interface::get_os_version_str()
case 0x61: w = (ws ? "win7" : "2008r2"); break; case 0x61: w = (ws ? "win7" : "2008r2"); break;
case 0x62: w = (ws ? "win8" : "2012" ); break; case 0x62: w = (ws ? "win8" : "2012" ); break;
case 0x63: w = (ws ? "win8.1": "2012r2"); break; case 0x63: w = (ws ? "win8.1": "2012r2"); break;
case 0x64: w = (ws ? "win10" : "w10srv"); break;
} }
} }
} }
@ -696,7 +745,7 @@ int64_t win_smart_interface::get_timer_usec()
// Return value for device detection functions // Return value for device detection functions
enum win_dev_type { DEV_UNKNOWN = 0, DEV_ATA, DEV_SCSI, DEV_USB }; enum win_dev_type { DEV_UNKNOWN = 0, DEV_ATA, DEV_SCSI, DEV_SAT, DEV_USB };
static win_dev_type get_phy_drive_type(int drive); static win_dev_type get_phy_drive_type(int drive);
static win_dev_type get_phy_drive_type(int drive, GETVERSIONINPARAMS_EX * ata_version_ex); static win_dev_type get_phy_drive_type(int drive, GETVERSIONINPARAMS_EX * ata_version_ex);
@ -828,6 +877,55 @@ smart_device * win_smart_interface::get_custom_smart_device(const char * name, c
} }
else else
set_err(EINVAL, "Option -d areca,N/E requires device name /dev/arcmsrX"); set_err(EINVAL, "Option -d areca,N/E requires device name /dev/arcmsrX");
return 0;
}
// aacraid?
unsigned ctrnum, lun, target;
n1 = -1;
if ( sscanf(type, "aacraid,%u,%u,%u%n", &ctrnum, &lun, &target, &n1) >= 3
&& n1 == (int)strlen(type)) {
#define aacraid_MAX_CTLR_NUM 16
if (ctrnum >= aacraid_MAX_CTLR_NUM) {
set_err(EINVAL, "aacraid: invalid host number %u", ctrnum);
return 0;
}
/*
1. scan from "\\\\.\\scsi[0]:" up to "\\\\.\\scsi[AACRAID_MAX_CTLR_NUM]:" and
2. map ARCX into "\\\\.\\scsiX"
*/
memset(devpath, 0, sizeof(devpath));
unsigned ctlrindex = 0;
for (int portNum = 0; portNum < aacraid_MAX_CTLR_NUM; portNum++){
char subKey[63];
snprintf(subKey, sizeof(subKey), "HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port %d", portNum);
HKEY hScsiKey = 0;
long regStatus = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subKey, 0, KEY_READ, &hScsiKey);
if (regStatus == ERROR_SUCCESS){
char driverName[20];
DWORD driverNameSize = sizeof(driverName);
DWORD regType = 0;
regStatus = RegQueryValueExA(hScsiKey, "Driver", NULL, &regType, (LPBYTE) driverName, &driverNameSize);
if (regStatus == ERROR_SUCCESS){
if (regType == REG_SZ){
if (stricmp(driverName, "arcsas") == 0){
if(ctrnum == ctlrindex){
snprintf(devpath, sizeof(devpath), "\\\\.\\Scsi%d:", portNum);
return get_sat_device("sat,auto",
new win_aacraid_device(this, devpath, ctrnum, target, lun));
}
ctlrindex++;
}
}
}
RegCloseKey(hScsiKey);
}
}
set_err(EINVAL, "aacraid: host %u not found", ctrnum);
return 0;
} }
return 0; return 0;
@ -835,7 +933,7 @@ smart_device * win_smart_interface::get_custom_smart_device(const char * name, c
std::string win_smart_interface::get_valid_custom_dev_types_str() std::string win_smart_interface::get_valid_custom_dev_types_str()
{ {
return "areca,N[/E]"; return "aacraid,H,L,ID, areca,N[/E]";
} }
@ -856,9 +954,13 @@ smart_device * win_smart_interface::autodetect_smart_device(const char * name)
if (type == DEV_ATA) if (type == DEV_ATA)
return new win_ata_device(this, name, ""); return new win_ata_device(this, name, "");
if (type == DEV_SCSI) if (type == DEV_SCSI)
return new win_scsi_device(this, name, ""); return new win_scsi_device(this, name, "");
if (type == DEV_SAT)
return get_sat_device("sat", new win_scsi_device(this, name, ""));
if (type == DEV_USB) { if (type == DEV_USB) {
// Get USB bridge ID // Get USB bridge ID
unsigned short vendor_id = 0, product_id = 0; unsigned short vendor_id = 0, product_id = 0;
@ -905,29 +1007,33 @@ bool win_smart_interface::scan_smart_devices(smart_device_list & devlist,
} }
// Set valid types // Set valid types
bool ata, scsi, usb, csmi; bool ata, scsi, sat, usb, csmi;
if (!type) { if (!type) {
ata = scsi = usb = csmi = true; ata = scsi = usb = sat = csmi = true;
} }
else { else {
ata = scsi = usb = csmi = false; ata = scsi = usb = sat = csmi = false;
if (!strcmp(type, "ata")) if (!strcmp(type, "ata"))
ata = true; ata = true;
else if (!strcmp(type, "scsi")) else if (!strcmp(type, "scsi"))
scsi = true; scsi = true;
else if (!strcmp(type, "sat"))
sat = true;
else if (!strcmp(type, "usb")) else if (!strcmp(type, "usb"))
usb = true; usb = true;
else if (!strcmp(type, "csmi")) else if (!strcmp(type, "csmi"))
csmi = true; csmi = true;
else { else {
set_err(EINVAL, "Invalid type '%s', valid arguments are: ata[,pd], scsi[,pd], usb[,pd], csmi, pd", type); set_err(EINVAL,
"Invalid type '%s', valid arguments are: ata[,pd], scsi[,pd], sat[,pd], usb[,pd], csmi, pd",
type);
return false; return false;
} }
} }
char name[20]; char name[20];
if (ata || scsi || usb) { if (ata || scsi || sat || usb) {
// Scan up to 128 drives and 2 3ware controllers // Scan up to 128 drives and 2 3ware controllers
const int max_raid = 2; const int max_raid = 2;
bool raid_seen[max_raid] = {false, false}; bool raid_seen[max_raid] = {false, false};
@ -977,6 +1083,13 @@ bool win_smart_interface::scan_smart_devices(smart_device_list & devlist,
devlist.push_back( new win_scsi_device(this, name, "scsi") ); devlist.push_back( new win_scsi_device(this, name, "scsi") );
break; break;
case DEV_SAT:
// STORAGE_QUERY_PROPERTY returned VendorId "ATA "
if (!sat)
continue;
devlist.push_back( get_sat_device("sat", new win_scsi_device(this, name, "")) );
break;
case DEV_USB: case DEV_USB:
// STORAGE_QUERY_PROPERTY returned USB // STORAGE_QUERY_PROPERTY returned USB
if (!usb) if (!usb)
@ -2015,6 +2128,16 @@ static int storage_predict_failure_ioctl(HANDLE hdevice, char * data = 0)
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Return true if ATA drive behind a SAT layer
static bool is_sat(const STORAGE_DEVICE_DESCRIPTOR_DATA * data)
{
if (!data->desc.VendorIdOffset)
return false;
if (strcmp(data->raw + data->desc.VendorIdOffset, "ATA "))
return false;
return true;
}
// Return true if Intel ICHxR RAID volume // Return true if Intel ICHxR RAID volume
static bool is_intel_raid_volume(const STORAGE_DEVICE_DESCRIPTOR_DATA * data) static bool is_intel_raid_volume(const STORAGE_DEVICE_DESCRIPTOR_DATA * data)
{ {
@ -2040,22 +2163,34 @@ static win_dev_type get_controller_type(HANDLE hdevice, bool admin, GETVERSIONIN
switch ((int)data.desc.BusType) { switch ((int)data.desc.BusType) {
case BusTypeAta: case BusTypeAta:
case 0x0b: // BusTypeSata case 0x0b: // BusTypeSata
// Certain Intel AHCI drivers (C600+/C220+) have broken
// IOCTL_ATA_PASS_THROUGH support and a working SAT layer
if (is_sat(&data))
return DEV_SAT;
if (ata_version_ex) if (ata_version_ex)
memset(ata_version_ex, 0, sizeof(*ata_version_ex)); memset(ata_version_ex, 0, sizeof(*ata_version_ex));
return DEV_ATA; return DEV_ATA;
case BusTypeScsi: case BusTypeScsi:
case BusTypeRAID: case BusTypeRAID:
if (is_sat(&data))
return DEV_SAT;
// Intel ICHxR RAID volume: reports SMART_GET_VERSION but does not support SMART_* // Intel ICHxR RAID volume: reports SMART_GET_VERSION but does not support SMART_*
if (is_intel_raid_volume(&data)) if (is_intel_raid_volume(&data))
return DEV_SCSI; return DEV_SCSI;
// LSI/3ware RAID volume: supports SMART_* // LSI/3ware RAID volume: supports SMART_*
if (admin && smart_get_version(hdevice, ata_version_ex) >= 0) if (admin && smart_get_version(hdevice, ata_version_ex) >= 0)
return DEV_ATA; return DEV_ATA;
return DEV_SCSI; return DEV_SCSI;
case 0x09: // BusTypeiScsi case 0x09: // BusTypeiScsi
case 0x0a: // BusTypeSas case 0x0a: // BusTypeSas
if (is_sat(&data))
return DEV_SAT;
return DEV_SCSI; return DEV_SCSI;
case BusTypeUsb: case BusTypeUsb:
@ -3831,6 +3966,170 @@ bool win_areca_ata_device::arcmsr_unlock()
return true; return true;
} }
// AACRAID
win_aacraid_device::win_aacraid_device(smart_interface * intf,
const char *dev_name, unsigned ctrnum, unsigned target, unsigned lun)
: smart_device(intf, dev_name, "aacraid", "aacraid"),
m_ctrnum(ctrnum), m_lun(lun), m_target(target)
{
set_info().info_name = strprintf("%s [aacraid_disk_%02d_%02d_%d]", dev_name, m_ctrnum, m_lun, m_target);
set_info().dev_type = strprintf("aacraid,%d,%d,%d", m_ctrnum, m_lun, m_target);
}
win_aacraid_device::~win_aacraid_device() throw()
{
}
bool win_aacraid_device::open()
{
if (is_open())
return true;
HANDLE hFh = CreateFile( get_dev_name(),
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
0,
0);
if (hFh == INVALID_HANDLE_VALUE)
return set_err(ENODEV, "Open failed, Error=%u", (unsigned)GetLastError());
set_fh(hFh);
return true;
}
bool win_aacraid_device::scsi_pass_through(struct scsi_cmnd_io *iop)
{
int report = scsi_debugmode;
if (report > 0)
{
int k, j;
const unsigned char * ucp = iop->cmnd;
const char * np;
char buff[256];
const int sz = (int)sizeof(buff);
np = scsi_get_opcode_name(ucp[0]);
j = snprintf(buff, sz, " [%s: ", np ? np : "<unknown opcode>");
for (k = 0; k < (int)iop->cmnd_len; ++k)
j += snprintf(&buff[j], (sz > j ? (sz - j) : 0), "%02x ", ucp[k]);
if ((report > 1) &&
(DXFER_TO_DEVICE == iop->dxfer_dir) && (iop->dxferp)) {
int trunc = (iop->dxfer_len > 256) ? 1 : 0;
j += snprintf(&buff[j], (sz > j ? (sz - j) : 0), "]\n Outgoing "
"data, len=%d%s:\n", (int)iop->dxfer_len,
(trunc ? " [only first 256 bytes shown]" : ""));
dStrHex((const char *)iop->dxferp,
(trunc ? 256 : (int)iop->dxfer_len) , 1);
}
else
j += snprintf(&buff[j], (sz > j ? (sz - j) : 0), "]\n");
pout("buff %s\n",buff);
}
char ioBuffer[1000];
SRB_IO_CONTROL * pSrbIO = (SRB_IO_CONTROL *) ioBuffer;
SCSI_REQUEST_BLOCK * pScsiIO = (SCSI_REQUEST_BLOCK *) (ioBuffer + sizeof(SRB_IO_CONTROL));
DWORD scsiRequestBlockSize = sizeof(SCSI_REQUEST_BLOCK);
char *pRequestSenseIO = (char *) (ioBuffer + sizeof(SRB_IO_CONTROL) + scsiRequestBlockSize);
DWORD dataOffset = (sizeof(SRB_IO_CONTROL) + scsiRequestBlockSize + 7) & 0xfffffff8;
char *pDataIO = (char *) (ioBuffer + dataOffset);
memset(pScsiIO, 0, scsiRequestBlockSize);
pScsiIO->Length = (USHORT) scsiRequestBlockSize;
pScsiIO->Function = SRB_FUNCTION_EXECUTE_SCSI;
pScsiIO->PathId = 0;
pScsiIO->TargetId = m_target;
pScsiIO->Lun = m_lun;
pScsiIO->CdbLength = (int)iop->cmnd_len;
switch(iop->dxfer_dir){
case DXFER_NONE:
pScsiIO->SrbFlags = SRB_NoDataXfer;
break;
case DXFER_FROM_DEVICE:
pScsiIO->SrbFlags |= SRB_DataIn;
break;
case DXFER_TO_DEVICE:
pScsiIO->SrbFlags |= SRB_DataOut;
break;
default:
pout("aacraid: bad dxfer_dir\n");
return set_err(EINVAL, "aacraid: bad dxfer_dir\n");
}
pScsiIO->DataTransferLength = (ULONG)iop->dxfer_len;
pScsiIO->TimeOutValue = iop->timeout;
UCHAR *pCdb = (UCHAR *) pScsiIO->Cdb;
memcpy(pCdb, iop->cmnd, 16);
if (iop->max_sense_len){
memset(pRequestSenseIO, 0, iop->max_sense_len);
}
if (pScsiIO->SrbFlags & SRB_FLAGS_DATA_OUT){
memcpy(pDataIO, iop->dxferp, iop->dxfer_len);
}
else if (pScsiIO->SrbFlags & SRB_FLAGS_DATA_IN){
memset(pDataIO, 0, iop->dxfer_len);
}
DWORD bytesReturned = 0;
memset(pSrbIO, 0, sizeof(SRB_IO_CONTROL));
pSrbIO->HeaderLength = sizeof(SRB_IO_CONTROL);
memcpy(pSrbIO->Signature, "AACAPI", 7);
pSrbIO->ControlCode = ARCIOCTL_SEND_RAW_SRB;
pSrbIO->Length = (dataOffset + iop->dxfer_len - sizeof(SRB_IO_CONTROL) + 7) & 0xfffffff8;
pSrbIO->Timeout = 3*60;
if (!DeviceIoControl(
get_fh(),
IOCTL_SCSI_MINIPORT,
ioBuffer,
sizeof(SRB_IO_CONTROL) + pSrbIO->Length,
ioBuffer,
sizeof(SRB_IO_CONTROL) + pSrbIO->Length,
&bytesReturned,
NULL)
) {
return set_err(EIO, "ARCIOCTL_SEND_RAW_SRB failed, Error=%u", (unsigned)GetLastError());
}
iop->scsi_status = pScsiIO->ScsiStatus;
if (SCSI_STATUS_CHECK_CONDITION & iop->scsi_status) {
int slen = sizeof(pRequestSenseIO) + 8;
if (slen > (int)sizeof(pRequestSenseIO))
slen = sizeof(pRequestSenseIO);
if (slen > (int)iop->max_sense_len)
slen = (int)iop->max_sense_len;
memcpy(iop->sensep, pRequestSenseIO, slen);
iop->resp_sense_len = slen;
if (report) {
if (report > 1) {
pout(" >>> Sense buffer, len=%d:\n", slen);
dStrHex(iop->sensep, slen , 1);
}
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]);
}
}
else {
iop->resp_sense_len = 0;
}
if (iop->dxfer_dir == DXFER_FROM_DEVICE){
memcpy(iop->dxferp,pDataIO, iop->dxfer_len);
}
if((iop->dxfer_dir == DXFER_FROM_DEVICE) && (report > 1)){
int trunc = (iop->dxfer_len > 256) ? 1 : 0;
pout(" Incoming data, len=%d, resid=%d%s:\n", (int)iop->dxfer_len, iop->resid,
(trunc ? " [only first 256 bytes shown]" : ""));
dStrHex((CHAR*)pDataIO, (trunc ? 256 : (int)(iop->dxfer_len)) , 1);
}
return true;
}
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -3,7 +3,7 @@
; ;
; Home page of code is: http://smartmontools.sourceforge.net ; Home page of code is: http://smartmontools.sourceforge.net
; ;
; Copyright (C) 2006-14 Christian Franke <smartmontools-support@lists.sourceforge.net> ; Copyright (C) 2006-15 Christian Franke
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
@ -13,7 +13,7 @@
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; (for example COPYING); If not, see <http://www.gnu.org/licenses/>. ; (for example COPYING); If not, see <http://www.gnu.org/licenses/>.
; ;
; $Id: installer.nsi 3912 2014-06-18 19:03:30Z chrfranke $ ; $Id: installer.nsi 4072 2015-04-28 20:35:15Z chrfranke $
; ;
@ -182,7 +182,6 @@ Section "!Documentation" DOC_SECTION
File "${INPDIR}\doc\NEWS.txt" File "${INPDIR}\doc\NEWS.txt"
File "${INPDIR}\doc\README.txt" File "${INPDIR}\doc\README.txt"
File "${INPDIR}\doc\TODO.txt" File "${INPDIR}\doc\TODO.txt"
File "${INPDIR}\doc\WARNINGS.txt"
!ifdef INPDIR64 !ifdef INPDIR64
StrCmp $X64 "" +3 StrCmp $X64 "" +3
File "${INPDIR64}\doc\checksums64.txt" File "${INPDIR64}\doc\checksums64.txt"
@ -444,7 +443,6 @@ Section "Uninstall"
Delete "$INSTDIR\doc\NEWS.txt" Delete "$INSTDIR\doc\NEWS.txt"
Delete "$INSTDIR\doc\README.txt" Delete "$INSTDIR\doc\README.txt"
Delete "$INSTDIR\doc\TODO.txt" Delete "$INSTDIR\doc\TODO.txt"
Delete "$INSTDIR\doc\WARNINGS.txt"
Delete "$INSTDIR\doc\checksums*.txt" Delete "$INSTDIR\doc\checksums*.txt"
Delete "$INSTDIR\doc\smartctl.8.html" Delete "$INSTDIR\doc\smartctl.8.html"
Delete "$INSTDIR\doc\smartctl.8.txt" Delete "$INSTDIR\doc\smartctl.8.txt"
@ -647,8 +645,31 @@ Function AddToPath
Push $1 Push $1
Push $2 Push $2
Push $3 Push $3
Push $4
ReadRegStr $1 ${Environ} "PATH" ; NSIS ReadRegStr returns empty string on string overflow
; Native calls are used here to check actual length of PATH
; $4 = RegOpenKey(HKEY_CURRENT_USER, "Environment", &$3)
System::Call "advapi32::RegOpenKey(i 0x80000001, t'Environment', *i.r3) i.r4"
IntCmp $4 0 0 done done
; $4 = RegQueryValueEx($3, "PATH", (DWORD*)0, (DWORD*)0, &$1, ($2=NSIS_MAX_STRLEN, &$2))
; RegCloseKey($3)
System::Call "advapi32::RegQueryValueEx(i $3, t'PATH', i 0, i 0, t.r1, *i ${NSIS_MAX_STRLEN} r2) i.r4"
System::Call "advapi32::RegCloseKey(i $3)"
IntCmp $4 234 0 +4 +4 ; $4 == ERROR_MORE_DATA
DetailPrint "AddToPath: original length $2 > ${NSIS_MAX_STRLEN}"
MessageBox MB_OK "PATH not updated, original length $2 > ${NSIS_MAX_STRLEN}"
Goto done
IntCmp $4 0 +5 ; $4 != NO_ERROR
IntCmp $4 2 +3 ; $4 != ERROR_FILE_NOT_FOUND
DetailPrint "AddToPath: unexpected error code $4"
Goto done
StrCpy $1 ""
; Check if already in PATH
Push "$1;" Push "$1;"
Push "$0;" Push "$0;"
Call StrStr Call StrStr
@ -660,6 +681,17 @@ Function AddToPath
Pop $2 Pop $2
StrCmp $2 "" 0 done StrCmp $2 "" 0 done
; Prevent NSIS string overflow
StrLen $2 $0
StrLen $3 $1
IntOp $2 $2 + $3
IntOp $2 $2 + 2 ; $2 = strlen(dir) + strlen(PATH) + sizeof(";")
IntCmp $2 ${NSIS_MAX_STRLEN} +4 +4 0
DetailPrint "AddToPath: new length $2 > ${NSIS_MAX_STRLEN}"
MessageBox MB_OK "PATH not updated, new length $2 > ${NSIS_MAX_STRLEN}."
Goto done
; Append dir to PATH
DetailPrint "Add to PATH: $0" DetailPrint "Add to PATH: $0"
StrCpy $2 $1 1 -1 StrCpy $2 $1 1 -1
StrCmp $2 ";" 0 +2 StrCmp $2 ";" 0 +2
@ -670,6 +702,7 @@ Function AddToPath
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
done: done:
Pop $4
Pop $3 Pop $3
Pop $2 Pop $2
Pop $1 Pop $1

View File

@ -171,6 +171,7 @@
<ClCompile Include="..\..\utility.cpp" /> <ClCompile Include="..\..\utility.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\aacraid.h" />
<ClInclude Include="..\..\ataidentify.h" /> <ClInclude Include="..\..\ataidentify.h" />
<ClInclude Include="..\..\dev_areca.h" /> <ClInclude Include="..\..\dev_areca.h" />
<ClInclude Include="config.h" /> <ClInclude Include="config.h" />

View File

@ -82,6 +82,7 @@
<ClInclude Include="..\..\getopt\getopt.h"> <ClInclude Include="..\..\getopt\getopt.h">
<Filter>getopt</Filter> <Filter>getopt</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\aacraid.h" />
<ClInclude Include="..\..\atacmdnames.h" /> <ClInclude Include="..\..\atacmdnames.h" />
<ClInclude Include="..\..\atacmds.h" /> <ClInclude Include="..\..\atacmds.h" />
<ClInclude Include="..\..\ataprint.h" /> <ClInclude Include="..\..\ataprint.h" />

View File

@ -174,6 +174,7 @@
<ClCompile Include="..\..\utility.cpp" /> <ClCompile Include="..\..\utility.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\aacraid.h" />
<ClInclude Include="..\..\ataidentify.h"> <ClInclude Include="..\..\ataidentify.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>

View File

@ -88,6 +88,7 @@
<ClInclude Include="..\..\getopt\getopt.h"> <ClInclude Include="..\..\getopt\getopt.h">
<Filter>getopt</Filter> <Filter>getopt</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\aacraid.h" />
<ClInclude Include="..\..\atacmdnames.h" /> <ClInclude Include="..\..\atacmdnames.h" />
<ClInclude Include="..\..\atacmds.h" /> <ClInclude Include="..\..\atacmds.h" />
<ClInclude Include="..\..\cissio_freebsd.h" /> <ClInclude Include="..\..\cissio_freebsd.h" />

View File

@ -62,7 +62,7 @@
#include "dev_ata_cmd_set.h" // ata_device_with_command_set #include "dev_ata_cmd_set.h" // ata_device_with_command_set
#include "dev_tunnelled.h" // tunnelled_device<> #include "dev_tunnelled.h" // tunnelled_device<>
const char * scsiata_cpp_cvsid = "$Id: scsiata.cpp 3922 2014-06-23 19:17:18Z chrfranke $"; const char * scsiata_cpp_cvsid = "$Id: scsiata.cpp 4041 2015-03-14 00:50:20Z dpgilbert $";
/* This is a slightly stretched SCSI sense "descriptor" format header. /* This is a slightly stretched SCSI sense "descriptor" format header.
The addition is to allow the 0x70 and 0x71 response codes. The idea The addition is to allow the 0x70 and 0x71 response codes. The idea
@ -203,6 +203,25 @@ sat_device::~sat_device() throw()
// des[11]: lba_high (7:0) // des[11]: lba_high (7:0)
// des[12]: device // des[12]: device
// des[13]: status // des[13]: status
//
//
// ATA registers returned via fixed format sense (allowed >= SAT-2)
// fxs[0]: info_valid (bit 7); response_code (6:0)
// fxs[1]: (obsolete)
// fxs[2]: sense_key (3:0) --> recovered error (formerly 'no sense')
// fxs[3]: information (31:24) --> ATA Error register
// fxs[4]: information (23:16) --> ATA Status register
// fxs[5]: information (15:8) --> ATA Device register
// fxs[6]: information (7:0) --> ATA Count (7:0)
// fxs[7]: additional sense length [should be >= 10]
// fxs[8]: command specific info (31:24) --> Extend (7), count_upper_nonzero
// (6), lba_upper_nonzero(5), log_index (3:0)
// fxs[9]: command specific info (23:16) --> ATA LBA (7:0)
// fxs[10]: command specific info (15:8) --> ATA LBA (15:8)
// fxs[11]: command specific info (7:0) --> ATA LBA (23:16)
// fxs[12]: additional sense code (asc) --> 0x0
// fxs[13]: additional sense code qualifier (ascq) --> 0x1d
// asc,ascq = 0x0,0x1d --> 'ATA pass through information available'
@ -243,7 +262,7 @@ bool sat_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out & out)
unsigned char cdb[SAT_ATA_PASSTHROUGH_16LEN]; unsigned char cdb[SAT_ATA_PASSTHROUGH_16LEN];
unsigned char sense[32]; unsigned char sense[32];
const unsigned char * ardp; const unsigned char * ardp;
int status, ard_len, have_sense; int ard_len, have_sense;
int extend = 0; int extend = 0;
int ck_cond = 0; /* set to 1 to read register(s) back */ int ck_cond = 0; /* set to 1 to read register(s) back */
int protocol = 3; /* non-data */ int protocol = 3; /* non-data */
@ -251,6 +270,7 @@ bool sat_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out & out)
int byte_block = 1; /* 0 -> bytes, 1 -> 512 byte blocks */ int byte_block = 1; /* 0 -> bytes, 1 -> 512 byte blocks */
int t_length = 0; /* 0 -> no data transferred */ int t_length = 0; /* 0 -> no data transferred */
int passthru_size = DEF_SAT_ATA_PASSTHRU_SIZE; int passthru_size = DEF_SAT_ATA_PASSTHRU_SIZE;
bool sense_descriptor = true;
memset(cdb, 0, sizeof(cdb)); memset(cdb, 0, sizeof(cdb));
memset(sense, 0, sizeof(sense)); memset(sense, 0, sizeof(sense));
@ -358,20 +378,23 @@ bool sat_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out & out)
have_sense = sg_scsi_normalize_sense(io_hdr.sensep, io_hdr.resp_sense_len, have_sense = sg_scsi_normalize_sense(io_hdr.sensep, io_hdr.resp_sense_len,
&ssh); &ssh);
if (have_sense) { if (have_sense) {
/* look for SAT ATA Return Descriptor */ sense_descriptor = ssh.response_code >= 0x72;
ardp = sg_scsi_sense_desc_find(io_hdr.sensep, if (sense_descriptor) {
io_hdr.resp_sense_len, /* look for SAT ATA Return Descriptor */
ATA_RETURN_DESCRIPTOR); ardp = sg_scsi_sense_desc_find(io_hdr.sensep,
if (ardp) { io_hdr.resp_sense_len,
ard_len = ardp[1] + 2; ATA_RETURN_DESCRIPTOR);
if (ard_len < 12) if (ardp) {
ard_len = 12; ard_len = ardp[1] + 2;
else if (ard_len > 14) if (ard_len < 12)
ard_len = 14; ard_len = 12;
else if (ard_len > 14)
ard_len = 14;
}
} }
scsi_do_sense_disect(&io_hdr, &sinfo); scsi_do_sense_disect(&io_hdr, &sinfo);
status = scsiSimpleSenseFilter(&sinfo); int status = scsiSimpleSenseFilter(&sinfo);
if (0 != status) { if (0 != status) { /* other than no_sense and recovered_error */
if (scsi_debugmode > 0) { if (scsi_debugmode > 0) {
pout("sat_device::ata_pass_through: scsi error: %s\n", pout("sat_device::ata_pass_through: scsi error: %s\n",
scsiErrString(status)); scsiErrString(status));
@ -408,26 +431,56 @@ bool sat_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out & out)
hi.lba_mid = ardp[ 8]; hi.lba_mid = ardp[ 8];
hi.lba_high = ardp[10]; hi.lba_high = ardp[10];
} }
} else if ((! sense_descriptor) &&
(0 == ssh.asc) &&
(SCSI_ASCQ_ATA_PASS_THROUGH == ssh.ascq)) {
/* in SAT-2 and later, ATA registers may be passed back via
* fixed format sense data [ref: sat3r07 section 12.2.2.7] */
ata_out_regs & lo = out.out_regs;
lo.error = io_hdr.sensep[ 3];
lo.status = io_hdr.sensep[ 4];
lo.device = io_hdr.sensep[ 5];
lo.sector_count = io_hdr.sensep[ 6];
lo.lba_low = io_hdr.sensep[ 9];
lo.lba_mid = io_hdr.sensep[10];
lo.lba_high = io_hdr.sensep[11];
if (in.in_regs.is_48bit_cmd()) {
if (0 == (0x60 & io_hdr.sensep[8])) {
ata_out_regs & hi = out.out_regs.prev;
hi.sector_count = 0;
hi.lba_low = 0;
hi.lba_mid = 0;
hi.lba_high = 0;
} else {
/* getting the "hi." values when either
* count_upper_nonzero or lba_upper_nonzero are set
* involves fetching the SCSI ATA PASS-THROUGH
* Results log page and decoding the descriptor with
* the matching log_index field. Painful. */
}
}
} }
} }
if (ardp == NULL) } else { /* ck_cond == 0 */
ck_cond = 0; /* not the type of sense data expected */
}
if (0 == ck_cond) {
if (have_sense) { if (have_sense) {
if ((ssh.response_code >= 0x72) && if (((SCSI_SK_NO_SENSE == ssh.sense_key) ||
((SCSI_SK_NO_SENSE == ssh.sense_key) ||
(SCSI_SK_RECOVERED_ERR == ssh.sense_key)) && (SCSI_SK_RECOVERED_ERR == ssh.sense_key)) &&
(0 == ssh.asc) && (0 == ssh.asc) &&
(SCSI_ASCQ_ATA_PASS_THROUGH == ssh.ascq)) { (SCSI_ASCQ_ATA_PASS_THROUGH == ssh.ascq)) {
if (ardp) { if (scsi_debugmode > 0) {
if (scsi_debugmode > 0) { if (sense_descriptor && ardp) {
pout("Values from ATA Return Descriptor are:\n"); pout("Values from ATA Return Descriptor are:\n");
dStrHex((const char *)ardp, ard_len, 1); dStrHex((const char *)ardp, ard_len, 1);
} else if (! sense_descriptor) {
pout("Values from ATA fixed format sense are:\n");
pout(" Error: 0x%x\n", io_hdr.sensep[3]);
pout(" Status: 0x%x\n", io_hdr.sensep[4]);
pout(" Device: 0x%x\n", io_hdr.sensep[5]);
pout(" Count: 0x%x\n", io_hdr.sensep[6]);
} }
return set_err(EIO, "SAT command failed");
} }
} }
return set_err(EIO, "SAT command failed");
} }
} }
return true; return true;
@ -1118,6 +1171,148 @@ bool usbjmicron_device::get_registers(unsigned short addr,
} }
/////////////////////////////////////////////////////////////////////////////
/// Prolific USB Bridge support. (PL2773) (Probably works on PL2771 also...)
class usbprolific_device
: public tunnelled_device<
/*implements*/ ata_device,
/*by tunnelling through a*/ scsi_device
>
{
public:
usbprolific_device(smart_interface * intf, scsi_device * scsidev,
const char * req_type);
virtual ~usbprolific_device() throw();
virtual bool ata_pass_through(const ata_cmd_in & in, ata_cmd_out & out);
};
usbprolific_device::usbprolific_device(smart_interface * intf, scsi_device * scsidev,
const char * req_type)
: smart_device(intf, scsidev->get_dev_name(), "usbprolific", req_type),
tunnelled_device<ata_device, scsi_device>(scsidev)
{
set_info().info_name = strprintf("%s [USB Prolific]", scsidev->get_info_name());
}
usbprolific_device::~usbprolific_device() throw()
{
}
bool usbprolific_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out & out)
{
if (!ata_cmd_is_supported(in,
ata_device::supports_data_out |
ata_device::supports_48bit_hi_null |
ata_device::supports_output_regs |
ata_device::supports_smart_status,
"Prolific" )
)
return false;
scsi_cmnd_io io_hdr;
memset(&io_hdr, 0, sizeof(io_hdr));
unsigned char cmd_rw = 0x10; // Read
switch (in.direction) {
case ata_cmd_in::no_data:
io_hdr.dxfer_dir = DXFER_NONE;
break;
case ata_cmd_in::data_in:
io_hdr.dxfer_dir = DXFER_FROM_DEVICE;
io_hdr.dxfer_len = in.size;
io_hdr.dxferp = (unsigned char *)in.buffer;
memset(in.buffer, 0, in.size);
break;
case ata_cmd_in::data_out:
io_hdr.dxfer_dir = DXFER_TO_DEVICE;
io_hdr.dxfer_len = in.size;
io_hdr.dxferp = (unsigned char *)in.buffer;
cmd_rw = 0x0; // Write
break;
default:
return set_err(EINVAL);
}
// Based on reverse engineering of iSmart.exe with API Monitor.
// Seen commands:
// D0 0 0 0 06 7B 0 0 0 0 0 0 // Read Firmware info?, reads 16 bytes
// F4 0 0 0 06 7B // ??
// D8 15 0 D8 06 7B 0 0 0 0 1 1 4F C2 A0 B0 // SMART Enable
// D8 15 0 D0 06 7B 0 0 2 0 1 1 4F C2 A0 B0 // SMART Read values
// D8 15 0 D1 06 7B 0 0 2 0 1 1 4F C2 A0 B0 // SMART Read thresholds
// D8 15 0 D4 06 7B 0 0 0 0 0 1 4F C2 A0 B0 // SMART Execute self test
// D7 0 0 0 06 7B 0 0 0 0 0 0 0 0 0 0 // Read status registers, Reads 16 bytes of data
// Additional DATA OUT support based on document from Prolific
// Build pass through command
unsigned char cdb[16];
cdb[ 0] = 0xD8; // Operation Code (D8 = Prolific ATA pass through)
cdb[ 1] = cmd_rw|0x5; // Read(0x10)/Write(0x0) | NORMAL(0x5)/PREFIX(0x0)(?)
cdb[ 2] = 0x0; // Reserved
cdb[ 3] = in.in_regs.features; // Feature register (SMART command)
cdb[ 4] = 0x06; // Check Word (VendorID magic, Prolific: 0x067B)
cdb[ 5] = 0x7B; // Check Word (VendorID magic, Prolific: 0x067B)
cdb[ 6] = (unsigned char)(io_hdr.dxfer_len >> 24); // Length MSB
cdb[ 7] = (unsigned char)(io_hdr.dxfer_len >> 16); // Length ...
cdb[ 8] = (unsigned char)(io_hdr.dxfer_len >> 8); // Length ...
cdb[ 9] = (unsigned char)(io_hdr.dxfer_len ); // Length LSB
cdb[10] = in.in_regs.sector_count; // Sector Count
cdb[11] = in.in_regs.lba_low; // LBA Low (7:0)
cdb[12] = in.in_regs.lba_mid; // LBA Mid (15:8)
cdb[13] = in.in_regs.lba_high; // LBA High (23:16)
cdb[14] = in.in_regs.device | 0xA0; // Device/Head
cdb[15] = in.in_regs.command; // ATA Command Register (only PIO supported)
// Use '-r scsiioctl,1' to print CDB for debug purposes
io_hdr.cmnd = cdb;
io_hdr.cmnd_len = 16;
scsi_device * scsidev = get_tunnel_dev();
if (!scsi_pass_through_and_check(scsidev, &io_hdr,
"usbprolific_device::ata_pass_through: "))
return set_err(scsidev->get_err());
if (in.out_needed.is_set()) {
// Read ATA output registers
unsigned char regbuf[16] = {0, };
memset(&io_hdr, 0, sizeof(io_hdr));
io_hdr.dxfer_dir = DXFER_FROM_DEVICE;
io_hdr.dxfer_len = sizeof(regbuf);
io_hdr.dxferp = regbuf;
memset(cdb, 0, sizeof(cdb));
cdb[ 0] = 0xD7; // Prolific read registers
cdb[ 4] = 0x06; // Check Word (VendorID magic, Prolific: 0x067B)
cdb[ 5] = 0x7B; // Check Word (VendorID magic, Prolific: 0x067B)
io_hdr.cmnd = cdb;
io_hdr.cmnd_len = sizeof(cdb);
if (!scsi_pass_through_and_check(scsidev, &io_hdr,
"usbprolific_device::scsi_pass_through (get registers): "))
return set_err(scsidev->get_err());
// Use '-r scsiioctl,2' to print input registers for debug purposes
// Example: 50 00 00 00 00 01 4f 00 c2 00 a0 da 00 b0 00 50
out.out_regs.status = regbuf[0]; // Status
out.out_regs.error = regbuf[1]; // Error
out.out_regs.sector_count = regbuf[2]; // Sector Count (7:0)
out.out_regs.lba_low = regbuf[4]; // LBA Low (7:0)
out.out_regs.lba_mid = regbuf[6]; // LBA Mid (7:0)
out.out_regs.lba_high = regbuf[8]; // LBA High (7:0)
out.out_regs.device = regbuf[10]; // Device/Head
// = regbuf[11]; // ATA Feature (7:0)
// = regbuf[13]; // ATA Command
}
return true;
}
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/// SunplusIT USB Bridge support. /// SunplusIT USB Bridge support.
@ -1328,6 +1523,10 @@ ata_device * smart_interface::get_sat_device(const char * type, scsi_device * sc
return new usbjmicron_device(this, scsidev, type, prolific, ata_48bit_support, port); return new usbjmicron_device(this, scsidev, type, prolific, ata_48bit_support, port);
} }
else if (!strcmp(type, "usbprolific")) {
return new usbprolific_device(this, scsidev, type);
}
else if (!strcmp(type, "usbsunplus")) { else if (!strcmp(type, "usbsunplus")) {
return new usbsunplus_device(this, scsidev, type); return new usbsunplus_device(this, scsidev, type);
} }

View File

@ -3,11 +3,11 @@
* *
* Home page of code is: http://smartmontools.sourceforge.net * Home page of code is: http://smartmontools.sourceforge.net
* *
* Copyright (C) 2002-8 Bruce Allen <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2002-8 Bruce Allen
* Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org> * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
* *
* Additional SCSI work: * Additional SCSI work:
* Copyright (C) 2003-13 Douglas Gilbert <dgilbert@interlog.com> * Copyright (C) 2003-15 Douglas Gilbert <dgilbert@interlog.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -49,7 +49,7 @@
#include "dev_interface.h" #include "dev_interface.h"
#include "utility.h" #include "utility.h"
const char *scsicmds_c_cvsid="$Id: scsicmds.cpp 3915 2014-06-19 18:24:57Z dpgilbert $" const char *scsicmds_c_cvsid="$Id: scsicmds.cpp 4081 2015-05-10 16:42:50Z chrfranke $"
SCSICMDS_H_CVSID; SCSICMDS_H_CVSID;
// Print SCSI debug messages? // Print SCSI debug messages?
@ -989,40 +989,6 @@ scsiSendDiagnostic(scsi_device * device, int functioncode, UINT8 *pBuf,
return scsiSimpleSenseFilter(&sinfo); return scsiSimpleSenseFilter(&sinfo);
} }
/* RECEIVE DIAGNOSTIC command. Returns 0 if ok, 1 if NOT READY, 2 if
* command not supported, 3 if field in command not supported or returns
* negated errno. SPC-3 section 6.18 (rev 22a) */
int
scsiReceiveDiagnostic(scsi_device * device, int pcv, int pagenum, UINT8 *pBuf,
int bufLen)
{
struct scsi_cmnd_io io_hdr;
struct scsi_sense_disect sinfo;
UINT8 cdb[6];
UINT8 sense[32];
memset(&io_hdr, 0, sizeof(io_hdr));
memset(cdb, 0, sizeof(cdb));
io_hdr.dxfer_dir = DXFER_FROM_DEVICE;
io_hdr.dxfer_len = bufLen;
io_hdr.dxferp = pBuf;
cdb[0] = RECEIVE_DIAGNOSTIC;
cdb[1] = pcv;
cdb[2] = pagenum;
cdb[3] = (bufLen >> 8) & 0xff;
cdb[4] = bufLen & 0xff;
io_hdr.cmnd = cdb;
io_hdr.cmnd_len = sizeof(cdb);
io_hdr.sensep = sense;
io_hdr.max_sense_len = sizeof(sense);
io_hdr.timeout = SCSI_TIMEOUT_DEFAULT;
if (!device->scsi_pass_through(&io_hdr))
return -device->get_errno();
scsi_do_sense_disect(&io_hdr, &sinfo);
return scsiSimpleSenseFilter(&sinfo);
}
/* TEST UNIT READY command. SPC-3 section 6.33 (rev 22a) */ /* TEST UNIT READY command. SPC-3 section 6.33 (rev 22a) */
static int static int
_testunitready(scsi_device * device, struct scsi_sense_disect * sinfo) _testunitready(scsi_device * device, struct scsi_sense_disect * sinfo)
@ -1072,7 +1038,8 @@ scsiTestUnitReady(scsi_device * device)
} }
/* READ DEFECT (10) command. Returns 0 if ok, 1 if NOT READY, 2 if /* READ DEFECT (10) command. Returns 0 if ok, 1 if NOT READY, 2 if
* command not supported, 3 if field in command not supported or returns * command not supported, 3 if field in command not supported, 101 if
* defect list not found (e.g. SSD may not have defect list) or returns
* negated errno. SBC-2 section 5.12 (rev 16) */ * negated errno. SBC-2 section 5.12 (rev 16) */
int int
scsiReadDefect10(scsi_device * device, int req_plist, int req_glist, scsiReadDefect10(scsi_device * device, int req_plist, int req_glist,
@ -1102,11 +1069,15 @@ scsiReadDefect10(scsi_device * device, int req_plist, int req_glist,
if (!device->scsi_pass_through(&io_hdr)) if (!device->scsi_pass_through(&io_hdr))
return -device->get_errno(); return -device->get_errno();
scsi_do_sense_disect(&io_hdr, &sinfo); scsi_do_sense_disect(&io_hdr, &sinfo);
/* Look for "(Primary|Grown) defect list not found" */
if ((sinfo.resp_code >= 0x70) && (0x1c == sinfo.asc))
return 101;
return scsiSimpleSenseFilter(&sinfo); return scsiSimpleSenseFilter(&sinfo);
} }
/* READ DEFECT (12) command. Returns 0 if ok, 1 if NOT READY, 2 if /* READ DEFECT (12) command. Returns 0 if ok, 1 if NOT READY, 2 if
* command not supported, 3 if field in command not supported or returns * command not supported, 3 if field in command not supported, 101 if
* defect list not found (e.g. SSD may not have defect list) or returns
* negated errno. SBC-3 section 5.18 (rev 35; vale Mark Evans) */ * negated errno. SBC-3 section 5.18 (rev 35; vale Mark Evans) */
int int
scsiReadDefect12(scsi_device * device, int req_plist, int req_glist, scsiReadDefect12(scsi_device * device, int req_plist, int req_glist,
@ -1142,6 +1113,9 @@ scsiReadDefect12(scsi_device * device, int req_plist, int req_glist,
if (!device->scsi_pass_through(&io_hdr)) if (!device->scsi_pass_through(&io_hdr))
return -device->get_errno(); return -device->get_errno();
scsi_do_sense_disect(&io_hdr, &sinfo); scsi_do_sense_disect(&io_hdr, &sinfo);
/* Look for "(Primary|Grown) defect list not found" */
if ((sinfo.resp_code >= 0x70) && (0x1c == sinfo.asc))
return 101;
return scsiSimpleSenseFilter(&sinfo); return scsiSimpleSenseFilter(&sinfo);
} }
@ -2109,30 +2083,6 @@ scsiGetIEString(UINT8 asc, UINT8 ascq)
} }
/* This is not documented in t10.org, page 0x80 is vendor specific */
/* Some IBM disks do an offline read-scan when they get this command. */
int
scsiSmartIBMOfflineTest(scsi_device * device)
{
UINT8 tBuf[256];
int res;
memset(tBuf, 0, sizeof(tBuf));
/* Build SMART Off-line Immediate Diag Header */
tBuf[0] = 0x80; /* Page Code */
tBuf[1] = 0x00; /* Reserved */
tBuf[2] = 0x00; /* Page Length MSB */
tBuf[3] = 0x04; /* Page Length LSB */
tBuf[4] = 0x03; /* SMART Revision */
tBuf[5] = 0x00; /* Reserved */
tBuf[6] = 0x00; /* Off-line Immediate Time MSB */
tBuf[7] = 0x00; /* Off-line Immediate Time LSB */
res = scsiSendDiagnostic(device, SCSI_DIAG_NO_SELF_TEST, tBuf, 8);
if (res)
pout("IBM offline test failed [%s]\n", scsiErrString(res));
return res;
}
int int
scsiSmartDefaultSelfTest(scsi_device * device) scsiSmartDefaultSelfTest(scsi_device * device)
{ {

View File

@ -3,11 +3,11 @@
* *
* Home page of code is: http://smartmontools.sourceforge.net * Home page of code is: http://smartmontools.sourceforge.net
* *
* Copyright (C) 2002-8 Bruce Allen <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2002-8 Bruce Allen
* Copyright (C) 2000 Michael Cornwell <cornwell@acm.org> * Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
* *
* Additional SCSI work: * Additional SCSI work:
* Copyright (C) 2003-13 Douglas Gilbert <dgilbert@interlog.com> * Copyright (C) 2003-15 Douglas Gilbert <dgilbert@interlog.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -32,7 +32,7 @@
#ifndef SCSICMDS_H_ #ifndef SCSICMDS_H_
#define SCSICMDS_H_ #define SCSICMDS_H_
#define SCSICMDS_H_CVSID "$Id: scsicmds.h 3896 2014-04-28 04:31:25Z dpgilbert $\n" #define SCSICMDS_H_CVSID "$Id: scsicmds.h 4081 2015-05-10 16:42:50Z chrfranke $\n"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -385,9 +385,6 @@ int scsiRequestSense(scsi_device * device, struct scsi_sense_disect * sense_info
int scsiSendDiagnostic(scsi_device * device, int functioncode, UINT8 *pBuf, int bufLen); int scsiSendDiagnostic(scsi_device * device, int functioncode, UINT8 *pBuf, int bufLen);
int scsiReceiveDiagnostic(scsi_device * device, int pcv, int pagenum, UINT8 *pBuf,
int bufLen);
int scsiReadDefect10(scsi_device * device, int req_plist, int req_glist, int dl_format, int scsiReadDefect10(scsi_device * device, int req_plist, int req_glist, int dl_format,
UINT8 *pBuf, int bufLen); UINT8 *pBuf, int bufLen);
@ -433,8 +430,6 @@ const char* scsiGetIEString(UINT8 asc, UINT8 ascq);
int scsiGetTemp(scsi_device * device, UINT8 *currenttemp, UINT8 *triptemp); int scsiGetTemp(scsi_device * device, UINT8 *currenttemp, UINT8 *triptemp);
int scsiSmartIBMOfflineTest(scsi_device * device);
int scsiSmartDefaultSelfTest(scsi_device * device); int scsiSmartDefaultSelfTest(scsi_device * device);
int scsiSmartShortSelfTest(scsi_device * device); int scsiSmartShortSelfTest(scsi_device * device);
int scsiSmartExtendSelfTest(scsi_device * device); int scsiSmartExtendSelfTest(scsi_device * device);

View File

@ -42,7 +42,7 @@
#define GBUF_SIZE 65535 #define GBUF_SIZE 65535
const char * scsiprint_c_cvsid = "$Id: scsiprint.cpp 3898 2014-04-30 17:44:13Z dpgilbert $" const char * scsiprint_c_cvsid = "$Id: scsiprint.cpp 4040 2015-03-10 22:30:44Z dpgilbert $"
SCSIPRINT_H_CVSID; SCSIPRINT_H_CVSID;
@ -339,7 +339,9 @@ scsiPrintGrownDefectListLen(scsi_device * device)
return; return;
} else } else
got_rd12 = 0; got_rd12 = 0;
} else { } else if (101 == err) /* Defect list not found, leave quietly */
return;
else {
if (scsi_debugmode > 0) { if (scsi_debugmode > 0) {
print_on(); print_on();
pout("Read defect list (12) Failed: %s\n", scsiErrString(err)); pout("Read defect list (12) Failed: %s\n", scsiErrString(err));

View File

@ -1,8 +1,8 @@
.ig .ig
Copyright (C) 2002-10 Bruce Allen <smartmontools-support@lists.sourceforge.net> Copyright (C) 2002-10 Bruce Allen
Copyright (C) 2004-14 Christian Franke <smartmontools-support@lists.sourceforge.net> Copyright (C) 2004-15 Christian Franke
$Id: smartctl.8.in 3965 2014-07-20 14:46:41Z chrfranke $ $Id: smartctl.8.in 4099 2015-05-30 17:32:13Z chrfranke $
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -18,16 +18,13 @@ Research Center), Jack Baskin School of Engineering, University of
California, Santa Cruz. http://ssrc.soe.ucsc.edu/ California, Santa Cruz. http://ssrc.soe.ucsc.edu/
.. ..
.TH SMARTCTL 8 CURRENT_SVN_DATE CURRENT_SVN_VERSION CURRENT_SVN_DATE .TH SMARTCTL 8 "CURRENT_SVN_DATE" "CURRENT_SVN_VERSION" "SMART Monitoring Tools"
.SH NAME .SH NAME
\fBsmartctl\fP \- Control and Monitor Utility for SMART Disks \fBsmartctl\fP \- Control and Monitor Utility for SMART Disks
.SH SYNOPSIS .SH SYNOPSIS
.B smartctl [options] device .B smartctl [options] device
.SH PACKAGE VERSION
CURRENT_SVN_VERSION CURRENT_SVN_DATE CURRENT_SVN_REV
.SH DESCRIPTION .SH DESCRIPTION
.\" %IF NOT OS ALL .\" %IF NOT OS ALL
.\"! [This man page is generated for the OS_MAN_FILTER version of smartmontools. .\"! [This man page is generated for the OS_MAN_FILTER version of smartmontools.
@ -55,11 +52,9 @@ option (for more information see the section on "ATA, SCSI command sets
and SAT" below). Device paths are as follows: and SAT" below). Device paths are as follows:
.\" %IF OS Linux .\" %IF OS Linux
.IP \fBLINUX\fP: 9 .IP \fBLINUX\fP: 9
Use the forms \fB"/dev/hd[a\-t]"\fP for IDE/ATA devices, and Use the forms \fB"/dev/sd[a\-z]"\fP for ATA/SATA and SCSI/SAS devices.
\fB"/dev/sd[a\-z]"\fP for SCSI devices. For SCSI Tape Drives and For SCSI Tape Drives and Changers with TapeAlert support use the
Changers with TapeAlert support use the devices \fB"/dev/nst*"\fP and devices \fB"/dev/nst*"\fP and \fB"/dev/sg*"\fP. For disks behind
\fB"/dev/sg*"\fP. For SATA disks accessed with libata, use
\fB"/dev/sd[a\-z]"\fP and append \fB"\-d ata"\fP. For disks behind
3ware controllers you may need \fB"/dev/sd[a\-z]"\fP or 3ware controllers you may need \fB"/dev/sd[a\-z]"\fP or
\fB"/dev/twe[0\-9]"\fP, \fB"/dev/twa[0\-9]"\fP or \fB"/dev/twl[0\-9]"\fP: see details \fB"/dev/twe[0\-9]"\fP, \fB"/dev/twa[0\-9]"\fP or \fB"/dev/twl[0\-9]"\fP: see details
below. For disks behind HighPoint RocketRAID controllers you may need below. For disks behind HighPoint RocketRAID controllers you may need
@ -135,8 +130,8 @@ For disks behind an Intel ICHxR controller with RST driver use
\fB"/dev/csmi[0\-9],N"\fP where N specifies the port behind the logical \fB"/dev/csmi[0\-9],N"\fP where N specifies the port behind the logical
scsi controller "\\\\.\\Scsi[0\-9]:". scsi controller "\\\\.\\Scsi[0\-9]:".
[NEW EXPERIMENTAL SMARTCTL FEATURE] For SATA or SAS disks behind an Areca For SATA or SAS disks behind an Areca controller use
controller use \fB"/dev/arcmsr[0\-9]"\fP, see \'\-d areca,N[/E]\' below. \fB"/dev/arcmsr[0\-9]"\fP, see \'\-d areca,N[/E]\' below.
The prefix \fB"/dev/"\fP is optional. The prefix \fB"/dev/"\fP is optional.
.\" %ENDIF OS Windows Cygwin .\" %ENDIF OS Windows Cygwin
@ -266,7 +261,7 @@ which failed either now or in the past.
.I silent .I silent
\- print no output. The only way to learn about what was found is to \- print no output. The only way to learn about what was found is to
use the exit status of \fBsmartctl\fP (see RETURN VALUES below). use the exit status of \fBsmartctl\fP (see EXIT STATUS below).
.I noserial .I noserial
\- Do not print the serial number of the device. \- Do not print the serial number of the device.
@ -331,13 +326,17 @@ CAUTION: Specifying \',x\' for a device which does not support it results
in I/O errors and may disconnect the drive. The same applies if the specified in I/O errors and may disconnect the drive. The same applies if the specified
PORT does not exist or is not connected to a disk. PORT does not exist or is not connected to a disk.
[NEW EXPERIMENTAL SMARTCTL FEATURE]
The Prolific PL2507/3507 USB bridges with older firmware support a pass-through The Prolific PL2507/3507 USB bridges with older firmware support a pass-through
command similar to JMicron and work with \'\-d usbjmicron,0\'. command similar to JMicron and work with \'\-d usbjmicron,0\'.
Newer Prolific firmware requires a modified command which can be selected by Newer Prolific firmware requires a modified command which can be selected by
\'\-d usbjmicron,p\'. \'\-d usbjmicron,p\'.
Note that this does not yet support the SMART status command. Note that this does not yet support the SMART status command.
.I usbprolific
\- [NEW EXPERIMENTAL SMARTCTL FEATURE]
this device type is for SATA disks that are behind a Prolific PL2571/2771/2773/2775
USB to SATA bridge.
.I usbsunplus .I usbsunplus
\- this device type is for SATA disks that are behind a SunplusIT USB to SATA \- this device type is for SATA disks that are behind a SunplusIT USB to SATA
bridge. bridge.
@ -372,24 +371,32 @@ For PERC2/3/4 controllers: \fBmegadevN\fP
.br .br
For PERC5/6 controllers: \fBmegaraid_sas_ioctlN\fP For PERC5/6 controllers: \fBmegaraid_sas_ioctlN\fP
.\" %ENDIF OS Linux
.\" %IF OS Linux Windows Cygwin
.I aacraid,H,L,ID .I aacraid,H,L,ID
\- [Linux only] [NEW EXPERIMENTAL SMARTCTL FEATURE] \- [Linux, Windows and Cygwin only] [NEW EXPERIMENTAL SMARTCTL FEATURE]
the device consists of one or more SCSI/SAS disks connected to an AacRaid controller. the device consists of one or more SCSI/SAS disks connected to an AacRaid controller.
The non-negative integers H,L,ID (Host number, Lun, ID) denote which disk The non-negative integers H,L,ID (Host number, Lun, ID) denote which disk
on the controller is monitored. on the controller is monitored.
Use syntax such as: Use syntax such as:
.nf .nf
\fBsmartctl \-a \-d aacraid,0,0,66 /dev/sda\fP \fBsmartctl \-a \-d aacraid,0,0,2 /dev/sda\fP
.fi .fi
.nf .nf
\fBsmartctl \-a \-d aacraid,0,0,66 /dev/sdb\fP \fBsmartctl \-a \-d aacraid,1,0,4 /dev/sdb\fP
.fi .fi
The L and ID numbers of a disk can be found in /proc/scsi/scsi
The following entry in /proc/devices must exist: \fBaac\fP. .\" %ENDIF OS Linux Windows Cygwin
.\" %IF OS Linux
On Linux, the following entry in /proc/devices must exist: \fBaac\fP.
Character device nodes /dev/aacH (H=Host number) are created if required. Character device nodes /dev/aacH (H=Host number) are created if required.
.\" %ENDIF OS Linux .\" %ENDIF OS Linux
.\" %IF OS Windows Cygwin
On Windows, the device name parameter /dev/sdX is ignored if \'-d aacraid\'
is specified.
.\" %ENDIF OS Windows Cygwin
.\" %IF OS FreeBSD Linux .\" %IF OS FreeBSD Linux
.I 3ware,N .I 3ware,N
\- [FreeBSD and Linux only] the device consists of one or more ATA disks \- [FreeBSD and Linux only] the device consists of one or more ATA disks
@ -495,7 +502,7 @@ On FreeBSD use syntax such as:
.fi .fi
.\" %ENDIF OS FreeBSD .\" %ENDIF OS FreeBSD
.\" %IF OS Windows Cygwin .\" %IF OS Windows Cygwin
[NEW EXPERIMENTAL SMARTCTL FEATURE] On Windows and Cygwin use syntax such as: On Windows and Cygwin use syntax such as:
.nf .nf
\fBsmartctl \-a \-d areca,2 /dev/arcmsr0\fP \fBsmartctl \-a \-d areca,2 /dev/arcmsr0\fP
.fi .fi
@ -526,8 +533,8 @@ later. Lower-numbered firmware versions will give (harmless) SCSI
error messages and no SMART information. error messages and no SMART information.
.I areca,N/E .I areca,N/E
\- [FreeBSD, Linux, Windows and Cygwin only] [NEW EXPERIMENTAL SMARTCTL FEATURE] the \- [FreeBSD, Linux, Windows and Cygwin only] the device consists of one
device consists of one or more SATA or SAS disks connected to an Areca SAS RAID controller. or more SATA or SAS disks connected to an Areca SAS RAID controller.
The integer N (range 1 to 128) denotes the channel (slot) and E (range The integer N (range 1 to 128) denotes the channel (slot) and E (range
1 to 8) denotes the enclosure. 1 to 8) denotes the enclosure.
Important: This requires Areca SAS controller firmware version 1.51 or later. Important: This requires Areca SAS controller firmware version 1.51 or later.
@ -689,7 +696,7 @@ behaviour. This is does not work for SCSI devices yet.
checks when the device is in a low-power mode. It may be used to prevent checks when the device is in a low-power mode. It may be used to prevent
a disk from being spun-up by \fBsmartctl\fP. The power mode is ignored by a disk from being spun-up by \fBsmartctl\fP. The power mode is ignored by
default. A nonzero exit status is returned if the device is in one of the default. A nonzero exit status is returned if the device is in one of the
specified low-power modes (see RETURN VALUES below). specified low-power modes (see EXIT STATUS below).
Note: If this option is used it may also be necessary to specify the device Note: If this option is used it may also be necessary to specify the device
type with the \'\-d\' option. Otherwise the device may spin up due to type with the \'\-d\' option. Otherwise the device may spin up due to
@ -885,13 +892,11 @@ the drive. The setting of the standby timer is not affected.
The write cache is usually enabled by default. The write cache is usually enabled by default.
.I wcache[,on|off] .I wcache[,on|off]
\- [SCSI] [NEW EXPERIMENTAL SMARTCTL FEATURE] \- [SCSI] Gets/sets the \'Write Cache Enable\' (WCE) bit (if supported).
Gets/sets the \'Write Cache Enable\' (WCE) bit (if supported).
The write cache is usually enabled by default. The write cache is usually enabled by default.
.I wcreorder[,on|off] .I wcreorder[,on|off]
\- [ATA only] [NEW EXPERIMENTAL SMARTCTL FEATURE] \- [ATA only] Gets/sets Write Cache Reordering.
Gets/sets Write Cache Reordering.
If it is disabled (off), disk write scheduling is executed on a If it is disabled (off), disk write scheduling is executed on a
first-in-first-out (FIFO) basis. If Write Cache Reordering is enabled (on), first-in-first-out (FIFO) basis. If Write Cache Reordering is enabled (on),
then disk write scheduling may be reordered by the drive. If write cache is then disk write scheduling may be reordered by the drive. If write cache is
@ -901,21 +906,15 @@ The state of Write Cache Reordering has no effect on either NCQ or LCQ queued
commands. commands.
.I rcache[,on|off] .I rcache[,on|off]
\- [SCSI only] [NEW EXPERIMENTAL SMARTCTL FEATURE] \- [SCSI only] Gets/sets the \'Read Cache Disable\' (RCE) bit.
Gets/sets the \'Read Cache Disable\' (RCE) bit. \'Off\' value disables read cache \'Off\' value disables read cache (if supported).
(if supported).
The read cache is usually enabled by default. The read cache is usually enabled by default.
.TP .TP
.B SMART READ AND DISPLAY DATA OPTIONS: .B SMART READ AND DISPLAY DATA OPTIONS:
.TP .TP
.B \-H, \-\-health .B \-H, \-\-health
Check: Ask the device to report its SMART health status or pending Prints the health status of the device or pending TapeAlert messages.
TapeAlert messages. SMART status is based on
information that it has gathered from online and offline
tests, which were used to determine/update its
SMART vendor-specific Attribute values. TapeAlert status is obtained
by reading the TapeAlert log page.
If the device reports failing health status, this means If the device reports failing health status, this means
.B either .B either
@ -924,6 +923,26 @@ that the device has already failed,
that it is predicting its own failure within the next 24 hours. If that it is predicting its own failure within the next 24 hours. If
this happens, use the \'\-a\' option to get more information, and this happens, use the \'\-a\' option to get more information, and
.B get your data off the disk and to someplace safe as soon as you can. .B get your data off the disk and to someplace safe as soon as you can.
[ATA] Health status is obtained by checking the (boolean) result returned
by the SMART RETURN STATUS command.
The return value of this ATA command may be unknown due to limitations or
bugs in some layer (e.g. RAID controller or USB bridge firmware) between
disk and operating system.
In this case, \fBsmartctl\fP prints a warning and checks whether any
Prefailure SMART Attribute value is less than or equal to its threshold
(see \'\-A\' below).
[SCSI] Health status is obtained by checking the Additional Sense Code
(ASC) and Additional Sense Code Qualifier (ASCQ) from Informal Exceptions
(IE) log page (if supported) and/or from SCSI sense data.
[SCSI tape drive or changer] TapeAlert status is obtained by reading the
TapeAlert log page.
Please note that the TapeAlert log page flags are cleared for the initiator
when the page is read.
This means that each alert condition is reported only once by \fBsmartctl\fP
for each initiator for each activation of the condition.
.TP .TP
.B \-c, \-\-capabilities .B \-c, \-\-capabilities
[ATA only] Prints only the generic SMART capabilities. These [ATA only] Prints only the generic SMART capabilities. These
@ -1791,25 +1810,25 @@ a disk can be specified by N\-\fBmax\fP.
For example the commands: For example the commands:
.nf .nf
smartctl \-t select,10\-20 /dev/hda smartctl \-t select,10\-20 /dev/sda
smartctl \-t select,10+11 /dev/hda smartctl \-t select,10+11 /dev/sda
.fi .fi
both runs a self test on one span consisting of LBAs ten to twenty both runs a self test on one span consisting of LBAs ten to twenty
(inclusive). The command: (inclusive). The command:
.nf .nf
smartctl \-t select,100000000\-max /dev/hda smartctl \-t select,100000000\-max /dev/sda
.fi .fi
run a self test from LBA 100000000 up to the end of the disk. run a self test from LBA 100000000 up to the end of the disk.
The \'\-t\' option can be given up to five times, to test The \'\-t\' option can be given up to five times, to test
up to five spans. For example the command: up to five spans. For example the command:
.nf .nf
smartctl \-t select,0\-100 \-t select,1000\-2000 /dev/hda smartctl \-t select,0\-100 \-t select,1000\-2000 /dev/sda
.fi .fi
runs a self test on two spans. The first span consists of 101 LBAs runs a self test on two spans. The first span consists of 101 LBAs
and the second span consists of 1001 LBAs. Note that the spans can and the second span consists of 1001 LBAs. Note that the spans can
overlap partially or completely, for example: overlap partially or completely, for example:
.nf .nf
smartctl \-t select,0\-10 \-t select,5\-15 \-t select,10\-20 /dev/hda smartctl \-t select,0\-10 \-t select,5\-15 \-t select,10\-20 /dev/sda
.fi .fi
The results of the selective self-test can be obtained (both during The results of the selective self-test can be obtained (both during
and after the test) by printing the SMART self-test log, using the and after the test) by printing the SMART self-test log, using the
@ -1836,15 +1855,15 @@ argument.
For example the commands: For example the commands:
.nf .nf
smartctl \-t select,10\-20 /dev/hda smartctl \-t select,10\-20 /dev/sda
smartctl \-t select,redo /dev/hda smartctl \-t select,redo /dev/sda
smartctl \-t select,redo+20 /dev/hda smartctl \-t select,redo+20 /dev/sda
.fi .fi
have the same effect as: have the same effect as:
.nf .nf
smartctl \-t select,10\-20 /dev/hda smartctl \-t select,10\-20 /dev/sda
smartctl \-t select,10\-20 /dev/hda smartctl \-t select,10\-20 /dev/sda
smartctl \-t select,10\-29 /dev/hda smartctl \-t select,10\-29 /dev/sda
.fi .fi
.I select,next[+SIZE] .I select,next[+SIZE]
@ -1855,15 +1874,15 @@ optional +SIZE argument.
For example the commands: For example the commands:
.nf .nf
smartctl \-t select,0\-999 /dev/hda smartctl \-t select,0\-999 /dev/sda
smartctl \-t select,next /dev/hda smartctl \-t select,next /dev/sda
smartctl \-t select,next+2000 /dev/hda smartctl \-t select,next+2000 /dev/sda
.fi .fi
have the same effect as: have the same effect as:
.nf .nf
smartctl \-t select,0\-999 /dev/hda smartctl \-t select,0\-999 /dev/sda
smartctl \-t select,1000\-1999 /dev/hda smartctl \-t select,1000\-1999 /dev/sda
smartctl \-t select,2000\-3999 /dev/hda smartctl \-t select,2000\-3999 /dev/sda
.fi .fi
If the last test ended at the last LBA of the disk, the new range starts If the last test ended at the last LBA of the disk, the new range starts
@ -1986,62 +2005,55 @@ browser.
.SH EXAMPLES .SH EXAMPLES
.nf .nf
.B smartctl \-a /dev/hda .B smartctl \-a /dev/sda
.fi .fi
Print a large amount of SMART information for drive /dev/hda which is Print a large amount of SMART information for drive /dev/sda .
typically an ATA (IDE) or SATA disk in Linux.
.PP .PP
.nf .nf
.B smartctl \-a /dev/sdb .B smartctl \-s off /dev/sdd
.fi .fi
Print a large amount of SMART information for drive /dev/sdb . This may Disable SMART monitoring and data log collection on drive /dev/sdd .
be a SCSI disk or an ATA (SATA) disk.
.PP .PP
.nf .nf
.B smartctl \-s off /dev/hdd .B smartctl \-\-smart=on \-\-offlineauto=on \-\-saveauto=on /dev/sda
.fi .fi
Disable SMART monitoring and data log collection on drive /dev/hdd . Enable SMART on drive /dev/sda, enable automatic offline
.PP
.nf
.B smartctl \-\-smart=on \-\-offlineauto=on \-\-saveauto=on /dev/hda
.fi
Enable SMART on drive /dev/hda, enable automatic offline
testing every four hours, and enable autosaving of testing every four hours, and enable autosaving of
SMART Attributes. This is a good start-up line for your system\'s SMART Attributes. This is a good start-up line for your system\'s
init files. You can issue this command on a running system. init files. You can issue this command on a running system.
.PP .PP
.nf .nf
.B smartctl \-t long /dev/hdc .B smartctl \-t long /dev/sdc
.fi .fi
Begin an extended self-test of drive /dev/hdc. You can issue this Begin an extended self-test of drive /dev/sdc. You can issue this
command on a running system. The results can be seen in the self-test command on a running system. The results can be seen in the self-test
log visible with the \'\-l selftest\' option after it has completed. log visible with the \'\-l selftest\' option after it has completed.
.PP .PP
.nf .nf
.B smartctl \-s on \-t offline /dev/hda .B smartctl \-s on \-t offline /dev/sda
.fi .fi
Enable SMART on the disk, and begin an immediate offline test of Enable SMART on the disk, and begin an immediate offline test of
drive /dev/hda. You can issue this command on a running system. The drive /dev/sda. You can issue this command on a running system. The
results are only used to update the SMART Attributes, visible results are only used to update the SMART Attributes, visible
with the \'\-A\' option. If any device errors occur, they are logged to with the \'\-A\' option. If any device errors occur, they are logged to
the SMART error log, which can be seen with the \'\-l error\' option. the SMART error log, which can be seen with the \'\-l error\' option.
.PP .PP
.nf .nf
.B smartctl \-A \-v 9,minutes /dev/hda .B smartctl \-A \-v 9,minutes /dev/sda
.fi .fi
Shows the vendor Attributes, when the disk stores its power-on time Shows the vendor Attributes, when the disk stores its power-on time
internally in minutes rather than hours. internally in minutes rather than hours.
.PP .PP
.nf .nf
.B smartctl \-q errorsonly \-H \-l selftest /dev/hda .B smartctl \-q errorsonly \-H \-l selftest /dev/sda
.fi .fi
Produces output only if the device returns failing SMART status, Produces output only if the device returns failing SMART status,
or if some of the logged self-tests ended with errors. or if some of the logged self-tests ended with errors.
.PP .PP
.nf .nf
.B smartctl \-q silent \-a /dev/hda .B smartctl \-q silent \-a /dev/sda
.fi .fi
Examine all SMART data for device /dev/hda, but produce no Examine all SMART data for device /dev/sda, but produce no
printed output. You must use the exit status (the printed output. You must use the exit status (the
.B $? .B $?
shell variable) to learn if any Attributes are out of bound, if the shell variable) to learn if any Attributes are out of bound, if the
@ -2100,7 +2112,7 @@ Start a short self-test on the (S)ATA disk connected to second pmport on the
first channel of the first HighPoint RocketRAID controller card. first channel of the first HighPoint RocketRAID controller card.
.PP .PP
.nf .nf
.B smartctl \-t select,10\-100 \-t select,30\-300 \-t afterselect,on \-t pending,45 /dev/hda .B smartctl \-t select,10\-100 \-t select,30\-300 \-t afterselect,on \-t pending,45 /dev/sda
.fi .fi
Run a selective self-test on LBAs 10 to 100 and 30 to 300. After the Run a selective self-test on LBAs 10 to 100 and 30 to 300. After the
these LBAs have been tested, read-scan the remainder of the disk. If the disk is these LBAs have been tested, read-scan the remainder of the disk. If the disk is
@ -2113,13 +2125,13 @@ device is restored.
Examine all SMART data for the first SCSI disk connected to a cciss Examine all SMART data for the first SCSI disk connected to a cciss
RAID controller card. RAID controller card.
.SH RETURN VALUES .SH EXIT STATUS
The return values of \fBsmartctl\fP are defined by a bitmask. If all The exit statuses of \fBsmartctl\fP are defined by a bitmask.
is well with the disk, the return value (exit status) of If all is well with the disk, the exit status (return value) of
\fBsmartctl\fP is 0 (all bits turned off). If a problem occurs, or an \fBsmartctl\fP is 0 (all bits turned off). If a problem occurs, or an
error, potential error, or fault is detected, then a non-zero status error, potential error, or fault is detected, then a non-zero status
is returned. In this case, the eight different bits in the return is returned. In this case, the eight different bits in the exit status
value have the following meanings for ATA disks; some of these values have the following meanings for ATA disks; some of these values
may also be returned for SCSI disks. may also be returned for SCSI disks.
.TP .TP
.B Bit 0: .B Bit 0:
@ -2188,61 +2200,33 @@ drive database (see \'\-B\' option).
optional local drive database (see \'\-B\' option). optional local drive database (see \'\-B\' option).
.\" %ENDIF NOT OS Windows .\" %ENDIF NOT OS Windows
.SH NOTES
The TapeAlert log page flags are cleared for the initiator when the
page is read. This means that each alert condition is reported only
once by \fBsmartctl\fP for each initiator for each activation of the
condition.
.SH AUTHORS .SH AUTHORS
\fBBruce Allen\fP \fBBruce Allen\fP (project initiator),
.br .br
University of Wisconsin \- Milwaukee Physics Department \fBChristian Franke\fP (project manager, Windows port and all sort of things),
.br .br
\fBChristian Franke\fP (Windows interface, C++ redesign, most enhancements \fBDouglas Gilbert\fP (SCSI subsystem),
since 2009)
.br .br
\fBsmartmontools\-support@lists.sourceforge.net\fP \fBVolker Kuhlmann\fP (moderator of support and database mailing list),
.br
\fBGabriele Pohl\fP (wiki & development team support),
.br
\fBAlex Samorukov\fP (FreeBSD port and more, new Trac wiki).
The following have made large contributions to smartmontools: Many other individuals have made contributions and corrections,
.br see AUTHORS, ChangeLog and repository files.
\fBCasper Dik\fP (Solaris SCSI interface)
.br
\fBDouglas Gilbert\fP (SCSI subsystem)
.br
\fBGuido Guenther\fP (Autoconf/Automake packaging)
.br
\fBGeoffrey Keating\fP (Darwin ATA interface)
.br
\fBEduard Martinescu\fP (FreeBSD interface)
.br
\fBFr\['e]d\['e]ric L. W. Meunier\fP (Web site and Mailing list)
.br
\fBGabriele Pohl\fP (Web site and Wiki, conversion from CVS to SVN)
.br
\fBKeiji Sawada\fP (Solaris ATA interface)
.br
\fBManfred Schwarb\fP (Drive database)
.br
\fBSergey Svishchev\fP (NetBSD interface)
.br
\fBDavid Snyder and Sergey Svishchev\fP (OpenBSD interface)
.br
\fBPhil Williams\fP (User interface and drive database)
.br
\fBYuri Dario\fP (OS/2, eComStation interface)
.br
\fBShengfeng Zhou\fP (Linux/FreeBSD HighPoint RocketRAID interface)
.br
Many other individuals have made smaller contributions and corrections.
The first smartmontools code was derived from the smartsuite package, The first smartmontools code was derived from the smartsuite package,
written by Michael Cornwell, and from the previous UCSC smartsuite package. written by Michael Cornwell and Andre Hedrick.
This code was originally developed as a
Senior Thesis by Michael Cornwell at the Concurrent Systems Laboratory .SH REPORTING BUGS
(now part of the Storage Systems Research Center), Jack Baskin School To submit a bug report, create a ticket in smartmontools wiki:
of Engineering, University of California, Santa .br
Cruz. \fBhttp://ssrc.soe.ucsc.edu/\fP . <\fBhttp://www.smartmontools.org/\fP>.
.br
Alternatively send the info to the smartmontools support mailing list:
.br
<\fBhttps://lists.sourceforge.net/lists/listinfo/smartmontools-support\fB>.
.SH SEE ALSO .SH SEE ALSO
\fBsmartd\fP(8), \fBupdate-smart-drivedb\fP(8). \fBsmartd\fP(8), \fBupdate-smart-drivedb\fP(8).
@ -2269,5 +2253,7 @@ publications of the Small Form Factors (SFF) Committee.
Links to these and other documents may be found on the Links page of the Links to these and other documents may be found on the Links page of the
\fBsmartmontools\fP Wiki at \fBhttp://www.smartmontools.org/wiki/Links\fP . \fBsmartmontools\fP Wiki at \fBhttp://www.smartmontools.org/wiki/Links\fP .
.SH SVN ID OF THIS PAGE .SH PACKAGE VERSION
$Id: smartctl.8.in 3965 2014-07-20 14:46:41Z chrfranke $ CURRENT_SVN_VERSION CURRENT_SVN_DATE CURRENT_SVN_REV
.br
$Id: smartctl.8.in 4099 2015-05-30 17:32:13Z chrfranke $

View File

@ -3,8 +3,8 @@
* *
* Home page of code is: http://smartmontools.sourceforge.net * Home page of code is: http://smartmontools.sourceforge.net
* *
* Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2002-11 Bruce Allen
* Copyright (C) 2008-14 Christian Franke <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2008-15 Christian Franke
* Copyright (C) 2000 Michael Cornwell <cornwell@acm.org> * Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -51,7 +51,7 @@
#include "smartctl.h" #include "smartctl.h"
#include "utility.h" #include "utility.h"
const char * smartctl_cpp_cvsid = "$Id: smartctl.cpp 3936 2014-07-05 17:16:23Z chrfranke $" const char * smartctl_cpp_cvsid = "$Id: smartctl.cpp 4080 2015-05-05 20:31:22Z chrfranke $"
CONFIG_H_CVSID SMARTCTL_H_CVSID; CONFIG_H_CVSID SMARTCTL_H_CVSID;
// Globals to control printing // Globals to control printing
@ -503,10 +503,14 @@ static const char * parse_options(int argc, char** argv,
sscanf(optarg, "devstat%n,%u%n", &n1, &val, &n2); sscanf(optarg, "devstat%n,%u%n", &n1, &val, &n2);
if (n1 == len) if (n1 == len)
ataopts.devstat_all_pages = true; ataopts.devstat_all_pages = true;
else if (n2 == len && val <= 255) else {
ataopts.devstat_pages.push_back(val); if (n2 != len) // retry with hex
else sscanf(optarg, "devstat,0x%x%n", &val, &n2);
badarg = true; if (n2 == len && val <= 0xff)
ataopts.devstat_pages.push_back(val);
else
badarg = true;
}
} else if (!strncmp(optarg, "xerror", sizeof("xerror")-1)) { } else if (!strncmp(optarg, "xerror", sizeof("xerror")-1)) {
int n1 = -1, n2 = -1, len = strlen(optarg); int n1 = -1, n2 = -1, len = strlen(optarg);

View File

@ -1,8 +1,8 @@
.ig .ig
Copyright (C) 2002-10 Bruce Allen <smartmontools-support@lists.sourceforge.net> Copyright (C) 2002-10 Bruce Allen
Copyright (C) 2004-14 Christian Franke <smartmontools-support@lists.sourceforge.net> Copyright (C) 2004-15 Christian Franke
$Id: smartd.8.in 3965 2014-07-20 14:46:41Z chrfranke $ $Id: smartd.8.in 4102 2015-06-01 19:25:47Z chrfranke $
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -18,16 +18,13 @@ Research Center), Jack Baskin School of Engineering, University of
California, Santa Cruz. http://ssrc.soe.ucsc.edu/ California, Santa Cruz. http://ssrc.soe.ucsc.edu/
.. ..
.TH SMARTD 8 CURRENT_SVN_DATE CURRENT_SVN_VERSION CURRENT_SVN_DATE .TH SMARTD 8 "CURRENT_SVN_DATE" "CURRENT_SVN_VERSION" "SMART Monitoring Tools"
.SH NAME .SH NAME
\fBsmartd\fP \- SMART Disk Monitoring Daemon \fBsmartd\fP \- SMART Disk Monitoring Daemon
.SH SYNOPSIS .SH SYNOPSIS
.B smartd [options] .B smartd [options]
.SH PACKAGE VERSION
CURRENT_SVN_VERSION CURRENT_SVN_DATE CURRENT_SVN_REV
.SH DESCRIPTION .SH DESCRIPTION
.\" %IF NOT OS ALL .\" %IF NOT OS ALL
.\"! [This man page is generated for the OS_MAN_FILTER version of smartmontools. .\"! [This man page is generated for the OS_MAN_FILTER version of smartmontools.
@ -101,7 +98,7 @@ devices that support SMART. The scanning is done as follows:
.IP \fBLINUX:\fP 9 .IP \fBLINUX:\fP 9
Examine all entries \fB"/dev/hd[a-t]"\fP for IDE/ATA Examine all entries \fB"/dev/hd[a-t]"\fP for IDE/ATA
devices, and \fB"/dev/sd[a-z]"\fP, \fB"/dev/sd[a-c][a-z]"\fP devices, and \fB"/dev/sd[a-z]"\fP, \fB"/dev/sd[a-c][a-z]"\fP
for SCSI or SATA devices. for ATA/SATA or SCSI/SAS devices.
Disks behind RAID controllers are not included. Disks behind RAID controllers are not included.
.\" %ENDIF OS Linux .\" %ENDIF OS Linux
.\" %IF OS FreeBSD .\" %IF OS FreeBSD
@ -186,13 +183,14 @@ can be used to verify the existence of the default configuration file.
By using \'\-\' for FILE, the configuration is read from standard By using \'\-\' for FILE, the configuration is read from standard
input. This is useful for commands like: input. This is useful for commands like:
.nf .nf
.B echo /dev/hdb \-m user@home \-M test | smartd \-c \- \-q onecheck .B echo /dev/sdb \-m user@home \-M test | smartd \-c \- \-q onecheck
.fi .fi
to perform quick and simple checks without a configuration file. to perform quick and simple checks without a configuration file.
.\" %IF ENABLE_CAPABILITIES .\" %IF ENABLE_CAPABILITIES
.TP .TP
.B \-C, \-\-capabilities .B \-C, \-\-capabilities
Use \fBcapabilities\fP(7). [Linux only] Use libcap-ng to drop unneeded Linux process \fBcapabilities\fP(7).
The following capabilities are kept: CAP_SYS_ADMIN, CAP_SYS_RAWIO, CAP_MKNOD.
Warning: Mail notification does not work when used. Warning: Mail notification does not work when used.
.\" %ENDIF ENABLE_CAPABILITIES .\" %ENDIF ENABLE_CAPABILITIES
@ -283,7 +281,7 @@ log output is redirected as follows:
.TP .TP
.B \-n, \-\-no\-fork .B \-n, \-\-no\-fork
Do not fork into background; this is useful when executed from modern Do not fork into background; this is useful when executed from modern
init methods like initng, minit or supervise. init methods like initng, minit, supervise or systemd.
.\" %IF OS Cygwin .\" %IF OS Cygwin
On Cygwin, this allows running \fBsmartd\fP as service via cygrunsrv, On Cygwin, this allows running \fBsmartd\fP as service via cygrunsrv,
@ -416,7 +414,6 @@ forced by SIGUSR1. After a normal check cycle, a file is only rewritten if
an important change (which usually results in a SYSLOG output) occurred. an important change (which usually results in a SYSLOG output) occurred.
.TP .TP
.B \-w PATH, \-\-warnexec=PATH .B \-w PATH, \-\-warnexec=PATH
[NEW EXPERIMENTAL SMARTD FEATURE]
Run the executable PATH instead of the default script when smartd Run the executable PATH instead of the default script when smartd
needs to send warning messages. PATH must point to an executable binary needs to send warning messages. PATH must point to an executable binary
file or script. file or script.
@ -464,6 +461,7 @@ once. The exit status (the shell
variable) will be zero if all went well, and nonzero if no devices variable) will be zero if all went well, and nonzero if no devices
were detected or some other problem was encountered. were detected or some other problem was encountered.
.\" %IF ENABLE_INITSCRIPT
Note that \fBsmartmontools\fP provides a start-up script in Note that \fBsmartmontools\fP provides a start-up script in
\fB/usr/local/etc/rc.d/init.d/smartd\fP which is responsible for starting and \fB/usr/local/etc/rc.d/init.d/smartd\fP which is responsible for starting and
stopping the daemon via the normal init interface. Using this script, stopping the daemon via the normal init interface. Using this script,
@ -476,6 +474,7 @@ and stop it by using the command:
.B /usr/local/etc/rc.d/init.d/smartd stop .B /usr/local/etc/rc.d/init.d/smartd stop
.fi .fi
.\" %ENDIF ENABLE_INITSCRIPT
.SH CONFIGURATION .SH CONFIGURATION
The syntax of the \fBsmartd.conf\fP(5) file is discussed separately. The syntax of the \fBsmartd.conf\fP(5) file is discussed separately.
@ -489,7 +488,7 @@ or
.B \'\-u\' .B \'\-u\'
Directives. For example: Directives. For example:
.nf .nf
.B \'Device: /dev/hda, SMART Attribute: 194 Temperature_Celsius changed from 94 to 93\' .B \'Device: /dev/sda, SMART Attribute: 194 Temperature_Celsius changed from 94 to 93\'
.fi .fi
Note that in this message, the value given is the \'Normalized\' not the \'Raw\' Note that in this message, the value given is the \'Normalized\' not the \'Raw\'
Attribute value (the disk temperature in this case is about 22 Attribute value (the disk temperature in this case is about 22
@ -500,7 +499,7 @@ and
Directives modify this behavior, so that the information is printed Directives modify this behavior, so that the information is printed
with the Raw values as well, for example: with the Raw values as well, for example:
.nf .nf
.B \'Device: /dev/hda, SMART Attribute: 194 Temperature_Celsius changed from 94 [Raw 22] to 93 [Raw 23]\' .B \'Device: /dev/sda, SMART Attribute: 194 Temperature_Celsius changed from 94 [Raw 22] to 93 [Raw 23]\'
.fi .fi
Here the Raw values are the actual disk temperatures in Celsius. The Here the Raw values are the actual disk temperatures in Celsius. The
way in which the Raw values are printed, and the names under which the way in which the Raw values are printed, and the names under which the
@ -518,7 +517,7 @@ will make log entries at loglevel
.B LOG_CRIT .B LOG_CRIT
if a SMART Attribute has failed, for example: if a SMART Attribute has failed, for example:
.nf .nf
.B \'Device: /dev/hdc, Failed SMART Attribute: 5 Reallocated_Sector_Ct\' .B \'Device: /dev/sdc, Failed SMART Attribute: 5 Reallocated_Sector_Ct\'
.fi .fi
This loglevel is used for reporting enabled by the This loglevel is used for reporting enabled by the
.B \'\-H\', \-f\', \'\-l\ selftest\', .B \'\-H\', \-f\', \'\-l\ selftest\',
@ -549,14 +548,17 @@ see the \fBsmartd\fP '\-l' command-line option described above.
.\" %ENDIF OS Solaris .\" %ENDIF OS Solaris
.\" %IF OS Cygwin .\" %IF OS Cygwin
The Cygwin Version of \fBsmartd\fP can be run as a service via the The Cygwin Version of \fBsmartd\fP can be run as a service via the
cygrunsrv tool. The start-up script provides Cygwin-specific commands cygrunsrv tool.
to install and remove the service: .\" %IF ENABLE_INITSCRIPT
The start-up script provides Cygwin-specific commands to install and
remove the service:
.nf .nf
.B /usr/local/etc/rc.d/init.d/smartd install [options] .B /usr/local/etc/rc.d/init.d/smartd install [options]
.B /usr/local/etc/rc.d/init.d/smartd remove .B /usr/local/etc/rc.d/init.d/smartd remove
.fi .fi
The service can be started and stopped by the start-up script as usual The service can be started and stopped by the start-up script as usual
(see \fBEXAMPLES\fP above). (see \fBEXAMPLES\fP above).
.\" %ENDIF ENABLE_INITSCRIPT
.\" %ENDIF OS Cygwin .\" %ENDIF OS Cygwin
.\" %IF OS Windows .\" %IF OS Windows
@ -624,10 +626,8 @@ set using \fB/etc/localtime\fP. The work-around \fIfails\fP if the
time-zone is set using the \'\fBTZ\fP\' variable (or a file that it time-zone is set using the \'\fBTZ\fP\' variable (or a file that it
points to). points to).
.SH RETURN VALUES .SH EXIT STATUS
The return value (exit status) of The exit status (return value) of \fBsmartd\fP can have the following values:
\fBsmartd\fP
can have the following values:
.TP .TP
.B 0: .B 0:
Daemon startup successful, or \fBsmartd\fP was killed by a SIGTERM (or in debug mode, a SIGQUIT). Daemon startup successful, or \fBsmartd\fP was killed by a SIGTERM (or in debug mode, a SIGQUIT).
@ -654,16 +654,11 @@ Config file exists, but cannot be read.
\fBsmartd\fP \fBsmartd\fP
ran out of memory during startup. ran out of memory during startup.
.TP .TP
.B 9:
A compile time constant of\fB smartd\fP was too small. This can be caused by an
excessive number of disks, or by lines in \fB /usr/local/etc/smartd.conf\fP that are too long.
Please report this problem to \fB smartmontools-support@lists.sourceforge.net\fP.
.TP
.B 10: .B 10:
An inconsistency was found in \fBsmartd\fP\'s internal data An inconsistency was found in \fBsmartd\fP\'s internal data
structures. This should never happen. It must be due to either a structures. This should never happen. It must be due to either a
coding or compiler bug. \fIPlease\fP report such failures to coding or compiler bug. \fIPlease\fP report such failures to
smartmontools-support@lists.sourceforge.net. smartmontools developers, see REPORTING BUGS below.
.TP .TP
.B 16: .B 16:
A device explicitly listed in A device explicitly listed in
@ -718,52 +713,32 @@ optional local drive database (see \'\-B\' option).
.\" %ENDIF NOT OS Windows .\" %ENDIF NOT OS Windows
.SH AUTHORS .SH AUTHORS
\fBBruce Allen\fP \fBBruce Allen\fP (project initiator),
.br .br
University of Wisconsin \- Milwaukee Physics Department \fBChristian Franke\fP (project manager, Windows port and all sort of things),
.br .br
\fBChristian Franke\fP (Windows interface, C++ redesign, most enhancements \fBDouglas Gilbert\fP (SCSI subsystem),
since 2009)
.br .br
\fBsmartmontools\-support@lists.sourceforge.net\fP \fBVolker Kuhlmann\fP (moderator of support and database mailing list),
.br
\fBGabriele Pohl\fP (wiki & development team support),
.br
\fBAlex Samorukov\fP (FreeBSD port and more, new Trac wiki).
The following have made large contributions to smartmontools: Many other individuals have made contributions and corrections,
.br see AUTHORS, ChangeLog and repository files.
\fBCasper Dik\fP (Solaris SCSI interface)
.br
\fBDouglas Gilbert\fP (SCSI subsystem)
.br
\fBGuido Guenther\fP (Autoconf/Automake packaging)
.br
\fBGeoffrey Keating\fP (Darwin ATA interface)
.br
\fBEduard Martinescu\fP (FreeBSD interface)
.br
\fBFr\['e]d\['e]ric L. W. Meunier\fP (Web site and Mailing list)
.br
\fBGabriele Pohl\fP (Web site and Wiki, conversion from CVS to SVN)
.br
\fBKeiji Sawada\fP (Solaris ATA interface)
.br
\fBManfred Schwarb\fP (Drive database)
.br
\fBSergey Svishchev\fP (NetBSD interface)
.br
\fBDavid Snyder and Sergey Svishchev\fP (OpenBSD interface)
.br
\fBPhil Williams\fP (User interface and drive database)
.br
\fBShengfeng Zhou\fP (Linux/FreeBSD HighPoint RocketRAID interface)
.br
Many other individuals have made smaller contributions and corrections.
The first smartmontools code was derived from the smartsuite package, The first smartmontools code was derived from the smartsuite package,
written by Michael Cornwell, and from the previous UCSC smartsuite package. written by Michael Cornwell and Andre Hedrick.
This code was originally developed as a
Senior Thesis by Michael Cornwell at the Concurrent Systems Laboratory .SH REPORTING BUGS
(now part of the Storage Systems Research Center), Jack Baskin School To submit a bug report, create a ticket in smartmontools wiki:
of Engineering, University of California, Santa .br
Cruz. \fBhttp://ssrc.soe.ucsc.edu/\fP . <\fBhttp://www.smartmontools.org/\fP>.
.br
Alternatively send the info to the smartmontools support mailing list:
.br
<\fBhttps://lists.sourceforge.net/lists/listinfo/smartmontools-support\fB>.
.SH SEE ALSO .SH SEE ALSO
\fBsmartd.conf\fP(5), \fBsmartctl\fP(8), \fBupdate-smart-drivedb\fP(8). \fBsmartd.conf\fP(5), \fBsmartctl\fP(8), \fBupdate-smart-drivedb\fP(8).
@ -790,5 +765,7 @@ publications of the Small Form Factors (SFF) Committee.
Links to these and other documents may be found on the Links page of the Links to these and other documents may be found on the Links page of the
\fBsmartmontools\fP Wiki at \fBhttp://www.smartmontools.org/wiki/Links\fP . \fBsmartmontools\fP Wiki at \fBhttp://www.smartmontools.org/wiki/Links\fP .
.SH SVN ID OF THIS PAGE .SH PACKAGE VERSION
$Id: smartd.8.in 3965 2014-07-20 14:46:41Z chrfranke $ CURRENT_SVN_VERSION CURRENT_SVN_DATE CURRENT_SVN_REV
.br
$Id: smartd.8.in 4102 2015-06-01 19:25:47Z chrfranke $

View File

@ -2,7 +2,7 @@
# Home page is: http://smartmontools.sourceforge.net # Home page is: http://smartmontools.sourceforge.net
# $Id: smartd.conf 3651 2012-10-18 15:11:36Z samm2 $ # $Id: smartd.conf 4047 2015-03-22 16:16:24Z chrfranke $
# smartd will re-read the configuration file if it receives a HUP # smartd will re-read the configuration file if it receives a HUP
# signal # signal
@ -33,21 +33,21 @@ DEVICESCAN
# and min/max temperatures. # and min/max temperatures.
#DEVICESCAN -I 194 -I 231 -I 9 -W 5 #DEVICESCAN -I 194 -I 231 -I 9 -W 5
# First (primary) ATA/IDE hard disk. Monitor all attributes, enable # First ATA/SATA or SCSI/SAS disk. Monitor all attributes, enable
# automatic online data collection, automatic Attribute autosave, and # automatic online data collection, automatic Attribute autosave, and
# start a short self-test every day between 2-3am, and a long self test # start a short self-test every day between 2-3am, and a long self test
# Saturdays between 3-4am. # Saturdays between 3-4am.
#/dev/hda -a -o on -S on -s (S/../.././02|L/../../6/03) #/dev/sda -a -o on -S on -s (S/../.././02|L/../../6/03)
# Monitor SMART status, ATA Error Log, Self-test log, and track # Monitor SMART status, ATA Error Log, Self-test log, and track
# changes in all attributes except for attribute 194 # changes in all attributes except for attribute 194
#/dev/hdb -H -l error -l selftest -t -I 194 #/dev/sdb -H -l error -l selftest -t -I 194
# Monitor all attributes except normalized Temperature (usually 194), # Monitor all attributes except normalized Temperature (usually 194),
# but track Temperature changes >= 4 Celsius, report Temperatures # but track Temperature changes >= 4 Celsius, report Temperatures
# >= 45 Celsius and changes in Raw value of Reallocated_Sector_Ct (5). # >= 45 Celsius and changes in Raw value of Reallocated_Sector_Ct (5).
# Send mail on SMART failures or when Temperature is >= 55 Celsius. # Send mail on SMART failures or when Temperature is >= 55 Celsius.
#/dev/hdc -a -I 194 -W 4,45,55 -R 5 -m admin@example.com #/dev/sdc -a -I 194 -W 4,45,55 -R 5 -m admin@example.com
# An ATA disk may appear as a SCSI device to the OS. If a SCSI to # An ATA disk may appear as a SCSI device to the OS. If a SCSI to
# ATA Translation (SAT) layer is between the OS and the device then # ATA Translation (SAT) layer is between the OS and the device then
@ -57,7 +57,7 @@ DEVICESCAN
# A very silent check. Only report SMART health status if it fails # A very silent check. Only report SMART health status if it fails
# But send an email in this case # But send an email in this case
#/dev/hdc -H -C 0 -U 0 -m admin@example.com #/dev/sdc -H -C 0 -U 0 -m admin@example.com
# First two SCSI disks. This will monitor everything that smartd can # First two SCSI disks. This will monitor everything that smartd can
# monitor. Start extended self-tests Wednesdays between 6-7pm and # monitor. Start extended self-tests Wednesdays between 6-7pm and
@ -141,5 +141,5 @@ DEVICESCAN
# All but -d, -m and -M Directives are only implemented for ATA devices # All but -d, -m and -M Directives are only implemented for ATA devices
# #
# If the test string DEVICESCAN is the first uncommented text # If the test string DEVICESCAN is the first uncommented text
# then smartd will scan for devices /dev/hd[a-l] and /dev/sd[a-z] # then smartd will scan for devices.
# DEVICESCAN may be followed by any desired Directives. # DEVICESCAN may be followed by any desired Directives.

View File

@ -1,8 +1,8 @@
.ig .ig
Copyright (C) 2002-10 Bruce Allen <smartmontools-support@lists.sourceforge.net> Copyright (C) 2002-10 Bruce Allen
Copyright (C) 2004-14 Christian Franke <smartmontools-support@lists.sourceforge.net> Copyright (C) 2004-15 Christian Franke
$Id: smartd.conf.5.in 3965 2014-07-20 14:46:41Z chrfranke $ $Id: smartd.conf.5.in 4103 2015-06-01 19:51:18Z chrfranke $
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -18,13 +18,10 @@ Research Center), Jack Baskin School of Engineering, University of
California, Santa Cruz. http://ssrc.soe.ucsc.edu/ California, Santa Cruz. http://ssrc.soe.ucsc.edu/
.. ..
.TH SMARTD.CONF 5 CURRENT_SVN_DATE CURRENT_SVN_VERSION CURRENT_SVN_DATE .TH SMARTD.CONF 5 "CURRENT_SVN_DATE" "CURRENT_SVN_VERSION" "SMART Monitoring Tools"
.SH NAME .SH NAME
\fBsmartd.conf\fP \- SMART Disk Monitoring Daemon Configuration File\fP \fBsmartd.conf\fP \- SMART Disk Monitoring Daemon Configuration File\fP
.SH PACKAGE VERSION
CURRENT_SVN_VERSION CURRENT_SVN_DATE CURRENT_SVN_REV
.SH DESCRIPTION .SH DESCRIPTION
.\" %IF NOT OS ALL .\" %IF NOT OS ALL
.\"! [This man page is generated for the OS_MAN_FILTER version of smartmontools. .\"! [This man page is generated for the OS_MAN_FILTER version of smartmontools.
@ -90,27 +87,17 @@ Section below!
.nf .nf
.B ################################################ .B ################################################
.B # This is an example smartd startup config file .B # This is an example smartd startup config file
.B # /usr/local/etc/smartd.conf for monitoring three .B # /usr/local/etc/smartd.conf
.B # ATA disks, three SCSI disks, six ATA disks
.B # behind two 3ware controllers, three SATA disks
.B # directly connected to the HighPoint Rocket-
.B # RAID controller, two SATA disks connected to
.B # the HighPoint RocketRAID controller via a pmport
.B # device, four SATA disks connected to an Areca
.B # RAID controller, and one SATA disk.
.B # .B #
.B # First ATA disk on two different interfaces. On .B # On the second disk, start a long self-test every
.B # the second disk, start a long self-test every
.B # Sunday between 3 and 4 am. .B # Sunday between 3 and 4 am.
.B # .B #
.B \ \ /dev/hda -a -m admin@example.com,root@localhost .B \ \ /dev/sda -a -m admin@example.com,root@localhost
.B \ \ /dev/hdc -a -I 194 -I 5 -i 12 -s L/../../7/03 .B \ \ /dev/sdb -a -I 194 -I 5 -i 12 -s L/../../7/03
.B # .B #
.B # SCSI disks. Send a TEST warning email to admin on .B # Send a TEST warning email to admin on startup.
.B # startup.
.B # .B #
.B \ \ /dev/sda .B \ \ /dev/sdc -m admin@example.com -M test
.B \ \ /dev/sdb -m admin@example.com -M test
.B # .B #
.B # Strange device. It\'s SCSI. Start a scheduled .B # Strange device. It\'s SCSI. Start a scheduled
.B # long self test between 5 and 6 am Monday/Thursday .B # long self test between 5 and 6 am Monday/Thursday
@ -220,7 +207,7 @@ Section below!
.B # and Usage Attributes, apart from Attributes .B # and Usage Attributes, apart from Attributes
.B # 9, 194, and 231, and shows continued lines: .B # 9, 194, and 231, and shows continued lines:
.B # .B #
.B \ \ /dev/hdd\ -l\ error\ \e .B \ \ /dev/sdd\ -l\ error\ \e
.B \ \ \ \ \ \ \ \ \ \ \ -l\ selftest\ \e .B \ \ \ \ \ \ \ \ \ \ \ -l\ selftest\ \e
.B \ \ \ \ \ \ \ \ \ \ \ -t\ \e\ \ \ \ \ \ # Attributes not tracked: .B \ \ \ \ \ \ \ \ \ \ \ -t\ \e\ \ \ \ \ \ # Attributes not tracked:
.B \ \ \ \ \ \ \ \ \ \ \ -I\ 194\ \e\ \ # temperature .B \ \ \ \ \ \ \ \ \ \ \ -I\ 194\ \e\ \ # temperature
@ -369,13 +356,17 @@ CAUTION: Specifying \',x\' for a device which does not support it results
in I/O errors and may disconnect the drive. The same applies if the specified in I/O errors and may disconnect the drive. The same applies if the specified
PORT does not exist or is not connected to a disk. PORT does not exist or is not connected to a disk.
[NEW EXPERIMENTAL SMARTD FEATURE]
The Prolific PL2507/3507 USB bridges with older firmware support a pass-through The Prolific PL2507/3507 USB bridges with older firmware support a pass-through
command similar to JMicron and work with \'\-d usbjmicron,0\'. command similar to JMicron and work with \'\-d usbjmicron,0\'.
Newer Prolific firmware requires a modified command which can be selected by Newer Prolific firmware requires a modified command which can be selected by
\'\-d usbjmicron,p\'. \'\-d usbjmicron,p\'.
Note that this does not yet support the SMART status command. Note that this does not yet support the SMART status command.
.I usbprolific
\- [NEW EXPERIMENTAL SMARTD FEATURE]
this device type is for SATA disks that are behind a Prolific PL2571/2771/2773/2775
USB to SATA bridge.
.I usbsunplus .I usbsunplus
\- this device type is for SATA disks that are behind a SunplusIT USB to SATA \- this device type is for SATA disks that are behind a SunplusIT USB to SATA
bridge. bridge.
@ -397,15 +388,17 @@ It is possible to set RAID device name as /dev/bus/N, where N is a SCSI bus
number. number.
Please see the \fBsmartctl\fP(8) man page for further details. Please see the \fBsmartctl\fP(8) man page for further details.
.\" %ENDIF OS Linux
.\" %IF OS Linux Windows Cygwin
.I aacraid,H,L,ID .I aacraid,H,L,ID
\- [Linux only] [NEW EXPERIMENTAL SMARTD FEATURE] \- [Linux, Windows and Cygwin only] [NEW EXPERIMENTAL SMARTD FEATURE]
the device consists of one or more SCSI/SAS disks connected to an AacRaid controller. the device consists of one or more SCSI/SAS disks connected to an AacRaid controller.
The non-negative integers H,L,ID (Host number, Lun, ID) denote which disk The non-negative integers H,L,ID (Host number, Lun, ID) denote which disk
on the controller is monitored. on the controller is monitored.
In log files and email messages this disk will be identified as aacraid_disk_HH_LL_ID. In log files and email messages this disk will be identified as aacraid_disk_HH_LL_ID.
Please see the \fBsmartctl\fP(8) man page for further details. Please see the \fBsmartctl\fP(8) man page for further details.
.\" %ENDIF OS Linux .\" %ENDIF OS Linux Windows Cygwin
.\" %IF OS FreeBSD Linux .\" %IF OS FreeBSD Linux
.I 3ware,N .I 3ware,N
\- [FreeBSD and Linux only] the device consists of one or more ATA disks \- [FreeBSD and Linux only] the device consists of one or more ATA disks
@ -432,8 +425,8 @@ areca_disk_XX with XX in the range from 01 to 24 inclusive.
Please see the \fBsmartctl\fP(8) man page for further details. Please see the \fBsmartctl\fP(8) man page for further details.
.I areca,N/E .I areca,N/E
\- [FreeBSD, Linux, Windows and Cygwin only] [NEW EXPERIMENTAL SMARTD FEATURE] the \- [FreeBSD, Linux, Windows and Cygwin only] the device consists of one
device consists of one or more SATA or SAS disks connected to an Areca SAS RAID controller. or more SATA or SAS disks connected to an Areca SAS RAID controller.
The integer N (range 1 to 128) denotes the channel (slot) and E (range The integer N (range 1 to 128) denotes the channel (slot) and E (range
1 to 8) denotes the enclosure. 1 to 8) denotes the enclosure.
Important: This requires Areca SAS controller firmware version 1.51 or later. Important: This requires Areca SAS controller firmware version 1.51 or later.
@ -463,8 +456,7 @@ Please see the \fBsmartctl\fP(8) man page for further details.
.\" %ENDIF OS FreeBSD Linux .\" %ENDIF OS FreeBSD Linux
.I ignore .I ignore
\- [NEW EXPERIMENTAL SMARTD FEATURE] \- the device specified by this configuration entry should be ignored.
the device specified by this configuration entry should be ignored.
This allows to ignore specific devices which are detected by a following This allows to ignore specific devices which are detected by a following
DEVICESCAN configuration line. DEVICESCAN configuration line.
It may also be used to temporary disable longer multi-line configuration entries. It may also be used to temporary disable longer multi-line configuration entries.
@ -574,8 +566,9 @@ Directive are \fIon\fP and \fIoff\fP. Also affects SCSI devices.
[Please see the \fBsmartctl \-S\fP command-line option.] [Please see the \fBsmartctl \-S\fP command-line option.]
.TP .TP
.B \-H .B \-H
[ATA only] Check the SMART health status of the disk. If any Prefailure [ATA only] Check the health status of the disk with the SMART RETURN
Attributes are less than or equal to their threshold values, then disk STATUS command.
If this command reports a failing health status, then disk
failure is predicted in less than 24 hours, and a message at loglevel failure is predicted in less than 24 hours, and a message at loglevel
.B \'LOG_CRIT\' .B \'LOG_CRIT\'
will be logged to syslog. [Please see the will be logged to syslog. [Please see the
@ -868,7 +861,6 @@ below.
.\" %IF ENABLE_SMARTDPLUGINDIR .\" %IF ENABLE_SMARTDPLUGINDIR
.\" %IF NOT OS Windows .\" %IF NOT OS Windows
[NEW EXPERIMENTAL SMARTD FEATURE]
If a word of the comma separated list has the form \'@plugin\', a custom If a word of the comma separated list has the form \'@plugin\', a custom
script /usr/local/etc/smartd_warning.d/plugin is run and the word is script /usr/local/etc/smartd_warning.d/plugin is run and the word is
removed from the list before sending mail. The string \'plugin\' may be any removed from the list before sending mail. The string \'plugin\' may be any
@ -881,9 +873,8 @@ This is handled by the script /usr/local/etc/smartd_warning.sh
.\" %ENDIF ENABLE_SMARTDPLUGINDIR .\" %ENDIF ENABLE_SMARTDPLUGINDIR
.\" %IF OS Windows .\" %IF OS Windows
[Windows only] [NEW EXPERIMENTAL SMARTD FEATURE] [Windows only] If one of the following words are used as the first address
If one of the following words are used as the first address in the in the comma separated list, warning messages are sent via WTSSendMessage().
comma separated list, warning messages are sent via WTSSendMessage().
This displays message boxes on the desktops of the selected sessions. This displays message boxes on the desktops of the selected sessions.
Address \'\fBconsole\fP\' specifies the console session only, Address \'\fBconsole\fP\' specifies the console session only,
\'\fBactive\fP\' specifies the console session and all active remote \'\fBactive\fP\' specifies the console session and all active remote
@ -978,7 +969,7 @@ exported by \fBsmartd\fP are:
is set to the argument of \-M exec, if present or else to \'mail\' is set to the argument of \-M exec, if present or else to \'mail\'
(examples: /usr/local/bin/mail, mail). (examples: /usr/local/bin/mail, mail).
.IP \fBSMARTD_DEVICE\fP 4 .IP \fBSMARTD_DEVICE\fP 4
is set to the device path (examples: /dev/hda, /dev/sdb). is set to the device path (example: /dev/sda).
.IP \fBSMARTD_DEVICETYPE\fP 4 .IP \fBSMARTD_DEVICETYPE\fP 4
is set to the device type specified by \'-d\' directive or is set to the device type specified by \'-d\' directive or
\'auto\' if none. \'auto\' if none.
@ -1082,10 +1073,6 @@ It it set to empty on \'\-M once\' and set to \'1\' on \'\-M daily\'.
.\" They define a non-existent option; useful because man2html can't correctly reset the margins. .\" They define a non-existent option; useful because man2html can't correctly reset the margins.
.TP .TP
.B \& .B \&
The shell which is used to run PATH is system-dependent. For vanilla
Linux/glibc it\'s bash. For other systems, the man page for
\fBpopen\fP(3) should say what shell is used.
If the \'\-m ADD\' Directive is given with a normal address argument, If the \'\-m ADD\' Directive is given with a normal address argument,
then the executable pointed to by PATH will be run in a shell with then the executable pointed to by PATH will be run in a shell with
STDIN receiving the body of the email message, and with the same STDIN receiving the body of the email message, and with the same
@ -1130,7 +1117,7 @@ Some sample scripts are also included in
/usr/local/share/doc/smartmontools/examplescripts/. /usr/local/share/doc/smartmontools/examplescripts/.
.\" %ENDIF NOT OS Windows .\" %ENDIF NOT OS Windows
[NEW EXPERIMENTAL SMARTD FEATURE] The executable is run by the script The executable is run by the script
.\" %IF NOT OS Windows .\" %IF NOT OS Windows
/usr/local/etc/smartd_warning.sh. /usr/local/etc/smartd_warning.sh.
.\" %ENDIF NOT OS Windows .\" %ENDIF NOT OS Windows
@ -1493,7 +1480,6 @@ will do the same, but only monitors the SMART health status of the
devices, (rather than the default \-a, which monitors all SMART devices, (rather than the default \-a, which monitors all SMART
properties). properties).
[NEW EXPERIMENTAL SMARTD FEATURE]
Configuration entries for specific devices may precede the \fBDEVICESCAN\fP entry. Configuration entries for specific devices may precede the \fBDEVICESCAN\fP entry.
For example For example
.nf .nf
@ -1581,5 +1567,7 @@ full path of this file.
\fBsmartd\fP(8), \fBsmartctl\fP(8), \fBsmartd\fP(8), \fBsmartctl\fP(8),
\fBmail\fP(1), \fBregex\fP(7). \fBmail\fP(1), \fBregex\fP(7).
.SH SVN ID OF THIS PAGE .SH PACKAGE VERSION
$Id: smartd.conf.5.in 3965 2014-07-20 14:46:41Z chrfranke $ CURRENT_SVN_VERSION CURRENT_SVN_DATE CURRENT_SVN_REV
.br
$Id: smartd.conf.5.in 4103 2015-06-01 19:51:18Z chrfranke $

View File

@ -4,7 +4,7 @@
* Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 2000 Michael Cornwell <cornwell@acm.org> * Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
* Copyright (C) 2008 Oliver Bock <brevilo@users.sourceforge.net> * Copyright (C) 2008 Oliver Bock <brevilo@users.sourceforge.net>
* Copyright (C) 2008-14 Christian Franke <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2008-15 Christian Franke <smartmontools-support@lists.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -106,7 +106,7 @@ typedef int pid_t;
extern "C" int getdomainname(char *, int); // no declaration in header files! extern "C" int getdomainname(char *, int); // no declaration in header files!
#endif #endif
const char * smartd_cpp_cvsid = "$Id: smartd.cpp 3948 2014-07-13 16:53:30Z chrfranke $" const char * smartd_cpp_cvsid = "$Id: smartd.cpp 4059 2015-04-18 17:01:31Z chrfranke $"
CONFIG_H_CVSID; CONFIG_H_CVSID;
// smartd exit codes // smartd exit codes
@ -1507,7 +1507,7 @@ static void Usage()
PrintOut(LOG_INFO," [default is %s]\n\n", configfile); PrintOut(LOG_INFO," [default is %s]\n\n", configfile);
#ifdef HAVE_LIBCAP_NG #ifdef HAVE_LIBCAP_NG
PrintOut(LOG_INFO," -C, --capabilities\n"); PrintOut(LOG_INFO," -C, --capabilities\n");
PrintOut(LOG_INFO," Use capabilities.\n" PrintOut(LOG_INFO," Drop unneeded Linux process capabilities.\n"
" Warning: Mail notification does not work when used.\n\n"); " Warning: Mail notification does not work when used.\n\n");
#endif #endif
PrintOut(LOG_INFO," -d, --debug\n"); PrintOut(LOG_INFO," -d, --debug\n");
@ -1591,7 +1591,7 @@ static int read_ata_error_count(ata_device * device, const char * name,
} }
else { else {
ata_smart_exterrlog logx; ata_smart_exterrlog logx;
if (!ataReadExtErrorLog(device, &logx, 1 /*first sector only*/, firmwarebugs)) { if (!ataReadExtErrorLog(device, &logx, 0, 1 /*first sector only*/, firmwarebugs)) {
PrintOut(LOG_INFO,"Device: %s, Read Extended Comprehensive SMART Error Log failed\n",name); PrintOut(LOG_INFO,"Device: %s, Read Extended Comprehensive SMART Error Log failed\n",name);
return -1; return -1;
} }
@ -1849,8 +1849,12 @@ static int ATADeviceScan(dev_config & cfg, dev_state & state, ata_device * atade
if (ataEnableSmart(atadev)) { if (ataEnableSmart(atadev)) {
// Enable SMART command has failed // Enable SMART command has failed
PrintOut(LOG_INFO,"Device: %s, could not enable SMART capability\n",name); PrintOut(LOG_INFO,"Device: %s, could not enable SMART capability\n",name);
CloseDevice(atadev, name);
return 2; if (ataIsSmartEnabled(&drive) <= 0) {
CloseDevice(atadev, name);
return 2;
}
PrintOut(LOG_INFO, "Device: %s, proceeding since SMART is already enabled\n", name);
} }
// disable device attribute autosave... // disable device attribute autosave...
@ -4789,7 +4793,7 @@ static int ReadOrMakeConfigEntries(dev_config_vector & conf_entries, smart_devic
PrintOut(LOG_CRIT,"In the system's table of devices NO devices found to scan\n"); PrintOut(LOG_CRIT,"In the system's table of devices NO devices found to scan\n");
} }
else else
PrintOut(LOG_CRIT,"Configuration file %s parsed but has no entries (like /dev/hda)\n",configfile); PrintOut(LOG_CRIT, "Configuration file %s parsed but has no entries\n", configfile);
return conf_entries.size(); return conf_entries.size();
} }

View File

@ -1,8 +1,8 @@
.ig .ig
Copyright (C) 2013 Hannes von Haugwitz <hannes@vonhaugwitz.com> Copyright (C) 2013 Hannes von Haugwitz <hannes@vonhaugwitz.com>
Copyright (C) 2014 Christian Franke <smartmontools-support@lists.sourceforge.net> Copyright (C) 2014-15 Christian Franke <smartmontools-support@lists.sourceforge.net>
$Id: update-smart-drivedb.8.in 3961 2014-07-19 16:44:10Z chrfranke $ $Id: update-smart-drivedb.8.in 4054 2015-04-15 19:04:49Z chrfranke $
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -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/>. (for example COPYING); If not, see <http://www.gnu.org/licenses/>.
.. ..
.TH UPDATE-SMART-DRIVEDB 8 CURRENT_SVN_DATE CURRENT_SVN_VERSION CURRENT_SVN_DATE .TH UPDATE-SMART-DRIVEDB 8 "CURRENT_SVN_DATE" "CURRENT_SVN_VERSION" "SMART Monitoring Tools"
.SH NAME .SH NAME
update-smart-drivedb \- update smartmontools drive database update-smart-drivedb \- update smartmontools drive database
@ -22,9 +22,6 @@ update-smart-drivedb \- update smartmontools drive database
.RB [ -v ] .RB [ -v ]
.RI [ DESTFILE ] .RI [ DESTFILE ]
.SH PACKAGE VERSION
CURRENT_SVN_VERSION CURRENT_SVN_DATE CURRENT_SVN_REV
.SH "DESCRIPTION" .SH "DESCRIPTION"
.B update-smart-drivedb .B update-smart-drivedb
updates updates
@ -88,17 +85,25 @@ new drive database rejected due to syntax errors.
.B /usr/local/share/smartmontools/drivedb.h.lastcheck .B /usr/local/share/smartmontools/drivedb.h.lastcheck
empty file created if downloaded file was identical. empty file created if downloaded file was identical.
.SH "SEE ALSO"
.BR smartctl (8),
.BR smartd (8).
.SH AUTHORS .SH AUTHORS
\fBChristian Franke\fP \fBChristian Franke\fP.
.br
\fBsmartmontools\-support@lists.sourceforge.net\fP
.br .br
This manual page was originally written by This manual page was originally written by
.BR "Hannes von Haugwitz <hannes@vonhaugwitz.com>" . .BR "Hannes von Haugwitz <hannes@vonhaugwitz.com>" .
.SH SVN ID OF THIS PAGE .SH REPORTING BUGS
$Id: update-smart-drivedb.8.in 3961 2014-07-19 16:44:10Z chrfranke $ To submit a bug report, create a ticket in smartmontools wiki:
.br
<\fBhttp://www.smartmontools.org/\fP>.
.br
Alternatively send the info to the smartmontools support mailing list:
.br
<\fBhttps://lists.sourceforge.net/lists/listinfo/smartmontools-support\fB>.
.SH SEE ALSO
\fBsmartctl\fP(8), \fBsmartd\fP(8).
.SH PACKAGE VERSION
CURRENT_SVN_VERSION CURRENT_SVN_DATE CURRENT_SVN_REV
.br
$Id: update-smart-drivedb.8.in 4054 2015-04-15 19:04:49Z chrfranke $

View File

@ -2,7 +2,7 @@
# #
# smartmontools drive database update script # smartmontools drive database update script
# #
# Copyright (C) 2010-13 Christian Franke <smartmontools-support@lists.sourceforge.net> # Copyright (C) 2010-14 Christian Franke <smartmontools-support@lists.sourceforge.net>
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -12,7 +12,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# (for example COPYING); If not, see <http://www.gnu.org/licenses/>. # (for example COPYING); If not, see <http://www.gnu.org/licenses/>.
# #
# $Id: update-smart-drivedb.in 3814 2013-06-04 19:38:25Z chrfranke $ # $Id: update-smart-drivedb.in 4019 2014-12-06 20:12:50Z chrfranke $
# #
set -e set -e
@ -122,7 +122,7 @@ chmod 0644 "$DEST.new"
# Check syntax # Check syntax
rm -f "$DEST.error" rm -f "$DEST.error"
if $SMARTCTL -B "$DEST.new" -P showall >/dev/null; then :; else if "$SMARTCTL" -B "$DEST.new" -P showall >/dev/null; then :; else
mv "$DEST.new" "$DEST.error" mv "$DEST.new" "$DEST.error"
echo "$DEST.error: rejected by $SMARTCTL, probably no longer compatible" >&2 echo "$DEST.error: rejected by $SMARTCTL, probably no longer compatible" >&2
exit 1 exit 1

View File

@ -4,7 +4,7 @@
* Home page of code is: http://smartmontools.sourceforge.net * Home page of code is: http://smartmontools.sourceforge.net
* *
* Copyright (C) 2002-12 Bruce Allen <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2002-12 Bruce Allen <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 2008-14 Christian Franke <smartmontools-support@lists.sourceforge.net> * Copyright (C) 2008-15 Christian Franke <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 2000 Michael Cornwell <cornwell@acm.org> * Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -52,7 +52,7 @@
#include "atacmds.h" #include "atacmds.h"
#include "dev_interface.h" #include "dev_interface.h"
const char * utility_cpp_cvsid = "$Id: utility.cpp 3937 2014-07-05 17:51:21Z chrfranke $" const char * utility_cpp_cvsid = "$Id: utility.cpp 4031 2015-01-01 10:47:48Z chrfranke $"
UTILITY_H_CVSID INT64_H_CVSID; UTILITY_H_CVSID INT64_H_CVSID;
const char * packet_types[] = { const char * packet_types[] = {
@ -90,7 +90,7 @@ std::string format_version_info(const char * prog_name, bool full /*= false*/)
"(build date " __DATE__ ")" // checkout without expansion of Id keywords "(build date " __DATE__ ")" // checkout without expansion of Id keywords
#endif #endif
" [%s] " BUILD_INFO "\n" " [%s] " BUILD_INFO "\n"
"Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org\n", "Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org\n",
prog_name, smi()->get_os_version_str().c_str() prog_name, smi()->get_os_version_str().c_str()
); );
if (!full) if (!full)
@ -651,37 +651,17 @@ int64_t bytes = 0;
// Helps debugging. If the second argument is non-negative, then // Helps debugging. If the second argument is non-negative, then
// decrement bytes by that amount. Else decrement bytes by (one plus) // decrement bytes by that amount. Else decrement bytes by (one plus)
// length of null terminated string. // length of null terminated string.
void *FreeNonZero1(void *address, int size, int line, const char* file){ void *FreeNonZero(void *address, int size, int /*line*/, const char* /*file*/){
if (address) { if (address) {
if (size<0) if (size<0)
bytes-=1+strlen((char*)address); bytes-=1+strlen((char*)address);
else else
bytes-=size; bytes-=size;
return CheckFree1(address, line, file); free(address);
} }
return NULL; return NULL;
} }
// To help with memory checking. Use when it is known that address is
// NOT null.
void *CheckFree1(void *address, int /*whatline*/, const char* /*file*/){
if (address){
free(address);
return NULL;
}
throw std::runtime_error("Internal error in CheckFree()");
}
// A custom version of calloc() that tracks memory use
void *Calloc(size_t nmemb, size_t size) {
void *ptr=calloc(nmemb, size);
if (ptr)
bytes+=nmemb*size;
return ptr;
}
// A custom version of strdup() that keeps track of how much memory is // A custom version of strdup() that keeps track of how much memory is
// being allocated. If mustexist is set, it also throws an error if we // being allocated. If mustexist is set, it also throws an error if we
// try to duplicate a NULL string. // try to duplicate a NULL string.

View File

@ -25,7 +25,7 @@
#ifndef UTILITY_H_ #ifndef UTILITY_H_
#define UTILITY_H_ #define UTILITY_H_
#define UTILITY_H_CVSID "$Id: utility.h 3936 2014-07-05 17:16:23Z chrfranke $" #define UTILITY_H_CVSID "$Id: utility.h 4028 2014-12-13 14:59:48Z chrfranke $"
#include <time.h> #include <time.h>
#include <sys/types.h> // for regex.h (according to POSIX) #include <sys/types.h> // for regex.h (according to POSIX)
@ -98,18 +98,6 @@ int split_report_arg(char *s, int *i);
// Function for processing -t selective... option in smartctl // Function for processing -t selective... option in smartctl
int split_selective_arg(char *s, uint64_t *start, uint64_t *stop, int *mode); int split_selective_arg(char *s, uint64_t *start, uint64_t *stop, int *mode);
// Guess device type (ata or scsi) based on device name
// Guessing will now use Controller Type defines below
// Moved to C++ interface
//int guess_device_type(const char * dev_name);
// Create and return the list of devices to probe automatically
// if the DEVICESCAN option is in the smartd config file
// Moved to C++ interface
//int make_device_names (char ***devlist, const char* name);
// Replacement for exit(status) // Replacement for exit(status)
// (exit is not compatible with C++ destructors) // (exit is not compatible with C++ destructors)
#define EXIT(status) { throw (int)(status); } #define EXIT(status) { throw (int)(status); }
@ -117,31 +105,14 @@ int split_selective_arg(char *s, uint64_t *start, uint64_t *stop, int *mode);
#ifdef OLD_INTERFACE #ifdef OLD_INTERFACE
// replacement for calloc() that tracks memory usage
void *Calloc(size_t nmemb, size_t size);
// Utility function to free memory // Utility function to free memory
void *FreeNonZero1(void* address, int size, int whatline, const char* file); void *FreeNonZero(void* address, int size, int whatline, const char* file);
// Typesafe version of above
template <class T>
inline T * FreeNonZero(T * address, int size, int whatline, const char* file)
{ return (T *)FreeNonZero1((void *)address, size, whatline, file); }
// A custom version of strdup() that keeps track of how much memory is // A custom version of strdup() that keeps track of how much memory is
// being allocated. If mustexist is set, it also throws an error if we // being allocated. If mustexist is set, it also throws an error if we
// try to duplicate a NULL string. // try to duplicate a NULL string.
char *CustomStrDup(const char *ptr, int mustexist, int whatline, const char* file); char *CustomStrDup(const char *ptr, int mustexist, int whatline, const char* file);
// To help with memory checking. Use when it is known that address is
// NOT null.
void *CheckFree1(void *address, int whatline, const char* file);
// Typesafe version of above
template <class T>
inline T * CheckFree(T * address, int whatline, const char* file)
{ return (T *)CheckFree1((void *)address, whatline, file); }
#endif // OLD_INTERFACE #endif // OLD_INTERFACE
// Compile time check of byte ordering // Compile time check of byte ordering
@ -163,17 +134,6 @@ void check_config();
// the ATA standard for packet devices to define the device type. // the ATA standard for packet devices to define the device type.
const char *packetdevicetype(int type); const char *packetdevicetype(int type);
// Moved to C++ interface
//int deviceopen(const char *pathname, char *type);
//int deviceclose(int fd);
// Optional functions of os_*.c
#ifdef HAVE_GET_OS_VERSION_STR
// Return build host and OS version as static string
//const char * get_os_version_str(void);
#endif
// returns true if any of the n bytes are nonzero, else zero. // returns true if any of the n bytes are nonzero, else zero.
bool nonempty(const void * data, int size); bool nonempty(const void * data, int size);