summaryrefslogtreecommitdiffstats
path: root/src/util/disk_cache.h
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-11-13 16:54:38 +0100
committerMarek Olšák <[email protected]>2016-11-15 20:22:28 +0100
commita6ff2a3378636f4a261ea32c3dc870b0aeae3c03 (patch)
treed6cd9dee6c6d2e3c61609521955dd285cdf85825 /src/util/disk_cache.h
parent31727300e177b11c2b2b267838b59b090cb605d0 (diff)
util/disk_cache: use unambiguous naming
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/util/disk_cache.h')
-rw-r--r--src/util/disk_cache.h56
1 files changed, 29 insertions, 27 deletions
diff --git a/src/util/disk_cache.h b/src/util/disk_cache.h
index d4d939883e6..7e9cb809b59 100644
--- a/src/util/disk_cache.h
+++ b/src/util/disk_cache.h
@@ -36,6 +36,8 @@ extern "C" {
typedef uint8_t cache_key[CACHE_KEY_SIZE];
+struct disk_cache;
+
/* Provide inlined stub functions if the shader cache is disabled. */
#ifdef ENABLE_SHADER_CACHE
@@ -49,12 +51,12 @@ typedef uint8_t cache_key[CACHE_KEY_SIZE];
* This cache provides two distinct operations:
*
* o Storage and retrieval of arbitrary objects by cryptographic
- * name (or "key"). This is provided via cache_put() and
- * cache_get().
+ * name (or "key"). This is provided via disk_cache_put() and
+ * disk_cache_get().
*
* o The ability to store a key alone and check later whether the
- * key was previously stored. This is provided via cache_put_key()
- * and cache_has_key().
+ * key was previously stored. This is provided via disk_cache_put_key()
+ * and disk_cache_has_key().
*
* The put_key()/has_key() operations are conceptually identical to
* put()/get() with no data, but are provided separately to allow for
@@ -66,32 +68,32 @@ typedef uint8_t cache_key[CACHE_KEY_SIZE];
* names are computed). See mesa-sha1.h and _mesa_sha1_compute for
* assistance in computing SHA-1 signatures.
*/
-struct program_cache *
-cache_create(void);
+struct disk_cache *
+disk_cache_create(void);
/**
* Destroy a cache object, (freeing all associated resources).
*/
void
-cache_destroy(struct program_cache *cache);
+disk_cache_destroy(struct disk_cache *cache);
/**
* Store an item in the cache under the name \key.
*
- * The item can be retrieved later with cache_get(), (unless the item has
+ * The item can be retrieved later with disk_cache_get(), (unless the item has
* been evicted in the interim).
*
- * Any call to cache_put() may cause an existing, random item to be
+ * Any call to disk_cache_put() may cause an existing, random item to be
* evicted from the cache.
*/
void
-cache_put(struct program_cache *cache, cache_key key,
- const void *data, size_t size);
+disk_cache_put(struct disk_cache *cache, cache_key key,
+ const void *data, size_t size);
/**
* Retrieve an item previously stored in the cache with the name <key>.
*
- * The item must have been previously stored with a call to cache_put().
+ * The item must have been previously stored with a call to disk_cache_put().
*
* If \size is non-NULL, then, on successful return, it will be set to the
* size of the object.
@@ -102,67 +104,67 @@ cache_put(struct program_cache *cache, cache_key key,
* caller should call free() it when finished.
*/
void *
-cache_get(struct program_cache *cache, cache_key key, size_t *size);
+disk_cache_get(struct disk_cache *cache, cache_key key, size_t *size);
/**
* Store the name \key within the cache, (without any associated data).
*
- * Later this key can be checked with cache_has_key(), (unless the key
+ * Later this key can be checked with disk_cache_has_key(), (unless the key
* has been evicted in the interim).
*
* Any call to cache_record() may cause an existing, random key to be
* evicted from the cache.
*/
void
-cache_put_key(struct program_cache *cache, cache_key key);
+disk_cache_put_key(struct disk_cache *cache, cache_key key);
/**
* Test whether the name \key was previously recorded in the cache.
*
- * Return value: True if cache_put_key() was previously called with
+ * Return value: True if disk_cache_put_key() was previously called with
* \key, (and the key was not evicted in the interim).
*
- * Note: cache_has_key() will only return true for keys passed to
- * cache_put_key(). Specifically, a call to cache_put() will not cause
- * cache_has_key() to return true for the same key.
+ * Note: disk_cache_has_key() will only return true for keys passed to
+ * disk_cache_put_key(). Specifically, a call to disk_cache_put() will not cause
+ * disk_cache_has_key() to return true for the same key.
*/
bool
-cache_has_key(struct program_cache *cache, cache_key key);
+disk_cache_has_key(struct disk_cache *cache, cache_key key);
#else
-static inline struct program_cache *
-cache_create(void)
+static inline struct disk_cache *
+disk_cache_create(void)
{
return NULL;
}
static inline void
-cache_destroy(struct program_cache *cache) {
+disk_cache_destroy(struct disk_cache *cache) {
return;
}
static inline void
-cache_put(struct program_cache *cache, cache_key key,
+disk_cache_put(struct disk_cache *cache, cache_key key,
const void *data, size_t size)
{
return;
}
static inline uint8_t *
-cache_get(struct program_cache *cache, cache_key key, size_t *size)
+disk_cache_get(struct disk_cache *cache, cache_key key, size_t *size)
{
return NULL;
}
static inline void
-cache_put_key(struct program_cache *cache, cache_key key)
+disk_cache_put_key(struct disk_cache *cache, cache_key key)
{
return;
}
static inline bool
-cache_has_key(struct program_cache *cache, cache_key key)
+disk_cache_has_key(struct disk_cache *cache, cache_key key)
{
return false;
}