Skip to content
Snippets Groups Projects
Commit 7a2ee0e1 authored by ballen4705's avatar ballen4705
Browse files

I decided to simplify this, rather than give the Offline test command twice...

I decided to simplify this, rather than give the Offline test command twice and confuse the poor user.
The time printed may be wrong if the test self-aborts.


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@335 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 41600ae6
No related branches found
No related tags found
No related merge requests found
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "smartctl.h" #include "smartctl.h"
#include "extern.h" #include "extern.h"
const char *CVSid2="$Id: ataprint.c,v 1.46 2002/11/27 13:58:30 ballen4705 Exp $" const char *CVSid2="$Id: ataprint.c,v 1.47 2002/11/29 10:41:58 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID6; CVSID1 CVSID2 CVSID3 CVSID6;
// for passing global control variables // for passing global control variables
...@@ -1010,25 +1010,19 @@ int ataPrintMain (int fd){ ...@@ -1010,25 +1010,19 @@ int ataPrintMain (int fd){
// Tell user how long test will take to complete. This is tricky // Tell user how long test will take to complete. This is tricky
// because in the case of an Offline Full Scan, the completion timer // because in the case of an Offline Full Scan, the completion timer
// is volatile, and needs to be read AFTER the command is // is volatile, and needs to be read AFTER the command is given. If
// given. [This is NOT the case for the self-test times which are // this will interrupt the Offline Full Scan, we don't do it, just
// FIXED not volatile.] Since the data is in the Device SMART data // warn user.
// structure, we need to give a SMART read data command to retrieve
// this. However, in some cases the SMART read data command will
// interrupt the Offline Full Scan. So...
if (con->testcase==OFFLINE_FULL_SCAN){ if (con->testcase==OFFLINE_FULL_SCAN){
// get the data that we need if (isSupportOfflineAbort(&smartval))
if (ataReadSmartValues(fd, &smartval)){ pout("Note: giving further SMART commands will abort Offline testing\n");
else if (ataReadSmartValues(fd, &smartval)){
pout("Smartctl: SMART Read Values failed.\n"); pout("Smartctl: SMART Read Values failed.\n");
failuretest(OPTIONAL_CMD, returnval|=FAILSMART); failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
} }
// then restart the command if getting the data aborted it
if (isSupportOfflineAbort(&smartval) && ataSmartTest(fd, con->testcase))
failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
} }
// Now find out how long the test will take to complete, and tell // Now say how long the test will take to complete
// the poor user.
if ((timewait=TestTime(&smartval,con->testcase))){ if ((timewait=TestTime(&smartval,con->testcase))){
pout("Please wait %d %s for test to complete.\n", pout("Please wait %d %s for test to complete.\n",
(int)timewait, con->testcase==OFFLINE_FULL_SCAN?"seconds":"minutes"); (int)timewait, con->testcase==OFFLINE_FULL_SCAN?"seconds":"minutes");
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "smartctl.h" #include "smartctl.h"
#include "extern.h" #include "extern.h"
const char *CVSid2="$Id: ataprint.cpp,v 1.46 2002/11/27 13:58:30 ballen4705 Exp $" const char *CVSid2="$Id: ataprint.cpp,v 1.47 2002/11/29 10:41:58 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID6; CVSID1 CVSID2 CVSID3 CVSID6;
// for passing global control variables // for passing global control variables
...@@ -1010,25 +1010,19 @@ int ataPrintMain (int fd){ ...@@ -1010,25 +1010,19 @@ int ataPrintMain (int fd){
// Tell user how long test will take to complete. This is tricky // Tell user how long test will take to complete. This is tricky
// because in the case of an Offline Full Scan, the completion timer // because in the case of an Offline Full Scan, the completion timer
// is volatile, and needs to be read AFTER the command is // is volatile, and needs to be read AFTER the command is given. If
// given. [This is NOT the case for the self-test times which are // this will interrupt the Offline Full Scan, we don't do it, just
// FIXED not volatile.] Since the data is in the Device SMART data // warn user.
// structure, we need to give a SMART read data command to retrieve
// this. However, in some cases the SMART read data command will
// interrupt the Offline Full Scan. So...
if (con->testcase==OFFLINE_FULL_SCAN){ if (con->testcase==OFFLINE_FULL_SCAN){
// get the data that we need if (isSupportOfflineAbort(&smartval))
if (ataReadSmartValues(fd, &smartval)){ pout("Note: giving further SMART commands will abort Offline testing\n");
else if (ataReadSmartValues(fd, &smartval)){
pout("Smartctl: SMART Read Values failed.\n"); pout("Smartctl: SMART Read Values failed.\n");
failuretest(OPTIONAL_CMD, returnval|=FAILSMART); failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
} }
// then restart the command if getting the data aborted it
if (isSupportOfflineAbort(&smartval) && ataSmartTest(fd, con->testcase))
failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
} }
// Now find out how long the test will take to complete, and tell // Now say how long the test will take to complete
// the poor user.
if ((timewait=TestTime(&smartval,con->testcase))){ if ((timewait=TestTime(&smartval,con->testcase))){
pout("Please wait %d %s for test to complete.\n", pout("Please wait %d %s for test to complete.\n",
(int)timewait, con->testcase==OFFLINE_FULL_SCAN?"seconds":"minutes"); (int)timewait, con->testcase==OFFLINE_FULL_SCAN?"seconds":"minutes");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment