Lines Matching refs:path
21 int create_pkg_path_in_dir(char path[PKG_PATH_MAX], in create_pkg_path_in_dir()
41 char *dst = path; in create_pkg_path_in_dir()
44 if (append_and_increment(&dst, dir->path, &dst_size) < 0 in create_pkg_path_in_dir()
58 int create_pkg_path(char path[PKG_PATH_MAX], in create_pkg_path()
79 if (append_and_increment(&dst, android_data_dir.path, &dst_size) < 0 in create_pkg_path()
94 dir.path = prefix; in create_pkg_path()
97 return create_pkg_path_in_dir(path, &dir, pkgname, postfix); in create_pkg_path()
104 int create_persona_path(char path[PKG_PATH_MAX], in create_persona_path()
117 char *dst = path; in create_persona_path()
120 if (append_and_increment(&dst, android_data_dir.path, &dst_size) < 0 in create_persona_path()
144 int create_persona_media_path(char path[PATH_MAX], userid_t userid) { in create_persona_media_path()
145 if (snprintf(path, PATH_MAX, "%s%d", android_media_dir.path, userid) > PATH_MAX) { in create_persona_media_path()
151 int create_move_path(char path[PKG_PATH_MAX], in create_move_path()
161 sprintf(path, "%s%s%s/%s", android_data_dir.path, PRIMARY_USER_PREFIX, pkgname, leaf); in create_move_path()
365 if (statfs(android_data_dir.path, &sfs) == 0) { in data_disk_free()
368 ALOGE("Couldn't statfs %s: %s\n", android_data_dir.path, strerror(errno)); in data_disk_free()
671 static char *create_dir_path(char path[PATH_MAX], cache_dir_t* dir) in create_dir_path()
673 char *pos = path; in create_dir_path()
675 pos = create_dir_path(path, dir->parent); in create_dir_path()
688 static void delete_cache_dir(char path[PATH_MAX], cache_dir_t* dir) in delete_cache_dir()
691 create_dir_path(path, dir); in delete_cache_dir()
692 ALOGI("DEL DIR %s\n", path); in delete_cache_dir()
694 if (rmdir(path)) { in delete_cache_dir()
695 ALOGE("Couldn't rmdir %s: %s\n", path, strerror(errno)); in delete_cache_dir()
701 if (delete_dir_contents(path, 1, NULL)) { in delete_cache_dir()
708 delete_cache_dir(path, dir->parent); in delete_cache_dir()
713 create_dir_path(path, dir); in delete_cache_dir()
714 ALOGI("DEL CONTENTS %s\n", path); in delete_cache_dir()
715 delete_dir_contents(path, 0, NULL); in delete_cache_dir()
730 char path[PATH_MAX]; in clear_cache_files() local
743 delete_cache_dir(path, dir); in clear_cache_files()
757 strcpy(create_dir_path(path, file->dir), file->name); in clear_cache_files()
758 ALOGI("DEL (mod %d) %s\n", (int)file->modTime, path); in clear_cache_files()
759 if (unlink(path) < 0) { in clear_cache_files()
760 ALOGE("Couldn't unlink %s: %s\n", path, strerror(errno)); in clear_cache_files()
764 delete_cache_dir(path, file->dir); in clear_cache_files()
799 int validate_system_app_path(const char* path) { in validate_system_app_path() argument
804 if (!strncmp(path, android_system_dirs.dirs[i].path, dir_len)) { in validate_system_app_path()
805 if (path[dir_len] == '.' || strchr(path + dir_len, '/') != NULL) { in validate_system_app_path()
806 ALOGE("invalid system apk path '%s' (trickery)\n", path); in validate_system_app_path()
822 const char* path = getenv(var); in get_path_from_env() local
823 int ret = get_path_from_string(rec, path); in get_path_from_env()
837 int get_path_from_string(dir_rec_t* rec, const char* path) { in get_path_from_string() argument
838 if (path == NULL) { in get_path_from_string()
841 const size_t path_len = strlen(path); in get_path_from_string()
847 if (path[0] != '/') { in get_path_from_string()
851 if (path[path_len - 1] == '/') { in get_path_from_string()
854 rec->path = strdup(path); in get_path_from_string()
855 if (rec->path == NULL) { in get_path_from_string()
867 rec->path = malloc(dst_size); in get_path_from_string()
868 if (rec->path == NULL) { in get_path_from_string()
872 dst = rec->path; in get_path_from_string()
874 if (append_and_increment(&dst, path, &dst_size) < 0 in get_path_from_string()
880 rec->len = dst - rec->path; in get_path_from_string()
889 dst->path = (char*) malloc(dstSize); in copy_and_append()
891 if (dst->path == NULL in copy_and_append()
892 || snprintf(dst->path, dstSize, "%s%s", src->path, suffix) in copy_and_append()
906 int validate_apk_path(const char *path) in validate_apk_path() argument
913 if (!strncmp(path, android_app_dir.path, android_app_dir.len)) { in validate_apk_path()
915 } else if (!strncmp(path, android_app_private_dir.path, android_app_private_dir.len)) { in validate_apk_path()
917 } else if (!strncmp(path, android_asec_dir.path, android_asec_dir.len)) { in validate_apk_path()
921 ALOGE("invalid apk path '%s' (bad prefix)\n", path); in validate_apk_path()
925 path_len = strlen(path); in validate_apk_path()
930 if ((subdir = strchr(path + dir_len, '/')) != NULL) { in validate_apk_path()
933 || (path_len > (size_t) (subdir - path) && (strchr(subdir, '/') != NULL))) { in validate_apk_path()
934 ALOGE("invalid apk path '%s' (subdir?)\n", path); in validate_apk_path()
943 if (path[dir_len] == '.' in validate_apk_path()
945 ALOGE("invalid apk path '%s' (trickery)\n", path); in validate_apk_path()
997 char path[PATH_MAX]; in ensure_media_user_dirs() local