8 Commits

2 changed files with 14 additions and 18 deletions

View File

@ -1,6 +1,6 @@
/**
* @file reHDD.h
* @brief represent
* @brief app logic header
* @author hendrik schutter
* @date 01.05.2020
*/
@ -8,13 +8,13 @@
#ifndef REHDD_H_
#define REHDD_H_
#define REHDD_VERSION "bV0.1.0"
#define REHDD_VERSION "bV0.2.0"
// 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 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
#define LOG_PATH "./reHDD.log"
@ -23,16 +23,15 @@
#define SOFTWARE_VERSION "alpha"
#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
#ifndef LOG_LEVEL_HIGH
#define LOG_LEVEL_LOW //log only user actions and tasks
#endif
// Logic
//#define DRYRUN //don´t touch the drives
#define FROZEN_ALERT //show alert if drive is frozen
//IPC pipes
#define READ 0
#define WRITE 1
@ -98,5 +97,4 @@ private:
static Drive* getSelectedDrive();
};
#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;
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
@ -75,9 +75,7 @@ void reHDD::app_logic(void)
Logger::logThis()->info("got progress signal from a shred task");
#endif
}
//mxScannDrives.lock();
ui->updateTUI(&listDrives, u8SelectedEntry);
//mxScannDrives.unlock();
} //endless loop
thDevices.join();
thUserInput.join();
@ -90,7 +88,7 @@ Drive* reHDD::getSelectedDrive()
{
list<Drive>::iterator it = listDrives.begin();
advance(it, u8SelectedEntry);
return &(*it);
return &(*it);
}
else
{
@ -203,7 +201,7 @@ void reHDD::ThreadShred()
Shred* pShredTask = new Shred(); //create new shred task
pShredTask->shredDrive(getSelectedDrive(), &fdShredInformPipe[1]); //start new 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*
* \param pointer of vector <Drive>* pvecDrives
* \param pointer of list <Drive>* plistDrives
* \return void
*/
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"
* \param pointer of vector <Drive>* pvecDrives
* \param pointer of list <Drive>* plistDrives
* \return void
*/
void reHDD::filterIgnoredDrives(list <Drive>* plistDrives)
@ -404,7 +402,7 @@ void reHDD::filterIgnoredDrives(list <Drive>* plistDrives)
/**
* \brief print drives with all information
* \param pointer of vector <Drive>* pvecDrives
* \param pointer of list <Drive>* plistDrives
* \return void
*/
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
* \param pointer of vector <Drive>* pvecDrives
* \param pointer of list <Drive>* plistDrives
* \return void
*/
void reHDD::addSMARTData(list <Drive>* plistDrives)