app2ext_dir_details *dir_detail = NULL;
int reqd_size = 0;
int free_internal_mem = 0;
- struct statvfs buf = {0,};
unsigned long long temp = 0;
char err_buf[1024] = {0,};
char *encoded_id = NULL;
fp = NULL;
}
- memset((void *)&buf, '\0', sizeof(struct statvfs));
- ret = statvfs(INTERNAL_STORAGE_PATH, &buf);
- if (0 == ret) {
- temp = (buf.f_bsize * buf.f_bavail) / (1024 * 1024);
- free_internal_mem = (int)temp;
- } else {
- _E("unable to get internal storage size");
- return APP2EXT_ERROR_MMC_INSUFFICIENT_MEMORY;
+ /* find avialable free memory in the internal storage */
+ ret = _app2sd_get_available_free_memory(INTERNAL_STORAGE_PATH,
+ &free_internal_mem);
+ if (ret) {
+ _E("unable to get available free memory in internal (%d)",
+ ret);
+ return APP2EXT_ERROR_MMC_STATUS;
}
fp = fopen(loopback_device, "r+");
return APP2EXT_ERROR_LOOPBACK_DEVICE_UNAVAILABLE;
}
- _D("reqd size: (%d)MB, free internal mem: (%d)MB",
+ _I("reqd size: (%d)MB, free internal mem: (%d)MB",
reqd_size, free_internal_mem);
/* if avaialalbe free memory in internal storage is
}
/*
- * This function returns the available free memory in the SD Card.
- * param [in]: sd_path: This is sd card access path.
+ * This function returns the available free memory in the storage.
+ * param [in]: mmc_path: This is storage access path.
* param [out]: free_mem: Result will be available in this.
* User has to pass valid memory address.
* return: On success, it will return 0.
ret = statvfs(mmc_path, &buf);
if (ret) {
- _E("unable to get SD Card memory information");
+ _E("unable to get memory information");
return APP2EXT_ERROR_MMC_INFORMATION;
}