detect frozen drives and show that the user

This commit is contained in:
2020-09-11 17:18:53 +02:00
parent 5f593682e2
commit 67b8e302be
7 changed files with 103 additions and 15 deletions

View File

@ -18,7 +18,8 @@ public:
SHRED_SELECTED,
SHRED_ACTIVE,
DELETE_SELECTED,
DELETE_ACTIVE
DELETE_ACTIVE,
FROZEN
} state;
bool bWasShredded = false;
@ -34,9 +35,11 @@ private:
uint32_t u32ErrorCount = 0U;
uint32_t u32PowerOnHours = 0U; //in hours
uint32_t u32PowerCycles = 0U;
time_t u32Timestamp = 0U; //unix timestamp for detecting a frozen drive
double d32TaskPercentage = 0U; //in percent for Shred (1 to 100)
private:
void setTimestamp();
protected:
@ -54,6 +57,7 @@ public:
uint32_t getErrorCount(void);
uint32_t getPowerOnHours(void); //in hours
uint32_t getPowerCycles(void);
void checkFrozenDrive(void);
void setDriveSMARTData( string modelFamily,
string modelName,

View File

@ -8,15 +8,13 @@
#ifndef REHDD_H_
#define REHDD_H_
//#define DRYRUN
#define DRYRUN
// Drive handling Settings
#define WORSE_HOURS 19200 //mark drive if at this limit or beyond
#define WORSE_POWERUP 10000 //mark drive if at this limit or beyond
#define SHRED_ITERATIONS 1
#define READ 0
#define WRITE 1
#define FROZEN_TIMEOUT 5 //After this timeout (minutes) the drive will be marked as frozen
// Logger Settings
#define LOG_PATH "./reHDD.log"
@ -30,6 +28,10 @@
#define LOG_LEVEL_LOW //log only user actions and tasks
#endif
//IPC pipes
#define READ 0
#define WRITE 1
#include <iostream>
#include <string>
#include <fstream>
@ -82,6 +84,7 @@ private:
static void ThreadScannDevices();
static void ThreadUserInput();
static void ThreadShred();
static void ThreadCheckFrozenDrives();
static void handleArrowKey(TUI::UserInput userInput);
static void handleEnter();
static void handleESC();

View File

@ -56,10 +56,11 @@ private:
static WINDOW *createOverViewWindow( int iXSize, int iYSize);
static WINDOW *createDetailViewWindow( int iXSize, int iYSize, int iXStart, Drive drive);
static WINDOW *overwriteDetailViewWindow( int iXSize, int iYSize, int iXStart);
static WINDOW *createEntryWindow(int iXSize, int iYSize, int iXStart, int iYStart,string sModelFamily, string sModelName, string sCapacity, string sState, bool bSelected);
static WINDOW *createEntryWindow(int iXSize, int iYSize, int iXStart, int iYStart, string sModelFamily, string sModelName, string sCapacity, string sState, bool bSelected);
static WINDOW *createSystemStats(int iXSize, int iYSize, int iYStart);
static WINDOW *createMenuView(int iXSize, int iYSize, int iXStart, int iYStart, struct MenuState menustate);
static WINDOW *createDialog(int iXSize, int iYSize, int iXStart, int iYStart, string selectedTask, string optionA, string optionB);
static WINDOW* createFrozenWarning(int iXSize, int iYSize, int iXStart, int iYStart, string sPath, string sModelFamily, string sModelName, string sSerial);
void displaySelectedDrive(Drive drive, int stdscrX, int stdscrY);