diff options
author | David McFarland <[email protected]> | 2018-10-23 21:51:09 -0300 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2018-10-26 14:49:22 +1100 |
commit | 07a00a8729d709a4c43c828c64242c226607f09a (patch) | |
tree | ec5fd349e3367c66aa3c5550eccffda1b853df0d /src/util | |
parent | 3d198926a487cefc0316c2c4d1ebb20ff8ebf535 (diff) |
util: Change remaining uint32 cache ids to sha1
After discussion with Timothy Arceri. disk_cache_get_function_identifier
was using only the first byte of the sha1 build-id. Replace
disk_cache_get_function_identifier with implementation from
radv_get_build_id. Instead of writing a uint32_t it now writes to a
mesa_sha1. All drivers using disk_cache_get_function_identifier are
updated accordingly.
Reviewed-by: Timothy Arceri <[email protected]>
Fixes: 83ea8dd99bb1 ("util: add disk_cache_get_function_identifier()")
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/disk_cache.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/util/disk_cache.h b/src/util/disk_cache.h index 3129de8ec9d..2a147cba615 100644 --- a/src/util/disk_cache.h +++ b/src/util/disk_cache.h @@ -33,6 +33,7 @@ #include <stdint.h> #include <stdbool.h> #include <sys/stat.h> +#include "util/mesa-sha1.h" #ifdef __cplusplus extern "C" { @@ -115,18 +116,21 @@ disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp) } static inline bool -disk_cache_get_function_identifier(void *ptr, uint32_t *id) +disk_cache_get_function_identifier(void *ptr, struct mesa_sha1 *ctx) { + uint32_t timestamp; + #ifdef HAVE_DL_ITERATE_PHDR const struct build_id_note *note = NULL; if ((note = build_id_find_nhdr_for_addr(ptr))) { - const uint8_t *id_sha1 = build_id_data(note); - assert(id_sha1); - *id = *id_sha1; - return true; + _mesa_sha1_update(ctx, build_id_data(note), build_id_length(note)); } else #endif - return disk_cache_get_function_timestamp(ptr, id); + if (disk_cache_get_function_timestamp(ptr, ×tamp)) { + _mesa_sha1_update(ctx, ×tamp, sizeof(timestamp)); + } else + return false; + return true; } #endif |