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

This commit is contained in:
Lennart Poettering 2012-09-24 15:02:43 +02:00
parent 73726ac898
commit 2a7b539a82
3 changed files with 12 additions and 12 deletions

View File

@ -666,7 +666,7 @@ static int verify_entry_array(
int journal_file_verify( int journal_file_verify(
JournalFile *f, JournalFile *f,
const char *key, 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) { bool show_progress) {
int r; int r;
Object *o; Object *o;
@ -1121,8 +1121,8 @@ int journal_file_verify(
close_nointr_nofail(entry_fd); close_nointr_nofail(entry_fd);
close_nointr_nofail(entry_array_fd); close_nointr_nofail(entry_array_fd);
if (first_validated) if (first_contained)
*first_validated = last_sealed_realtime > 0 ? le64toh(f->header->head_entry_realtime) : 0; *first_contained = le64toh(f->header->head_entry_realtime);
if (last_validated) if (last_validated)
*last_validated = last_sealed_realtime; *last_validated = last_sealed_realtime;
if (last_contained) if (last_contained)

View File

@ -23,4 +23,4 @@
#include "journal-file.h" #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);

View File

@ -684,14 +684,14 @@ static int verify(sd_journal *j) {
HASHMAP_FOREACH(f, j->files, i) { HASHMAP_FOREACH(f, j->files, i) {
int k; int k;
usec_t from, to, total; usec_t first, validated, last;
#ifdef HAVE_GCRYPT #ifdef HAVE_GCRYPT
if (!arg_verify_key && JOURNAL_HEADER_SEALED(f->header)) 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); log_notice("Journal file %s has sealing enabled but verification key has not been passed using --verify-key=.", f->path);
#endif #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 (k == -EINVAL) {
/* If the key was invalid give up right-away. */ /* If the key was invalid give up right-away. */
return k; return k;
@ -703,14 +703,14 @@ static int verify(sd_journal *j) {
log_info("PASS: %s", f->path); log_info("PASS: %s", f->path);
if (arg_verify_key && JOURNAL_HEADER_SEALED(f->header)) { 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.", log_info("=> Validated from %s to %s, final %s entries not sealed.",
format_timestamp(a, sizeof(a), from), format_timestamp(a, sizeof(a), first),
format_timestamp(b, sizeof(b), to), format_timestamp(b, sizeof(b), validated),
format_timespan(c, sizeof(c), total > to ? total - to : 0)); format_timespan(c, sizeof(c), last > validated ? last - validated : 0));
} else if (total > 0) } else if (last > 0)
log_info("=> No sealing yet, %s of entries not sealed.", 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 else
log_info("=> No sealing yet, no entries in file."); log_info("=> No sealing yet, no entries in file.");
} }