1 /* SPDX-License-Identifier: LGPL-2.1+ */
7 #include "sparse-endian.h"
10 * If you change this file you probably should also change its documentation:
12 * http://www.freedesktop.org/wiki/Software/systemd/journal-files
15 typedef struct Header Header
;
17 typedef struct ObjectHeader ObjectHeader
;
18 typedef union Object Object
;
20 typedef struct DataObject DataObject
;
21 typedef struct FieldObject FieldObject
;
22 typedef struct EntryObject EntryObject
;
23 typedef struct HashTableObject HashTableObject
;
24 typedef struct EntryArrayObject EntryArrayObject
;
25 typedef struct TagObject TagObject
;
27 typedef struct EntryItem EntryItem
;
28 typedef struct HashItem HashItem
;
30 typedef struct FSSHeader FSSHeader
;
33 typedef enum ObjectType
{
34 OBJECT_UNUSED
, /* also serves as "any type" or "additional context" */
38 OBJECT_DATA_HASH_TABLE
,
39 OBJECT_FIELD_HASH_TABLE
,
47 OBJECT_COMPRESSED_XZ
= 1 << 0,
48 OBJECT_COMPRESSED_LZ4
= 1 << 1,
49 _OBJECT_COMPRESSED_MAX
52 #define OBJECT_COMPRESSION_MASK (OBJECT_COMPRESSED_XZ | OBJECT_COMPRESSED_LZ4)
62 #define DataObject__contents { \
63 ObjectHeader object; \
65 le64_t next_hash_offset; \
66 le64_t next_field_offset; \
67 le64_t entry_offset; /* the first array entry we store inline */ \
68 le64_t entry_array_offset; \
73 struct DataObject DataObject__contents
;
74 struct DataObject__packed DataObject__contents _packed_
;
75 assert_cc(sizeof(struct DataObject
) == sizeof(struct DataObject__packed
));
80 le64_t next_hash_offset
;
81 le64_t head_data_offset
;
90 #define EntryObject__contents { \
91 ObjectHeader object; \
100 struct EntryObject EntryObject__contents
;
101 struct EntryObject__packed EntryObject__contents _packed_
;
102 assert_cc(sizeof(struct EntryObject
) == sizeof(struct EntryObject__packed
));
105 le64_t head_hash_offset
;
106 le64_t tail_hash_offset
;
109 struct HashTableObject
{
114 struct EntryArrayObject
{
116 le64_t next_entry_array_offset
;
120 #define TAG_LENGTH (256/8)
126 uint8_t tag
[TAG_LENGTH
]; /* SHA-256 HMAC */
134 HashTableObject hash_table
;
135 EntryArrayObject entry_array
;
148 HEADER_INCOMPATIBLE_COMPRESSED_XZ
= 1 << 0,
149 HEADER_INCOMPATIBLE_COMPRESSED_LZ4
= 1 << 1,
152 #define HEADER_INCOMPATIBLE_ANY (HEADER_INCOMPATIBLE_COMPRESSED_XZ|HEADER_INCOMPATIBLE_COMPRESSED_LZ4)
154 #if HAVE_XZ && HAVE_LZ4
155 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_ANY
157 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_XZ
159 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_LZ4
161 # define HEADER_INCOMPATIBLE_SUPPORTED 0
165 HEADER_COMPATIBLE_SEALED
= 1
168 #define HEADER_COMPATIBLE_ANY HEADER_COMPATIBLE_SEALED
170 # define HEADER_COMPATIBLE_SUPPORTED HEADER_COMPATIBLE_SEALED
172 # define HEADER_COMPATIBLE_SUPPORTED 0
175 #define HEADER_SIGNATURE ((char[]) { 'L', 'P', 'K', 'S', 'H', 'H', 'R', 'H' })
177 #define struct_Header__contents { \
178 uint8_t signature[8]; /* "LPKSHHRH" */ \
179 le32_t compatible_flags; \
180 le32_t incompatible_flags; \
182 uint8_t reserved[7]; \
183 sd_id128_t file_id; \
184 sd_id128_t machine_id; \
185 sd_id128_t boot_id; /* last writer */ \
186 sd_id128_t seqnum_id; \
187 le64_t header_size; \
189 le64_t data_hash_table_offset; \
190 le64_t data_hash_table_size; \
191 le64_t field_hash_table_offset; \
192 le64_t field_hash_table_size; \
193 le64_t tail_object_offset; \
196 le64_t tail_entry_seqnum; \
197 le64_t head_entry_seqnum; \
198 le64_t entry_array_offset; \
199 le64_t head_entry_realtime; \
200 le64_t tail_entry_realtime; \
201 le64_t tail_entry_monotonic; \
207 le64_t n_entry_arrays; \
210 struct Header struct_Header__contents
;
211 struct Header__packed struct_Header__contents _packed_
;
212 assert_cc(sizeof(struct Header
) == sizeof(struct Header__packed
));
213 assert_cc(sizeof(struct Header
) == 240);
215 #define FSS_HEADER_SIGNATURE ((char[]) { 'K', 'S', 'H', 'H', 'R', 'H', 'L', 'P' })
218 uint8_t signature
[8]; /* "KSHHRHLP" */
219 le32_t compatible_flags
;
220 le32_t incompatible_flags
;
221 sd_id128_t machine_id
;
222 sd_id128_t boot_id
; /* last writer */
225 le64_t interval_usec
;
228 le64_t fsprg_state_size
;