kill shred thread after abort or offline drive
This commit is contained in:
parent
c6a8fd861d
commit
ec300d7c75
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
echo "starting SHRED DUMMY"
|
echo "starting SHRED DUMMY"
|
||||||
|
|
||||||
for i in {0..100..20}
|
for i in {0..100..10}
|
||||||
do
|
do
|
||||||
echo "DUMMY shred $i%"
|
echo "DUMMY shred $i%"
|
||||||
sleep 1
|
sleep 1
|
||||||
|
@ -192,6 +192,7 @@ void reHDD::filterNewDrives(vector <Drive>* pvecOldDrives, vector <Drive>* pvecN
|
|||||||
{
|
{
|
||||||
//cout << "offline drive found: " << itOld->getPath() << endl;
|
//cout << "offline drive found: " << itOld->getPath() << endl;
|
||||||
//TODO kill task thread if running
|
//TODO kill task thread if running
|
||||||
|
itOld->state = Drive::NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@ void Shred::shredDrive(Drive* drive, int* fdInformPipeWrite)
|
|||||||
FILE* shredCmdOutput = popen(cpComand, "r");
|
FILE* shredCmdOutput = popen(cpComand, "r");
|
||||||
|
|
||||||
while ((getline(&cLine, &len, shredCmdOutput)) != -1)
|
while ((getline(&cLine, &len, shredCmdOutput)) != -1)
|
||||||
|
{
|
||||||
|
if(drive->state == Drive::SHRED_ACTIVE)
|
||||||
{
|
{
|
||||||
string sLine = string(cLine);
|
string sLine = string(cLine);
|
||||||
string search("%");
|
string search("%");
|
||||||
@ -46,5 +48,10 @@ void Shred::shredDrive(Drive* drive, int* fdInformPipeWrite)
|
|||||||
write(*fdInformPipeWrite, "A",1);
|
write(*fdInformPipeWrite, "A",1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return; //end shredding task
|
||||||
|
}
|
||||||
|
}
|
||||||
fclose(shredCmdOutput);
|
fclose(shredCmdOutput);
|
||||||
}
|
}
|
||||||
|
@ -67,12 +67,15 @@ void TUI::updateTUI(vector <Drive>* pvecDrives, int32_t i32SelectedEntry)
|
|||||||
systemview=createSystemStats((int)(stdscrX/3), 10, (stdscrY-11));
|
systemview=createSystemStats((int)(stdscrX/3), 10, (stdscrY-11));
|
||||||
wrefresh(systemview);
|
wrefresh(systemview);
|
||||||
|
|
||||||
|
delwin(detailview);
|
||||||
|
|
||||||
vector <Drive>::iterator it;
|
vector <Drive>::iterator it;
|
||||||
for (it = pvecDrives->begin(); it != pvecDrives->end(); ++it)
|
for (it = pvecDrives->begin(); it != pvecDrives->end(); ++it)
|
||||||
{
|
{
|
||||||
string sModelFamily = it->getModelFamily();
|
string sModelFamily = it->getModelFamily();
|
||||||
string sModelName = it->getModelName();
|
string sModelName = it->getModelName();
|
||||||
string sCapacity = it->sCapacityToText();
|
string sCapacity = it->sCapacityToText();
|
||||||
|
string sState = " ";
|
||||||
|
|
||||||
bool bSelectedEntry = false;
|
bool bSelectedEntry = false;
|
||||||
|
|
||||||
@ -82,7 +85,6 @@ void TUI::updateTUI(vector <Drive>* pvecDrives, int32_t i32SelectedEntry)
|
|||||||
displaySelectedDrive(pvecDrives->at(i32SelectedEntry), stdscrX, stdscrY);
|
displaySelectedDrive(pvecDrives->at(i32SelectedEntry), stdscrX, stdscrY);
|
||||||
}
|
}
|
||||||
|
|
||||||
string sState = " ";
|
|
||||||
|
|
||||||
switch (it->state)
|
switch (it->state)
|
||||||
{
|
{
|
||||||
@ -298,7 +300,6 @@ WINDOW* TUI::createSystemStats(int iXSize, int iYSize, int iYStart)
|
|||||||
|
|
||||||
WINDOW* TUI::createMenuView(int iXSize, int iYSize, int iXStart, int iYStart, struct MenuState menustate)
|
WINDOW* TUI::createMenuView(int iXSize, int iYSize, int iXStart, int iYStart, struct MenuState menustate)
|
||||||
{
|
{
|
||||||
|
|
||||||
WINDOW *newWindow;
|
WINDOW *newWindow;
|
||||||
newWindow = newwin(iYSize, iXSize, iYStart, iXStart);
|
newWindow = newwin(iYSize, iXSize, iYStart, iXStart);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user