Systemd/src/journal-remote/journal-remote-write.h
Chris Morin 924426a703 journal-remote: use source's boot-id
systemd-journal-remote always wrote the boot-id of the device it was running on
to the header of its journal files. When the source had a different boot-id
(because it was generated on a different boot, or a different device), the
boot-ids in the file were inconsistent. The _BOOT_ID field was that of the
source, but the journal file header and each entry object header were that of
the device systemd-journal-remote ran on. This breaks journalctl --list-boots
on any of these files.

Set the boot-id in the header to be that of the source. This also fixes the
entry object headers.
2019-04-02 10:32:21 +02:00

41 lines
962 B
C

/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include "journal-file.h"
#include "journal-importer.h"
typedef struct RemoteServer RemoteServer;
typedef struct Writer {
JournalFile *journal;
JournalMetrics metrics;
MMapCache *mmap;
RemoteServer *server;
char *hashmap_key;
uint64_t seqnum;
unsigned n_ref;
} Writer;
Writer* writer_new(RemoteServer* server);
Writer* writer_ref(Writer *w);
Writer* writer_unref(Writer *w);
DEFINE_TRIVIAL_CLEANUP_FUNC(Writer*, writer_unref);
int writer_write(Writer *s,
struct iovec_wrapper *iovw,
dual_timestamp *ts,
sd_id128_t *boot_id,
bool compress,
bool seal);
typedef enum JournalWriteSplitMode {
JOURNAL_WRITE_SPLIT_NONE,
JOURNAL_WRITE_SPLIT_HOST,
_JOURNAL_WRITE_SPLIT_MAX,
_JOURNAL_WRITE_SPLIT_INVALID = -1
} JournalWriteSplitMode;