]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mmap-cache: add MMapFileDescriptor.cache accessor
authorVito Caputo <vcaputo@pengaru.com>
Thu, 25 Nov 2021 23:07:39 +0000 (15:07 -0800)
committerVito Caputo <vcaputo@pengaru.com>
Tue, 7 Dec 2021 20:42:19 +0000 (12:42 -0800)
Sometimes we want to reuse an existing MMapFileDescriptor's
cache, but it's a private struct.

This lets us access that pointer if necessary.

src/libsystemd/sd-journal/mmap-cache.c
src/libsystemd/sd-journal/mmap-cache.h

index 4ecaaf23887e2e923dea32674222db1fcbb88ad2..124ee3f8c1b948f6c2ac04da01c8872cc4b695a9 100644 (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;
+}
index 28f699dbd13c85fa41eb8e321ba395721eae30bc..907ebae843b6307399420d20224bb2af69306570 100644 (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);