diff options
Diffstat (limited to 'storaged/include/storaged_info.h')
-rw-r--r-- | storaged/include/storaged_info.h | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/storaged/include/storaged_info.h b/storaged/include/storaged_info.h index cb5b8a8e2..cfcdd7f22 100644 --- a/storaged/include/storaged_info.h +++ b/storaged/include/storaged_info.h | |||
@@ -24,43 +24,34 @@ friend class test_case_name##_##test_name##_Test | |||
24 | 24 | ||
25 | using namespace std; | 25 | using namespace std; |
26 | 26 | ||
27 | // two characters in string for each byte | ||
28 | struct str_hex { | ||
29 | char str[2]; | ||
30 | }; | ||
31 | |||
32 | class storage_info_t { | 27 | class storage_info_t { |
33 | protected: | 28 | protected: |
34 | FRIEND_TEST(storaged_test, storage_info_t); | 29 | FRIEND_TEST(storaged_test, storage_info_t); |
35 | uint8_t eol; // pre-eol (end of life) information | 30 | uint16_t eol; // pre-eol (end of life) information |
36 | uint8_t lifetime_a; // device life time estimation (type A) | 31 | uint16_t lifetime_a; // device life time estimation (type A) |
37 | uint8_t lifetime_b; // device life time estimation (type B) | 32 | uint16_t lifetime_b; // device life time estimation (type B) |
38 | string version; // version string | 33 | string version; // version string |
39 | public: | ||
40 | void publish(); | 34 | void publish(); |
35 | public: | ||
36 | storage_info_t() : eol(0), lifetime_a(0), lifetime_b(0) {} | ||
41 | virtual ~storage_info_t() {} | 37 | virtual ~storage_info_t() {} |
42 | virtual bool init() = 0; | 38 | virtual bool report() = 0; |
43 | virtual bool update() = 0; | ||
44 | }; | 39 | }; |
45 | 40 | ||
46 | class emmc_info_t : public storage_info_t { | 41 | class emmc_info_t : public storage_info_t { |
47 | private: | 42 | private: |
48 | // minimum size of a ext_csd file | 43 | const string emmc_sysfs = "/sys/bus/mmc/devices/mmc0:0001/"; |
49 | const int EXT_CSD_FILE_MIN_SIZE = 1024; | 44 | const string emmc_debugfs = "/d/mmc0/mmc0:0001/ext_csd"; |
50 | // List of interesting offsets | 45 | const char* emmc_ver_str[9] = { |
51 | const size_t EXT_CSD_REV_IDX = 192 * sizeof(str_hex); | 46 | "4.0", "4.1", "4.2", "4.3", "Obsolete", "4.41", "4.5", "5.0", "5.1" |
52 | const size_t EXT_PRE_EOL_INFO_IDX = 267 * sizeof(str_hex); | ||
53 | const size_t EXT_DEVICE_LIFE_TIME_EST_A_IDX = 268 * sizeof(str_hex); | ||
54 | const size_t EXT_DEVICE_LIFE_TIME_EST_B_IDX = 269 * sizeof(str_hex); | ||
55 | |||
56 | const char* ext_csd_file = "/d/mmc0/mmc0:0001/ext_csd"; | ||
57 | const char* emmc_ver_str[8] = { | ||
58 | "4.0", "4.1", "4.2", "4.3", "Obsolete", "4.41", "4.5", "5.0" | ||
59 | }; | 47 | }; |
60 | public: | 48 | public: |
61 | virtual ~emmc_info_t() {} | 49 | virtual ~emmc_info_t() {} |
62 | bool init(); | 50 | bool report(); |
63 | bool update(); | 51 | bool report_sysfs(); |
52 | bool report_debugfs(); | ||
64 | }; | 53 | }; |
65 | 54 | ||
55 | void report_storage_health(); | ||
56 | |||
66 | #endif /* _STORAGED_INFO_H_ */ | 57 | #endif /* _STORAGED_INFO_H_ */ |