Ticket #877: smartctl.h

File smartctl.h, 3.2 KB (added by DamianW, 8 years ago)
Line 
1/*
2 * smartctl.h
3 *
4 * Home page of code is: http://www.smartmontools.org
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 * Changes / Modifications: Workaround for hangs with SATADOM drives
25 * 2017/09/14
26 * Damian Wojtal
27 * Add boolean flag to distinguish if we are handling SATADOM drive
28 */
29
30#ifndef SMARTCTL_H_
31#define SMARTCTL_H_
32
33#define SMARTCTL_H_CVSID "$Id: smartctl.h 4120 2015-08-27 16:12:21Z samm2 $\n"
34
35// Return codes (bitmask)
36
37// command line did not parse, or internal error occured in smartctl
38#define FAILCMD (0x01<<0)
39
40// device open failed
41#define FAILDEV (0x01<<1)
42
43// device is in low power mode and -n option requests to exit
44#define FAILPOWER (0x01<<1)
45
46// read device identity (ATA only) failed
47#define FAILID (0x01<<1)
48
49// smart command failed, or ATA identify device structure missing information
50#define FAILSMART (0x01<<2)
51
52// SMART STATUS returned FAILURE
53#define FAILSTATUS (0x01<<3)
54
55// Attributes found <= threshold with prefail=1
56#define FAILATTR (0x01<<4)
57
58// SMART STATUS returned GOOD but age attributes failed or prefail
59// attributes have failed in the past
60#define FAILAGE (0x01<<5)
61
62// Device had Errors in the error log
63#define FAILERR (0x01<<6)
64
65// Device had Errors in the self-test log
66#define FAILLOG (0x01<<7)
67
68// Classes of SMART commands. Here 'mandatory' means "Required by the
69// ATA/ATAPI-5 Specification if the device implements the S.M.A.R.T.
70// command set." The 'mandatory' S.M.A.R.T. commands are: (1)
71// Enable/Disable Attribute Autosave, (2) Enable/Disable S.M.A.R.T.,
72// and (3) S.M.A.R.T. Return Status. All others are optional.
73enum failure_type {
74 OPTIONAL_CMD,
75 MANDATORY_CMD,
76};
77
78// Globals to set failuretest() policy
79extern bool failuretest_conservative;
80extern unsigned char failuretest_permissive;
81
82
83// Compares failure type to policy in effect, and either exits or
84// simply returns to the calling routine.
85void failuretest(failure_type type, int returnvalue);
86
87// Globals to control printing
88extern bool printing_is_switchable;
89extern bool printing_is_off;
90
91// Globals for satadom support
92extern bool is_satadom;
93
94// Printing control functions
95inline void print_on()
96{
97 if (printing_is_switchable)
98 printing_is_off = false;
99}
100inline void print_off()
101{
102 if (printing_is_switchable)
103 printing_is_off = true;
104}
105
106#endif