mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 23:42:58 +02:00
CFlashExpert::checkSize: Fix display backupMaxSize & backupRequiredSize
This commit is contained in:
@@ -537,7 +537,7 @@ flashupdate.proxyusername Benutzername
|
|||||||
flashupdate.proxyusername_hint1 Geben Sie den Proxy-Benutzernamen ein
|
flashupdate.proxyusername_hint1 Geben Sie den Proxy-Benutzernamen ein
|
||||||
flashupdate.proxyusername_hint2 Ein leerer Eintrag bedeutet keine Authentifizierung
|
flashupdate.proxyusername_hint2 Ein leerer Eintrag bedeutet keine Authentifizierung
|
||||||
flashupdate.read_directory_not_exist Das Backupverzeichnis %s \nexistiert nicht!
|
flashupdate.read_directory_not_exist Das Backupverzeichnis %s \nexistiert nicht!
|
||||||
flashupdate.read_no_available_space Der maximal verfügbare Platz in %s \nbeträgt %d KB, es werden aber %d KB benötigt.\n \nDer Vorgang wird abgebrochen, wählen sie bitte einen anderen Datenträger!
|
flashupdate.read_no_available_space Der maximal verfügbare Platz in %s \nbeträgt %s KB, es werden aber %s KB benötigt.\n \nDer Vorgang wird abgebrochen, wählen sie bitte einen anderen Datenträger!
|
||||||
flashupdate.read_volume_error Die Größe des Datenträgers %s \nkann nicht ermittelt werden!
|
flashupdate.read_volume_error Die Größe des Datenträgers %s \nkann nicht ermittelt werden!
|
||||||
flashupdate.readflash ganzes Flashimage auslesen
|
flashupdate.readflash ganzes Flashimage auslesen
|
||||||
flashupdate.readflashmtd einzelne Partition auslesen
|
flashupdate.readflashmtd einzelne Partition auslesen
|
||||||
|
@@ -537,7 +537,7 @@ flashupdate.proxyusername Username
|
|||||||
flashupdate.proxyusername_hint1 enter the proxyserver username
|
flashupdate.proxyusername_hint1 enter the proxyserver username
|
||||||
flashupdate.proxyusername_hint2 a empty entry means no proxy-auth
|
flashupdate.proxyusername_hint2 a empty entry means no proxy-auth
|
||||||
flashupdate.read_directory_not_exist The backup directory %s \ndoes not exist!
|
flashupdate.read_directory_not_exist The backup directory %s \ndoes not exist!
|
||||||
flashupdate.read_no_available_space The maximum available space in %s \nis %d KB, but there are %d KB required.\n \nThe operation is canceled, please choose another medium!
|
flashupdate.read_no_available_space The maximum available space in %s \nis %s KB, but there are %s KB required.\n \nThe operation is canceled, please choose another medium!
|
||||||
flashupdate.read_volume_error The size of the volume %s \ncan not be determined!
|
flashupdate.read_volume_error The size of the volume %s \ncan not be determined!
|
||||||
flashupdate.readflash Read whole image
|
flashupdate.readflash Read whole image
|
||||||
flashupdate.readflashmtd Read one partition
|
flashupdate.readflashmtd Read one partition
|
||||||
|
@@ -55,6 +55,7 @@
|
|||||||
#include <system/flashtool.h>
|
#include <system/flashtool.h>
|
||||||
#include <system/httptool.h>
|
#include <system/httptool.h>
|
||||||
#include <system/helpers.h>
|
#include <system/helpers.h>
|
||||||
|
#include <system/debug.h>
|
||||||
|
|
||||||
#include <lib/libnet/libnet.h>
|
#include <lib/libnet/libnet.h>
|
||||||
|
|
||||||
@@ -582,6 +583,8 @@ bool CFlashExpert::checkSize(int mtd, std::string &backupFile)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
backupRequiredSize = ((bused * bsize) / 1024ULL) * 2ULL; // twice disk space for summarized image
|
backupRequiredSize = ((bused * bsize) / 1024ULL) * 2ULL; // twice disk space for summarized image
|
||||||
|
dprintf(DEBUG_INFO, "##### [%s] backupRequiredSize: %" PRIu64 ", btotal: %" PRIu64 ", bused: %" PRIu64 ", bsize: %ld\n",
|
||||||
|
__func__, backupRequiredSize, btotal, bused, bsize);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@@ -596,11 +599,11 @@ bool CFlashExpert::checkSize(int mtd, std::string &backupFile)
|
|||||||
uint64_t backupMaxSize = (btotal - bused) * (uint64_t)bsize;
|
uint64_t backupMaxSize = (btotal - bused) * (uint64_t)bsize;
|
||||||
uint64_t res = 10; // Reserved 10% of available space
|
uint64_t res = 10; // Reserved 10% of available space
|
||||||
backupMaxSize = (backupMaxSize - ((backupMaxSize * res) / 100ULL)) / 1024ULL;
|
backupMaxSize = (backupMaxSize - ((backupMaxSize * res) / 100ULL)) / 1024ULL;
|
||||||
printf("##### [%s] backupMaxSize: %" PRIu64 ", btotal: %" PRIu64 ", bused: %" PRIu64 ", bsize: %ld\n",
|
dprintf(DEBUG_INFO, "##### [%s] backupMaxSize: %" PRIu64 ", btotal: %" PRIu64 ", bused: %" PRIu64 ", bsize: %ld\n",
|
||||||
__func__, backupMaxSize, btotal, bused, bsize);
|
__func__, backupMaxSize, btotal, bused, bsize);
|
||||||
|
|
||||||
if (backupMaxSize < backupRequiredSize) {
|
if (backupMaxSize < backupRequiredSize) {
|
||||||
snprintf(errMsg, sizeof(errMsg)-1, g_Locale->getText(LOCALE_FLASHUPDATE_READ_NO_AVAILABLE_SPACE), path.c_str(), backupMaxSize, backupRequiredSize);
|
snprintf(errMsg, sizeof(errMsg)-1, g_Locale->getText(LOCALE_FLASHUPDATE_READ_NO_AVAILABLE_SPACE), path.c_str(), to_string(backupMaxSize).c_str(), to_string(backupRequiredSize).c_str());
|
||||||
ShowHint(LOCALE_MESSAGEBOX_ERROR, errMsg);
|
ShowHint(LOCALE_MESSAGEBOX_ERROR, errMsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user