merge threading to develop #21
@ -8,7 +8,7 @@
|
||||
#ifndef REHDD_H_
|
||||
#define REHDD_H_
|
||||
|
||||
//#define DRYRUN
|
||||
#define DRYRUN
|
||||
|
||||
#define WORSE_HOURS 19200 //mark drive if at this limit or beyond
|
||||
#define WORSE_POWERUP 4000 //mark drive if at this limit or beyond
|
||||
@ -72,9 +72,7 @@ private:
|
||||
static void handleEnter();
|
||||
static void handleESC();
|
||||
static void handleAbort();
|
||||
static void checkShredComplete(vector <Drive>* pvecDrives);
|
||||
static Drive* getSelectedDrive();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -75,8 +75,6 @@ void reHDD::app_logic(void)
|
||||
{
|
||||
char dummy;
|
||||
read (fdShredInformPipe[0],&dummy,1);
|
||||
|
||||
checkShredComplete(&vecDrives);
|
||||
}
|
||||
ui->updateTUI(&vecDrives, u8SelectedEntry);
|
||||
} //endless loop
|
||||
@ -457,17 +455,5 @@ void reHDD::handleAbort()
|
||||
}
|
||||
}
|
||||
|
||||
void reHDD::checkShredComplete(vector <Drive>* pvecDrives)
|
||||
{
|
||||
vector <Drive>::iterator it;
|
||||
for (it = pvecDrives->begin(); it != pvecDrives->end(); ++it)
|
||||
{
|
||||
if(it->getTaskPercentage() == 100 )
|
||||
{
|
||||
it->bWasShredded = true; //mark this drive as shredded
|
||||
it->setTaskPercentage(0); //reset for an other shredding
|
||||
it->state = Drive::NONE; //reset for an other task
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,16 +34,16 @@ static double d32Percent;
|
||||
void Shred::shredDrive(Drive* drive, int* ipSignalFd)
|
||||
{
|
||||
#ifdef DRYRUN
|
||||
for(int i = 0; i<=10; i++)
|
||||
for(int i = 0; i<=100; i++)
|
||||
{
|
||||
if(drive->state != Drive::SHRED_ACTIVE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
drive->setTaskPercentage(i*10);
|
||||
drive->setTaskPercentage(i+0.05);
|
||||
write(*ipSignalFd, "A",1);
|
||||
|
||||
sleep(2);
|
||||
usleep(20000);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -152,6 +152,7 @@ void Shred::shredDrive(Drive* drive, int* ipSignalFd)
|
||||
|
||||
if(drive->state != Drive::SHRED_ACTIVE)
|
||||
{
|
||||
drive->setTaskPercentage(0);
|
||||
goto _return;
|
||||
}
|
||||
|
||||
@ -267,14 +268,13 @@ void Shred::shredDrive(Drive* drive, int* ipSignalFd)
|
||||
_return:
|
||||
optind++;
|
||||
close(rsf);
|
||||
|
||||
#endif
|
||||
if(drive->state == Drive::SHRED_ACTIVE)
|
||||
{
|
||||
drive->bWasShredded = true;
|
||||
drive->state= Drive::NONE;
|
||||
drive->setTaskPercentage(0);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
#ifndef DRYRUN
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user