Modify calculation logic for data and cache. 87/129587/1
authorjongmyeongko <jongmyeong.ko@samsung.com>
Wed, 17 May 2017 05:25:56 +0000 (14:25 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Wed, 17 May 2017 05:25:56 +0000 (14:25 +0900)
Exclude the data or cache in the global directory from
the calculation of data or cache size.

Change-Id: I2830772de8046e6b8000624c9d0e3907fa7903da
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/pkg_getsize.c

index 6b68a7a..5877f23 100644 (file)
@@ -530,8 +530,10 @@ static int __calculate_pkg_size_info(STORAGE_TYPE type,
                                LOGE("Calculating data directory failed.");
                                goto error;
                        }
-                       *data_size += size;
-                       LOGD("data_size: %lld", *data_size);
+                       if (type != STORAGE_TYPE_INTERNAL_GLOBAL_PATH) {
+                               *data_size += size;
+                               LOGD("data_size: %lld", *data_size);
+                       }
                } else if (strncmp(name, "cache", strlen("cache")) == 0) {
                        LOGD("traverse path: %s/%s", app_root_dir, name);
                        ret = fstat(subfd, &st);
@@ -546,8 +548,10 @@ static int __calculate_pkg_size_info(STORAGE_TYPE type,
                                LOGE("Calculating cache directory failed.");
                                goto error;
                        }
-                       *cache_size += size;
-                       LOGD("cache_size: %lld", *cache_size);
+                       if (type != STORAGE_TYPE_INTERNAL_GLOBAL_PATH) {
+                               *cache_size += size;
+                               LOGD("cache_size: %lld", *cache_size);
+                       }
                } else if (strncmp(name, "shared", strlen("shared")) == 0) {
                        ret = __calculate_shared_dir_size(dfd, app_root_dir,
                                        data_size, app_size, cache_size);