[systemd-commits] 2 commits - src/journal

Lennart Poettering lennart at kemper.freedesktop.org
Mon Sep 24 06:03:25 PDT 2012


 src/journal/journal-verify.c |    6 +++---
 src/journal/journal-verify.h |    2 +-
 src/journal/journalctl.c     |   16 ++++++++--------
 3 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 2a7b539a82a45202c0e990c45da25ccdc487d633
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Sep 24 15:02:43 2012 +0200

    journald: always pass first entry timestamp back from journal_file_verify()

diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c
index 629b238..7d2e5eb 100644
--- a/src/journal/journal-verify.c
+++ b/src/journal/journal-verify.c
@@ -666,7 +666,7 @@ static int verify_entry_array(
 int journal_file_verify(
                 JournalFile *f,
                 const char *key,
-                usec_t *first_validated, usec_t *last_validated, usec_t *last_contained,
+                usec_t *first_contained, usec_t *last_validated, usec_t *last_contained,
                 bool show_progress) {
         int r;
         Object *o;
@@ -1121,8 +1121,8 @@ int journal_file_verify(
         close_nointr_nofail(entry_fd);
         close_nointr_nofail(entry_array_fd);
 
-        if (first_validated)
-                *first_validated = last_sealed_realtime > 0 ? le64toh(f->header->head_entry_realtime) : 0;
+        if (first_contained)
+                *first_contained = le64toh(f->header->head_entry_realtime);
         if (last_validated)
                 *last_validated = last_sealed_realtime;
         if (last_contained)
diff --git a/src/journal/journal-verify.h b/src/journal/journal-verify.h
index a4633ad..e392ab6 100644
--- a/src/journal/journal-verify.h
+++ b/src/journal/journal-verify.h
@@ -23,4 +23,4 @@
 
 #include "journal-file.h"
 
-int journal_file_verify(JournalFile *f, const char *key, usec_t *first_validated, usec_t *last_validated, usec_t *last_contained, bool show_progress);
+int journal_file_verify(JournalFile *f, const char *key, usec_t *first_contained, usec_t *last_validated, usec_t *last_contained, bool show_progress);
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index b9be0c6..62bdcb7 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -684,14 +684,14 @@ static int verify(sd_journal *j) {
 
         HASHMAP_FOREACH(f, j->files, i) {
                 int k;
-                usec_t from, to, total;
+                usec_t first, validated, last;
 
 #ifdef HAVE_GCRYPT
                 if (!arg_verify_key && JOURNAL_HEADER_SEALED(f->header))
                         log_notice("Journal file %s has sealing enabled but verification key has not been passed using --verify-key=.", f->path);
 #endif
 
-                k = journal_file_verify(f, arg_verify_key, &from, &to, &total, true);
+                k = journal_file_verify(f, arg_verify_key, &first, &validated, &last, true);
                 if (k == -EINVAL) {
                         /* If the key was invalid give up right-away. */
                         return k;
@@ -703,14 +703,14 @@ static int verify(sd_journal *j) {
                         log_info("PASS: %s", f->path);
 
                         if (arg_verify_key && JOURNAL_HEADER_SEALED(f->header)) {
-                                if (from > 0) {
+                                if (validated > 0) {
                                         log_info("=> Validated from %s to %s, final %s entries not sealed.",
-                                                 format_timestamp(a, sizeof(a), from),
-                                                 format_timestamp(b, sizeof(b), to),
-                                                 format_timespan(c, sizeof(c), total > to ? total - to : 0));
-                                } else if (total > 0)
+                                                 format_timestamp(a, sizeof(a), first),
+                                                 format_timestamp(b, sizeof(b), validated),
+                                                 format_timespan(c, sizeof(c), last > validated ? last - validated : 0));
+                                } else if (last > 0)
                                         log_info("=> No sealing yet, %s of entries not sealed.",
-                                                 format_timespan(c, sizeof(c), total - f->header->head_entry_realtime));
+                                                 format_timespan(c, sizeof(c), last - first));
                                 else
                                         log_info("=> No sealing yet, no entries in file.");
                         }

commit 73726ac8983f46f9a39ad76c395e86d9bbfb470c
Author: Mirco Tischler <mt-ml at gmx.de>
Date:   Sat Sep 22 21:45:31 2012 +0200

    journalctl: print correct timespan in verify
    
    The old code used a timestamp to print a timespan for unsealed journalfiles,
    incorrectly showing things like 2230 days of unsealed entries. Print the timespan
    between the first and last entry instead.

diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index e491c27..b9be0c6 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -710,7 +710,7 @@ static int verify(sd_journal *j) {
                                                  format_timespan(c, sizeof(c), total > to ? total - to : 0));
                                 } else if (total > 0)
                                         log_info("=> No sealing yet, %s of entries not sealed.",
-                                                 format_timespan(c, sizeof(c), total));
+                                                 format_timespan(c, sizeof(c), total - f->header->head_entry_realtime));
                                 else
                                         log_info("=> No sealing yet, no entries in file.");
                         }



More information about the systemd-commits mailing list