1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 This file is part of systemd.
7 Copyright 2011 Lennart Poettering
13 #include "sparse-endian.h"
16 * If you change this file you probably should also change its documentation:
18 * http://www.freedesktop.org/wiki/Software/systemd/journal-files
22 typedef struct Header Header
;
24 typedef struct ObjectHeader ObjectHeader
;
25 typedef union Object Object
;
27 typedef struct DataObject DataObject
;
28 typedef struct FieldObject FieldObject
;
29 typedef struct EntryObject EntryObject
;
30 typedef struct HashTableObject HashTableObject
;
31 typedef struct EntryArrayObject EntryArrayObject
;
32 typedef struct TagObject TagObject
;
34 typedef struct EntryItem EntryItem
;
35 typedef struct HashItem HashItem
;
37 typedef struct FSSHeader FSSHeader
;
40 typedef enum ObjectType
{
41 OBJECT_UNUSED
, /* also serves as "any type" or "additional context" */
45 OBJECT_DATA_HASH_TABLE
,
46 OBJECT_FIELD_HASH_TABLE
,
54 OBJECT_COMPRESSED_XZ
= 1 << 0,
55 OBJECT_COMPRESSED_LZ4
= 1 << 1,
56 _OBJECT_COMPRESSED_MAX
59 #define OBJECT_COMPRESSION_MASK (OBJECT_COMPRESSED_XZ | OBJECT_COMPRESSED_LZ4)
72 le64_t next_hash_offset
;
73 le64_t next_field_offset
;
74 le64_t entry_offset
; /* the first array entry we store inline */
75 le64_t entry_array_offset
;
83 le64_t next_hash_offset
;
84 le64_t head_data_offset
;
104 le64_t head_hash_offset
;
105 le64_t tail_hash_offset
;
108 struct HashTableObject
{
113 struct EntryArrayObject
{
115 le64_t next_entry_array_offset
;
119 #define TAG_LENGTH (256/8)
125 uint8_t tag
[TAG_LENGTH
]; /* SHA-256 HMAC */
133 HashTableObject hash_table
;
134 EntryArrayObject entry_array
;
147 HEADER_INCOMPATIBLE_COMPRESSED_XZ
= 1 << 0,
148 HEADER_INCOMPATIBLE_COMPRESSED_LZ4
= 1 << 1,
151 #define HEADER_INCOMPATIBLE_ANY (HEADER_INCOMPATIBLE_COMPRESSED_XZ|HEADER_INCOMPATIBLE_COMPRESSED_LZ4)
153 #if HAVE_XZ && HAVE_LZ4
154 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_ANY
156 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_XZ
158 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_LZ4
160 # define HEADER_INCOMPATIBLE_SUPPORTED 0
164 HEADER_COMPATIBLE_SEALED
= 1
167 #define HEADER_COMPATIBLE_ANY HEADER_COMPATIBLE_SEALED
169 # define HEADER_COMPATIBLE_SUPPORTED HEADER_COMPATIBLE_SEALED
171 # define HEADER_COMPATIBLE_SUPPORTED 0
174 #define HEADER_SIGNATURE ((char[]) { 'L', 'P', 'K', 'S', 'H', 'H', 'R', 'H' })
177 uint8_t signature
[8]; /* "LPKSHHRH" */
178 le32_t compatible_flags
;
179 le32_t incompatible_flags
;
183 sd_id128_t machine_id
;
184 sd_id128_t boot_id
; /* last writer */
185 sd_id128_t seqnum_id
;
188 le64_t data_hash_table_offset
;
189 le64_t data_hash_table_size
;
190 le64_t field_hash_table_offset
;
191 le64_t field_hash_table_size
;
192 le64_t tail_object_offset
;
195 le64_t tail_entry_seqnum
;
196 le64_t head_entry_seqnum
;
197 le64_t entry_array_offset
;
198 le64_t head_entry_realtime
;
199 le64_t tail_entry_realtime
;
200 le64_t tail_entry_monotonic
;
206 le64_t n_entry_arrays
;
211 #define FSS_HEADER_SIGNATURE ((char[]) { 'K', 'S', 'H', 'H', 'R', 'H', 'L', 'P' })
214 uint8_t signature
[8]; /* "KSHHRHLP" */
215 le32_t compatible_flags
;
216 le32_t incompatible_flags
;
217 sd_id128_t machine_id
;
218 sd_id128_t boot_id
; /* last writer */
221 le64_t interval_usec
;
224 le64_t fsprg_state_size
;