Compare commits
	
		
			4 Commits
		
	
	
		
			test/ipc-d
			...
			d8584486b9
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| d8584486b9 | |||
| 20d0dd8e90 | |||
| 1ec4a2c793 | |||
| a0c842d90d | 
| @ -8,7 +8,7 @@ | |||||||
| #ifndef REHDD_H_ | #ifndef REHDD_H_ | ||||||
| #define REHDD_H_ | #define REHDD_H_ | ||||||
|  |  | ||||||
| #define REHDD_VERSION "V1.1.3" | #define REHDD_VERSION "V1.2.0" | ||||||
|  |  | ||||||
| // Drive handling Settings | // Drive handling Settings | ||||||
| #define WORSE_HOURS 19200    // mark drive if at this limit or beyond | #define WORSE_HOURS 19200    // mark drive if at this limit or beyond | ||||||
| @ -25,13 +25,13 @@ | |||||||
| #define SOFTWARE_VERSION REHDD_VERSION | #define SOFTWARE_VERSION REHDD_VERSION | ||||||
| #define HARDWARE_VERSION "generic" | #define HARDWARE_VERSION "generic" | ||||||
|  |  | ||||||
| // #define LOG_LEVEL_HIGH  //log everything, like drive scan thread | // #define LOG_LEVEL_HIGH // log everything, like drive scan thread | ||||||
| #ifndef LOG_LEVEL_HIGH | #ifndef LOG_LEVEL_HIGH | ||||||
| #define LOG_LEVEL_LOW // log only user actions and tasks | #define LOG_LEVEL_LOW // log only user actions and tasks | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| // Logic | // Logic | ||||||
| //#define DRYRUN       // don't touch the drives | // #define DRYRUN       // don't touch the drives | ||||||
| #define FROZEN_ALERT // show alert if drive is frozen | #define FROZEN_ALERT // show alert if drive is frozen | ||||||
| #define ZERO_CHECK   // check drive after shred if all bytes are zero, show alert if this fails | #define ZERO_CHECK   // check drive after shred if all bytes are zero, show alert if this fails | ||||||
|  |  | ||||||
| @ -86,6 +86,7 @@ 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); | ||||||
|  |     static void stopShredAllDrives(list<Drive> *plistDrives); | ||||||
|     static void updateShredMetrics(list<Drive> *plistDrives); |     static void updateShredMetrics(list<Drive> *plistDrives); | ||||||
|     static void filterIgnoredDrives(list<Drive> *plistDrives); |     static void filterIgnoredDrives(list<Drive> *plistDrives); | ||||||
|     static void filterInvalidDrives(list<Drive> *plistDrives); |     static void filterInvalidDrives(list<Drive> *plistDrives); | ||||||
|  | |||||||
| @ -31,6 +31,7 @@ public: | |||||||
|         Delete, |         Delete, | ||||||
|         Enter, |         Enter, | ||||||
|         ESC, |         ESC, | ||||||
|  |         Terminate, | ||||||
|         Undefined |         Undefined | ||||||
|     }; |     }; | ||||||
|     struct MenuState |     struct MenuState | ||||||
|  | |||||||
| @ -197,6 +197,12 @@ void reHDD::ThreadUserInput() | |||||||
|             handleESC(); |             handleESC(); | ||||||
|             ui->updateTUI(&listDrives, u8SelectedEntry); |             ui->updateTUI(&listDrives, u8SelectedEntry); | ||||||
|             break; |             break; | ||||||
|  |         case TUI::UserInput::Terminate: | ||||||
|  |             cout << "Terminate" << endl; | ||||||
|  |             stopShredAllDrives(&listDrives); | ||||||
|  |             sleep(5);     // sleep 5 sec | ||||||
|  |             std::exit(1); // Terminates main, doesn't wait for threads | ||||||
|  |             break; | ||||||
|         default: |         default: | ||||||
|             break; |             break; | ||||||
|         } |         } | ||||||
| @ -464,6 +470,34 @@ void reHDD::startShredAllDrives(list<Drive> *plistDrives) | |||||||
|     mxDrives.unlock(); |     mxDrives.unlock(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * \brief   stop shred for all drives | ||||||
|  |  * \param	pointer of list <Drive>* plistDrives | ||||||
|  |  * \return  void | ||||||
|  |  */ | ||||||
|  | void reHDD::stopShredAllDrives(list<Drive> *plistDrives) | ||||||
|  | { | ||||||
|  |     list<Drive>::iterator it; | ||||||
|  |     mxDrives.lock(); | ||||||
|  |     for (it = plistDrives->begin(); it != plistDrives->end(); ++it) | ||||||
|  |     { | ||||||
|  |  | ||||||
|  |         if (it->state == Drive::SHRED_ACTIVE || it->state == Drive::DELETE_ACTIVE) | ||||||
|  |         { | ||||||
|  |             it->state = Drive::NONE; | ||||||
|  |             Logger::logThis()->info("Abort-Shred-Signal for: " + it->getModelName() + "-" + it->getSerial()); | ||||||
|  |             // task for drive is running --> remove selection | ||||||
|  |         } | ||||||
|  |  | ||||||
|  | #ifdef LOG_LEVEL_HIGH | ||||||
|  |         ostringstream address; | ||||||
|  |         address << (void const *)&(*it); | ||||||
|  |         Logger::logThis()->info("Started shred (all) for: " + it->getModelName() + "-" + it->getSerial() + " @" + address.str()); | ||||||
|  | #endif | ||||||
|  |     } | ||||||
|  |     mxDrives.unlock(); | ||||||
|  | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * \brief   print drives with all information |  * \brief   print drives with all information | ||||||
|  * \param	pointer of list <Drive>* plistDrives |  * \param	pointer of list <Drive>* plistDrives | ||||||
|  | |||||||
| @ -187,7 +187,7 @@ int Shred::shredDrive(Drive *drive, int *ipSignalFd) | |||||||
|     Logger::logThis()->info("Check-Task started - Drive: " + drive->getModelName() + "-" + drive->getSerial() + " @" + address.str()); |     Logger::logThis()->info("Check-Task started - Drive: " + drive->getModelName() + "-" + drive->getSerial() + " @" + address.str()); | ||||||
|     drive->u32DriveChecksumAfterShredding = uiCalcChecksum(driveFileDiscr, drive, ipSignalFd); |     drive->u32DriveChecksumAfterShredding = uiCalcChecksum(driveFileDiscr, drive, ipSignalFd); | ||||||
| #ifdef LOG_LEVEL_HIGH | #ifdef LOG_LEVEL_HIGH | ||||||
|     if (drive->u32DriveChecksumAferShredding != 0) |     if (drive->u32DriveChecksumAfterShredding != 0) | ||||||
|     { |     { | ||||||
|         Logger::logThis()->info("Shred-Task: Checksum not zero: " + to_string(drive->u32DriveChecksumAfterShredding) + " - Drive: " + drive->getSerial()); |         Logger::logThis()->info("Shred-Task: Checksum not zero: " + to_string(drive->u32DriveChecksumAfterShredding) + " - Drive: " + drive->getSerial()); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -237,6 +237,9 @@ enum TUI::UserInput TUI::readUserInput() | |||||||
|     case 'S': |     case 'S': | ||||||
|         return TUI::UserInput::ShredAll; |         return TUI::UserInput::ShredAll; | ||||||
|         break; |         break; | ||||||
|  |     case 'T': | ||||||
|  |         return TUI::UserInput::Terminate; | ||||||
|  |         break; | ||||||
|     default: |     default: | ||||||
|         return TUI::UserInput::Undefined; |         return TUI::UserInput::Undefined; | ||||||
|         break; |         break; | ||||||
| @ -482,8 +485,12 @@ WINDOW *TUI::createMenuView(int iXSize, int iYSize, int iXStart, int iYStart, st | |||||||
|     { |     { | ||||||
|         string sLineTmp = "Press d for Delete"; |         string sLineTmp = "Press d for Delete"; | ||||||
|         mvwaddstr(newWindow, u16Line++, (iXSize / 2) - (sLineTmp.size() / 2), sLineTmp.c_str()); |         mvwaddstr(newWindow, u16Line++, (iXSize / 2) - (sLineTmp.size() / 2), sLineTmp.c_str()); | ||||||
|  |         u16Line++; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     string sLineTmp = "Press T for terminating reHDD"; | ||||||
|  |     mvwaddstr(newWindow, u16Line++, (iXSize / 2) - (sLineTmp.size() / 2), sLineTmp.c_str()); | ||||||
|  |  | ||||||
|     return newWindow; |     return newWindow; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user