]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/journal/journal-def.h
macro: fix ALIGN_TO macro definition
[thirdparty/systemd.git] / src / journal / journal-def.h
CommitLineData
87d2c1ff
LP
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3#ifndef foojournaldefhfoo
4#define foojournaldefhfoo
5
6/***
7 This file is part of systemd.
8
9 Copyright 2011 Lennart Poettering
10
11 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
14 (at your option) any later version.
15
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
23***/
24
25#include <inttypes.h>
26
27#include "macro.h"
28#include "sd-id128.h"
29
30typedef struct Header Header;
31typedef struct ObjectHeader ObjectHeader;
32typedef union Object Object;
33typedef struct DataObject DataObject;
34typedef struct EntryObject EntryObject;
35typedef struct HashTableObject HashTableObject;
36typedef struct BisectTableObject BisectTableObject;
37typedef struct EntryItem EntryItem;
38typedef struct HashItem HashItem;
39
40/* Object types */
41enum {
42 OBJECT_UNUSED,
43 OBJECT_DATA,
44 OBJECT_ENTRY,
45 OBJECT_HASH_TABLE,
46 OBJECT_BISECT_TABLE
47};
48
49_packed_ struct ObjectHeader {
50 uint8_t type;
cec736d2 51 uint8_t reserved[7];
87d2c1ff
LP
52 uint64_t size;
53 uint8_t payload[];
54};
55
56_packed_ struct DataObject {
57 ObjectHeader object;
58 uint64_t hash;
59 uint64_t head_entry_offset;
60 uint64_t tail_entry_offset;
61 uint64_t prev_hash_offset;
62 uint64_t next_hash_offset;
63 uint8_t payload[];
64};
65
66_packed_ struct EntryItem {
67 uint64_t object_offset;
de7b95cd 68 uint64_t hash;
87d2c1ff
LP
69 uint64_t prev_entry_offset;
70 uint64_t next_entry_offset;
71};
72
73_packed_ struct EntryObject {
74 ObjectHeader object;
75 uint64_t seqnum;
76 uint64_t realtime;
77 uint64_t monotonic;
cec736d2 78 sd_id128_t boot_id;
dad50316 79 uint64_t xor_hash;
87d2c1ff
LP
80 uint64_t prev_entry_offset;
81 uint64_t next_entry_offset;
82 EntryItem items[];
83};
84
85_packed_ struct HashItem {
86 uint64_t head_hash_offset;
87 uint64_t tail_hash_offset;
88};
89
90_packed_ struct HashTableObject {
91 ObjectHeader object;
92 HashItem table[];
93};
94
95_packed_ struct BisectTableObject {
96 ObjectHeader object;
97 uint64_t table[];
98};
99
100union Object {
101 ObjectHeader object;
102 DataObject data;
103 EntryObject entry;
104 HashTableObject hash_table;
105 BisectTableObject bisect_table;
106};
107
108enum {
109 STATE_OFFLINE,
110 STATE_ONLINE,
111 STATE_ARCHIVED
112};
113
114_packed_ struct Header {
115 uint8_t signature[8]; /* "LPKSHHRH" */
116 uint32_t compatible_flags;
117 uint32_t incompatible_flags;
118 uint32_t state;
119 uint8_t reserved[4];
120 sd_id128_t file_id;
121 sd_id128_t machine_id;
122 sd_id128_t boot_id;
cec736d2 123 sd_id128_t seqnum_id;
87d2c1ff
LP
124 uint64_t arena_offset;
125 uint64_t arena_size;
126 uint64_t arena_max_size;
127 uint64_t arena_min_size;
128 uint64_t arena_keep_free;
129 uint64_t hash_table_offset; /* for looking up data objects */
130 uint64_t hash_table_size;
131 uint64_t bisect_table_offset; /* for looking up entry objects */
132 uint64_t bisect_table_size;
133 uint64_t head_object_offset;
134 uint64_t tail_object_offset;
135 uint64_t head_entry_offset;
136 uint64_t tail_entry_offset;
137 uint64_t last_bisect_offset;
138 uint64_t n_objects;
87d2c1ff 139 uint64_t seqnum;
0ac38b70
LP
140 uint64_t head_entry_realtime;
141 uint64_t tail_entry_realtime;
87d2c1ff
LP
142};
143
144#endif