disk_cache: move munmap into an OS specific helper

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197>
This commit is contained in:
Timothy Arceri 2020-07-31 14:29:12 +10:00 committed by Marge Bot
parent 889356e731
commit e1236470dc
3 changed files with 10 additions and 1 deletions

View File

@ -264,7 +264,7 @@ disk_cache_destroy(struct disk_cache *cache)
if (cache && !cache->path_init_failed) {
util_queue_finish(&cache->cache_queue);
util_queue_destroy(&cache->cache_queue);
munmap(cache->index_mmap, cache->index_mmap_size);
disk_cache_destroy_mmap(cache);
}
ralloc_free(cache);

View File

@ -249,6 +249,12 @@ path_fail:
return mapped;
}
void
disk_cache_destroy_mmap(struct disk_cache *cache)
{
munmap(cache->index_mmap, cache->index_mmap_size);
}
#endif
#endif /* ENABLE_SHADER_CACHE */

View File

@ -83,6 +83,9 @@ bool
disk_cache_mmap_cache_index(void *mem_ctx, struct disk_cache *cache,
char *path);
void
disk_cache_destroy_mmap(struct disk_cache *cache);
#endif
#endif /* DISK_CACHE_OS_H */