mmap-cache: add MMapFileDescriptor.cache accessor

Sometimes we want to reuse an existing MMapFileDescriptor's
cache, but it's a private struct.

This lets us access that pointer if necessary.
This commit is contained in:
Vito Caputo
2021-12-07 12:42:19 -08:00
parent fd9ac6c307
commit 176bf8b827
2 changed files with 8 additions and 1 deletions
+6
View File
@@ -591,3 +591,9 @@ void mmap_cache_fd_free(MMapFileDescriptor *f) {
free(f);
}
MMapCache* mmap_cache_fd_cache(MMapFileDescriptor *f) {
assert(f);
return f->cache;
}
+2 -1
View File
@@ -22,7 +22,8 @@ int mmap_cache_fd_get(
size_t size,
struct stat *st,
void **ret);
MMapFileDescriptor * mmap_cache_add_fd(MMapCache *m, int fd, int prot);
MMapFileDescriptor* mmap_cache_add_fd(MMapCache *m, int fd, int prot);
MMapCache* mmap_cache_fd_cache(MMapFileDescriptor *f);
void mmap_cache_fd_free(MMapFileDescriptor *f);
void mmap_cache_stats_log_debug(MMapCache *m);