Lines Matching refs:path
107 /* Create a directory named 'path' if it does not already exist.
109 * Returns: 0 if path already exists as a directory or if created.
113 mkdir_if_needed(const char *path)
117 /* If the path exists already, then our work is done if it's a
120 if (stat(path, &sb) == 0) {
125 "---disabling.\n", path);
130 int ret = mkdir(path, 0755);
135 path, strerror(errno));
140 /* Concatenate an existing path and a new name to form a new path. If the new
141 * path does not exist as a directory, create it then return the resulting
142 * name of the new path (ralloc'ed off of 'ctx').
146 * <path> does not exist or is not a directory
147 * <path>/<name> exists but is not a directory
148 * <path>/<name> cannot be created as a directory
151 concatenate_and_mkdir(void *ctx, const char *path, const char *name)
156 if (stat(path, &sb) != 0 || ! S_ISDIR(sb.st_mode))
159 new_path = ralloc_asprintf(ctx, "%s/%s", path, name);
185 /* Given a directory path and predicate function, create a linked list of entrys
288 /* Create the full path for the file list we found */
307 is_regular_non_tmp_file(const char *path, const struct stat *sb,
321 unlink_lru_file_from_directory(const char *path)
324 choose_lru_file_matching(path, is_regular_non_tmp_file);
345 is_two_character_sub_directory(const char *path, const struct stat *sb,
358 if (asprintf(&subdir, "%s/%s", path, d_name) == -1)
393 if (asprintf(&dir, "%s/%c%c", cache->path, buf[0], buf[1]) == -1)
442 if (asprintf(&dir_path, "%s/%02" PRIx64 , cache->path, rand64 & 0xff) < 0)
463 choose_lru_file_matching(cache->path, is_two_character_sub_directory);
627 if (asprintf(&filename, "%s/%c%c/%s", cache->path, buf[0],
806 /* Determine path for cache based on the first defined name as follows:
820 char *path = getenv("MESA_SHADER_CACHE_DIR");
822 if (!path) {
823 path = getenv("MESA_GLSL_CACHE_DIR");
824 if (path)
830 if (path) {
831 if (mkdir_if_needed(path) == -1)
834 path = concatenate_and_mkdir(mem_ctx, path, cache_dir_name);
835 if (!path)
839 if (path == NULL) {
846 path = concatenate_and_mkdir(mem_ctx, xdg_cache_home, cache_dir_name);
847 if (!path)
852 if (!path) {
878 path = concatenate_and_mkdir(mem_ctx, pwd.pw_dir, ".cache");
879 if (!path)
882 path = concatenate_and_mkdir(mem_ctx, path, cache_dir_name);
883 if (!path)
888 path = concatenate_and_mkdir(mem_ctx, path, driver_id);
889 if (!path)
892 path = concatenate_and_mkdir(mem_ctx, path, gpu_name);
893 if (!path)
897 return path;
964 return foz_prepare(&cache->foz_db, cache->path);
969 char *path)
974 path = ralloc_asprintf(mem_ctx, "%s/index", cache->path);
975 if (path == NULL)
978 fd = open(path, O_RDWR | O_CREAT | O_CLOEXEC, 0644);