10 Commits

2 changed files with 14 additions and 18 deletions

View File

@ -1,6 +1,6 @@
/** /**
* @file reHDD.h * @file reHDD.h
* @brief represent * @brief app logic header
* @author hendrik schutter * @author hendrik schutter
* @date 01.05.2020 * @date 01.05.2020
*/ */
@ -8,13 +8,13 @@
#ifndef REHDD_H_ #ifndef REHDD_H_
#define REHDD_H_ #define REHDD_H_
#define REHDD_VERSION "bV0.1.0" #define REHDD_VERSION "bV0.2.0"
// Drive handling Settings // Drive handling Settings
#define WORSE_HOURS 19200 //mark drive if at this limit or beyond #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 WORSE_POWERUP 10000 //mark drive if at this limit or beyond
#define SHRED_ITERATIONS 3 #define SHRED_ITERATIONS 3
#define FROZEN_TIMEOUT 5 //After this timeout (minutes) the drive will be marked as frozen #define FROZEN_TIMEOUT 10 //After this timeout (minutes) the drive will be marked as frozen
// Logger Settings // Logger Settings
#define LOG_PATH "./reHDD.log" #define LOG_PATH "./reHDD.log"
@ -23,16 +23,15 @@
#define SOFTWARE_VERSION "alpha" #define SOFTWARE_VERSION "alpha"
#define HARDWARE_VERSION "generic" #define HARDWARE_VERSION "generic"
// Logic
//#define DRYRUN //don´t touch the drives
#define FROZEN_ALERT //show alert if drive is frozen
#define LOG_LEVEL_HIGH //log everything, like drive scann thread #define LOG_LEVEL_HIGH //log everything, like drive scann thread
#ifndef LOG_LEVEL_HIGH #ifndef LOG_LEVEL_HIGH
#define LOG_LEVEL_LOW //log only user actions and tasks #define LOG_LEVEL_LOW //log only user actions and tasks
#endif #endif
// Logic
//#define DRYRUN //don´t touch the drives
#define FROZEN_ALERT //show alert if drive is frozen
//IPC pipes //IPC pipes
#define READ 0 #define READ 0
#define WRITE 1 #define WRITE 1
@ -98,5 +97,4 @@ private:
static Drive* getSelectedDrive(); static Drive* getSelectedDrive();
}; };
#endif // REHDD_H_ #endif // REHDD_H_

View File

@ -13,7 +13,7 @@ static int fdShredInformPipe[2];//File descriptor for pipe that informs if a wip
static std::mutex mxScannDrives; static std::mutex mxScannDrives;
list <Drive> listNewDrives; //store found drives that are updated every 5sec list <Drive> listNewDrives; //store found drives that are updated every 5sec
static list <Drive> listDrives; //stores all drive data from scann thread static list <Drive> listDrives; //stores all drive data from scann thread
@ -75,9 +75,7 @@ void reHDD::app_logic(void)
Logger::logThis()->info("got progress signal from a shred task"); Logger::logThis()->info("got progress signal from a shred task");
#endif #endif
} }
//mxScannDrives.lock();
ui->updateTUI(&listDrives, u8SelectedEntry); ui->updateTUI(&listDrives, u8SelectedEntry);
//mxScannDrives.unlock();
} //endless loop } //endless loop
thDevices.join(); thDevices.join();
thUserInput.join(); thUserInput.join();
@ -90,7 +88,7 @@ Drive* reHDD::getSelectedDrive()
{ {
list<Drive>::iterator it = listDrives.begin(); list<Drive>::iterator it = listDrives.begin();
advance(it, u8SelectedEntry); advance(it, u8SelectedEntry);
return &(*it); return &(*it);
} }
else else
{ {
@ -203,7 +201,7 @@ void reHDD::ThreadShred()
Shred* pShredTask = new Shred(); //create new shred task Shred* pShredTask = new Shred(); //create new shred task
pShredTask->shredDrive(getSelectedDrive(), &fdShredInformPipe[1]); //start new shred task pShredTask->shredDrive(getSelectedDrive(), &fdShredInformPipe[1]); //start new shred task
delete pShredTask; //delete shred task delete pShredTask; //delete shred task
ui->updateTUI(&listDrives, u8SelectedEntry);; ui->updateTUI(&listDrives, u8SelectedEntry);
} }
} }
@ -286,7 +284,7 @@ void reHDD::filterNewDrives(list <Drive>* plistOldDrives, list <Drive>* plistNew
/** /**
* \brief search attached drives on /dev/sd* * \brief search attached drives on /dev/sd*
* \param pointer of vector <Drive>* pvecDrives * \param pointer of list <Drive>* plistDrives
* \return void * \return void
*/ */
void reHDD::searchDrives(list <Drive>* plistDrives) void reHDD::searchDrives(list <Drive>* plistDrives)
@ -319,7 +317,7 @@ void reHDD::searchDrives(list <Drive>* plistDrives)
/** /**
* \brief filter out drives that are listed in "ignoreDrives.conf" * \brief filter out drives that are listed in "ignoreDrives.conf"
* \param pointer of vector <Drive>* pvecDrives * \param pointer of list <Drive>* plistDrives
* \return void * \return void
*/ */
void reHDD::filterIgnoredDrives(list <Drive>* plistDrives) void reHDD::filterIgnoredDrives(list <Drive>* plistDrives)
@ -404,7 +402,7 @@ void reHDD::filterIgnoredDrives(list <Drive>* plistDrives)
/** /**
* \brief print drives with all information * \brief print drives with all information
* \param pointer of vector <Drive>* pvecDrives * \param pointer of list <Drive>* plistDrives
* \return void * \return void
*/ */
void reHDD::printDrives(list <Drive>* plistDrives) void reHDD::printDrives(list <Drive>* plistDrives)
@ -439,7 +437,7 @@ void reHDD::printDrives(list <Drive>* plistDrives)
/** /**
* \brief add S.M.A.R.T data from SMART * \brief add S.M.A.R.T data from SMART
* \param pointer of vector <Drive>* pvecDrives * \param pointer of list <Drive>* plistDrives
* \return void * \return void
*/ */
void reHDD::addSMARTData(list <Drive>* plistDrives) void reHDD::addSMARTData(list <Drive>* plistDrives)