chiark / gitweb /
journald: always pass first entry timestamp back from journal_file_verify()
authorLennart Poettering <lennart@poettering.net>
Mon, 24 Sep 2012 13:02:43 +0000 (15:02 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 24 Sep 2012 13:02:43 +0000 (15:02 +0200)
src/journal/journal-verify.c
src/journal/journal-verify.h
src/journal/journalctl.c

index 629b238..7d2e5eb 100644 (file)
@@ -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)
index a4633ad..e392ab6 100644 (file)
@@ -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);
index b9be0c6..62bdcb7 100644 (file)
@@ -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.");
                         }