Compare commits
	
		
			2 Commits
		
	
	
		
			d8584486b9
			...
			test/ipc-d
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| a35cb111ee | |||
| 575cb73d95 | 
| @ -8,7 +8,7 @@ | |||||||
| #ifndef REHDD_H_ | #ifndef REHDD_H_ | ||||||
| #define REHDD_H_ | #define REHDD_H_ | ||||||
|  |  | ||||||
| #define REHDD_VERSION "V1.2.0" | #define REHDD_VERSION "V1.1.3" | ||||||
|  |  | ||||||
| // 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,7 +86,6 @@ 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,7 +31,6 @@ public: | |||||||
|         Delete, |         Delete, | ||||||
|         Enter, |         Enter, | ||||||
|         ESC, |         ESC, | ||||||
|         Terminate, |  | ||||||
|         Undefined |         Undefined | ||||||
|     }; |     }; | ||||||
|     struct MenuState |     struct MenuState | ||||||
|  | |||||||
							
								
								
									
										30
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								src/main.cpp
									
									
									
									
									
								
							| @ -6,6 +6,7 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "../include/reHDD.h" | #include "../include/reHDD.h" | ||||||
|  | #include "../include/printer.h" | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * \brief   app entry point |  * \brief   app entry point | ||||||
| @ -14,9 +15,32 @@ | |||||||
|  */ |  */ | ||||||
| int main(void) | int main(void) | ||||||
| { | { | ||||||
|     // cout << "refurbishingHddTool" << endl; |     cout << "refurbishingHddTool" << endl; | ||||||
|  |  | ||||||
|     reHDD *app = new reHDD(); |     Drive *tmpDrive = new Drive("/dev/"); | ||||||
|     app->app_logic(); |     tmpDrive->setActionStartTimestamp(); | ||||||
|  |     tmpDrive->bWasShredded = true; | ||||||
|  |     tmpDrive->setDriveSMARTData("modelFamily", | ||||||
|  |         "modelName", | ||||||
|  |         "serial", | ||||||
|  |          420000, | ||||||
|  |          43, | ||||||
|  |          44, | ||||||
|  |          45, | ||||||
|  |          46); | ||||||
|  |  | ||||||
|  |     while(true){ | ||||||
|  |         cout << "send" << endl; | ||||||
|  |         Printer::getPrinter()->print(tmpDrive); | ||||||
|  |         sleep(5); // sleep 5 sec | ||||||
|  |         break; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |      | ||||||
|  |  | ||||||
|  |     cout << "exit" << endl; | ||||||
|  |  | ||||||
|  |     // reHDD *app = new reHDD(); | ||||||
|  |     // app->app_logic(); | ||||||
|     return EXIT_SUCCESS; |     return EXIT_SUCCESS; | ||||||
| } | } | ||||||
| @ -197,12 +197,6 @@ 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; | ||||||
|         } |         } | ||||||
| @ -470,34 +464,6 @@ 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->u32DriveChecksumAfterShredding != 0) |     if (drive->u32DriveChecksumAferShredding != 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,9 +237,6 @@ 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; | ||||||
| @ -485,12 +482,8 @@ 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