autoformat all sources
This commit is contained in:
parent
e4a73556d6
commit
70dda97ae2
|
@ -13,13 +13,11 @@
|
||||||
class Delete
|
class Delete
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void deleteDrive(Drive *drive);
|
static void deleteDrive(Drive *drive);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Delete(void);
|
Delete(void);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DELETE_H_
|
#endif // DELETE_H_
|
||||||
|
|
|
@ -14,7 +14,9 @@ class Drive
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum TaskState {NONE,
|
enum TaskState
|
||||||
|
{
|
||||||
|
NONE,
|
||||||
SHRED_SELECTED,
|
SHRED_SELECTED,
|
||||||
SHRED_ACTIVE, // shred iterations active
|
SHRED_ACTIVE, // shred iterations active
|
||||||
CHECK_ACTIVE, // optional checking active
|
CHECK_ACTIVE, // optional checking active
|
||||||
|
@ -60,7 +62,6 @@ private:
|
||||||
void setTimestamp();
|
void setTimestamp();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Drive(string path)
|
Drive(string path)
|
||||||
{
|
{
|
||||||
|
@ -101,7 +102,6 @@ public:
|
||||||
|
|
||||||
void calculateTaskDuration();
|
void calculateTaskDuration();
|
||||||
time_t getTaskDuration();
|
time_t getTaskDuration();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DRIVE_H_
|
#endif // DRIVE_H_
|
|
@ -68,7 +68,6 @@ private:
|
||||||
~Logger();
|
~Logger();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void info(string s);
|
void info(string s);
|
||||||
void warning(string s);
|
void warning(string s);
|
||||||
void error(string s);
|
void error(string s);
|
||||||
|
|
|
@ -39,11 +39,9 @@ typedef struct
|
||||||
t_driveData driveData;
|
t_driveData driveData;
|
||||||
} t_msgQueueData;
|
} t_msgQueueData;
|
||||||
|
|
||||||
|
|
||||||
class Printer
|
class Printer
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Printer *getPrinter();
|
static Printer *getPrinter();
|
||||||
void print(Drive *drive);
|
void print(Drive *drive);
|
||||||
|
@ -54,7 +52,5 @@ private:
|
||||||
int msqid;
|
int msqid;
|
||||||
Printer();
|
Printer();
|
||||||
~Printer();
|
~Printer();
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif // PRINTER_H_
|
#endif // PRINTER_H_
|
|
@ -69,7 +69,8 @@ using namespace std;
|
||||||
|
|
||||||
extern Logger *logging;
|
extern Logger *logging;
|
||||||
|
|
||||||
template <typename T, typename I> T* iterator_to_pointer(I i)
|
template <typename T, typename I>
|
||||||
|
T *iterator_to_pointer(I i)
|
||||||
{
|
{
|
||||||
return (&(*i));
|
return (&(*i));
|
||||||
}
|
}
|
||||||
|
@ -77,13 +78,11 @@ template <typename T, typename I> T* iterator_to_pointer(I i)
|
||||||
class reHDD
|
class reHDD
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
reHDD(void);
|
reHDD(void);
|
||||||
static void app_logic();
|
static void app_logic();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static void searchDrives(list<Drive> *plistDrives);
|
static void searchDrives(list<Drive> *plistDrives);
|
||||||
static void printDrives(list<Drive> *plistDrives);
|
static void printDrives(list<Drive> *plistDrives);
|
||||||
static void startShredAllDrives(list<Drive> *plistDrives);
|
static void startShredAllDrives(list<Drive> *plistDrives);
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
#define CHUNK_SIZE 1024 * 1024 * 32 // amount of bytes that are overwritten at once --> 32MB
|
#define CHUNK_SIZE 1024 * 1024 * 32 // amount of bytes that are overwritten at once --> 32MB
|
||||||
#define TFNG_DATA_SIZE CHUNK_SIZE // amount of bytes used by tfng
|
#define TFNG_DATA_SIZE CHUNK_SIZE // amount of bytes used by tfng
|
||||||
|
|
||||||
|
@ -31,9 +30,7 @@ typedef int fileDescriptor;
|
||||||
class Shred
|
class Shred
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Shred();
|
Shred();
|
||||||
~Shred();
|
~Shred();
|
||||||
int shredDrive(Drive *drive, int *ipSignalFd);
|
int shredDrive(Drive *drive, int *ipSignalFd);
|
||||||
|
@ -53,7 +50,6 @@ private:
|
||||||
unsigned long getDriveSizeInBytes(fileDescriptor file);
|
unsigned long getDriveSizeInBytes(fileDescriptor file);
|
||||||
unsigned int uiCalcChecksum(fileDescriptor file, Drive *drive, int *ipSignalFd);
|
unsigned int uiCalcChecksum(fileDescriptor file, Drive *drive, int *ipSignalFd);
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SHRED_H_
|
#endif // SHRED_H_
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
class SMART
|
class SMART
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void readSMARTData(Drive *drive);
|
static void readSMARTData(Drive *drive);
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,19 @@
|
||||||
class TUI
|
class TUI
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum UserInput
|
||||||
enum UserInput { UpKey, DownKey, Abort, Shred, ShredAll, Delete, Enter, ESC, Undefined};
|
{
|
||||||
|
UpKey,
|
||||||
|
DownKey,
|
||||||
|
Abort,
|
||||||
|
Shred,
|
||||||
|
ShredAll,
|
||||||
|
Delete,
|
||||||
|
Enter,
|
||||||
|
ESC,
|
||||||
|
Undefined
|
||||||
|
};
|
||||||
struct MenuState
|
struct MenuState
|
||||||
{
|
{
|
||||||
bool bAbort;
|
bool bAbort;
|
||||||
|
|
|
@ -98,7 +98,8 @@ string Drive::sPowerCyclesToText()
|
||||||
|
|
||||||
string Drive::sTemperatureToText()
|
string Drive::sTemperatureToText()
|
||||||
{
|
{
|
||||||
return to_string(getTemperature())+" C";;
|
return to_string(getTemperature()) + " C";
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Drive::setTaskPercentage(double d32TaskPercentage)
|
void Drive::setTaskPercentage(double d32TaskPercentage)
|
||||||
|
@ -114,7 +115,6 @@ double Drive::getTaskPercentage(void)
|
||||||
return this->d32TaskPercentage;
|
return this->d32TaskPercentage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief set S.M.A.R.T. values in model
|
* \brief set S.M.A.R.T. values in model
|
||||||
* \param string modelFamily
|
* \param string modelFamily
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
* @date 04.09.2020
|
* @date 04.09.2020
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "../../include/reHDD.h" //for logger settings
|
#include "../../include/reHDD.h" //for logger settings
|
||||||
#include "../../include/logger/logger.h"
|
#include "../../include/logger/logger.h"
|
||||||
|
|
||||||
|
@ -153,7 +152,6 @@ string Logger::getMacAddress()
|
||||||
if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0)
|
if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0)
|
||||||
{
|
{
|
||||||
strcpy(ifr.ifr_name, "eno1");
|
strcpy(ifr.ifr_name, "eno1");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char *hwaddr = (unsigned char *)ifr.ifr_hwaddr.sa_data;
|
unsigned char *hwaddr = (unsigned char *)ifr.ifr_hwaddr.sa_data;
|
||||||
|
@ -229,5 +227,3 @@ Logger* Logger::logThis()
|
||||||
return single; // return existing obj
|
return single; // return existing obj
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,12 +58,13 @@ void Printer::print(Drive* drive)
|
||||||
if (-1 == msgsnd(this->msqid, &msgQueueData, sizeof(t_msgQueueData) - sizeof(long), 0))
|
if (-1 == msgsnd(this->msqid, &msgQueueData, sizeof(t_msgQueueData) - sizeof(long), 0))
|
||||||
{
|
{
|
||||||
Logger::logThis()->error("Printer: Send mgs queue failed!");
|
Logger::logThis()->error("Printer: Send mgs queue failed!");
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Logger::logThis()->info("Printer: print triggered - Drive: " + drive->getSerial());
|
Logger::logThis()->info("Printer: print triggered - Drive: " + drive->getSerial());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief return a instance of the printer
|
* \brief return a instance of the printer
|
||||||
* \return printer obj
|
* \return printer obj
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
#include "../include/reHDD.h"
|
#include "../include/reHDD.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
#endif
|
#endif
|
||||||
#include "../tfnoisegen/tfprng.h"
|
#include "../tfnoisegen/tfprng.h"
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -89,7 +90,8 @@ int Shred::shredDrive(Drive* drive, int* ipSignalFd)
|
||||||
tfng_prng_seedkey(ucKey);
|
tfng_prng_seedkey(ucKey);
|
||||||
|
|
||||||
this->ulDriveByteSize = getDriveSizeInBytes(driveFileDiscr);
|
this->ulDriveByteSize = getDriveSizeInBytes(driveFileDiscr);
|
||||||
drive->sShredSpeed.chronoShredTimestamp = std::chrono::system_clock::now();; //set inital timestamp for speed metric
|
drive->sShredSpeed.chronoShredTimestamp = std::chrono::system_clock::now();
|
||||||
|
; // set inital timestamp for speed metric
|
||||||
drive->sShredSpeed.ulSpeedMetricBytesWritten = 0U; // uses to calculate speed metric
|
drive->sShredSpeed.ulSpeedMetricBytesWritten = 0U; // uses to calculate speed metric
|
||||||
|
|
||||||
#ifdef LOG_LEVEL_HIGH
|
#ifdef LOG_LEVEL_HIGH
|
||||||
|
|
|
@ -11,7 +11,6 @@ static std::mutex mxUIrefresh;
|
||||||
|
|
||||||
TUI::TUI(void)
|
TUI::TUI(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue