Skip to content

Commit a300052

Browse files
committed
feat: Adding support for --showFARM option
Adding new option to read and dump the FARM log to the screen. Currently this is human readable only, but eventually we will get JSON too. [#75] Signed-off-by: Tyler Erickson <[email protected]>
1 parent 9376216 commit a300052

File tree

5 files changed

+50
-3
lines changed

5 files changed

+50
-3
lines changed

include/openseachest_util_options.h

+7
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,11 @@ extern "C"
479479
SMART_ATTRIBUTES_LONG_OPT_STRING, required_argument, M_NULLPTR, 0 \
480480
}
481481

482+
#define SHOW_FARM_FLAG showFARMData
483+
#define SHOW_FARM_VAR getOptBool SHOW_FARM_FLAG = goFalse;
484+
#define SHOW_FARM_LONG_OPT_STRING "showFARM"
485+
#define SHOW_FARM_LONG_OPT { SHOW_FARM_LONG_OPT_STRING, no_argument, &SHOW_FARM_FLAG, goTrue }
486+
482487
#define NVME_HEALTH_FLAG showNVMeHealthData
483488
#define NVME_HEALTH_VAR getOptBool NVME_HEALTH_FLAG = goFalse;
484489
#define NVME_HEALTH_LONG_OPT_STRING "showNvmeHealth"
@@ -4073,6 +4078,8 @@ extern "C"
40734078
//-----------------------------------------------------------------------------
40744079
void print_SMART_Attributes_Help(bool shortHelp);
40754080

4081+
void print_Show_FARM_Help(bool shortHelp);
4082+
40764083
//-----------------------------------------------------------------------------
40774084
//
40784085
// print_Abort_DST_Help()

src/openseachest_util_options.c

+20
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,26 @@ void print_SMART_Attributes_Help(bool shortHelp)
976976
}
977977
}
978978

979+
void print_Show_FARM_Help(bool shortHelp)
980+
{
981+
printf("\t--%s\n", SHOW_FARM_LONG_OPT_STRING);
982+
if (!shortHelp)
983+
{
984+
printf("\t\tUse this option to show the data in the FARM log.\n");
985+
printf("\t\tFARM is the Field Accessible Reliability Metrics that\n");
986+
printf("\t\tcan be reported from a Seagate hard drive.\n");
987+
printf("\t\tFarm data has a few sections available:\n");
988+
printf("\t\t\tGeneral Drive Info\n");
989+
printf("\t\t\tWorkload Statistics\n");
990+
printf("\t\t\tError Statistics\n");
991+
printf("\t\t\tEnvironment Statistics\n");
992+
printf("\t\t\tReliability Statistics\n");
993+
printf("\t\tNewer Seagate HDDs may be able to report more information than\n");
994+
printf("\t\tolder models. Data that can be reported may vary depending on the\n");
995+
printf("\t\tcapabilities of a given product.\n\n");
996+
}
997+
}
998+
979999
void print_NVME_Health_Help(bool shortHelp)
9801000
{
9811001
printf("\t--%s\t(NVMe Only)\n", NVME_HEALTH_LONG_OPT_STRING);

utils/C/openSeaChest/openSeaChest_SMART.c

+21-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "device_statistics.h"
3030
#include "drive_info.h"
3131
#include "dst.h"
32+
#include "farm_log.h"
3233
#include "getopt.h"
3334
#include "openseachest_util_options.h"
3435
#include "operations.h"
@@ -122,6 +123,7 @@ int main(int argc, char* argv[])
122123
NVME_HEALTH_VAR
123124
LOWLEVEL_INFO_VAR
124125
SMART_OFFLINE_SCAN_VAR
126+
SHOW_FARM_VAR
125127

126128
int args = 0;
127129
int argIndex = 0;
@@ -186,6 +188,7 @@ int main(int argc, char* argv[])
186188
DEVICE_STATISTICS_LONG_OPT,
187189
NVME_HEALTH_LONG_OPT,
188190
SMART_OFFLINE_SCAN_LONG_OPT,
191+
SHOW_FARM_LONG_OPT,
189192
LONG_OPT_TERMINATOR
190193
};
191194

@@ -817,7 +820,7 @@ int main(int argc, char* argv[])
817820
RUN_IDD_FLAG || DST_AND_CLEAN_FLAG || SMART_FEATURE_FLAG || SMART_ATTR_AUTOSAVE_FEATURE_FLAG ||
818821
SMART_INFO_FLAG || SMART_AUTO_OFFLINE_FEATURE_FLAG || SHOW_DST_LOG_FLAG || CONVEYANCE_DST_FLAG ||
819822
SET_MRIE_MODE_FLAG || SCSI_DEFECTS_FLAG || SHOW_SMART_ERROR_LOG_FLAG || DEVICE_STATISTICS_FLAG ||
820-
NVME_HEALTH_FLAG || SMART_OFFLINE_SCAN_FLAG
823+
NVME_HEALTH_FLAG || SMART_OFFLINE_SCAN_FLAG || SHOW_FARM_FLAG
821824
// check for other tool specific options here
822825
))
823826
{
@@ -1127,6 +1130,22 @@ int main(int argc, char* argv[])
11271130
}
11281131
}
11291132

1133+
1134+
if (SHOW_FARM_FLAG)
1135+
{
1136+
farmLogData farmdata;
1137+
safe_memset(&farmdata, sizeof(farmLogData), 0, sizeof(farmLogData));
1138+
switch(read_FARM_Data(&deviceList[deviceIter], &farmdata))
1139+
{
1140+
case SUCCESS:
1141+
print_FARM_Data(&farmdata);
1142+
break;
1143+
default:
1144+
printf("Unable to read FARM data\n");
1145+
break;
1146+
}
1147+
}
1148+
11301149
if (LOWLEVEL_INFO_FLAG)
11311150
{
11321151
print_Low_Level_Info(&deviceList[deviceIter]);
@@ -2280,6 +2299,7 @@ void utility_Usage(bool shortUsage)
22802299
print_Long_DST_Help(shortUsage, commandWindowType);
22812300
print_Short_DST_Help(shortUsage);
22822301
print_Show_DST_Log_Help(shortUsage);
2302+
print_Show_FARM_Help(shortUsage);
22832303
print_SMART_Check_Help(shortUsage);
22842304
print_SMART_Feature_Help(shortUsage);
22852305
// SATA Only

0 commit comments

Comments
 (0)