mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-28 06:35:34 +07:00
journal: don't write tag objects if nothing has been written since the last time
This commit is contained in:
parent
31094aae09
commit
e627440b41
@ -51,8 +51,6 @@ int journal_file_append_tag(JournalFile *f) {
|
||||
if (!f->hmac_running)
|
||||
return 0;
|
||||
|
||||
log_debug("Writing tag for epoch %llu\n", (unsigned long long) FSPRG_GetEpoch(f->fsprg_state));
|
||||
|
||||
assert(f->hmac);
|
||||
|
||||
r = journal_file_append_object(f, OBJECT_TAG, sizeof(struct TagObject), &o, &p);
|
||||
@ -62,6 +60,10 @@ int journal_file_append_tag(JournalFile *f) {
|
||||
o->tag.seqnum = htole64(journal_file_tag_seqnum(f));
|
||||
o->tag.epoch = htole64(FSPRG_GetEpoch(f->fsprg_state));
|
||||
|
||||
log_debug("Writing tag %llu for epoch %llu\n",
|
||||
(unsigned long long) le64toh(o->tag.seqnum),
|
||||
(unsigned long long) FSPRG_GetEpoch(f->fsprg_state));
|
||||
|
||||
/* Add the tag object itself, so that we can protect its
|
||||
* header. This will exclude the actual hash value in it */
|
||||
r = journal_file_hmac_put_object(f, OBJECT_TAG, p);
|
||||
@ -221,10 +223,6 @@ int journal_file_maybe_append_tag(JournalFile *f, uint64_t realtime) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = journal_file_hmac_start(f);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,6 @@
|
||||
|
||||
/* FIXME:
|
||||
*
|
||||
* - write tag only if non-tag objects have been written
|
||||
* - write bit mucking test
|
||||
* - tag timestamps should be between entry timestamps
|
||||
* - output validated time ranges
|
||||
@ -857,6 +856,8 @@ int journal_file_verify(JournalFile *f, const char *key) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
log_debug("Checking tag %llu..", (unsigned long long) le64toh(o->tag.seqnum));
|
||||
|
||||
if (le64toh(o->tag.seqnum) != n_tags + 1) {
|
||||
log_error("Tag sequence number out of synchronization at %llu", (unsigned long long) p);
|
||||
r = -EBADMSG;
|
||||
|
Loading…
Reference in New Issue
Block a user