fixed bug #15
This commit is contained in:
parent
b271f7955a
commit
7c00fd638c
@ -8,7 +8,7 @@
|
|||||||
#ifndef REHDD_H_
|
#ifndef REHDD_H_
|
||||||
#define REHDD_H_
|
#define REHDD_H_
|
||||||
|
|
||||||
//#define DRYRUN
|
#define DRYRUN
|
||||||
|
|
||||||
#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 4000 //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 handleEnter();
|
||||||
static void handleESC();
|
static void handleESC();
|
||||||
static void handleAbort();
|
static void handleAbort();
|
||||||
static void checkShredComplete(vector <Drive>* pvecDrives);
|
|
||||||
static Drive* getSelectedDrive();
|
static Drive* getSelectedDrive();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,8 +75,6 @@ void reHDD::app_logic(void)
|
|||||||
{
|
{
|
||||||
char dummy;
|
char dummy;
|
||||||
read (fdShredInformPipe[0],&dummy,1);
|
read (fdShredInformPipe[0],&dummy,1);
|
||||||
|
|
||||||
checkShredComplete(&vecDrives);
|
|
||||||
}
|
}
|
||||||
ui->updateTUI(&vecDrives, u8SelectedEntry);
|
ui->updateTUI(&vecDrives, u8SelectedEntry);
|
||||||
} //endless loop
|
} //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)
|
void Shred::shredDrive(Drive* drive, int* ipSignalFd)
|
||||||
{
|
{
|
||||||
#ifdef DRYRUN
|
#ifdef DRYRUN
|
||||||
for(int i = 0; i<=10; i++)
|
for(int i = 0; i<=100; i++)
|
||||||
{
|
{
|
||||||
if(drive->state != Drive::SHRED_ACTIVE)
|
if(drive->state != Drive::SHRED_ACTIVE)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
drive->setTaskPercentage(i*10);
|
drive->setTaskPercentage(i+0.05);
|
||||||
write(*ipSignalFd, "A",1);
|
write(*ipSignalFd, "A",1);
|
||||||
|
|
||||||
sleep(2);
|
usleep(20000);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -152,6 +152,7 @@ void Shred::shredDrive(Drive* drive, int* ipSignalFd)
|
|||||||
|
|
||||||
if(drive->state != Drive::SHRED_ACTIVE)
|
if(drive->state != Drive::SHRED_ACTIVE)
|
||||||
{
|
{
|
||||||
|
drive->setTaskPercentage(0);
|
||||||
goto _return;
|
goto _return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,14 +268,13 @@ void Shred::shredDrive(Drive* drive, int* ipSignalFd)
|
|||||||
_return:
|
_return:
|
||||||
optind++;
|
optind++;
|
||||||
close(rsf);
|
close(rsf);
|
||||||
|
#endif
|
||||||
if(drive->state == Drive::SHRED_ACTIVE)
|
if(drive->state == Drive::SHRED_ACTIVE)
|
||||||
{
|
{
|
||||||
drive->bWasShredded = true;
|
drive->bWasShredded = true;
|
||||||
|
drive->state= Drive::NONE;
|
||||||
|
drive->setTaskPercentage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#ifndef DRYRUN
|
#ifndef DRYRUN
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user