ataprint.h, nvmeprint.h, scsiprint.h: Use C++11 in-class member initializers.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5183 4ea69e1a-61f1-4043-bf83-b5c94c648137
pull/89/head
chrfranke 2 years ago
parent de241fd893
commit f9e5f2b743
  1. 3
      smartmontools/ChangeLog
  2. 167
      smartmontools/ataprint.h
  3. 28
      smartmontools/nvmeprint.h
  4. 75
      smartmontools/scsiprint.h

@ -2,6 +2,9 @@ $Id$
2021-01-24 Christian Franke <franke@computer.org>
ataprint.h, nvmeprint.h, scsiprint.h: Use C++11 in-class member
initializers.
Drop C++98 restriction, allow C++11.
configure.ac: Enable C++11. Fail if no option found.
Disable C++14 if possible. Warn if no C++14 option found.

@ -1,7 +1,7 @@
/*
* ataprint.h
*
* Home page of code is: http://www.smartmontools.org
* Home page of code is: https://www.smartmontools.org
*
* Copyright (C) 2002-09 Bruce Allen
* Copyright (C) 2008-21 Christian Franke
@ -20,134 +20,87 @@
// Request to dump a GP or SMART log
struct ata_log_request
{
bool gpl; // false: SMART, true: GP
unsigned char logaddr; // Log address
unsigned page; // First page (sector)
unsigned nsectors; // # Sectors
ata_log_request()
: gpl(false), logaddr(0), page(0), nsectors(0)
{ }
bool gpl = false; // false: SMART, true: GP
unsigned char logaddr = 0; // Log address
unsigned page = 0; // First page (sector)
unsigned nsectors = 0; // # Sectors
};
// Options for ataPrintMain
struct ata_print_options
{
bool drive_info;
int identify_word_level, identify_bit_level;
bool smart_check_status;
bool smart_general_values;
bool smart_vendor_attrib;
bool smart_error_log;
bool smart_selftest_log;
bool smart_selective_selftest_log;
bool gp_logdir, smart_logdir;
unsigned smart_ext_error_log;
unsigned smart_ext_selftest_log;
bool retry_error_log, retry_selftest_log;
bool drive_info = false;
int identify_word_level = -1, identify_bit_level = -1;
bool smart_check_status = false;
bool smart_general_values = false;
bool smart_vendor_attrib = false;
bool smart_error_log = false;
bool smart_selftest_log = false;
bool smart_selective_selftest_log = false;
bool gp_logdir = false, smart_logdir = false;
unsigned smart_ext_error_log = 0;
unsigned smart_ext_selftest_log = 0;
bool retry_error_log = false, retry_selftest_log = false;
std::vector<ata_log_request> log_requests;
bool devstat_all_pages, devstat_ssd_page;
bool devstat_all_pages = false, devstat_ssd_page = false;
std::vector<int> devstat_pages;
unsigned pending_defects_log;
unsigned pending_defects_log = 0;
bool sct_temp_sts, sct_temp_hist;
int sct_erc_get; // get(1), get_power_on(2)
int sct_erc_set; // set(1), set_power_on(2), mfg_default(3)
unsigned sct_erc_readtime, sct_erc_writetime;
bool sataphy, sataphy_reset;
bool sct_temp_sts = false, sct_temp_hist = false;
int sct_erc_get = 0; // get(1), get_power_on(2)
int sct_erc_set = 0; // set(1), set_power_on(2), mfg_default(3)
unsigned sct_erc_readtime = 0, sct_erc_writetime = 0;
bool sataphy = false, sataphy_reset = false;
bool smart_disable, smart_enable;
bool smart_auto_offl_disable, smart_auto_offl_enable;
bool smart_auto_save_disable, smart_auto_save_enable;
bool smart_disable = false, smart_enable = false;
bool smart_auto_offl_disable = false, smart_auto_offl_enable = false;
bool smart_auto_save_disable = false, smart_auto_save_enable = false;
int smart_selftest_type; // OFFLINE_FULL_SCAN, ..., see atacmds.h. -1 for no test
bool smart_selftest_force; // Ignore already running test
int smart_selftest_type = -1; // OFFLINE_FULL_SCAN, ..., see atacmds.h. -1 for no test
bool smart_selftest_force = false; // Ignore already running test
ata_selective_selftest_args smart_selective_args; // Extra args for selective self-test
unsigned sct_temp_int;
bool sct_temp_int_pers;
unsigned sct_temp_int = 0;
bool sct_temp_int_pers = false;
enum { FMT_BRIEF = 0x01, FMT_HEX_ID = 0x02, FMT_HEX_VAL = 0x04 };
unsigned char output_format; // FMT_* flags
unsigned char output_format = 0; // FMT_* flags
firmwarebug_defs firmwarebugs; // -F options
bool fix_swapped_id; // Fix swapped ID strings returned by some buggy drivers
bool fix_swapped_id = false; // Fix swapped ID strings returned by some buggy drivers
ata_vendor_attr_defs attribute_defs; // -v options
bool ignore_presets; // Ignore presets from drive database
bool show_presets; // Show presets and exit
unsigned char powermode; // Skip check, if disk in idle or standby mode
unsigned char powerexit; // exit() code for low power mode
bool get_set_used; // true if any get/set command is used
bool get_aam; // print Automatic Acoustic Management status
int set_aam; // disable(-1), enable(1..255->0..254) Automatic Acoustic Management
bool get_apm; // print Advanced Power Management status
int set_apm; // disable(-1), enable(2..255->1..254) Advanced Power Management
bool get_lookahead; // print read look-ahead status
int set_lookahead; // disable(-1), enable(1) read look-ahead
int set_standby; // set(1..255->0..254) standby timer
bool set_standby_now; // set drive to standby
bool get_security; // print ATA security status
bool set_security_freeze; // Freeze ATA security
bool get_wcache; // print write cache status
int set_wcache; // disable(-1), enable(1) write cache
bool sct_wcache_reorder_get; // print write cache reordering status
int sct_wcache_reorder_set; // disable(-1), enable(1) write cache reordering
bool sct_wcache_reorder_set_pers;
bool sct_wcache_sct_get; // print SCT Feature Control of write cache status
int sct_wcache_sct_set; // determined by ata set features command(1), force enable(2), force disable(3)
bool sct_wcache_sct_set_pers; // persistent or volatile
bool get_dsn; // print DSN status
int set_dsn; // disable(02h), enable(01h) DSN
ata_print_options()
: drive_info(false),
identify_word_level(-1), identify_bit_level(-1),
smart_check_status(false),
smart_general_values(false),
smart_vendor_attrib(false),
smart_error_log(false),
smart_selftest_log(false),
smart_selective_selftest_log(false),
gp_logdir(false), smart_logdir(false),
smart_ext_error_log(0),
smart_ext_selftest_log(0),
retry_error_log(false), retry_selftest_log(false),
devstat_all_pages(false), devstat_ssd_page(false),
pending_defects_log(0),
sct_temp_sts(false), sct_temp_hist(false),
sct_erc_get(0), sct_erc_set(0),
sct_erc_readtime(0), sct_erc_writetime(0),
sataphy(false), sataphy_reset(false),
smart_disable(false), smart_enable(false),
smart_auto_offl_disable(false), smart_auto_offl_enable(false),
smart_auto_save_disable(false), smart_auto_save_enable(false),
smart_selftest_type(-1), smart_selftest_force(false),
sct_temp_int(0), sct_temp_int_pers(false),
output_format(0),
fix_swapped_id(false),
ignore_presets(false),
show_presets(false),
powermode(0), powerexit(0),
get_set_used(false),
get_aam(false), set_aam(0),
get_apm(false), set_apm(0),
get_lookahead(false), set_lookahead(0),
set_standby(0), set_standby_now(false),
get_security(false), set_security_freeze(false),
get_wcache(false), set_wcache(0),
sct_wcache_reorder_get(false), sct_wcache_reorder_set(0),
sct_wcache_reorder_set_pers(false),
sct_wcache_sct_get(false), sct_wcache_sct_set(0),
sct_wcache_sct_set_pers(false),
get_dsn(false), set_dsn(0)
{ }
bool ignore_presets = false; // Ignore presets from drive database
bool show_presets = false; // Show presets and exit
unsigned char powermode = 0; // Skip check, if disk in idle or standby mode
unsigned char powerexit = 0; // exit() code for low power mode
bool get_set_used = false; // true if any get/set command is used
bool get_aam = false; // print Automatic Acoustic Management status
int set_aam = 0; // disable(-1), enable(1..255->0..254) Automatic Acoustic Management
bool get_apm = false; // print Advanced Power Management status
int set_apm = 0; // disable(-1), enable(2..255->1..254) Advanced Power Management
bool get_lookahead = false; // print read look-ahead status
int set_lookahead = 0; // disable(-1), enable(1) read look-ahead
int set_standby = 0; // set(1..255->0..254) standby timer
bool set_standby_now = false; // set drive to standby
bool get_security = false; // print ATA security status
bool set_security_freeze = false; // Freeze ATA security
bool get_wcache = false; // print write cache status
int set_wcache = 0; // disable(-1), enable(1) write cache
bool sct_wcache_reorder_get = false; // print write cache reordering status
int sct_wcache_reorder_set = 0; // disable(-1), enable(1) write cache reordering
bool sct_wcache_reorder_set_pers = false;
bool sct_wcache_sct_get = false; // print SCT Feature Control of write cache status
int sct_wcache_sct_set = 0; // determined by ata set features command(1), force enable(2), force disable(3)
bool sct_wcache_sct_set_pers = false; // persistent or volatile
bool get_dsn = false; // print DSN status
int set_dsn = 0; // disable(02h), enable(01h) DSN
};
int ataPrintMain(ata_device * device, const ata_print_options & options);

@ -1,9 +1,9 @@
/*
* nvmeprint.h
*
* Home page of code is: http://www.smartmontools.org
* Home page of code is: https://www.smartmontools.org
*
* Copyright (C) 2016 Christian Franke
* Copyright (C) 2016-21 Christian Franke
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
@ -18,23 +18,13 @@
// options for nvmePrintMain
struct nvme_print_options
{
bool drive_info;
bool drive_capabilities;
bool smart_check_status;
bool smart_vendor_attrib;
unsigned error_log_entries;
unsigned char log_page;
unsigned log_page_size;
nvme_print_options()
: drive_info(false),
drive_capabilities(false),
smart_check_status(false),
smart_vendor_attrib(false),
error_log_entries(0),
log_page(0),
log_page_size(0)
{ }
bool drive_info = false;
bool drive_capabilities = false;
bool smart_check_status = false;
bool smart_vendor_attrib = false;
unsigned error_log_entries = 0;
unsigned char log_page = 0;
unsigned log_page_size = 0;
};
int nvmePrintMain(nvme_device * device, const nvme_print_options & options);

@ -1,7 +1,7 @@
/*
* scsiprint.h
*
* Home page of code is: http://www.smartmontools.org
* Home page of code is: https://www.smartmontools.org
*
* Copyright (C) 2002-9 Bruce Allen
* Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
@ -21,57 +21,34 @@
// Options for scsiPrintMain
struct scsi_print_options
{
bool drive_info;
bool smart_check_status;
bool smart_vendor_attrib;
bool smart_error_log;
bool smart_selftest_log;
bool smart_background_log;
bool smart_ss_media_log;
bool smart_disable, smart_enable;
bool smart_auto_save_disable, smart_auto_save_enable;
bool smart_default_selftest;
bool smart_short_selftest, smart_short_cap_selftest;
bool smart_extend_selftest, smart_extend_cap_selftest;
bool smart_selftest_abort;
bool smart_selftest_force; // Ignore already running test
bool sasphy, sasphy_reset;
bool drive_info = false;
bool smart_check_status = false;
bool smart_vendor_attrib = false;
bool smart_error_log = false;
bool smart_selftest_log = false;
bool smart_background_log = false;
bool smart_ss_media_log = false;
bool smart_disable = false, smart_enable = false;
bool smart_auto_save_disable = false, smart_auto_save_enable = false;
bool smart_default_selftest = false;
bool smart_short_selftest = false, smart_short_cap_selftest = false;
bool smart_extend_selftest = false, smart_extend_cap_selftest = false;
bool smart_selftest_abort = false;
bool smart_selftest_force = false; // Ignore already running test
bool sasphy = false, sasphy_reset = false;
bool get_wce, get_rcd;
short int set_wce, set_rcd; // disable(-1), enable(1) cache
unsigned char powermode; // Enhancement Skip check, if disk in idle or standby mode
unsigned char powerexit; // exit() code for low power mode
bool get_wce = false, get_rcd = false;
short int set_wce = 0, set_rcd = 0; // disable(-1), enable(1) cache
int set_standby; // set(1..255->0..254) standby timer
bool set_standby_now; // set drive to standby
bool set_active; // set drive to active
unsigned char powermode = 0; // Enhancement Skip check, if disk in idle or standby mode
unsigned char powerexit = 0; // exit() code for low power mode
scsi_print_options()
: drive_info(false),
smart_check_status(false),
smart_vendor_attrib(false),
smart_error_log(false),
smart_selftest_log(false),
smart_background_log(false),
smart_ss_media_log(false),
smart_disable(false), smart_enable(false),
smart_auto_save_disable(false), smart_auto_save_enable(false),
smart_default_selftest(false),
smart_short_selftest(false), smart_short_cap_selftest(false),
smart_extend_selftest(false), smart_extend_cap_selftest(false),
smart_selftest_abort(false),
smart_selftest_force(false),
sasphy(false), sasphy_reset(false),
get_wce(false), get_rcd(false),
set_wce(0), set_rcd(0),
powermode(0), powerexit(0), // Power Check -n enhancement option
set_standby(0), set_standby_now(false), // enable Standby options for -s
set_active(false)
{ }
int set_standby = 0; // set(1..255->0..254) standby timer
bool set_standby_now = false; // set drive to standby
bool set_active = false; // set drive to active
};
int scsiPrintMain(scsi_device * device, const scsi_print_options & options);

Loading…
Cancel
Save