#include "alloc-util.h"
#include "journal-remote.h"
-static int do_rotate(JournaldFile **f, bool compress, bool seal) {
- int r = journald_file_rotate(f, compress, UINT64_MAX, seal, NULL);
+static int do_rotate(JournaldFile **f, MMapCache *m, bool compress, bool seal) {
+ int r = journald_file_rotate(f, m, compress, UINT64_MAX, seal, NULL);
if (r < 0) {
if (*f)
log_error_errno(r, "Failed to rotate %s: %m", (*f)->file->path);
if (journal_file_rotate_suggested(w->journal->file, 0, LOG_DEBUG)) {
log_info("%s: Journal header limits reached or header out-of-date, rotating",
w->journal->file->path);
- r = do_rotate(&w->journal, compress, seal);
+ r = do_rotate(&w->journal, w->mmap, compress, seal);
if (r < 0)
return r;
}
return r;
log_debug_errno(r, "%s: Write failed, rotating: %m", w->journal->file->path);
- r = do_rotate(&w->journal, compress, seal);
+ r = do_rotate(&w->journal, w->mmap, compress, seal);
if (r < 0)
return r;
else
int journald_file_rotate(
JournaldFile **f,
+ MMapCache *mmap_cache,
bool compress,
uint64_t compress_threshold_bytes,
bool seal,
compress_threshold_bytes,
seal,
NULL, /* metrics */
- (*f)->file->mmap,
+ mmap_cache,
deferred_closes,
*f, /* template */
&new_file);
JournaldFile **ret);
JournaldFile* journald_file_initiate_close(JournaldFile *f, Set *deferred_closes);
-int journald_file_rotate(JournaldFile **f, bool compress, uint64_t compress_threshold_bytes, bool seal, Set *deferred_closes);
+int journald_file_rotate(JournaldFile **f, MMapCache *mmap_cache, bool compress, uint64_t compress_threshold_bytes, bool seal, Set *deferred_closes);
if (!*f)
return -EINVAL;
- r = journald_file_rotate(f, s->compress.enabled, s->compress.threshold_bytes, seal, s->deferred_closes);
+ r = journald_file_rotate(f, s->mmap, s->compress.enabled, s->compress.threshold_bytes, seal, s->deferred_closes);
if (r < 0) {
if (*f)
return log_error_errno(r, "Failed to rotate %s: %m", (*f)->file->path);
assert_se(journal_file_move_to_entry_by_seqnum(f->file, 10, DIRECTION_DOWN, &o, NULL) == 0);
- journald_file_rotate(&f, true, UINT64_MAX, true, NULL);
- journald_file_rotate(&f, true, UINT64_MAX, true, NULL);
+ journald_file_rotate(&f, NULL, true, UINT64_MAX, true, NULL);
+ journald_file_rotate(&f, NULL, true, UINT64_MAX, true, NULL);
(void) journald_file_close(f);
void journal_file_print_header(JournalFile *f);
int journal_file_archive(JournalFile *f, char **ret_previous_path);
+JournalFile* journal_initiate_close(JournalFile *f, Set *deferred_closes);
int journal_file_dispose(int dir_fd, const char *fname);
unsigned i;
bool found_last = false;
const char *tmp_dir = NULL;
+ MMapCache *m;
#if HAVE_GCRYPT
uint64_t last_tag = 0;
goto fail;
}
- cache_data_fd = mmap_cache_add_fd(f->mmap, data_fd, PROT_READ|PROT_WRITE);
+ m = mmap_cache_fd_cache(f->cache_fd);
+ cache_data_fd = mmap_cache_add_fd(m, data_fd, PROT_READ|PROT_WRITE);
if (!cache_data_fd) {
r = log_oom();
goto fail;
}
- cache_entry_fd = mmap_cache_add_fd(f->mmap, entry_fd, PROT_READ|PROT_WRITE);
+ cache_entry_fd = mmap_cache_add_fd(m, entry_fd, PROT_READ|PROT_WRITE);
if (!cache_entry_fd) {
r = log_oom();
goto fail;
}
- cache_entry_array_fd = mmap_cache_add_fd(f->mmap, entry_array_fd, PROT_READ|PROT_WRITE);
+ cache_entry_array_fd = mmap_cache_add_fd(m, entry_array_fd, PROT_READ|PROT_WRITE);
if (!cache_entry_array_fd) {
r = log_oom();
goto fail;