smartmontools  SVN Rev 4078
Utility to control and monitor storage systems with "S.M.A.R.T."
smartctl.h
Go to the documentation of this file.
1 /*
2  * smartctl.h
3  *
4  * Home page of code is: http://smartmontools.sourceforge.net
5  *
6  * Copyright (C) 2002-10 Bruce Allen <smartmontools-support@lists.sourceforge.net>
7  * Copyright (C) 2008-10 Christian Franke <smartmontools-support@lists.sourceforge.net>
8  * Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2, or (at your option)
13  * any later version.
14  *
15  * You should have received a copy of the GNU General Public License
16  * (for example COPYING); if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * This code was originally developed as a Senior Thesis by Michael Cornwell
20  * at the Concurrent Systems Laboratory (now part of the Storage Systems
21  * Research Center), Jack Baskin School of Engineering, University of
22  * California, Santa Cruz. http://ssrc.soe.ucsc.edu/
23  *
24  */
25 
26 #ifndef SMARTCTL_H_
27 #define SMARTCTL_H_
28 
29 #define SMARTCTL_H_CVSID "$Id: smartctl.h 3727 2012-12-13 17:23:06Z samm2 $\n"
30 
31 // Return codes (bitmask)
32 
33 // command line did not parse, or internal error occured in smartctl
34 #define FAILCMD (0x01<<0)
35 
36 // device open failed
37 #define FAILDEV (0x01<<1)
38 
39 // device is in low power mode and -n option requests to exit
40 #define FAILPOWER (0x01<<1)
41 
42 // read device identity (ATA only) failed
43 #define FAILID (0x01<<1)
44 
45 // smart command failed, or ATA identify device structure missing information
46 #define FAILSMART (0x01<<2)
47 
48 // SMART STATUS returned FAILURE
49 #define FAILSTATUS (0x01<<3)
50 
51 // Attributes found <= threshold with prefail=1
52 #define FAILATTR (0x01<<4)
53 
54 // SMART STATUS returned GOOD but age attributes failed or prefail
55 // attributes have failed in the past
56 #define FAILAGE (0x01<<5)
57 
58 // Device had Errors in the error log
59 #define FAILERR (0x01<<6)
60 
61 // Device had Errors in the self-test log
62 #define FAILLOG (0x01<<7)
63 
64 // Classes of SMART commands. Here 'mandatory' means "Required by the
65 // ATA/ATAPI-5 Specification if the device implements the S.M.A.R.T.
66 // command set." The 'mandatory' S.M.A.R.T. commands are: (1)
67 // Enable/Disable Attribute Autosave, (2) Enable/Disable S.M.A.R.T.,
68 // and (3) S.M.A.R.T. Return Status. All others are optional.
72 };
73 
74 // Globals to set failuretest() policy
75 extern bool failuretest_conservative;
76 extern unsigned char failuretest_permissive;
77 
78 // Compares failure type to policy in effect, and either exits or
79 // simply returns to the calling routine.
80 void failuretest(failure_type type, int returnvalue);
81 
82 // Globals to control printing
83 extern bool printing_is_switchable;
84 extern bool printing_is_off;
85 
86 // Printing control functions
87 inline void print_on()
88 {
90  printing_is_off = false;
91 }
92 inline void print_off()
93 {
95  printing_is_off = true;
96 }
97 
98 #endif
bool printing_is_switchable
Definition: smartctl.cpp:58
bool printing_is_off
Definition: smartctl.cpp:59
void failuretest(failure_type type, int returnvalue)
Definition: smartctl.cpp:1115
void print_off()
Definition: smartctl.h:92
void print_on()
Definition: smartctl.h:87
unsigned char failuretest_permissive
Definition: smartctl.cpp:1110
bool failuretest_conservative
Definition: smartctl.cpp:1109
failure_type
Definition: smartctl.h:69