From c6e3c9d13389bc30b238007ce7cf3b806095a551 Mon Sep 17 00:00:00 2001 From: dpgilbert <dpgilbert@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Thu, 17 Feb 2022 03:25:14 +0000 Subject: [PATCH] smartctl.cpp: add new --log=tapedevstat to print out SCSI Tape (SSC) Device Statistics log page git-svn-id: https://svn.code.sf.net/p/smartmontools/code/trunk@5317 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- smartmontools/ChangeLog | 8 ++++++++ smartmontools/scsiprint.cpp | 2 +- smartmontools/scsiprint.h | 2 ++ smartmontools/smartctl.cpp | 8 ++++++-- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/smartmontools/ChangeLog b/smartmontools/ChangeLog index d06f14c87..9d233f4f4 100644 --- a/smartmontools/ChangeLog +++ b/smartmontools/ChangeLog @@ -1,5 +1,13 @@ $Id$ +2022-02-16 Douglas Gilbert <dgilbert@interlog.com> + + smartctl.cpp: add new --log=tapedevstat to print out SCSI + Tape (SSC) Device Statistics log page. '-a' does not include + this log page, but '-x' does. May add new --log= option + soon (probably 'tapealert' which must be invoked explicitly); + manpage needs updating + 2022-02-09 Alex Samorukov <samm@os2.kiev.ua> Remove cppcheck 2.7 warning as we are using it now on our CI builds diff --git a/smartmontools/scsiprint.cpp b/smartmontools/scsiprint.cpp index 3f77f48a6..6a2a1dace 100644 --- a/smartmontools/scsiprint.cpp +++ b/smartmontools/scsiprint.cpp @@ -3441,7 +3441,7 @@ scsiPrintMain(scsi_device * device, const scsi_print_options & options) any_output = true; } - if (options.smart_background_log && is_tape) { + if (options.tape_device_stats && is_tape) { if (! checkedSupportedLogPages) scsiGetSupportedLogPages(device); res = 0; diff --git a/smartmontools/scsiprint.h b/smartmontools/scsiprint.h index 41a398a6d..5449257dc 100644 --- a/smartmontools/scsiprint.h +++ b/smartmontools/scsiprint.h @@ -41,6 +41,8 @@ struct scsi_print_options bool smart_env_rep = false; bool sasphy = false, sasphy_reset = false; + + bool tape_device_stats = false; bool get_wce = false, get_rcd = false; short int set_wce = 0, set_rcd = 0; // disable(-1), enable(1) cache diff --git a/smartmontools/smartctl.cpp b/smartmontools/smartctl.cpp index 6e65f9d38..2f7cbe5cc 100644 --- a/smartmontools/smartctl.cpp +++ b/smartmontools/smartctl.cpp @@ -177,7 +177,8 @@ static void Usage() " xerror[,N][,error], xselftest[,N][,selftest], background,\n" " sasphy[,reset], sataphy[,reset], scttemp[sts,hist],\n" " scttempint,N[,p], scterc[,N,M][,p|reset], devstat[,N], defects[,N],\n" -" ssd, gplog,N[,RANGE], smartlog,N[,RANGE], nvmelog,N,SIZE\n\n" +" ssd, gplog,N[,RANGE], smartlog,N[,RANGE], nvmelog,N,SIZE\n" +" tapedevstat\n\n" " -v N,OPTION , --vendorattribute=N,OPTION (ATA)\n" " Set display OPTION for vendor Attribute N (see man page)\n\n" " -F TYPE, --firmwarebug=TYPE (ATA)\n" @@ -245,7 +246,7 @@ static std::string getvalidarglist(int opt) "scttemp[sts,hist], scttempint,N[,p], " "scterc[,N,M][,p|reset], devstat[,N], defects[,N], " "ssd, gplog,N[,RANGE], smartlog,N[,RANGE], " - "nvmelog,N,SIZE"; + "nvmelog,N,SIZE, tapedevstat"; case 'P': return "use, ignore, show, showall"; case 't': @@ -549,6 +550,8 @@ static int parse_options(int argc, char** argv, const char * & type, ataopts.sct_temp_sts = true; } else if (!strcmp(optarg,"scttemphist")) { ataopts.sct_temp_hist = true; + } else if (!strcmp(optarg,"tapedevstat")) { + scsiopts.tape_device_stats = true; } else if (!strncmp(optarg, "scttempint,", sizeof("scstempint,")-1)) { unsigned interval = 0; int n1 = -1, n2 = -1, len = strlen(optarg); @@ -739,6 +742,7 @@ static int parse_options(int argc, char** argv, const char * & type, scsiopts.smart_ss_media_log = true; scsiopts.sasphy = true; scsiopts.smart_env_rep = true; + scsiopts.tape_device_stats = true; if (!output_format_set) ataopts.output_format |= ata_print_options::FMT_BRIEF; break; -- GitLab