smartmontools  SVN Rev 4430
Utility to control and monitor storage systems with "S.M.A.R.T."
ataprint.h
Go to the documentation of this file.
1 /*
2  * ataprint.h
3  *
4  * Home page of code is: http://www.smartmontools.org
5  *
6  * Copyright (C) 2002-09 Bruce Allen
7  * Copyright (C) 2008-17 Christian Franke
8  * Copyright (C) 1999-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, see <http://www.gnu.org/licenses/>.
17  *
18  * This code was originally developed as a Senior Thesis by Michael Cornwell
19  * at the Concurrent Systems Laboratory (now part of the Storage Systems
20  * Research Center), Jack Baskin School of Engineering, University of
21  * California, Santa Cruz. http://ssrc.soe.ucsc.edu/
22  *
23  */
24 
25 #ifndef ATAPRINT_H_
26 #define ATAPRINT_H_
27 
28 #define ATAPRINT_H_CVSID "$Id: ataprint.h 4402 2017-03-09 20:20:48Z chrfranke $\n"
29 
30 #include <vector>
31 
32 // Request to dump a GP or SMART log
34 {
35  bool gpl; // false: SMART, true: GP
36  unsigned char logaddr; // Log address
37  unsigned page; // First page (sector)
38  unsigned nsectors; // # Sectors
39 
41  : gpl(false), logaddr(0), page(0), nsectors(0)
42  { }
43 };
44 
45 // Options for ataPrintMain
47 {
48  bool drive_info;
56 
61 
62  std::vector<ata_log_request> log_requests;
63 
65  std::vector<int> devstat_pages;
66 
72 
76 
77  int smart_selftest_type; // OFFLINE_FULL_SCAN, ..., see atacmds.h. -1 for no test
78  bool smart_selftest_force; // Ignore already running test
79  ata_selective_selftest_args smart_selective_args; // Extra args for selective self-test
80 
81  unsigned sct_temp_int;
83 
84  enum { FMT_BRIEF = 0x01, FMT_HEX_ID = 0x02, FMT_HEX_VAL = 0x04 };
85  unsigned char output_format; // FMT_* flags
86 
88  bool fix_swapped_id; // Fix swapped ID strings returned by some buggy drivers
89 
91 
92  bool ignore_presets; // Ignore presets from drive database
93  bool show_presets; // Show presets and exit
94  unsigned char powermode; // Skip check, if disk in idle or standby mode
95  unsigned char powerexit; // exit() code for low power mode
96 
97  bool get_set_used; // true if any get/set command is used
98  bool get_aam; // print Automatic Acoustic Management status
99  int set_aam; // disable(-1), enable(1..255->0..254) Automatic Acoustic Management
100  bool get_apm; // print Advanced Power Management status
101  int set_apm; // disable(-1), enable(2..255->1..254) Advanced Power Management
102  bool get_lookahead; // print read look-ahead status
103  int set_lookahead; // disable(-1), enable(1) read look-ahead
104  int set_standby; // set(1..255->0..254) standby timer
105  bool set_standby_now; // set drive to standby
106  bool get_security; // print ATA security status
107  bool set_security_freeze; // Freeze ATA security
108  bool get_wcache; // print write cache status
109  int set_wcache; // disable(-1), enable(1) write cache
110  bool sct_wcache_reorder_get; // print write cache reordering status
111  int sct_wcache_reorder_set; // disable(-1), enable(1) write cache reordering
113  bool sct_wcache_sct_get; // print SCT Feature Control of write cache status
114  int sct_wcache_sct_set; // determined by ata set features command(1), force enable(2), force disable(3)
115  bool sct_wcache_sct_set_pers; // persistent or volatile
116  bool get_dsn; // print DSN status
117  int set_dsn; // disable(02h), enable(01h) DSN
118 
120  : drive_info(false),
121  identify_word_level(-1), identify_bit_level(-1),
122  smart_check_status(false),
123  smart_general_values(false),
124  smart_vendor_attrib(false),
125  smart_error_log(false),
126  smart_selftest_log(false),
127  smart_selective_selftest_log(false),
128  gp_logdir(false), smart_logdir(false),
129  smart_ext_error_log(0),
130  smart_ext_selftest_log(0),
131  retry_error_log(false), retry_selftest_log(false),
132  devstat_all_pages(false), devstat_ssd_page(false),
133  sct_temp_sts(false), sct_temp_hist(false),
134  sct_erc_get(false),
135  sct_erc_set(false),
136  sct_erc_readtime(0), sct_erc_writetime(0),
137  sataphy(false), sataphy_reset(false),
138  smart_disable(false), smart_enable(false),
139  smart_auto_offl_disable(false), smart_auto_offl_enable(false),
140  smart_auto_save_disable(false), smart_auto_save_enable(false),
141  smart_selftest_type(-1), smart_selftest_force(false),
142  sct_temp_int(0), sct_temp_int_pers(false),
143  output_format(0),
144  fix_swapped_id(false),
145  ignore_presets(false),
146  show_presets(false),
147  powermode(0), powerexit(0),
148  get_set_used(false),
149  get_aam(false), set_aam(0),
150  get_apm(false), set_apm(0),
151  get_lookahead(false), set_lookahead(0),
152  set_standby(0), set_standby_now(false),
153  get_security(false), set_security_freeze(false),
154  get_wcache(false), set_wcache(0),
155  sct_wcache_reorder_get(false), sct_wcache_reorder_set(0),
156  sct_wcache_reorder_set_pers(false),
157  sct_wcache_sct_get(false), sct_wcache_sct_set(0),
158  sct_wcache_sct_set_pers(false),
159  get_dsn(false), set_dsn(0)
160  { }
161 };
162 
163 int ataPrintMain(ata_device * device, const ata_print_options & options);
164 
165 #endif
bool sct_wcache_sct_get
Definition: ataprint.h:113
unsigned page
Definition: ataprint.h:37
ata_vendor_attr_defs attribute_defs
Definition: ataprint.h:90
bool sct_wcache_sct_set_pers
Definition: ataprint.h:115
firmwarebug_defs firmwarebugs
Definition: ataprint.h:87
bool smart_error_log
Definition: ataprint.h:53
bool sct_wcache_reorder_get
Definition: ataprint.h:110
int smart_selftest_type
Definition: ataprint.h:77
bool smart_selective_selftest_log
Definition: ataprint.h:55
bool smart_disable
Definition: ataprint.h:73
bool sct_temp_hist
Definition: ataprint.h:67
int identify_bit_level
Definition: ataprint.h:49
bool smart_selftest_force
Definition: ataprint.h:78
std::vector< int > devstat_pages
Definition: ataprint.h:65
unsigned sct_erc_writetime
Definition: ataprint.h:70
unsigned smart_ext_selftest_log
Definition: ataprint.h:59
ata_selective_selftest_args smart_selective_args
Definition: ataprint.h:79
bool retry_error_log
Definition: ataprint.h:60
bool fix_swapped_id
Definition: ataprint.h:88
bool set_security_freeze
Definition: ataprint.h:107
unsigned char output_format
Definition: ataprint.h:85
bool smart_auto_save_enable
Definition: ataprint.h:75
unsigned char logaddr
Definition: ataprint.h:36
bool smart_general_values
Definition: ataprint.h:51
int ataPrintMain(ata_device *device, const ata_print_options &options)
Definition: ataprint.cpp:2547
unsigned sct_temp_int
Definition: ataprint.h:81
bool smart_selftest_log
Definition: ataprint.h:54
bool sct_temp_int_pers
Definition: ataprint.h:82
bool retry_selftest_log
Definition: ataprint.h:60
bool sct_wcache_reorder_set_pers
Definition: ataprint.h:112
unsigned char powerexit
Definition: ataprint.h:95
bool smart_auto_offl_disable
Definition: ataprint.h:74
int sct_wcache_sct_set
Definition: ataprint.h:114
bool ignore_presets
Definition: ataprint.h:92
bool set_standby_now
Definition: ataprint.h:105
ATA device access.
bool devstat_all_pages
Definition: ataprint.h:64
bool smart_vendor_attrib
Definition: ataprint.h:52
unsigned char powermode
Definition: ataprint.h:94
bool smart_check_status
Definition: ataprint.h:50
unsigned sct_erc_readtime
Definition: ataprint.h:70
bool smart_auto_save_disable
Definition: ataprint.h:75
unsigned nsectors
Definition: ataprint.h:38
std::vector< ata_log_request > log_requests
Definition: ataprint.h:62
bool devstat_ssd_page
Definition: ataprint.h:64
unsigned smart_ext_error_log
Definition: ataprint.h:58
int identify_word_level
Definition: ataprint.h:49
int sct_wcache_reorder_set
Definition: ataprint.h:111
bool sataphy_reset
Definition: ataprint.h:71
bool smart_auto_offl_enable
Definition: ataprint.h:74