1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 This file is part of systemd.
7 Copyright 2011 Lennart Poettering
9 systemd is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public License
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
26 #include "sparse-endian.h"
29 * If you change this file you probably should also change its documentation:
31 * http://www.freedesktop.org/wiki/Software/systemd/journal-files
35 typedef struct Header Header
;
37 typedef struct ObjectHeader ObjectHeader
;
38 typedef union Object Object
;
40 typedef struct DataObject DataObject
;
41 typedef struct FieldObject FieldObject
;
42 typedef struct EntryObject EntryObject
;
43 typedef struct HashTableObject HashTableObject
;
44 typedef struct EntryArrayObject EntryArrayObject
;
45 typedef struct TagObject TagObject
;
47 typedef struct EntryItem EntryItem
;
48 typedef struct HashItem HashItem
;
50 typedef struct FSSHeader FSSHeader
;
53 typedef enum ObjectType
{
54 OBJECT_UNUSED
, /* also serves as "any type" or "additional context" */
58 OBJECT_DATA_HASH_TABLE
,
59 OBJECT_FIELD_HASH_TABLE
,
67 OBJECT_COMPRESSED_XZ
= 1 << 0,
68 OBJECT_COMPRESSED_LZ4
= 1 << 1,
69 _OBJECT_COMPRESSED_MAX
72 #define OBJECT_COMPRESSION_MASK (OBJECT_COMPRESSED_XZ | OBJECT_COMPRESSED_LZ4)
85 le64_t next_hash_offset
;
86 le64_t next_field_offset
;
87 le64_t entry_offset
; /* the first array entry we store inline */
88 le64_t entry_array_offset
;
96 le64_t next_hash_offset
;
97 le64_t head_data_offset
;
102 le64_t object_offset
;
117 le64_t head_hash_offset
;
118 le64_t tail_hash_offset
;
121 struct HashTableObject
{
126 struct EntryArrayObject
{
128 le64_t next_entry_array_offset
;
132 #define TAG_LENGTH (256/8)
138 uint8_t tag
[TAG_LENGTH
]; /* SHA-256 HMAC */
146 HashTableObject hash_table
;
147 EntryArrayObject entry_array
;
160 HEADER_INCOMPATIBLE_COMPRESSED_XZ
= 1 << 0,
161 HEADER_INCOMPATIBLE_COMPRESSED_LZ4
= 1 << 1,
164 #define HEADER_INCOMPATIBLE_ANY (HEADER_INCOMPATIBLE_COMPRESSED_XZ|HEADER_INCOMPATIBLE_COMPRESSED_LZ4)
166 #if HAVE_XZ && HAVE_LZ4
167 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_ANY
169 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_XZ
171 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_LZ4
173 # define HEADER_INCOMPATIBLE_SUPPORTED 0
177 HEADER_COMPATIBLE_SEALED
= 1
180 #define HEADER_COMPATIBLE_ANY HEADER_COMPATIBLE_SEALED
182 # define HEADER_COMPATIBLE_SUPPORTED HEADER_COMPATIBLE_SEALED
184 # define HEADER_COMPATIBLE_SUPPORTED 0
187 #define HEADER_SIGNATURE ((char[]) { 'L', 'P', 'K', 'S', 'H', 'H', 'R', 'H' })
190 uint8_t signature
[8]; /* "LPKSHHRH" */
191 le32_t compatible_flags
;
192 le32_t incompatible_flags
;
196 sd_id128_t machine_id
;
197 sd_id128_t boot_id
; /* last writer */
198 sd_id128_t seqnum_id
;
201 le64_t data_hash_table_offset
;
202 le64_t data_hash_table_size
;
203 le64_t field_hash_table_offset
;
204 le64_t field_hash_table_size
;
205 le64_t tail_object_offset
;
208 le64_t tail_entry_seqnum
;
209 le64_t head_entry_seqnum
;
210 le64_t entry_array_offset
;
211 le64_t head_entry_realtime
;
212 le64_t tail_entry_realtime
;
213 le64_t tail_entry_monotonic
;
219 le64_t n_entry_arrays
;
224 #define FSS_HEADER_SIGNATURE ((char[]) { 'K', 'S', 'H', 'H', 'R', 'H', 'L', 'P' })
227 uint8_t signature
[8]; /* "KSHHRHLP" */
228 le32_t compatible_flags
;
229 le32_t incompatible_flags
;
230 sd_id128_t machine_id
;
231 sd_id128_t boot_id
; /* last writer */
234 le64_t interval_usec
;
237 le64_t fsprg_state_size
;