From 0609bb1894cc5959769447765b38e7bed821fa34 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 26 Jun 2026 00:13:58 +0900 Subject: [PATCH] journal: drop journal_file_tag_seqnum() and embed into journal_file_append_tag() --- .../sd-journal/journal-authenticate.c | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/libsystemd/sd-journal/journal-authenticate.c b/src/libsystemd/sd-journal/journal-authenticate.c index db13dc1851e..86be008aa18 100644 --- a/src/libsystemd/sd-journal/journal-authenticate.c +++ b/src/libsystemd/sd-journal/journal-authenticate.c @@ -29,23 +29,8 @@ static void* fssheader_free(FSSHeader *p) { DEFINE_TRIVIAL_CLEANUP_FUNC(FSSHeader*, fssheader_free); -#if HAVE_GCRYPT -static uint64_t journal_file_tag_seqnum(JournalFile *f) { - uint64_t r; - - assert(f); - - r = le64toh(f->header->n_tags) + 1; - f->header->n_tags = htole64(r); - - return r; -} -#endif - int journal_file_append_tag(JournalFile *f) { #if HAVE_GCRYPT - Object *o; - uint64_t p; int r; assert(f); @@ -61,11 +46,16 @@ int journal_file_append_tag(JournalFile *f) { assert(f->hmac); + Object *o; + uint64_t p; r = journal_file_append_object(f, OBJECT_TAG, sizeof(struct TagObject), &o, &p); if (r < 0) return r; - o->tag.seqnum = htole64(journal_file_tag_seqnum(f)); + uint64_t seqnum = le64toh(f->header->n_tags) + 1; + f->header->n_tags = htole64(seqnum); + + o->tag.seqnum = htole64(seqnum); o->tag.epoch = htole64(FSPRG_GetEpoch(f->fsprg_state.iov_base)); log_debug("Writing tag %"PRIu64" for epoch %"PRIu64"", -- 2.47.3