]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - smartctl.h
e379c7e8b15de177256fe07698979f9aebfe64cd
[mirror_smartmontools-debian.git] / smartctl.h
1 /*
2 * smartctl.h
3 *
4 * Home page of code is: http://www.smartmontools.org
5 *
6 * Copyright (C) 2002-10 Bruce Allen
7 * Copyright (C) 2008-10 Christian Franke
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 4431 2017-08-08 19:38:15Z chrfranke $\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.
69 enum failure_type {
70 OPTIONAL_CMD,
71 MANDATORY_CMD,
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 {
89 if (printing_is_switchable)
90 printing_is_off = false;
91 }
92 inline void print_off()
93 {
94 if (printing_is_switchable)
95 printing_is_off = true;
96 }
97
98 #endif