summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyeonghun Lee <kh9090.lee@samsung.com>2016-06-02 14:30:20 +0900
committerKyeonghun Lee <kh9090.lee@samsung.com>2016-06-03 10:20:41 +0900
commit2418878cf742dd90d80c33b380d3952b33adb5a0 (patch)
treefd26e0a7f33e6def3bdcbeb2792486d96645f94c
parentfe11eee16f1a744cac1ab76acc37c00f8c415158 (diff)
downloadmsg-service-2418878cf742dd90d80c33b380d3952b33adb5a0.tar.gz
msg-service-2418878cf742dd90d80c33b380d3952b33adb5a0.tar.bz2
msg-service-2418878cf742dd90d80c33b380d3952b33adb5a0.zip
Change-Id: Ifeae3011b73be34e9d508e8ed273b94eea2b9c37 Signed-off-by: Kyeonghun Lee <kh9090.lee@samsung.com>
-rwxr-xr-xutils/MsgUtilStorage.cpp37
1 files changed, 29 insertions, 8 deletions
diff --git a/utils/MsgUtilStorage.cpp b/utils/MsgUtilStorage.cpp
index 7b8de31..defb17c 100755
--- a/utils/MsgUtilStorage.cpp
+++ b/utils/MsgUtilStorage.cpp
@@ -38,7 +38,10 @@ static int msgCntLimit[MSG_COUNT_LIMIT_MAILBOX_TYPE_MAX][MSG_COUNT_LIMIT_MSG_TYP
using namespace std;
-#define ITERATION_SIZE 200
+#define CHECK_SIZE 1 * 1024 * 1024 * 1024
+#define RESERVE 100 * 1024 * 1024
+#define RESERVE_LITE 5 * 1024 * 1024
+
/*==================================================================================================
FUNCTION IMPLEMENTATION
==================================================================================================*/
@@ -197,16 +200,25 @@ msg_error_t MsgStoCheckMsgCntFull(MsgDbHandler *pDbHandle, const MSG_MESSAGE_TYP
boost::system::error_code ec;
boost::filesystem::space_info si = boost::filesystem::space(TZ_SYS_HOME_PATH, ec);
+ long long int available = 0;
if (ec) {
- MSG_ERR("Faile to get space info [%s]", ec.message().c_str());
+ MSG_ERR("Failed to get space info [%s]", ec.message().c_str());
return MSG_ERR_STORAGE_ERROR;
} else {
- MSG_DEBUG("Free space of storage is [%llu] Bytes.", si.available);
+ if (si.capacity < CHECK_SIZE)
+ available = si.available - RESERVE_LITE;
+ else
+ available = si.available - RESERVE;
+
+ if (available < 0)
+ available = 0;
+
+ MSG_DEBUG("Free space of storage is [%llu] Bytes.", available);
- if (si.available < SMS_MINIMUM_SPACE && pMsgType->mainType == MSG_SMS_TYPE)
+ if (available < SMS_MINIMUM_SPACE && pMsgType->mainType == MSG_SMS_TYPE)
err = MSG_ERR_MESSAGE_COUNT_FULL;
- else if (si.available < MMS_MINIMUM_SPACE && pMsgType->mainType == MSG_MMS_TYPE)
+ else if (available < MMS_MINIMUM_SPACE && pMsgType->mainType == MSG_MMS_TYPE)
err = MSG_ERR_MESSAGE_COUNT_FULL;
}
@@ -348,15 +360,24 @@ msg_error_t MsgStocheckMemoryStatus()
msg_error_t err = MSG_SUCCESS;
boost::system::error_code ec;
boost::filesystem::space_info si = boost::filesystem::space(TZ_SYS_HOME_PATH, ec);
+ long long int available = 0;
if (ec) {
- MSG_ERR("Faile to get space info [%s]", ec.message().c_str());
+ MSG_ERR("Failed to get space info [%s]", ec.message().c_str());
return MSG_ERR_STORAGE_ERROR;
}
- MSG_DEBUG("Free space of storage is [%llu] Bytes.", si.available);
+ if (si.capacity < CHECK_SIZE)
+ available = si.available - RESERVE_LITE;
+ else
+ available = si.available - RESERVE;
+
+ if (available < 0)
+ available = 0;
+
+ MSG_DEBUG("Free space of storage is [%llu] Bytes.", available);
- if (si.available < SMS_MINIMUM_SPACE)
+ if (available < SMS_MINIMUM_SPACE)
err = MSG_ERR_MESSAGE_COUNT_FULL;
MSG_DEBUG("Memory status =[%d]", err);