* -1 in all other cases.
*/
static int
-mkdir_if_needed(char *path)
+mkdir_if_needed(const char *path)
{
struct stat sb;
* <path>/<name> cannot be created as a directory
*/
static char *
-concatenate_and_mkdir(void *ctx, char *path, const char *name)
+concatenate_and_mkdir(void *ctx, const char *path, const char *name)
{
char *new_path;
struct stat sb;
}
static void
-remove_old_cache_directories(void *mem_ctx, char *path, const char *timestamp)
+remove_old_cache_directories(void *mem_ctx, const char *path,
+ const char *timestamp)
{
DIR *dir = opendir(path);
}
static char *
-create_mesa_cache_dir(void *mem_ctx, char *path, const char *timestamp,
+create_mesa_cache_dir(void *mem_ctx, const char *path, const char *timestamp,
const char *gpu_name)
{
char *new_path = concatenate_and_mkdir(mem_ctx, path, "mesa");
* Returns NULL if out of memory.
*/
static char *
-get_cache_file(struct disk_cache *cache, cache_key key)
+get_cache_file(struct disk_cache *cache, const cache_key key)
{
char buf[41];
char *filename;
* _get_cache_file above.
*/
static void
-make_cache_file_directory(struct disk_cache *cache, cache_key key)
+make_cache_file_directory(struct disk_cache *cache, const cache_key key)
{
char *dir;
char buf[41];
*/
static char *
choose_random_file_matching(const char *dir_path,
- bool (*predicate)(struct dirent *,
+ bool (*predicate)(const struct dirent *,
const char *dir_path))
{
DIR *dir;
* ".tmp"
*/
static bool
-is_regular_non_tmp_file(struct dirent *entry, const char *path)
+is_regular_non_tmp_file(const struct dirent *entry, const char *path)
{
char *filename;
if (asprintf(&filename, "%s/%s", path, entry->d_name) == -1)
* special name of "..")
*/
static bool
-is_two_character_sub_directory(struct dirent *entry, const char *path)
+is_two_character_sub_directory(const struct dirent *entry, const char *path)
{
char *subdir;
if (asprintf(&subdir, "%s/%s", path, entry->d_name) == -1)
}
void
-disk_cache_remove(struct disk_cache *cache, cache_key key)
+disk_cache_remove(struct disk_cache *cache, const cache_key key)
{
struct stat sb;
*/
static size_t
deflate_and_write_to_disk(const void *in_data, size_t in_data_size, int dest,
- char *filename)
+ const char *filename)
{
unsigned char out[BUFSIZE];
void
disk_cache_put(struct disk_cache *cache,
- cache_key key,
+ const cache_key key,
const void *data,
size_t size)
{
}
void *
-disk_cache_get(struct disk_cache *cache, cache_key key, size_t *size)
+disk_cache_get(struct disk_cache *cache, const cache_key key, size_t *size)
{
int fd = -1, ret, len;
struct stat sb;
}
void
-disk_cache_put_key(struct disk_cache *cache, cache_key key)
+disk_cache_put_key(struct disk_cache *cache, const cache_key key)
{
- uint32_t *key_chunk = (uint32_t *) key;
+ const uint32_t *key_chunk = (const uint32_t *) key;
int i = *key_chunk & CACHE_INDEX_KEY_MASK;
unsigned char *entry;
* extra recompile.
*/
bool
-disk_cache_has_key(struct disk_cache *cache, cache_key key)
+disk_cache_has_key(struct disk_cache *cache, const cache_key key)
{
- uint32_t *key_chunk = (uint32_t *) key;
+ const uint32_t *key_chunk = (const uint32_t *) key;
int i = *key_chunk & CACHE_INDEX_KEY_MASK;
unsigned char *entry;
* Remove the item in the cache under the name \key.
*/
void
-disk_cache_remove(struct disk_cache *cache, cache_key key);
+disk_cache_remove(struct disk_cache *cache, const cache_key key);
/**
* Store an item in the cache under the name \key.
* evicted from the cache.
*/
void
-disk_cache_put(struct disk_cache *cache, cache_key key,
+disk_cache_put(struct disk_cache *cache, const cache_key key,
const void *data, size_t size);
/**
* caller should call free() it when finished.
*/
void *
-disk_cache_get(struct disk_cache *cache, cache_key key, size_t *size);
+disk_cache_get(struct disk_cache *cache, const cache_key key, size_t *size);
/**
* Store the name \key within the cache, (without any associated data).
* evicted from the cache.
*/
void
-disk_cache_put_key(struct disk_cache *cache, cache_key key);
+disk_cache_put_key(struct disk_cache *cache, const cache_key key);
/**
* Test whether the name \key was previously recorded in the cache.
* disk_cache_has_key() to return true for the same key.
*/
bool
-disk_cache_has_key(struct disk_cache *cache, cache_key key);
+disk_cache_has_key(struct disk_cache *cache, const cache_key key);
#else
}
static inline void
-disk_cache_put(struct disk_cache *cache, cache_key key,
+disk_cache_put(struct disk_cache *cache, const cache_key key,
const void *data, size_t size)
{
return;
}
static inline void
-disk_cache_remove(struct disk_cache *cache, cache_key key)
+disk_cache_remove(struct disk_cache *cache, const cache_key key)
{
return;
}
static inline uint8_t *
-disk_cache_get(struct disk_cache *cache, cache_key key, size_t *size)
+disk_cache_get(struct disk_cache *cache, const cache_key key, size_t *size)
{
return NULL;
}
static inline void
-disk_cache_put_key(struct disk_cache *cache, cache_key key)
+disk_cache_put_key(struct disk_cache *cache, const cache_key key)
{
return;
}
static inline bool
-disk_cache_has_key(struct disk_cache *cache, cache_key key)
+disk_cache_has_key(struct disk_cache *cache, const cache_key key)
{
return false;
}