From 65999d9abaebbe051a1a8d940b87fcf4f8f30192 Mon Sep 17 00:00:00 2001 From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Thu, 29 Oct 2009 23:01:27 +0000 Subject: [PATCH] Add '-v ID,raw64[,...]' print format. git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2976 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- smartmontools/CHANGELOG | 3 +++ smartmontools/atacmds.cpp | 11 +++++++++++ smartmontools/atacmds.h | 1 + 3 files changed, 15 insertions(+) diff --git a/smartmontools/CHANGELOG b/smartmontools/CHANGELOG index 07cb6e653..46dcf74ec 100644 --- a/smartmontools/CHANGELOG +++ b/smartmontools/CHANGELOG @@ -43,6 +43,9 @@ NOTES FOR FUTURE RELEASES: see TODO file. <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE> + [CF] Add '-v ID,raw64[,...]' print format based on an patch provided + by Marcin Marszalek. + [CF] Add '-v ID,RAW_FORMAT[,ATTR_NAME]' option. This allows to add new attributes without the need to enhance the '-v' option. Rework attribute name and raw value formatting. diff --git a/smartmontools/atacmds.cpp b/smartmontools/atacmds.cpp index 37698d640..b567f3f99 100644 --- a/smartmontools/atacmds.cpp +++ b/smartmontools/atacmds.cpp @@ -196,6 +196,7 @@ const format_name_entry format_names[] = { {"raw8" , RAWFMT_RAW8}, {"raw16" , RAWFMT_RAW16}, {"raw48" , RAWFMT_RAW48}, + {"raw64" , RAWFMT_RAW64}, {"raw16(raw16)" , RAWFMT_RAW16_OPT_RAW16}, {"raw16(avg16)" , RAWFMT_RAW16_OPT_AVG16}, {"raw24/raw24" , RAWFMT_RAW24_RAW24}, @@ -1832,6 +1833,16 @@ std::string ata_format_attr_raw_value(const ata_smart_attribute & attribute, s = strprintf("%"PRIu64, rawvalue); break; + case RAWFMT_RAW64: + // Some SSD vendors use bytes 3-10 from the Attribute + // Data Structure to store a 64-bit raw value. + rawvalue <<= 8; + rawvalue |= attribute.worst; + rawvalue <<= 8; + rawvalue |= attribute.current; + s = strprintf("%"PRIu64, rawvalue); + break; + case RAWFMT_RAW16_OPT_RAW16: s = strprintf("%u", word[0]); if (word[1] || word[2]) diff --git a/smartmontools/atacmds.h b/smartmontools/atacmds.h index 7c02c3a24..746b66cbd 100644 --- a/smartmontools/atacmds.h +++ b/smartmontools/atacmds.h @@ -641,6 +641,7 @@ enum ata_attr_raw_format RAWFMT_RAW8, RAWFMT_RAW16, RAWFMT_RAW48, + RAWFMT_RAW64, RAWFMT_RAW16_OPT_RAW16, RAWFMT_RAW16_OPT_AVG16, RAWFMT_RAW24_RAW24, -- GitLab