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