util/disk_cache: hash pointer size and gpu name into cache keys

This allows to get rid of the arch and gpu name directories.

v2: (Timothy Arceri) don't use an opaque data type to store
    pointer size and gpu name.

v3: (Timothy Arceri) use blob to store driver keys just make sure
    to store null terminator for strings, and make sure blob is
    defined by disk_cache and not it's users.

v4: (Timothy Arceri) fix typo, and make ptr_size a uint8_t.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
Grazvydas Ignotas
2017-03-16 01:09:31 +02:00
committed by Timothy Arceri
parent feb716239e
commit 5136c09e70
3 changed files with 17 additions and 54 deletions
+2 -11
View File
@@ -181,16 +181,11 @@ test_disk_cache_create(void)
expect_null(cache, "disk_cache_create with XDG_CACHE_HOME set with"
"a non-existing parent directory");
/* Create string with expected directory hierarchy */
char expected_dir_h[255];
sprintf(expected_dir_h, "%s%s%s", CACHE_TEST_TMP "/xdg-cache-home/mesa/",
get_arch_bitness_str(), "/test");
mkdir(CACHE_TEST_TMP, 0755);
cache = disk_cache_create("test", "make_check");
expect_non_null(cache, "disk_cache_create with XDG_CACHE_HOME set");
check_directories_created(expected_dir_h);
check_directories_created(CACHE_TEST_TMP "/xdg-cache-home/mesa");
disk_cache_destroy(cache);
@@ -203,15 +198,11 @@ test_disk_cache_create(void)
expect_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DIR set with"
"a non-existing parent directory");
sprintf(expected_dir_h, "%s%s%s", CACHE_TEST_TMP
"/mesa-glsl-cache-dir/mesa/", get_arch_bitness_str(),
"/test");
mkdir(CACHE_TEST_TMP, 0755);
cache = disk_cache_create("test", "make_check");
expect_non_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DIR set");
check_directories_created(expected_dir_h);
check_directories_created(CACHE_TEST_TMP "/mesa-glsl-cache-dir/mesa");
disk_cache_destroy(cache);
}