[systemd-commits] 7 commits - man/systemd-journald.service.xml src/journal src/shared src/systemctl src/systemd TODO

Lennart Poettering lennart at kemper.freedesktop.org
Sat Jun 16 15:03:28 PDT 2012


 TODO                               |    6 --
 man/systemd-journald.service.xml   |   33 ++++++++++++
 src/journal/journal-def.h          |   24 +++++++-
 src/journal/journal-file.c         |  101 ++++++++++++++++++++++++++++++++-----
 src/journal/journal-file.h         |    3 +
 src/journal/journalctl.c           |   20 +++++++
 src/journal/journald.c             |   11 +++-
 src/journal/libsystemd-journal.sym |    6 ++
 src/journal/sd-journal.c           |   78 ++++++++++++++++++++++++++++
 src/shared/logs-show.c             |   23 ++++++++
 src/shared/logs-show.h             |    3 -
 src/systemctl/systemctl.c          |    2 
 src/systemd/sd-journal.h           |    3 +
 13 files changed, 287 insertions(+), 26 deletions(-)

New commits:
commit 10b6f904cc58c5a725f123e17819516eca606a3e
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Jun 9 15:20:42 2012 +0200

    journal: fix monotonic seeking

diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 73420d9..db64a32 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -1400,11 +1400,11 @@ int journal_file_move_to_entry_by_monotonic(
                 Object **ret,
                 uint64_t *offset) {
 
-        char t[8+32+1] = "_BOOT_ID=";
+        char t[9+32+1] = "_BOOT_ID=";
         Object *o;
         int r;
 
-        sd_id128_to_string(boot_id, t + 8);
+        sd_id128_to_string(boot_id, t + 9);
 
         r = journal_file_find_data_object(f, t, strlen(t), &o, NULL);
         if (r < 0)

commit ba6b3039531a70466dd955c6faa9bf521b3dfbac
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Jun 9 15:04:14 2012 +0200

    journal: rotate on SIGUSR2

diff --git a/TODO b/TODO
index 1f7f974..7360681 100644
--- a/TODO
+++ b/TODO
@@ -163,8 +163,6 @@ Features:
 
 * figure out whether we should leave dbus around during shutdown
 
-* add interface to allow immediate rotation of the journal, and even flushing.
-
 * dbus: in fedora, make the machine a symlink to /etc/machine-id
 
 * journald: reuse XZ context
@@ -199,14 +197,10 @@ Features:
 
 * systemctl status: show coredumps
 
-* systemctl status: show whether journal was rotated since service started
-
 * save coredump in Windows/Mozilla minidump format
 
 * support crash reporting operation modes (https://live.gnome.org/GnomeOS/Design/Whiteboards/ProblemReporting)
 
-* journal: allow per-entry control on /var vs. /run (think incognito browser mode)
-
 * clean up session cgroups that remain after logout (think sshd), but eventually run empty
 
 * support "systemctl stop foobar at .service" to stop all units matching a certain template
diff --git a/man/systemd-journald.service.xml b/man/systemd-journald.service.xml
index 5d39c50..8ee0cf4 100644
--- a/man/systemd-journald.service.xml
+++ b/man/systemd-journald.service.xml
@@ -98,6 +98,39 @@
         </refsect1>
 
         <refsect1>
+                <title>Signals</title>
+
+                <variablelist>
+                        <varlistentry>
+                                <term>SIGUSR1</term>
+
+                                <listitem><para>Request that journal
+                                data from <filename>/run/</filename>
+                                is flushed to
+                                <filename>/var/</filename> in order to
+                                make it persistent (if this is
+                                enabled). This may be used after
+                                <filename>/var/</filename> is mounted,
+                                but is generally not required since
+                                the first journal write when
+                                <filename>/var/</filename> becomes
+                                writable triggers the flushing
+                                anyway.</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
+                                <term>SIGUSR2</term>
+
+                                <listitem><para>Request immediate
+                                rotation of the journal
+                                files.</para></listitem>
+                        </varlistentry>
+                </variablelist>
+        </refsect1>
+
+
+
+        <refsect1>
                 <title>See Also</title>
                 <para>
                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 795b235..1bf25e8 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -2143,6 +2143,7 @@ static int server_flush_proc_kmsg(Server *s) {
 
 static int process_event(Server *s, struct epoll_event *ev) {
         assert(s);
+        assert(ev);
 
         if (ev->data.fd == s->signal_fd) {
                 struct signalfd_siginfo sfsi;
@@ -2167,7 +2168,13 @@ static int process_event(Server *s, struct epoll_event *ev) {
 
                 if (sfsi.ssi_signo == SIGUSR1) {
                         server_flush_to_var(s);
-                        return 0;
+                        return 1;
+                }
+
+                if (sfsi.ssi_signo == SIGUSR2) {
+                        server_rotate(s);
+                        server_vacuum(s);
+                        return 1;
                 }
 
                 log_debug("Received SIG%s", signal_to_string(sfsi.ssi_signo));
@@ -2558,7 +2565,7 @@ static int open_signalfd(Server *s) {
         assert(s);
 
         assert_se(sigemptyset(&mask) == 0);
-        sigset_add_many(&mask, SIGINT, SIGTERM, SIGUSR1, -1);
+        sigset_add_many(&mask, SIGINT, SIGTERM, SIGUSR1, SIGUSR2, -1);
         assert_se(sigprocmask(SIG_SETMASK, &mask, NULL) == 0);
 
         s->signal_fd = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC);

commit 38a6db16dc6f3ac6e6f497c90e51fb9904d785ba
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Jun 9 15:03:22 2012 +0200

    journal: fix SD_JOURNAL_SYSTEM_ONLY flag

diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 5ed8c3f..9c6cbaa 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -943,7 +943,8 @@ static int add_file(sd_journal *j, const char *prefix, const char *dir, const ch
         assert(filename);
 
         if ((j->flags & SD_JOURNAL_SYSTEM_ONLY) &&
-            !startswith(filename, "system.journal"))
+            !(streq(filename, "system.journal") ||
+             (startswith(filename, "system@") && endswith(filename, ".journal"))))
                 return 0;
 
         if (dir)

commit 089842938dd0f4080084044bb9a1a3b00137926a
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Jun 9 10:32:38 2012 +0200

    journal: expose and make use of cutoff times of journal
    
    This helps explaining when the log output of "systemctl status" is
    incomplete because the logs got rotated since the service was started.

diff --git a/src/journal/journal-def.h b/src/journal/journal-def.h
index 86aef8f..b30ae79 100644
--- a/src/journal/journal-def.h
+++ b/src/journal/journal-def.h
@@ -160,8 +160,8 @@ _packed_ struct Header {
         uint8_t state;
         uint8_t reserved[7];
         sd_id128_t file_id;
-        sd_id128_t machine_id;
-        sd_id128_t boot_id;
+        sd_id128_t machine_id; /* last writer */
+        sd_id128_t boot_id;    /* last writer */
         sd_id128_t seqnum_id;
         le64_t header_size;
         le64_t arena_size;
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 9cec140..73420d9 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -183,6 +183,7 @@ static int journal_file_verify_header(JournalFile *f) {
 
                 if (state == STATE_ONLINE)
                         log_debug("Journal file %s is already online. Assuming unclean closing. Ignoring.", f->path);
+                        /* FIXME: immediately rotate */
                 else if (state == STATE_ARCHIVED)
                         return -ESHUTDOWN;
                 else if (state != STATE_OFFLINE)
@@ -2284,3 +2285,74 @@ void journal_default_metrics(JournalMetrics *m, int fd) {
                  format_bytes(c, sizeof(c), m->min_size),
                  format_bytes(d, sizeof(d), m->keep_free));
 }
+
+int journal_file_get_cutoff_realtime_usec(JournalFile *f, usec_t *from, usec_t *to) {
+        Object *o;
+        int r;
+
+        assert(f);
+        assert(from || to);
+
+        if (from) {
+                r = journal_file_next_entry(f, NULL, 0, DIRECTION_DOWN, &o, NULL);
+                if (r <= 0)
+                        return r;
+
+                *from = le64toh(o->entry.realtime);
+        }
+
+        if (to) {
+                r = journal_file_next_entry(f, NULL, 0, DIRECTION_UP, &o, NULL);
+                if (r <= 0)
+                        return r;
+
+                *to = le64toh(o->entry.realtime);
+        }
+
+        return 1;
+}
+
+int journal_file_get_cutoff_monotonic_usec(JournalFile *f, sd_id128_t boot_id, usec_t *from, usec_t *to) {
+        char t[9+32+1] = "_BOOT_ID=";
+        Object *o;
+        uint64_t p;
+        int r;
+
+        assert(f);
+        assert(from || to);
+
+        sd_id128_to_string(boot_id, t + 9);
+
+        r = journal_file_find_data_object(f, t, strlen(t), &o, &p);
+        if (r <= 0)
+                return r;
+
+        if (le64toh(o->data.n_entries) <= 0)
+                return 0;
+
+        if (from) {
+                r = journal_file_move_to_object(f, OBJECT_ENTRY, le64toh(o->data.entry_offset), &o);
+                if (r < 0)
+                        return r;
+
+                *from = le64toh(o->entry.monotonic);
+        }
+
+        if (to) {
+                r = journal_file_move_to_object(f, OBJECT_DATA, p, &o);
+                if (r < 0)
+                        return r;
+
+                r = generic_array_get_plus_one(f,
+                                               le64toh(o->data.entry_offset),
+                                               le64toh(o->data.entry_array_offset),
+                                               le64toh(o->data.n_entries)-1,
+                                               &o, NULL);
+                if (r <= 0)
+                        return r;
+
+                *to = le64toh(o->entry.monotonic);
+        }
+
+        return 1;
+}
diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h
index aeb6d46..a9925c0 100644
--- a/src/journal/journal-file.h
+++ b/src/journal/journal-file.h
@@ -125,4 +125,7 @@ void journal_file_post_change(JournalFile *f);
 
 void journal_default_metrics(JournalMetrics *m, int fd);
 
+int journal_file_get_cutoff_realtime_usec(JournalFile *f, usec_t *from, usec_t *to);
+int journal_file_get_cutoff_monotonic_usec(JournalFile *f, sd_id128_t boot, usec_t *from, usec_t *to);
+
 #endif
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 9d44032..e9d918a 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -281,6 +281,26 @@ int main(int argc, char *argv[]) {
                 goto finish;
         }
 
+        if (!arg_quiet) {
+                usec_t start, end;
+                char start_buf[FORMAT_TIMESTAMP_MAX], end_buf[FORMAT_TIMESTAMP_MAX];
+
+                r = sd_journal_get_cutoff_realtime_usec(j, &start, &end);
+                if (r < 0) {
+                        log_error("Failed to get cutoff: %s", strerror(-r));
+                        goto finish;
+                }
+
+                if (r > 0) {
+                        if (arg_follow)
+                                printf("Logs begin at %s.\n", format_timestamp(start_buf, sizeof(start_buf), start));
+                        else
+                                printf("Logs begin at %s, end at %s.\n",
+                                       format_timestamp(start_buf, sizeof(start_buf), start),
+                                       format_timestamp(end_buf, sizeof(end_buf), end));
+                }
+        }
+
         if (arg_lines >= 0) {
                 r = sd_journal_seek_tail(j);
                 if (r < 0) {
diff --git a/src/journal/libsystemd-journal.sym b/src/journal/libsystemd-journal.sym
index 74bd298..d291084 100644
--- a/src/journal/libsystemd-journal.sym
+++ b/src/journal/libsystemd-journal.sym
@@ -51,3 +51,9 @@ global:
         sd_journal_send_with_location;
         sd_journal_sendv_with_location;
 } LIBSYSTEMD_JOURNAL_38;
+
+LIBSYSTEMD_JOURNAL_184 {
+global:
+        sd_journal_get_cutoff_realtime_usec;
+        sd_journal_get_cutoff_monotonic_usec;
+} LIBSYSTEMD_JOURNAL_183;
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 9f46f5c..5ed8c3f 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -1620,6 +1620,81 @@ _public_ int sd_journal_process(sd_journal *j) {
         }
 }
 
+_public_ int sd_journal_get_cutoff_realtime_usec(sd_journal *j, uint64_t *from, uint64_t *to) {
+        Iterator i;
+        JournalFile *f;
+        bool first = true;
+        int r;
+
+        if (!j)
+                return -EINVAL;
+        if (!from && !to)
+                return -EINVAL;
+
+        HASHMAP_FOREACH(f, j->files, i) {
+                usec_t fr, t;
+
+                r = journal_file_get_cutoff_realtime_usec(f, &fr, &t);
+                if (r < 0)
+                        return r;
+                if (r == 0)
+                        continue;
+
+                if (first) {
+                        if (from)
+                                *from = fr;
+                        if (to)
+                                *to = t;
+                        first = false;
+                } else {
+                        if (from)
+                                *from = MIN(fr, *from);
+                        if (to)
+                                *to = MIN(t, *to);
+                }
+        }
+
+        return first ? 0 : 1;
+}
+
+_public_ int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, sd_id128_t boot_id, uint64_t *from, uint64_t *to) {
+        Iterator i;
+        JournalFile *f;
+        bool first = true;
+        int r;
+
+        if (!j)
+                return -EINVAL;
+        if (!from && !to)
+                return -EINVAL;
+
+        HASHMAP_FOREACH(f, j->files, i) {
+                usec_t fr, t;
+
+                r = journal_file_get_cutoff_monotonic_usec(f, boot_id, &fr, &t);
+                if (r < 0)
+                        return r;
+                if (r == 0)
+                        continue;
+
+                if (first) {
+                        if (from)
+                                *from = fr;
+                        if (to)
+                                *to = t;
+                        first = false;
+                } else {
+                        if (from)
+                                *from = MIN(fr, *from);
+                        if (to)
+                                *to = MIN(t, *to);
+                }
+        }
+
+        return first ? 0 : 1;
+}
+
+
 /* _public_ int sd_journal_query_unique(sd_journal *j, const char *field) { */
 /*         if (!j) */
 /*                 return -EINVAL; */
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 4c59ca3..697b5cf 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -551,7 +551,8 @@ int show_journal_by_unit(
                 usec_t not_before,
                 unsigned how_many,
                 bool show_all,
-                bool follow) {
+                bool follow,
+                bool warn_cutoff) {
 
         char *m = NULL;
         sd_journal *j = NULL;
@@ -639,6 +640,26 @@ int show_journal_by_unit(
                                 goto finish;
                 }
 
+                if (warn_cutoff && line < how_many && not_before > 0) {
+                        sd_id128_t boot_id;
+                        usec_t cutoff;
+
+                        /* Check whether the cutoff line is too early */
+
+                        r = sd_id128_get_boot(&boot_id);
+                        if (r < 0)
+                                goto finish;
+
+                        r = sd_journal_get_cutoff_monotonic_usec(j, boot_id, &cutoff, NULL);
+                        if (r < 0)
+                                goto finish;
+
+                        if (not_before < cutoff)
+                                printf("Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.\n");
+
+                        warn_cutoff = false;
+                }
+
                 if (!follow)
                         break;
 
diff --git a/src/shared/logs-show.h b/src/shared/logs-show.h
index 94caed5..f8a9d40 100644
--- a/src/shared/logs-show.h
+++ b/src/shared/logs-show.h
@@ -48,7 +48,8 @@ int show_journal_by_unit(
                 usec_t not_before,
                 unsigned how_many,
                 bool show_all,
-                bool follow);
+                bool follow,
+                bool warn_cutoff);
 
 const char* output_mode_to_string(OutputMode m);
 OutputMode output_mode_from_string(const char *s);
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 133a27c..ad0cd17 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -2554,7 +2554,7 @@ static void print_status_info(UnitStatusInfo *i) {
 
         if (i->id && arg_transport != TRANSPORT_SSH) {
                 printf("\n");
-                show_journal_by_unit(i->id, arg_output, 0, i->inactive_exit_timestamp_monotonic, arg_lines, arg_all, arg_follow);
+                show_journal_by_unit(i->id, arg_output, 0, i->inactive_exit_timestamp_monotonic, arg_lines, arg_all, arg_follow, !arg_quiet);
         }
 
         if (i->need_daemon_reload)
diff --git a/src/systemd/sd-journal.h b/src/systemd/sd-journal.h
index 72c23ba..85f8604 100644
--- a/src/systemd/sd-journal.h
+++ b/src/systemd/sd-journal.h
@@ -97,6 +97,9 @@ int sd_journal_seek_cursor(sd_journal *j, const char *cursor);
 
 int sd_journal_get_cursor(sd_journal *j, char **cursor);
 
+int sd_journal_get_cutoff_realtime_usec(sd_journal *j, uint64_t *from, uint64_t *to);
+int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, const sd_id128_t boot_id, uint64_t *from, uint64_t *to);
+
 /* int sd_journal_query_unique(sd_journal *j, const char *field);      /\* missing *\/ */
 /* int sd_journal_enumerate_unique(sd_journal *j, const void **data, size_t *l); /\* missing *\/ */
 /* void sd_journal_restart_unique(sd_journal *j);                      /\* missing *\/ */

commit 8db4213e7b38ebc54bfdc7215991cc23b9580e3a
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Jun 9 10:30:44 2012 +0200

    journal: correct list link up on hash collisions

diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 8f301b8..9cec140 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -596,7 +596,7 @@ static int journal_file_link_data(JournalFile *f, Object *o, uint64_t offset, ui
         o->data.n_entries = 0;
 
         h = hash % (le64toh(f->header->data_hash_table_size) / sizeof(HashItem));
-        p = le64toh(f->data_hash_table[h].head_hash_offset);
+        p = le64toh(f->data_hash_table[h].tail_hash_offset);
         if (p == 0) {
                 /* Only entry in the hash table is easy */
                 f->data_hash_table[h].head_hash_offset = htole64(offset);

commit 8144056fa63291e5b25d91a48cd77b91e845eabf
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Jun 5 20:45:54 2012 +0200

    journal: add basic object definition for signatures

diff --git a/src/journal/journal-def.h b/src/journal/journal-def.h
index 53f1e22..86aef8f 100644
--- a/src/journal/journal-def.h
+++ b/src/journal/journal-def.h
@@ -29,13 +29,17 @@
 #include "macro.h"
 
 typedef struct Header Header;
+
 typedef struct ObjectHeader ObjectHeader;
 typedef union Object Object;
+
 typedef struct DataObject DataObject;
 typedef struct FieldObject FieldObject;
 typedef struct EntryObject EntryObject;
 typedef struct HashTableObject HashTableObject;
 typedef struct EntryArrayObject EntryArrayObject;
+typedef struct SignatureObject SignatureObject;
+
 typedef struct EntryItem EntryItem;
 typedef struct HashItem HashItem;
 
@@ -48,6 +52,7 @@ enum {
         OBJECT_DATA_HASH_TABLE,
         OBJECT_FIELD_HASH_TABLE,
         OBJECT_ENTRY_ARRAY,
+        OBJECT_SIGNATURE,
         _OBJECT_TYPE_MAX
 };
 
@@ -115,6 +120,14 @@ _packed_ struct EntryArrayObject {
         le64_t items[];
 };
 
+#define SIGNATURE_LENGTH 160
+
+_packed_ struct SignatureObject {
+        ObjectHeader object;
+        le64_t from;
+        uint8_t signature[SIGNATURE_LENGTH];
+};
+
 union Object {
         ObjectHeader object;
         DataObject data;
@@ -122,6 +135,7 @@ union Object {
         EntryObject entry;
         HashTableObject hash_table;
         EntryArrayObject entry_array;
+        SignatureObject signature;
 };
 
 enum {
@@ -135,6 +149,10 @@ enum {
         HEADER_INCOMPATIBLE_COMPRESSED = 1
 };
 
+enum {
+        HEADER_COMPATIBLE_SIGNED = 1
+};
+
 _packed_ struct Header {
         uint8_t signature[8]; /* "LPKSHHRH" */
         uint32_t compatible_flags;
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index bbe00ab..8f301b8 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -1702,6 +1702,10 @@ void journal_file_dump(JournalFile *f) {
                 case OBJECT_ENTRY_ARRAY:
                         printf("Type: OBJECT_ENTRY_ARRAY\n");
                         break;
+
+                case OBJECT_SIGNATURE:
+                        printf("Type: OBJECT_SIGNATURE\n");
+                        break;
                 }
 
                 if (o->object.flags & OBJECT_COMPRESSED)

commit 23b0b2b2647d3f0f3fd0219c877d6233b4585421
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Jun 5 20:32:55 2012 +0200

    journal: replace arena offset by header size

diff --git a/src/journal/journal-def.h b/src/journal/journal-def.h
index d117445..53f1e22 100644
--- a/src/journal/journal-def.h
+++ b/src/journal/journal-def.h
@@ -145,7 +145,7 @@ _packed_ struct Header {
         sd_id128_t machine_id;
         sd_id128_t boot_id;
         sd_id128_t seqnum_id;
-        le64_t arena_offset;
+        le64_t header_size;
         le64_t arena_size;
         le64_t data_hash_table_offset;     /* for looking up data objects */
         le64_t data_hash_table_size;
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 1f82191..bbe00ab 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -99,7 +99,7 @@ static int journal_file_init_header(JournalFile *f, JournalFile *template) {
 
         zero(h);
         memcpy(h.signature, signature, 8);
-        h.arena_offset = htole64(ALIGN64(sizeof(h)));
+        h.header_size = htole64(ALIGN64(sizeof(h)));
 
         r = sd_id128_randomize(&h.file_id);
         if (r < 0)
@@ -161,7 +161,10 @@ static int journal_file_verify_header(JournalFile *f) {
                 return -EPROTONOSUPPORT;
 #endif
 
-        if ((uint64_t) f->last_stat.st_size < (le64toh(f->header->arena_offset) + le64toh(f->header->arena_size)))
+        if (f->header->header_size != htole64(ALIGN64(sizeof(*(f->header)))))
+                return -EBADMSG;
+
+        if ((uint64_t) f->last_stat.st_size < (le64toh(f->header->header_size) + le64toh(f->header->arena_size)))
                 return -ENODATA;
 
         if (f->writable) {
@@ -200,12 +203,12 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
          * ourselves */
 
         old_size =
-                le64toh(f->header->arena_offset) +
+                le64toh(f->header->header_size) +
                 le64toh(f->header->arena_size);
 
         new_size = PAGE_ALIGN(offset + size);
-        if (new_size < le64toh(f->header->arena_offset))
-                new_size = le64toh(f->header->arena_offset);
+        if (new_size < le64toh(f->header->header_size))
+                new_size = le64toh(f->header->header_size);
 
         if (new_size <= old_size)
                 return 0;
@@ -243,7 +246,7 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
         if (fstat(f->fd, &f->last_stat) < 0)
                 return -errno;
 
-        f->header->arena_size = htole64(new_size - le64toh(f->header->arena_offset));
+        f->header->arena_size = htole64(new_size - le64toh(f->header->header_size));
 
         return 0;
 }
@@ -457,7 +460,7 @@ static int journal_file_append_object(JournalFile *f, int type, uint64_t size, O
 
         p = le64toh(f->header->tail_object_offset);
         if (p == 0)
-                p = le64toh(f->header->arena_offset);
+                p = le64toh(f->header->header_size);
         else {
                 r = journal_file_move_to_object(f, -1, p, &tail);
                 if (r < 0)
@@ -1665,7 +1668,7 @@ void journal_file_dump(JournalFile *f) {
                (unsigned long) le64toh(f->header->n_objects),
                (unsigned long) le64toh(f->header->n_entries));
 
-        p = le64toh(f->header->arena_offset);
+        p = le64toh(f->header->header_size);
         while (p != 0) {
                 r = journal_file_move_to_object(f, -1, p, &o);
                 if (r < 0)



More information about the systemd-commits mailing list