From ef5b8cfb64f46b97f3c79c86512479f9af349bc2 Mon Sep 17 00:00:00 2001
From: ballen4705 <ballen4705@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Mon, 17 Nov 2003 17:31:32 +0000
Subject: [PATCH] smartctl: make SCSI -T options behave the same way as the ATA
 ones

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@1249 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 sm5/CHANGELOG     |  5 ++++-
 sm5/scsiprint.c   | 28 ++--------------------------
 sm5/scsiprint.cpp | 28 ++--------------------------
 3 files changed, 8 insertions(+), 53 deletions(-)

diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG
index 1f9f98ae2..b8e07f94d 100644
--- a/sm5/CHANGELOG
+++ b/sm5/CHANGELOG
@@ -1,6 +1,6 @@
 CHANGELOG for smartmontools
 
-$Id: CHANGELOG,v 1.260 2003/11/17 11:56:28 dpgilbert Exp $
+$Id: CHANGELOG,v 1.261 2003/11/17 17:31:32 ballen4705 Exp $
 
 Maintainers / Developers Key:
 [BA] Bruce Allen
@@ -23,6 +23,9 @@ CURRENT DEVELOPMENT VERSION (see VERSION file in this directory):
 
   <ADDITIONS TO THE CHANGE LOG SHOULD BE ADDED HERE, PLEASE>
 
+  [BA] smartctl: make SCSI -T options behave the same way as the
+       ATA ones.
+
   [DG] smartctl: output scsi transport protocol if available
 
   [DG] scsi: stop device scan in smartd and smartctl if badly formed
diff --git a/sm5/scsiprint.c b/sm5/scsiprint.c
index 33c125f0f..36de14040 100644
--- a/sm5/scsiprint.c
+++ b/sm5/scsiprint.c
@@ -40,7 +40,7 @@
 
 #define GBUF_SIZE 65535
 
-const char* scsiprint_c_cvsid="$Id: scsiprint.c,v 1.62 2003/11/17 11:54:32 dpgilbert Exp $"
+const char* scsiprint_c_cvsid="$Id: scsiprint.c,v 1.63 2003/11/17 17:31:32 ballen4705 Exp $"
 EXTERN_H_CVSID SCSICMDS_H_CVSID SCSIPRINT_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID;
 
 // control block which points to external global control variables
@@ -68,33 +68,9 @@ static int gIecMPage = 1;     /* N.B. assume it until we know otherwise */
 /* Remember last successful mode sense/select command */
 static int modese_len = 0;
 
-
 // Compares failure type to policy in effect, and either exits or
 // simply returns to the calling routine.
-static void failuretest(int type, int returnvalue)
-{
-    // If this is an error in an "optional" SMART command
-    if (type == OPTIONAL_CMD) {
-        if (con->conservative) {
-            pout("An optional SMART command has failed: exiting.\n"
-                 "To continue, set the tolerance level to something other "
-                 "than 'conservative'\n");
-            EXIT(returnvalue);
-        }
-        return;
-    }
-    // If this is an error in a "mandatory" SMART command
-    if (type==MANDATORY_CMD) {
-        if (con->permissive)
-            return;
-        pout("A mandatory SMART command has failed: exiting. To continue, "
-             "use the -T option to set the tolerance level to 'permissive'\n");
-        exit(returnvalue);
-    }
-    pout("Smartctl internal error in failuretest(type=%d). Please contact "
-         "%s\n",type,PROJECTHOME);
-    exit(returnvalue|FAILCMD);
-}
+extern void failuretest(int type, int returnvalue);
 
 static void scsiGetSupportedLogPages(int device)
 {
diff --git a/sm5/scsiprint.cpp b/sm5/scsiprint.cpp
index 7b23742d8..53e116481 100644
--- a/sm5/scsiprint.cpp
+++ b/sm5/scsiprint.cpp
@@ -40,7 +40,7 @@
 
 #define GBUF_SIZE 65535
 
-const char* scsiprint_c_cvsid="$Id: scsiprint.cpp,v 1.62 2003/11/17 11:54:32 dpgilbert Exp $"
+const char* scsiprint_c_cvsid="$Id: scsiprint.cpp,v 1.63 2003/11/17 17:31:32 ballen4705 Exp $"
 EXTERN_H_CVSID SCSICMDS_H_CVSID SCSIPRINT_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID;
 
 // control block which points to external global control variables
@@ -68,33 +68,9 @@ static int gIecMPage = 1;     /* N.B. assume it until we know otherwise */
 /* Remember last successful mode sense/select command */
 static int modese_len = 0;
 
-
 // Compares failure type to policy in effect, and either exits or
 // simply returns to the calling routine.
-static void failuretest(int type, int returnvalue)
-{
-    // If this is an error in an "optional" SMART command
-    if (type == OPTIONAL_CMD) {
-        if (con->conservative) {
-            pout("An optional SMART command has failed: exiting.\n"
-                 "To continue, set the tolerance level to something other "
-                 "than 'conservative'\n");
-            EXIT(returnvalue);
-        }
-        return;
-    }
-    // If this is an error in a "mandatory" SMART command
-    if (type==MANDATORY_CMD) {
-        if (con->permissive)
-            return;
-        pout("A mandatory SMART command has failed: exiting. To continue, "
-             "use the -T option to set the tolerance level to 'permissive'\n");
-        exit(returnvalue);
-    }
-    pout("Smartctl internal error in failuretest(type=%d). Please contact "
-         "%s\n",type,PROJECTHOME);
-    exit(returnvalue|FAILCMD);
-}
+extern void failuretest(int type, int returnvalue);
 
 static void scsiGetSupportedLogPages(int device)
 {
-- 
GitLab