1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 Copyright 2011 Lennart Poettering
11 #include "sparse-endian.h"
14 * If you change this file you probably should also change its documentation:
16 * http://www.freedesktop.org/wiki/Software/systemd/journal-files
20 typedef struct Header Header
;
22 typedef struct ObjectHeader ObjectHeader
;
23 typedef union Object Object
;
25 typedef struct DataObject DataObject
;
26 typedef struct FieldObject FieldObject
;
27 typedef struct EntryObject EntryObject
;
28 typedef struct HashTableObject HashTableObject
;
29 typedef struct EntryArrayObject EntryArrayObject
;
30 typedef struct TagObject TagObject
;
32 typedef struct EntryItem EntryItem
;
33 typedef struct HashItem HashItem
;
35 typedef struct FSSHeader FSSHeader
;
38 typedef enum ObjectType
{
39 OBJECT_UNUSED
, /* also serves as "any type" or "additional context" */
43 OBJECT_DATA_HASH_TABLE
,
44 OBJECT_FIELD_HASH_TABLE
,
52 OBJECT_COMPRESSED_XZ
= 1 << 0,
53 OBJECT_COMPRESSED_LZ4
= 1 << 1,
54 _OBJECT_COMPRESSED_MAX
57 #define OBJECT_COMPRESSION_MASK (OBJECT_COMPRESSED_XZ | OBJECT_COMPRESSED_LZ4)
70 le64_t next_hash_offset
;
71 le64_t next_field_offset
;
72 le64_t entry_offset
; /* the first array entry we store inline */
73 le64_t entry_array_offset
;
81 le64_t next_hash_offset
;
82 le64_t head_data_offset
;
102 le64_t head_hash_offset
;
103 le64_t tail_hash_offset
;
106 struct HashTableObject
{
111 struct EntryArrayObject
{
113 le64_t next_entry_array_offset
;
117 #define TAG_LENGTH (256/8)
123 uint8_t tag
[TAG_LENGTH
]; /* SHA-256 HMAC */
131 HashTableObject hash_table
;
132 EntryArrayObject entry_array
;
145 HEADER_INCOMPATIBLE_COMPRESSED_XZ
= 1 << 0,
146 HEADER_INCOMPATIBLE_COMPRESSED_LZ4
= 1 << 1,
149 #define HEADER_INCOMPATIBLE_ANY (HEADER_INCOMPATIBLE_COMPRESSED_XZ|HEADER_INCOMPATIBLE_COMPRESSED_LZ4)
151 #if HAVE_XZ && HAVE_LZ4
152 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_ANY
154 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_XZ
156 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_LZ4
158 # define HEADER_INCOMPATIBLE_SUPPORTED 0
162 HEADER_COMPATIBLE_SEALED
= 1
165 #define HEADER_COMPATIBLE_ANY HEADER_COMPATIBLE_SEALED
167 # define HEADER_COMPATIBLE_SUPPORTED HEADER_COMPATIBLE_SEALED
169 # define HEADER_COMPATIBLE_SUPPORTED 0
172 #define HEADER_SIGNATURE ((char[]) { 'L', 'P', 'K', 'S', 'H', 'H', 'R', 'H' })
175 uint8_t signature
[8]; /* "LPKSHHRH" */
176 le32_t compatible_flags
;
177 le32_t incompatible_flags
;
181 sd_id128_t machine_id
;
182 sd_id128_t boot_id
; /* last writer */
183 sd_id128_t seqnum_id
;
186 le64_t data_hash_table_offset
;
187 le64_t data_hash_table_size
;
188 le64_t field_hash_table_offset
;
189 le64_t field_hash_table_size
;
190 le64_t tail_object_offset
;
193 le64_t tail_entry_seqnum
;
194 le64_t head_entry_seqnum
;
195 le64_t entry_array_offset
;
196 le64_t head_entry_realtime
;
197 le64_t tail_entry_realtime
;
198 le64_t tail_entry_monotonic
;
204 le64_t n_entry_arrays
;
209 #define FSS_HEADER_SIGNATURE ((char[]) { 'K', 'S', 'H', 'H', 'R', 'H', 'L', 'P' })
212 uint8_t signature
[8]; /* "KSHHRHLP" */
213 le32_t compatible_flags
;
214 le32_t incompatible_flags
;
215 sd_id128_t machine_id
;
216 sd_id128_t boot_id
; /* last writer */
219 le64_t interval_usec
;
222 le64_t fsprg_state_size
;