diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2021-11-30 16:18:56 +0100 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2021-12-06 22:17:38 +0100 |
commit | 035b0f8fe8c1883b17d864f15f99846ab206099d (patch) | |
tree | b163a7dec28beb6a6c468f08d71b5bbe05faceff /src/journal/journald-server.h | |
parent | core: use correct level for CPU time log message (diff) | |
download | systemd-035b0f8fe8c1883b17d864f15f99846ab206099d.tar.xz systemd-035b0f8fe8c1883b17d864f15f99846ab206099d.zip |
journal: Introduce journald-file.c for journal file write related logic
Currently, all the logic related to writing journal files lives in
journal-file.c which is part of libsystemd (sd-journal). Because it's
part of libsystemd, we can't depend on any code from src/shared.
To allow using code from src/shared when writing journal files, let's
gradually move the write related logic from journal-file.c to
journald-file.c in src/journal. This directory is not part of libsystemd
and as such can use code from src/shared.
We can safely remove any journal write related logic from libsystemd as
it's not used by any public APIs in libsystemd.
This commit introduces the new file along with the JournaldFile struct
which wraps an instance of JournalFile. The goal is to gradually move
more functions from journal-file.c and fields from JournalFile to
journald-file.c and JournaldFile respectively.
This commit also modifies all call sites that write journal files to
use JournaldFile instead of JournalFile. All sd-journal tests that
write journal files are moved to src/journal so they can make use of
journald-file.c.
Because the deferred closes logic is only used by journald, we move it
out of journal-file.c as well. In journal_file_open(), we would wait for
any remaining deferred closes for the file we're about to open to complete
before continuing if the file was not newly created. In journald_file_open(),
we call this logic unconditionally since it stands that if a file is newly
created, it can't have any outstanding deferred closes.
No changes in behavior are introduced aside from the earlier execution
of waiting for any deferred closes to complete when opening a new journal
file.
Diffstat (limited to 'src/journal/journald-server.h')
-rw-r--r-- | src/journal/journald-server.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/journal/journald-server.h b/src/journal/journald-server.h index 5b7e59cada..92c78a0d74 100644 --- a/src/journal/journald-server.h +++ b/src/journal/journald-server.h @@ -10,7 +10,7 @@ typedef struct Server Server; #include "conf-parser.h" #include "hashmap.h" -#include "journal-file.h" +#include "journald-file.h" #include "journald-context.h" #include "journald-rate-limit.h" #include "journald-stream.h" @@ -89,8 +89,8 @@ struct Server { sd_event_source *watchdog_event_source; sd_event_source *idle_event_source; - JournalFile *runtime_journal; - JournalFile *system_journal; + JournaldFile *runtime_journal; + JournaldFile *system_journal; OrderedHashmap *user_journals; uint64_t seqnum; |