Index: sources/device/DeviceController.cpp =================================================================== diff -u -rc13fbc4bee3c690aa820eeb49d2d4470e79320d0 -reb918e27185e683e1d6a2b3ef0c621d173d561a5 --- sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision c13fbc4bee3c690aa820eeb49d2d4470e79320d0) +++ sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision eb918e27185e683e1d6a2b3ef0c621d173d561a5) @@ -236,6 +236,10 @@ #ifdef BUILD_FOR_TARGET usbCheck(); sdcardSpaceCheck(); + + // The treatment logs are held in a separate partition from the unencrypted + // logs and need a separate disk space usage check + encryptedPartitionSpaceCheck(); #endif } @@ -276,7 +280,6 @@ qint64 mCTotal = 0; - // TODO We need to have an indicator in the export log whether it's SD or not. bool isMounted = FileHandler::isMounted(Storage::SDCard_Base_Path_Name); QString pathToCheckSpace = isMounted ? Storage::SDCard_Base_Path_Name : Storage::Standard_tmp; mCIsReady = driveSpaceCheck(pathToCheckSpace, mCTotal, mCAvailable, &mCIsReadOnly); @@ -363,7 +366,35 @@ // << mCAvailable ; } +/*! + * \brief DeviceController::encryptedPartitionSpaceCheck + * \details Checks the disk space of the encrypted partition + */ +void DeviceController::encryptedPartitionSpaceCheck() +{ + bool mCIsReady = false; + bool mCIsReadOnly = false; + qint64 mCTotal = 0; + qint64 mCAvailable = 0; + quint8 mPercent = 0; + mCIsReady = driveSpaceCheck(Storage::Encrypted_Partition_Path, mCTotal, mCAvailable, &mCIsReadOnly); +#if BUILD_FOR_DESKTOP + mCIsReady = true; // it is set to always true since on desktop a local folder is used for the encrypted folder which doesn't need (un)mount. +#endif + + if(!mCIsReady) qDebug()<<"NOT READY"; + + mPercent = mCTotal ? ((100 * mCAvailable) / mCTotal) : 0; + qDebug()<<"var percent "<< mPercent; + if (Log_Min_Available_Total_Space_IsLow(mPercent)) { + //DEBUG qDebug()<< (QString("Encrypted partition space lower than %1%").arg(Log_Min_Available_Total_Space_Percent)); + LOG_DEBUG(QString("Encrypted partition space lower than %1%").arg(Log_Min_Available_Total_Space_Percent)); + emit didEncryptedPartitionSpaceLow(); + } +} + + /*! * \brief DeviceController::usbError * \details Logs any error which has been happened Index: sources/device/DeviceController.h =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -reb918e27185e683e1d6a2b3ef0c621d173d561a5 --- sources/device/DeviceController.h (.../DeviceController.h) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/device/DeviceController.h (.../DeviceController.h) (revision eb918e27185e683e1d6a2b3ef0c621d173d561a5) @@ -230,6 +230,12 @@ */ void didSDCardSpaceTooLow(quint8 vAvailablePercent); + /*! + * \brief didEncryptedPartitionSpaceLow + * \details this signal will emit when the treatment log folder occupies x percent of the encrypted partition + */ + void didEncryptedPartitionSpaceLow(); + void didActionReceive( const DeviceBrightnessResponseData &vBrightness ); void didActionReceive( const DeviceRootSSHAccessResponseData &vRootSSHAccess); @@ -264,6 +270,7 @@ void sdcardSpaceCheck(); void usbSpaceCheck(); + void encryptedPartitionSpaceCheck(); SAFE_CALL_EX(doAddWatch, const QString &) }; Index: sources/storage/Logger.cpp =================================================================== diff -u -rc13fbc4bee3c690aa820eeb49d2d4470e79320d0 -reb918e27185e683e1d6a2b3ef0c621d173d561a5 --- sources/storage/Logger.cpp (.../Logger.cpp) (revision c13fbc4bee3c690aa820eeb49d2d4470e79320d0) +++ sources/storage/Logger.cpp (.../Logger.cpp) (revision eb918e27185e683e1d6a2b3ef0c621d173d561a5) @@ -146,6 +146,8 @@ this , SLOT( onSDCardStateChange(bool, bool))); connect(&_DeviceController, SIGNAL( didSDCardSpaceChange(bool, qint64, qint64, quint8)), this , SLOT( onSDCardSpaceChange(bool, qint64, qint64, quint8))); + connect(&_DeviceController, SIGNAL( didEncryptedPartitionSpaceLow()), + this , SLOT( concurrentRemoveLogs())); connect(&_DeviceController, SIGNAL(didCryptSetupMount(bool)), this , SLOT( onCryptSetupMount(bool))); Index: sources/storage/StorageGlobals.cpp =================================================================== diff -u -rb677e5e26a50bdb0f5cee4b25ae943a2aaddcd50 -reb918e27185e683e1d6a2b3ef0c621d173d561a5 --- sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision b677e5e26a50bdb0f5cee4b25ae943a2aaddcd50) +++ sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision eb918e27185e683e1d6a2b3ef0c621d173d561a5) @@ -52,11 +52,8 @@ const short Log_Max_Allowable_Datum_Space_Percent = 25; const short Log_Max_Allowable_AppED_Space_Percent = Log_Max_Allowable_Event_Space_Percent + Log_Max_Allowable_Datum_Space_Percent; // 50 const short Log_Max_Allowable_Debug_Space_Percent = 15; + const short Log_Max_Allowable_Trtmt_Space_Percent = 10; - // Treatment logs residing in the encrypted partition is estimated to occupy at most 16MB or ~50% of the /var/configuration partition - // This percentage is used when the encrypted partition mounted and settings are secured - const short Log_Max_Allowable_Trtmt_Space_Percent = 50; - // // Max Usage : 75 = 25 + 25 + 15 + 10 // // Max Used : 85 = 100 - 15 // // Min Buffer : 10 = 85 - 75 @@ -65,9 +62,11 @@ #ifdef BUILD_FOR_TARGET const char *SDCard_Base_Path_Name = "/media/sd-card/"; + const char *Encrypted_Partition_Path = "/var/configurations/"; #else // should not be in the project application folder. [not tracking by git] const char *SDCard_Base_Path_Name = "/home/denali/Desktop/sd-card/"; + const char *Encrypted_Partition_Path="/home/denali/Desktop/var/configurations/"; #endif // Screenshot store folder Index: sources/storage/StorageGlobals.h =================================================================== diff -u -r611bbf4dcba67768db87cf30f21fd2db788f677d -reb918e27185e683e1d6a2b3ef0c621d173d561a5 --- sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision 611bbf4dcba67768db87cf30f21fd2db788f677d) +++ sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision eb918e27185e683e1d6a2b3ef0c621d173d561a5) @@ -41,6 +41,7 @@ extern short Log_Min_Available_Total_Space_IsLow ( short vPercent ); extern const char *SDCard_Base_Path_Name; + extern const char *Encrypted_Partition_Path; // Screenshot store folder extern const char *Screenshot_Base_Path_Name;