Loading cmds/installd/commands.c +30 −8 Original line number Diff line number Diff line Loading @@ -447,6 +447,16 @@ int get_size(const char *pkgname, int persona, const char *apkpath, } } /* add in size of any libraries */ if (!create_pkg_path_in_dir(path, &android_app_lib_dir, pkgname, PKG_DIR_POSTFIX)) { d = opendir(path); if (d != NULL) { dfd = dirfd(d); codesize += calculate_dir_size(dfd); closedir(d); } } /* compute asec size if it is given */ if (asecpath != NULL && asecpath[0] != '!') { Loading Loading @@ -474,21 +484,33 @@ int get_size(const char *pkgname, int persona, const char *apkpath, if (de->d_type == DT_DIR) { int subfd; int64_t statsize = 0; int64_t dirsize = 0; /* always skip "." and ".." */ if (name[0] == '.') { if (name[1] == 0) continue; if ((name[1] == '.') && (name[2] == 0)) continue; } if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) == 0) { statsize = stat_size(&s); } subfd = openat(dfd, name, O_RDONLY | O_DIRECTORY); if (subfd >= 0) { int64_t size = calculate_dir_size(subfd); dirsize = calculate_dir_size(subfd); } if(!strcmp(name,"lib")) { codesize += size; codesize += dirsize + statsize; } else if(!strcmp(name,"cache")) { cachesize += size; cachesize += dirsize + statsize; } else { datasize += size; datasize += dirsize + statsize; } } else if (de->d_type == DT_LNK && !strcmp(name,"lib")) { // This is the symbolic link to the application's library // code. We'll count this as code instead of data, since // it is not something that the app creates. if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) == 0) { codesize += stat_size(&s); } } else { if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) == 0) { Loading libs/diskusage/dirsize.c +3 −4 Original line number Diff line number Diff line Loading @@ -49,6 +49,9 @@ int64_t calculate_dir_size(int dfd) while ((de = readdir(d))) { const char *name = de->d_name; if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) == 0) { size += stat_size(&s); } if (de->d_type == DT_DIR) { int subfd; Loading @@ -64,10 +67,6 @@ int64_t calculate_dir_size(int dfd) if (subfd >= 0) { size += calculate_dir_size(subfd); } } else { if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) == 0) { size += stat_size(&s); } } } closedir(d); Loading Loading
cmds/installd/commands.c +30 −8 Original line number Diff line number Diff line Loading @@ -447,6 +447,16 @@ int get_size(const char *pkgname, int persona, const char *apkpath, } } /* add in size of any libraries */ if (!create_pkg_path_in_dir(path, &android_app_lib_dir, pkgname, PKG_DIR_POSTFIX)) { d = opendir(path); if (d != NULL) { dfd = dirfd(d); codesize += calculate_dir_size(dfd); closedir(d); } } /* compute asec size if it is given */ if (asecpath != NULL && asecpath[0] != '!') { Loading Loading @@ -474,21 +484,33 @@ int get_size(const char *pkgname, int persona, const char *apkpath, if (de->d_type == DT_DIR) { int subfd; int64_t statsize = 0; int64_t dirsize = 0; /* always skip "." and ".." */ if (name[0] == '.') { if (name[1] == 0) continue; if ((name[1] == '.') && (name[2] == 0)) continue; } if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) == 0) { statsize = stat_size(&s); } subfd = openat(dfd, name, O_RDONLY | O_DIRECTORY); if (subfd >= 0) { int64_t size = calculate_dir_size(subfd); dirsize = calculate_dir_size(subfd); } if(!strcmp(name,"lib")) { codesize += size; codesize += dirsize + statsize; } else if(!strcmp(name,"cache")) { cachesize += size; cachesize += dirsize + statsize; } else { datasize += size; datasize += dirsize + statsize; } } else if (de->d_type == DT_LNK && !strcmp(name,"lib")) { // This is the symbolic link to the application's library // code. We'll count this as code instead of data, since // it is not something that the app creates. if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) == 0) { codesize += stat_size(&s); } } else { if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) == 0) { Loading
libs/diskusage/dirsize.c +3 −4 Original line number Diff line number Diff line Loading @@ -49,6 +49,9 @@ int64_t calculate_dir_size(int dfd) while ((de = readdir(d))) { const char *name = de->d_name; if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) == 0) { size += stat_size(&s); } if (de->d_type == DT_DIR) { int subfd; Loading @@ -64,10 +67,6 @@ int64_t calculate_dir_size(int dfd) if (subfd >= 0) { size += calculate_dir_size(subfd); } } else { if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) == 0) { size += stat_size(&s); } } } closedir(d); Loading