diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-09-30 08:46:16 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-10-02 03:52:45 +0200 |
commit | 45c0ecba2d502acb85405bf1330f1a466fc0cc3b (patch) | |
tree | 3d70a92e24cdeec01661c71b031d3fad4bf126ba /src/journal-remote | |
parent | journald: split-out closing journal files from managed_journal_file_open() (diff) | |
download | systemd-45c0ecba2d502acb85405bf1330f1a466fc0cc3b.tar.xz systemd-45c0ecba2d502acb85405bf1330f1a466fc0cc3b.zip |
journald: drop ManagedJournalFile
The ManagedJournalFile object is a trivial wrapper of JournalFile.
Let's drop it, and also drop 'managed_' prefix from the functions.
Diffstat (limited to 'src/journal-remote')
-rw-r--r-- | src/journal-remote/journal-remote-write.c | 22 | ||||
-rw-r--r-- | src/journal-remote/journal-remote-write.h | 2 | ||||
-rw-r--r-- | src/journal-remote/journal-remote.c | 4 |
3 files changed, 14 insertions, 14 deletions
diff --git a/src/journal-remote/journal-remote-write.c b/src/journal-remote/journal-remote-write.c index 158d015d89..f972b1fd47 100644 --- a/src/journal-remote/journal-remote-write.c +++ b/src/journal-remote/journal-remote-write.c @@ -7,13 +7,13 @@ #include "path-util.h" #include "stat-util.h" -static int do_rotate(ManagedJournalFile **f, MMapCache *m, JournalFileFlags file_flags) { +static int do_rotate(JournalFile **f, MMapCache *m, JournalFileFlags file_flags) { int r; - r = managed_journal_file_rotate(f, m, file_flags, UINT64_MAX, NULL); + r = journal_file_rotate(f, m, file_flags, UINT64_MAX, NULL); if (r < 0) { if (*f) - log_error_errno(r, "Failed to rotate %s: %m", (*f)->file->path); + log_error_errno(r, "Failed to rotate %s: %m", (*f)->path); else log_error_errno(r, "Failed to create rotated journal: %m"); } @@ -61,8 +61,8 @@ static Writer* writer_free(Writer *w) { return NULL; if (w->journal) { - log_debug("Closing journal file %s.", w->journal->file->path); - managed_journal_file_close(w->journal); + log_debug("Closing journal file %s.", w->journal->path); + journal_file_offline_close(w->journal); } if (w->server && w->hashmap_key) @@ -90,9 +90,9 @@ int writer_write(Writer *w, assert(w); assert(!iovw_isempty(iovw)); - if (journal_file_rotate_suggested(w->journal->file, 0, LOG_DEBUG)) { + if (journal_file_rotate_suggested(w->journal, 0, LOG_DEBUG)) { log_info("%s: Journal header limits reached or header out-of-date, rotating", - w->journal->file->path); + w->journal->path); r = do_rotate(&w->journal, w->mmap, file_flags); if (r < 0) return r; @@ -102,7 +102,7 @@ int writer_write(Writer *w, } r = journal_file_append_entry( - w->journal->file, + w->journal, ts, boot_id, iovw->iovec, @@ -118,19 +118,19 @@ int writer_write(Writer *w, } else if (r == -EBADMSG) return r; - log_debug_errno(r, "%s: Write failed, rotating: %m", w->journal->file->path); + log_debug_errno(r, "%s: Write failed, rotating: %m", w->journal->path); r = do_rotate(&w->journal, w->mmap, file_flags); if (r < 0) return r; else - log_debug("%s: Successfully rotated journal", w->journal->file->path); + log_debug("%s: Successfully rotated journal", w->journal->path); r = journal_directory_vacuum(w->output, w->metrics.max_use, w->metrics.n_max_files, 0, NULL, /* verbose = */ true); if (r < 0) return r; log_debug("Retrying write."); r = journal_file_append_entry( - w->journal->file, + w->journal, ts, boot_id, iovw->iovec, iovw->count, diff --git a/src/journal-remote/journal-remote-write.h b/src/journal-remote/journal-remote-write.h index 55513d9bf7..65ec2a599a 100644 --- a/src/journal-remote/journal-remote-write.h +++ b/src/journal-remote/journal-remote-write.h @@ -7,7 +7,7 @@ typedef struct RemoteServer RemoteServer; typedef struct Writer { - ManagedJournalFile *journal; + JournalFile *journal; JournalMetrics metrics; char *output; /* directory where we write, for vacuuming */ diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index 29da82e65a..16f74ef066 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -79,7 +79,7 @@ static int open_output(RemoteServer *s, Writer *w, const char* host) { assert_not_reached(); } - r = managed_journal_file_open_reliably( + r = journal_file_open_reliably( filename, O_RDWR|O_CREAT, s->file_flags, @@ -92,7 +92,7 @@ static int open_output(RemoteServer *s, Writer *w, const char* host) { if (r < 0) return log_error_errno(r, "Failed to open output journal %s: %m", filename); - log_debug("Opened output file %s", w->journal->file->path); + log_debug("Opened output file %s", w->journal->path); return 0; } |