1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright 2011 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 #include "sparse-endian.h"
26 #include "systemd/sd-id128.h"
31 * If you change this file you probably should also change its documentation:
33 * http://www.freedesktop.org/wiki/Software/systemd/journal-files
37 typedef struct Header Header;
39 typedef struct ObjectHeader ObjectHeader;
40 typedef union Object Object;
42 typedef struct DataObject DataObject;
43 typedef struct FieldObject FieldObject;
44 typedef struct EntryObject EntryObject;
45 typedef struct HashTableObject HashTableObject;
46 typedef struct EntryArrayObject EntryArrayObject;
47 typedef struct TagObject TagObject;
49 typedef struct EntryItem EntryItem;
50 typedef struct HashItem HashItem;
52 typedef struct FSSHeader FSSHeader;
60 OBJECT_DATA_HASH_TABLE,
61 OBJECT_FIELD_HASH_TABLE,
69 OBJECT_COMPRESSED_XZ = 1 << 0,
70 OBJECT_COMPRESSED_LZ4 = 1 << 1,
71 _OBJECT_COMPRESSED_MAX
74 #define OBJECT_COMPRESSION_MASK (OBJECT_COMPRESSED_XZ | OBJECT_COMPRESSED_LZ4)
87 le64_t next_hash_offset;
88 le64_t next_field_offset;
89 le64_t entry_offset; /* the first array entry we store inline */
90 le64_t entry_array_offset;
98 le64_t next_hash_offset;
99 le64_t head_data_offset;
104 le64_t object_offset;
119 le64_t head_hash_offset;
120 le64_t tail_hash_offset;
123 struct HashTableObject {
128 struct EntryArrayObject {
130 le64_t next_entry_array_offset;
134 #define TAG_LENGTH (256/8)
140 uint8_t tag[TAG_LENGTH]; /* SHA-256 HMAC */
148 HashTableObject hash_table;
149 EntryArrayObject entry_array;
162 HEADER_INCOMPATIBLE_COMPRESSED_XZ = 1 << 0,
163 HEADER_INCOMPATIBLE_COMPRESSED_LZ4 = 1 << 1,
166 #define HEADER_INCOMPATIBLE_ANY (HEADER_INCOMPATIBLE_COMPRESSED_XZ|HEADER_INCOMPATIBLE_COMPRESSED_LZ4)
168 #if defined(HAVE_XZ) && defined(HAVE_LZ4)
169 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_ANY
170 #elif defined(HAVE_XZ)
171 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_XZ
172 #elif defined(HAVE_LZ4)
173 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_LZ4
175 # define HEADER_INCOMPATIBLE_SUPPORTED 0
179 HEADER_COMPATIBLE_SEALED = 1
182 #define HEADER_COMPATIBLE_ANY HEADER_COMPATIBLE_SEALED
184 # define HEADER_COMPATIBLE_SUPPORTED HEADER_COMPATIBLE_SEALED
186 # define HEADER_COMPATIBLE_SUPPORTED 0
189 #define HEADER_SIGNATURE ((char[]) { 'L', 'P', 'K', 'S', 'H', 'H', 'R', 'H' })
192 uint8_t signature[8]; /* "LPKSHHRH" */
193 le32_t compatible_flags;
194 le32_t incompatible_flags;
198 sd_id128_t machine_id;
199 sd_id128_t boot_id; /* last writer */
200 sd_id128_t seqnum_id;
203 le64_t data_hash_table_offset;
204 le64_t data_hash_table_size;
205 le64_t field_hash_table_offset;
206 le64_t field_hash_table_size;
207 le64_t tail_object_offset;
210 le64_t tail_entry_seqnum;
211 le64_t head_entry_seqnum;
212 le64_t entry_array_offset;
213 le64_t head_entry_realtime;
214 le64_t tail_entry_realtime;
215 le64_t tail_entry_monotonic;
221 le64_t n_entry_arrays;
226 #define FSS_HEADER_SIGNATURE ((char[]) { 'K', 'S', 'H', 'H', 'R', 'H', 'L', 'P' })
229 uint8_t signature[8]; /* "KSHHRHLP" */
230 le32_t compatible_flags;
231 le32_t incompatible_flags;
232 sd_id128_t machine_id;
233 sd_id128_t boot_id; /* last writer */
236 le64_t interval_usec;
239 le64_t fsprg_state_size;