mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 23:42:58 +02:00
neutrino: Fit various functions to the changed at get_fs_usage()
This commit is contained in:
@@ -636,9 +636,9 @@ void CInfoViewerBB::showSysfsHdd()
|
||||
if (g_settings.infobar_show_sysfs_hdd) {
|
||||
//sysFS info
|
||||
int percent = 0;
|
||||
long t, u;
|
||||
uint64_t t, u;
|
||||
if (get_fs_usage("/", t, u))
|
||||
percent = (u * 100ULL) / t;
|
||||
percent = (int)((u * 100ULL) / t);
|
||||
showBarSys(percent);
|
||||
|
||||
if (check_dir(g_settings.network_nfs_recordingdir) == 0)
|
||||
@@ -651,9 +651,9 @@ void CInfoViewerBB::showSysfsHdd()
|
||||
void* CInfoViewerBB::hddperThread(void *arg)
|
||||
{
|
||||
CInfoViewerBB *infoViewerBB = (CInfoViewerBB*) arg;
|
||||
long t, u;
|
||||
uint64_t t, u;
|
||||
if (get_fs_usage(g_settings.network_nfs_recordingdir, t, u))
|
||||
infoViewerBB->hddpercent = (u * 100ULL) / t;
|
||||
infoViewerBB->hddpercent = (int)((u * 100ULL) / t);
|
||||
else
|
||||
infoViewerBB->hddpercent = 0;
|
||||
infoViewerBB->hddperTflag=false;
|
||||
|
@@ -571,8 +571,9 @@ bool CFlashExpert::checkSize(int mtd, std::string &backupFile)
|
||||
return false;
|
||||
}
|
||||
|
||||
long btotal = 0, bused = 0, bsize = 0;
|
||||
int backupRequiredSize = 0;
|
||||
uint64_t btotal = 0, bused = 0;
|
||||
long bsize = 0;
|
||||
uint64_t backupRequiredSize = 0;
|
||||
#ifdef BOXMODEL_APOLLO
|
||||
if (mtd == -1) { // check disk space for image creation
|
||||
if (!get_fs_usage("/", btotal, bused, &bsize)) {
|
||||
@@ -580,11 +581,11 @@ bool CFlashExpert::checkSize(int mtd, std::string &backupFile)
|
||||
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, errMsg);
|
||||
return false;
|
||||
}
|
||||
backupRequiredSize = (int)((bused * bsize) / 1024) * 2; // twice disk space for summarized image
|
||||
backupRequiredSize = ((bused * bsize) / 1024ULL) * 2ULL; // twice disk space for summarized image
|
||||
}
|
||||
else
|
||||
#endif
|
||||
backupRequiredSize = CMTDInfo::getInstance()->getMTDSize(mtd) / 1024;
|
||||
backupRequiredSize = CMTDInfo::getInstance()->getMTDSize(mtd) / 1024ULL;
|
||||
|
||||
btotal = 0; bused = 0; bsize = 0;
|
||||
if (!get_fs_usage(path.c_str(), btotal, bused, &bsize)) {
|
||||
@@ -592,9 +593,11 @@ bool CFlashExpert::checkSize(int mtd, std::string &backupFile)
|
||||
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, errMsg);
|
||||
return false;
|
||||
}
|
||||
int backupMaxSize = (int)((btotal - bused) * bsize);
|
||||
int res = 10; // Reserved 10% of available space
|
||||
backupMaxSize = (backupMaxSize - ((backupMaxSize * res) / 100)) / 1024;
|
||||
uint64_t backupMaxSize = (btotal - bused) * (uint64_t)bsize;
|
||||
uint64_t res = 10; // Reserved 10% of available space
|
||||
backupMaxSize = (backupMaxSize - ((backupMaxSize * res) / 100ULL)) / 1024ULL;
|
||||
printf("##### [%s] backupMaxSize: %llu, btotal: %llu, bused: %llu, bsize: %ld\n", __FUNCTION__, backupMaxSize, btotal, bused, bsize);
|
||||
|
||||
if (backupMaxSize < backupRequiredSize) {
|
||||
snprintf(errMsg, sizeof(errMsg)-1, g_Locale->getText(LOCALE_FLASHUPDATE_READ_NO_AVAILABLE_SPACE), path.c_str(), backupMaxSize, backupRequiredSize);
|
||||
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, errMsg);
|
||||
|
@@ -74,7 +74,8 @@ CExtUpdate::CExtUpdate()
|
||||
FileHelpers = NULL;
|
||||
MTDBuf = NULL;
|
||||
flashErrorFlag = false;
|
||||
total = bsize = used = 0;
|
||||
bsize = 0;
|
||||
total = used = 0;
|
||||
free1 = free2 = free3 = 0;
|
||||
|
||||
copyList.clear();
|
||||
@@ -704,12 +705,12 @@ bool CExtUpdate::readBackupList(const std::string & dstPath)
|
||||
sync();
|
||||
|
||||
if (get_fs_usage(mountPkt.c_str(), total, used, &bsize)) {
|
||||
long flashWarning = 1000; // 1MB
|
||||
long flashError = 600; // 600KB
|
||||
uint64_t flashWarning = 1000; // 1MB
|
||||
uint64_t flashError = 600; // 600KB
|
||||
char buf1[1024];
|
||||
total = (total * bsize) / 1024;
|
||||
free3 = total - (used * bsize) / 1024;
|
||||
printf("##### [%s] %ld KB free org, %ld KB free after delete, %ld KB free now\n", __FUNCTION__, free1, free2, free3);
|
||||
printf("##### [%s] %llu KB free org, %llu KB free after delete, %llu KB free now\n", __FUNCTION__, free1, free2, free3);
|
||||
memset(buf1, '\0', sizeof(buf1));
|
||||
if (free3 <= flashError) {
|
||||
snprintf(buf1, sizeof(buf1)-1, g_Locale->getText(LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_ERROR), free3, total);
|
||||
|
@@ -57,8 +57,9 @@ class CExtUpdate
|
||||
std::vector<std::string> copyList, blackList, deleteList;
|
||||
|
||||
bool flashErrorFlag;
|
||||
long total, bsize, used;
|
||||
long free1, free2, free3;
|
||||
long bsize;
|
||||
uint64_t total, used;
|
||||
uint64_t free1, free2, free3;
|
||||
|
||||
bool applySettings(void);
|
||||
bool readBackupList(const std::string & dstPath);
|
||||
|
Reference in New Issue
Block a user