]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - ataprint.h
New upstream version 6.6
[mirror_smartmontools-debian.git] / ataprint.h
CommitLineData
832b75ed
GG
1/*
2 * ataprint.h
3 *
a86ec89e 4 * Home page of code is: http://www.smartmontools.org
832b75ed 5 *
f9e10201
JD
6 * Copyright (C) 2002-09 Bruce Allen
7 * Copyright (C) 2008-17 Christian Franke
832b75ed
GG
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
ee38a438 16 * (for example COPYING); If not, see <http://www.gnu.org/licenses/>.
832b75ed
GG
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
f9e10201 28#define ATAPRINT_H_CVSID "$Id: ataprint.h 4572 2017-10-29 14:36:00Z chrfranke $\n"
832b75ed 29
2127e193 30#include <vector>
832b75ed 31
2127e193
GI
32// Request to dump a GP or SMART log
33struct ata_log_request
34{
35 bool gpl; // false: SMART, true: GP
36 unsigned char logaddr; // Log address
37 unsigned page; // First page (sector)
38 unsigned nsectors; // # Sectors
832b75ed 39
2127e193
GI
40 ata_log_request()
41 : gpl(false), logaddr(0), page(0), nsectors(0)
42 { }
43};
832b75ed 44
2127e193 45// Options for ataPrintMain
2127e193
GI
46struct ata_print_options
47{
48 bool drive_info;
ee38a438 49 int identify_word_level, identify_bit_level;
2127e193
GI
50 bool smart_check_status;
51 bool smart_general_values;
52 bool smart_vendor_attrib;
53 bool smart_error_log;
54 bool smart_selftest_log;
55 bool smart_selective_selftest_log;
832b75ed 56
2127e193
GI
57 bool gp_logdir, smart_logdir;
58 unsigned smart_ext_error_log;
59 unsigned smart_ext_selftest_log;
60 bool retry_error_log, retry_selftest_log;
832b75ed 61
2127e193 62 std::vector<ata_log_request> log_requests;
832b75ed 63
d008864d
GI
64 bool devstat_all_pages, devstat_ssd_page;
65 std::vector<int> devstat_pages;
66
f9e10201
JD
67 bool pending_defects_info;
68 unsigned pending_defects_log;
69
2127e193 70 bool sct_temp_sts, sct_temp_hist;
7f0798ef
GI
71 bool sct_erc_get;
72 bool sct_erc_set;
73 unsigned sct_erc_readtime, sct_erc_writetime;
2127e193 74 bool sataphy, sataphy_reset;
832b75ed 75
2127e193
GI
76 bool smart_disable, smart_enable;
77 bool smart_auto_offl_disable, smart_auto_offl_enable;
78 bool smart_auto_save_disable, smart_auto_save_enable;
832b75ed 79
2127e193 80 int smart_selftest_type; // OFFLINE_FULL_SCAN, ..., see atacmds.h. -1 for no test
d008864d 81 bool smart_selftest_force; // Ignore already running test
2127e193 82 ata_selective_selftest_args smart_selective_args; // Extra args for selective self-test
832b75ed 83
2127e193
GI
84 unsigned sct_temp_int;
85 bool sct_temp_int_pers;
832b75ed 86
e165493d
GI
87 enum { FMT_BRIEF = 0x01, FMT_HEX_ID = 0x02, FMT_HEX_VAL = 0x04 };
88 unsigned char output_format; // FMT_* flags
89
ee38a438 90 firmwarebug_defs firmwarebugs; // -F options
2127e193 91 bool fix_swapped_id; // Fix swapped ID strings returned by some buggy drivers
832b75ed 92
bed94269 93 ata_vendor_attr_defs attribute_defs; // -v options
2127e193
GI
94
95 bool ignore_presets; // Ignore presets from drive database
96 bool show_presets; // Show presets and exit
97 unsigned char powermode; // Skip check, if disk in idle or standby mode
f9e10201 98 unsigned char powerexit; // exit() code for low power mode
2127e193 99
d008864d
GI
100 bool get_set_used; // true if any get/set command is used
101 bool get_aam; // print Automatic Acoustic Management status
102 int set_aam; // disable(-1), enable(1..255->0..254) Automatic Acoustic Management
103 bool get_apm; // print Advanced Power Management status
104 int set_apm; // disable(-1), enable(2..255->1..254) Advanced Power Management
105 bool get_lookahead; // print read look-ahead status
106 int set_lookahead; // disable(-1), enable(1) read look-ahead
107 int set_standby; // set(1..255->0..254) standby timer
108 bool set_standby_now; // set drive to standby
109 bool get_security; // print ATA security status
110 bool set_security_freeze; // Freeze ATA security
111 bool get_wcache; // print write cache status
112 int set_wcache; // disable(-1), enable(1) write cache
3d17a85c
GI
113 bool sct_wcache_reorder_get; // print write cache reordering status
114 int sct_wcache_reorder_set; // disable(-1), enable(1) write cache reordering
f9e10201
JD
115 bool sct_wcache_reorder_set_pers;
116 bool sct_wcache_sct_get; // print SCT Feature Control of write cache status
117 int sct_wcache_sct_set; // determined by ata set features command(1), force enable(2), force disable(3)
118 bool sct_wcache_sct_set_pers; // persistent or volatile
119 bool get_dsn; // print DSN status
120 int set_dsn; // disable(02h), enable(01h) DSN
d008864d 121
2127e193
GI
122 ata_print_options()
123 : drive_info(false),
ee38a438 124 identify_word_level(-1), identify_bit_level(-1),
2127e193
GI
125 smart_check_status(false),
126 smart_general_values(false),
127 smart_vendor_attrib(false),
128 smart_error_log(false),
129 smart_selftest_log(false),
130 smart_selective_selftest_log(false),
131 gp_logdir(false), smart_logdir(false),
132 smart_ext_error_log(0),
133 smart_ext_selftest_log(0),
134 retry_error_log(false), retry_selftest_log(false),
d008864d 135 devstat_all_pages(false), devstat_ssd_page(false),
f9e10201 136 pending_defects_info(false), pending_defects_log(0),
2127e193 137 sct_temp_sts(false), sct_temp_hist(false),
7f0798ef
GI
138 sct_erc_get(false),
139 sct_erc_set(false),
140 sct_erc_readtime(0), sct_erc_writetime(0),
2127e193
GI
141 sataphy(false), sataphy_reset(false),
142 smart_disable(false), smart_enable(false),
143 smart_auto_offl_disable(false), smart_auto_offl_enable(false),
144 smart_auto_save_disable(false), smart_auto_save_enable(false),
d008864d 145 smart_selftest_type(-1), smart_selftest_force(false),
2127e193 146 sct_temp_int(0), sct_temp_int_pers(false),
a7e8ffec 147 output_format(0),
2127e193
GI
148 fix_swapped_id(false),
149 ignore_presets(false),
150 show_presets(false),
f9e10201 151 powermode(0), powerexit(0),
d008864d
GI
152 get_set_used(false),
153 get_aam(false), set_aam(0),
154 get_apm(false), set_apm(0),
155 get_lookahead(false), set_lookahead(0),
156 set_standby(0), set_standby_now(false),
157 get_security(false), set_security_freeze(false),
3d17a85c 158 get_wcache(false), set_wcache(0),
f9e10201
JD
159 sct_wcache_reorder_get(false), sct_wcache_reorder_set(0),
160 sct_wcache_reorder_set_pers(false),
161 sct_wcache_sct_get(false), sct_wcache_sct_set(0),
162 sct_wcache_sct_set_pers(false),
163 get_dsn(false), set_dsn(0)
bed94269 164 { }
2127e193
GI
165};
166
167int ataPrintMain(ata_device * device, const ata_print_options & options);
832b75ed
GG
168
169#endif