9
8
Copyright 2011 Lennart Poettering
11
10
systemd is free software; you can redistribute it and/or modify it
12
under the terms of the GNU General Public License as published by
13
the Free Software Foundation; either version 2 of the License, or
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
14
13
(at your option) any later version.
16
15
systemd is distributed in the hope that it will be useful, but
17
16
WITHOUT ANY WARRANTY; without even the implied warranty of
18
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
General Public License for more details.
18
Lesser General Public License for more details.
21
You should have received a copy of the GNU General Public License
20
You should have received a copy of the GNU Lesser General Public License
22
21
along with systemd; If not, see <http://www.gnu.org/licenses/>.
24
#include "sparse-endian.h"
27
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
31
37
typedef struct Header Header;
32
39
typedef struct ObjectHeader ObjectHeader;
33
40
typedef union Object Object;
34
42
typedef struct DataObject DataObject;
35
43
typedef struct FieldObject FieldObject;
36
44
typedef struct EntryObject EntryObject;
37
45
typedef struct HashTableObject HashTableObject;
38
46
typedef struct EntryArrayObject EntryArrayObject;
47
typedef struct TagObject TagObject;
39
49
typedef struct EntryItem EntryItem;
40
50
typedef struct HashItem HashItem;
52
typedef struct FSSHeader FSSHeader;
56
69
OBJECT_COMPRESSED = 1
59
_packed_ struct ObjectHeader {
62
75
uint8_t reserved[6];
67
_packed_ struct DataObject {
70
uint64_t next_hash_offset;
71
uint64_t next_field_offset;
72
uint64_t entry_offset; /* the first array entry we store inline */
73
uint64_t entry_array_offset;
78
_packed_ struct FieldObject {
81
uint64_t next_hash_offset;
82
uint64_t head_data_offset;
83
uint64_t tail_data_offset;
87
_packed_ struct EntryItem {
88
uint64_t object_offset;
92
_packed_ struct EntryObject {
83
le64_t next_hash_offset;
84
le64_t next_field_offset;
85
le64_t entry_offset; /* the first array entry we store inline */
86
le64_t entry_array_offset;
94
le64_t next_hash_offset;
95
le64_t head_data_offset;
100
le64_t object_offset;
97
109
sd_id128_t boot_id;
99
111
EntryItem items[];
102
_packed_ struct HashItem {
103
uint64_t head_hash_offset;
104
uint64_t tail_hash_offset;
107
_packed_ struct HashTableObject {
115
le64_t head_hash_offset;
116
le64_t tail_hash_offset;
119
struct HashTableObject {
108
120
ObjectHeader object;
109
121
HashItem items[];
112
_packed_ struct EntryArrayObject {
114
uint64_t next_entry_array_offset;
124
struct EntryArrayObject {
126
le64_t next_entry_array_offset;
130
#define TAG_LENGTH (256/8)
136
uint8_t tag[TAG_LENGTH]; /* SHA-256 HMAC */
119
140
ObjectHeader object;
135
158
HEADER_INCOMPATIBLE_COMPRESSED = 1
138
_packed_ struct Header {
162
HEADER_COMPATIBLE_SEALED = 1
165
#define HEADER_SIGNATURE ((char[]) { 'L', 'P', 'K', 'S', 'H', 'H', 'R', 'H' })
139
168
uint8_t signature[8]; /* "LPKSHHRH" */
140
uint32_t compatible_flags;
141
uint32_t incompatible_flags;
169
le32_t compatible_flags;
170
le32_t incompatible_flags;
143
172
uint8_t reserved[7];
144
173
sd_id128_t file_id;
145
174
sd_id128_t machine_id;
175
sd_id128_t boot_id; /* last writer */
147
176
sd_id128_t seqnum_id;
148
uint64_t arena_offset;
150
uint64_t data_hash_table_offset; /* for looking up data objects */
151
uint64_t data_hash_table_size;
152
uint64_t field_hash_table_offset; /* for looking up field objects */
153
uint64_t field_hash_table_size;
154
uint64_t tail_object_offset;
158
uint64_t first_seqnum;
159
uint64_t entry_array_offset;
160
uint64_t head_entry_realtime;
161
uint64_t tail_entry_realtime;
162
uint64_t tail_entry_monotonic;
179
le64_t data_hash_table_offset;
180
le64_t data_hash_table_size;
181
le64_t field_hash_table_offset;
182
le64_t field_hash_table_size;
183
le64_t tail_object_offset;
186
le64_t tail_entry_seqnum;
187
le64_t head_entry_seqnum;
188
le64_t entry_array_offset;
189
le64_t head_entry_realtime;
190
le64_t tail_entry_realtime;
191
le64_t tail_entry_monotonic;
197
le64_t n_entry_arrays;
202
#define FSS_HEADER_SIGNATURE ((char[]) { 'K', 'S', 'H', 'H', 'R', 'H', 'L', 'P' })
205
uint8_t signature[8]; /* "KSHHRHLP" */
206
le32_t compatible_flags;
207
le32_t incompatible_flags;
208
sd_id128_t machine_id;
209
sd_id128_t boot_id; /* last writer */
212
le64_t interval_usec;
215
le64_t fsprg_state_size;