summaryrefslogtreecommitdiff
path: root/src/journal/journal-file.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-08-14 22:02:24 +0200
committerLennart Poettering <lennart@poettering.net>2012-08-16 17:10:56 +0200
commit16e9f408fa9a9626059bdd6c89dc175e06b9e976 (patch)
tree89a6730a2f044626c9ca67d278dd6ac6a844aec3 /src/journal/journal-file.h
parent405053fafa88022c68e7adf04c91a56c1cde7dd8 (diff)
journal: implement generic sharable mmap caching logic
instead of having one simple per-file cache implement an more comprehensive one that works for multiple files and can actually maintain multiple maps per file and per object type.
Diffstat (limited to 'src/journal/journal-file.h')
-rw-r--r--src/journal/journal-file.h24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h
index a16c8ffc3e..11a1c7d641 100644
--- a/src/journal/journal-file.h
+++ b/src/journal/journal-file.h
@@ -32,24 +32,7 @@
#include "sparse-endian.h"
#include "journal-def.h"
#include "util.h"
-
-typedef struct Window {
- void *ptr;
- uint64_t offset;
- uint64_t size;
-} Window;
-
-enum {
- WINDOW_UNKNOWN = OBJECT_UNUSED,
- WINDOW_DATA = OBJECT_DATA,
- WINDOW_ENTRY = OBJECT_ENTRY,
- WINDOW_DATA_HASH_TABLE = OBJECT_DATA_HASH_TABLE,
- WINDOW_FIELD_HASH_TABLE = OBJECT_FIELD_HASH_TABLE,
- WINDOW_ENTRY_ARRAY = OBJECT_ENTRY_ARRAY,
- WINDOW_TAG = OBJECT_TAG,
- WINDOW_HEADER,
- _WINDOW_MAX
-};
+#include "mmap-cache.h"
typedef struct JournalMetrics {
uint64_t max_use;
@@ -76,11 +59,10 @@ typedef struct JournalFile {
HashItem *data_hash_table;
HashItem *field_hash_table;
- Window windows[_WINDOW_MAX];
-
uint64_t current_offset;
JournalMetrics metrics;
+ MMapCache *mmap;
#ifdef HAVE_XZ
void *compress_buffer;
@@ -108,6 +90,7 @@ int journal_file_open(
bool compress,
bool authenticate,
JournalMetrics *metrics,
+ MMapCache *mmap,
JournalFile *template,
JournalFile **ret);
@@ -120,6 +103,7 @@ int journal_file_open_reliably(
bool compress,
bool authenticate,
JournalMetrics *metrics,
+ MMapCache *mmap,
JournalFile *template,
JournalFile **ret);