summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-08-17 02:29:20 +0200
committerLennart Poettering <lennart@poettering.net>2012-08-17 02:29:20 +0200
commit3223f44f2312d01113a9c51f898528041cc7bd8d (patch)
tree5cfe8995ea210281b552f7526563ef98018f4030
parente627440b41bb0284e4892f7aa9d84c77972487e2 (diff)
journal: show new header fields in header dump
-rw-r--r--src/journal/journal-file.c25
-rw-r--r--src/journal/journal-verify.c2
-rw-r--r--src/journal/test-journal-verify.c3
3 files changed, 20 insertions, 10 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 76bf0e53ca..4d7a6ff17d 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -1885,21 +1885,21 @@ void journal_file_print_header(JournalFile *f) {
"Arena size: %llu\n"
"Data Hash Table Size: %llu\n"
"Field Hash Table Size: %llu\n"
- "Objects: %llu\n"
- "Entry Objects: %llu\n"
"Rotate Suggested: %s\n"
"Head Sequential Number: %llu\n"
"Tail Sequential Number: %llu\n"
"Head Realtime Timestamp: %s\n"
- "Tail Realtime Timestamp: %s\n",
+ "Tail Realtime Timestamp: %s\n"
+ "Objects: %llu\n"
+ "Entry Objects: %llu\n",
f->path,
sd_id128_to_string(f->header->file_id, a),
sd_id128_to_string(f->header->machine_id, b),
sd_id128_to_string(f->header->boot_id, c),
sd_id128_to_string(f->header->seqnum_id, c),
- f->header->state == STATE_OFFLINE ? "offline" :
- f->header->state == STATE_ONLINE ? "online" :
- f->header->state == STATE_ARCHIVED ? "archived" : "unknown",
+ f->header->state == STATE_OFFLINE ? "OFFLINE" :
+ f->header->state == STATE_ONLINE ? "ONLINE" :
+ f->header->state == STATE_ARCHIVED ? "ARCHIVED" : "UNKNOWN",
(f->header->compatible_flags & HEADER_COMPATIBLE_SEALED) ? " SEALED" : "",
(f->header->compatible_flags & ~HEADER_COMPATIBLE_SEALED) ? " ???" : "",
(f->header->incompatible_flags & HEADER_INCOMPATIBLE_COMPRESSED) ? " COMPRESSED" : "",
@@ -1908,13 +1908,13 @@ void journal_file_print_header(JournalFile *f) {
(unsigned long long) le64toh(f->header->arena_size),
(unsigned long long) le64toh(f->header->data_hash_table_size) / sizeof(HashItem),
(unsigned long long) le64toh(f->header->field_hash_table_size) / sizeof(HashItem),
- (unsigned long long) le64toh(f->header->n_objects),
- (unsigned long long) le64toh(f->header->n_entries),
yes_no(journal_file_rotate_suggested(f)),
(unsigned long long) le64toh(f->header->head_entry_seqnum),
(unsigned long long) le64toh(f->header->tail_entry_seqnum),
format_timestamp(x, sizeof(x), le64toh(f->header->head_entry_realtime)),
- format_timestamp(y, sizeof(y), le64toh(f->header->tail_entry_realtime)));
+ format_timestamp(y, sizeof(y), le64toh(f->header->tail_entry_realtime)),
+ (unsigned long long) le64toh(f->header->n_objects),
+ (unsigned long long) le64toh(f->header->n_entries));
if (JOURNAL_HEADER_CONTAINS(f->header, n_data))
printf("Data Objects: %llu\n"
@@ -1927,6 +1927,13 @@ void journal_file_print_header(JournalFile *f) {
"Field Hash Table Fill: %.1f%%\n",
(unsigned long long) le64toh(f->header->n_fields),
100.0 * (double) le64toh(f->header->n_fields) / ((double) (le64toh(f->header->field_hash_table_size) / sizeof(HashItem))));
+
+ if (JOURNAL_HEADER_CONTAINS(f->header, n_tags))
+ printf("Tag Objects: %llu\n",
+ (unsigned long long) le64toh(f->header->n_tags));
+ if (JOURNAL_HEADER_CONTAINS(f->header, n_entry_arrays))
+ printf("Entry Array Objects: %llu\n",
+ (unsigned long long) le64toh(f->header->n_entry_arrays));
}
int journal_file_open(
diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c
index 9907c5fe26..cfd6d40932 100644
--- a/src/journal/journal-verify.c
+++ b/src/journal/journal-verify.c
@@ -38,7 +38,7 @@
* - write bit mucking test
* - tag timestamps should be between entry timestamps
* - output validated time ranges
- * - add missing fields to journal header dump
+ * - evolve key even if nothing happened in regular intervals
*
* - Allow building without libgcrypt
* - check with sparse
diff --git a/src/journal/test-journal-verify.c b/src/journal/test-journal-verify.c
index 8a7d998ff9..9a99bcba4b 100644
--- a/src/journal/test-journal-verify.c
+++ b/src/journal/test-journal-verify.c
@@ -68,6 +68,9 @@ int main(int argc, char *argv[]) {
log_info("Verifying...");
assert_se(journal_file_open("test.journal", O_RDONLY, 0666, false, false, NULL, NULL, NULL, &f) == 0);
+
+ journal_file_print_header(f);
+
assert_se(journal_file_verify(f, verification_key) >= 0);
journal_file_close(f);