4 This file is part of systemd.
6 Copyright 2011 Lennart Poettering
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25 #include "sparse-endian.h"
28 * If you change this file you probably should also change its documentation:
30 * http://www.freedesktop.org/wiki/Software/systemd/journal-files
34 typedef struct Header Header
;
36 typedef struct ObjectHeader ObjectHeader
;
37 typedef union Object Object
;
39 typedef struct DataObject DataObject
;
40 typedef struct FieldObject FieldObject
;
41 typedef struct EntryObject EntryObject
;
42 typedef struct HashTableObject HashTableObject
;
43 typedef struct EntryArrayObject EntryArrayObject
;
44 typedef struct TagObject TagObject
;
46 typedef struct EntryItem EntryItem
;
47 typedef struct HashItem HashItem
;
49 typedef struct FSSHeader FSSHeader
;
52 typedef enum ObjectType
{
53 OBJECT_UNUSED
, /* also serves as "any type" or "additional context" */
57 OBJECT_DATA_HASH_TABLE
,
58 OBJECT_FIELD_HASH_TABLE
,
66 OBJECT_COMPRESSED_XZ
= 1 << 0,
67 OBJECT_COMPRESSED_LZ4
= 1 << 1,
68 _OBJECT_COMPRESSED_MAX
71 #define OBJECT_COMPRESSION_MASK (OBJECT_COMPRESSED_XZ | OBJECT_COMPRESSED_LZ4)
84 le64_t next_hash_offset
;
85 le64_t next_field_offset
;
86 le64_t entry_offset
; /* the first array entry we store inline */
87 le64_t entry_array_offset
;
95 le64_t next_hash_offset
;
96 le64_t head_data_offset
;
101 le64_t object_offset
;
116 le64_t head_hash_offset
;
117 le64_t tail_hash_offset
;
120 struct HashTableObject
{
125 struct EntryArrayObject
{
127 le64_t next_entry_array_offset
;
131 #define TAG_LENGTH (256/8)
137 uint8_t tag
[TAG_LENGTH
]; /* SHA-256 HMAC */
145 HashTableObject hash_table
;
146 EntryArrayObject entry_array
;
159 HEADER_INCOMPATIBLE_COMPRESSED_XZ
= 1 << 0,
160 HEADER_INCOMPATIBLE_COMPRESSED_LZ4
= 1 << 1,
163 #define HEADER_INCOMPATIBLE_ANY (HEADER_INCOMPATIBLE_COMPRESSED_XZ|HEADER_INCOMPATIBLE_COMPRESSED_LZ4)
165 #if HAVE_XZ && HAVE_LZ4
166 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_ANY
168 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_XZ
170 # define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_LZ4
172 # define HEADER_INCOMPATIBLE_SUPPORTED 0
176 HEADER_COMPATIBLE_SEALED
= 1
179 #define HEADER_COMPATIBLE_ANY HEADER_COMPATIBLE_SEALED
181 # define HEADER_COMPATIBLE_SUPPORTED HEADER_COMPATIBLE_SEALED
183 # define HEADER_COMPATIBLE_SUPPORTED 0
186 #define HEADER_SIGNATURE ((char[]) { 'L', 'P', 'K', 'S', 'H', 'H', 'R', 'H' })
189 uint8_t signature
[8]; /* "LPKSHHRH" */
190 le32_t compatible_flags
;
191 le32_t incompatible_flags
;
195 sd_id128_t machine_id
;
196 sd_id128_t boot_id
; /* last writer */
197 sd_id128_t seqnum_id
;
200 le64_t data_hash_table_offset
;
201 le64_t data_hash_table_size
;
202 le64_t field_hash_table_offset
;
203 le64_t field_hash_table_size
;
204 le64_t tail_object_offset
;
207 le64_t tail_entry_seqnum
;
208 le64_t head_entry_seqnum
;
209 le64_t entry_array_offset
;
210 le64_t head_entry_realtime
;
211 le64_t tail_entry_realtime
;
212 le64_t tail_entry_monotonic
;
218 le64_t n_entry_arrays
;
223 #define FSS_HEADER_SIGNATURE ((char[]) { 'K', 'S', 'H', 'H', 'R', 'H', 'L', 'P' })
226 uint8_t signature
[8]; /* "KSHHRHLP" */
227 le32_t compatible_flags
;
228 le32_t incompatible_flags
;
229 sd_id128_t machine_id
;
230 sd_id128_t boot_id
; /* last writer */
233 le64_t interval_usec
;
236 le64_t fsprg_state_size
;