~ubuntu-branches/ubuntu/trusty/systemd/trusty

« back to all changes in this revision

Viewing changes to src/journal/journal-def.h

  • Committer: Package Import Robot
  • Author(s): Michael Biebl, Michael Biebl, Michael Stapelberg, Daniel Schaal, Ondrej Balaz
  • Date: 2013-09-12 00:13:11 UTC
  • mfrom: (1.1.11) (9.1.2 experimental)
  • mto: This revision was merged to the branch mainline in revision 53.
  • Revision ID: package-import@ubuntu.com-20130912001311-dz35it34wr2lbday
Tags: 204-3
[ Michael Biebl ]
* Upload to unstable.
* Use /bin/bash in debug-shell.service as Debian doesn't have /sbin/sushell.
* Only import net.ifaces cmdline property for network devices.
* Generate strict dependencies between the binary packages using a
  shlibs.local file and add an explicit versioned dependency on
  libsystemd-login0 to systemd to ensure packages are upgraded in sync.
  Closes: #719444
* Drop obsolete Replaces: libudev0 from udev package.
* Use correct paths for various binaries, like /sbin/quotaon, which are
  installed in / and not /usr in Debian.  Closes: #721347
* Don't install kernel-install(8) man page since we don't install the
  corresponding binary either.  Closes: #722180
* Cherry-pick upstream fixes to make switching runlevels and starting
  reboot via ctrl-alt-del more robust.
* Cherry-pick upstream fix to properly apply ACLs to Journal files.

[ Michael Stapelberg ]
* Make systemctl enable|disable call update-rc.d for SysV init scripts.
  Closes: #709780
* Don't mount /tmp as tmpfs by default and make it possible to enable this
  feature via "systemctl enable tmp.mount".

[ Daniel Schaal ]
* Add bug-script to systemd and udev.  Closes: #711245

[ Ondrej Balaz ]
* Recognize discard option in /etc/crypttab.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
2
 
3
 
#ifndef foojournaldefhfoo
4
 
#define foojournaldefhfoo
 
3
#pragma once
5
4
 
6
5
/***
7
6
  This file is part of systemd.
9
8
  Copyright 2011 Lennart Poettering
10
9
 
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.
15
14
 
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.
20
19
 
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/>.
23
22
***/
24
23
 
25
 
#include <inttypes.h>
 
24
#include "sparse-endian.h"
26
25
 
27
26
#include <systemd/sd-id128.h>
28
27
 
29
28
#include "macro.h"
30
29
 
 
30
/*
 
31
 * If you change this file you probably should also change its documentation:
 
32
 *
 
33
 * http://www.freedesktop.org/wiki/Software/systemd/journal-files
 
34
 *
 
35
 */
 
36
 
31
37
typedef struct Header Header;
 
38
 
32
39
typedef struct ObjectHeader ObjectHeader;
33
40
typedef union Object Object;
 
41
 
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;
 
48
 
39
49
typedef struct EntryItem EntryItem;
40
50
typedef struct HashItem HashItem;
41
51
 
 
52
typedef struct FSSHeader FSSHeader;
 
53
 
42
54
/* Object types */
43
55
enum {
44
56
        OBJECT_UNUSED,
48
60
        OBJECT_DATA_HASH_TABLE,
49
61
        OBJECT_FIELD_HASH_TABLE,
50
62
        OBJECT_ENTRY_ARRAY,
 
63
        OBJECT_TAG,
51
64
        _OBJECT_TYPE_MAX
52
65
};
53
66
 
56
69
        OBJECT_COMPRESSED = 1
57
70
};
58
71
 
59
 
_packed_ struct ObjectHeader {
 
72
struct ObjectHeader {
60
73
        uint8_t type;
61
74
        uint8_t flags;
62
75
        uint8_t reserved[6];
63
 
        uint64_t size;
64
 
        uint8_t payload[];
65
 
};
66
 
 
67
 
_packed_ struct DataObject {
68
 
        ObjectHeader object;
69
 
        uint64_t hash;
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;
74
 
        uint64_t n_entries;
75
 
        uint8_t payload[];
76
 
};
77
 
 
78
 
_packed_ struct FieldObject {
79
 
        ObjectHeader object;
80
 
        uint64_t hash;
81
 
        uint64_t next_hash_offset;
82
 
        uint64_t head_data_offset;
83
 
        uint64_t tail_data_offset;
84
 
        uint8_t payload[];
85
 
};
86
 
 
87
 
_packed_ struct EntryItem {
88
 
        uint64_t object_offset;
89
 
        uint64_t hash;
90
 
};
91
 
 
92
 
_packed_ struct EntryObject {
93
 
        ObjectHeader object;
94
 
        uint64_t seqnum;
95
 
        uint64_t realtime;
96
 
        uint64_t monotonic;
 
76
        le64_t size;
 
77
        uint8_t payload[];
 
78
} _packed_;
 
79
 
 
80
struct DataObject {
 
81
        ObjectHeader object;
 
82
        le64_t hash;
 
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;
 
87
        le64_t n_entries;
 
88
        uint8_t payload[];
 
89
} _packed_;
 
90
 
 
91
struct FieldObject {
 
92
        ObjectHeader object;
 
93
        le64_t hash;
 
94
        le64_t next_hash_offset;
 
95
        le64_t head_data_offset;
 
96
        uint8_t payload[];
 
97
} _packed_;
 
98
 
 
99
struct EntryItem {
 
100
        le64_t object_offset;
 
101
        le64_t hash;
 
102
} _packed_;
 
103
 
 
104
struct EntryObject {
 
105
        ObjectHeader object;
 
106
        le64_t seqnum;
 
107
        le64_t realtime;
 
108
        le64_t monotonic;
97
109
        sd_id128_t boot_id;
98
 
        uint64_t xor_hash;
 
110
        le64_t xor_hash;
99
111
        EntryItem items[];
100
 
};
101
 
 
102
 
_packed_ struct HashItem {
103
 
        uint64_t head_hash_offset;
104
 
        uint64_t tail_hash_offset;
105
 
};
106
 
 
107
 
_packed_ struct HashTableObject {
 
112
} _packed_;
 
113
 
 
114
struct HashItem {
 
115
        le64_t head_hash_offset;
 
116
        le64_t tail_hash_offset;
 
117
} _packed_;
 
118
 
 
119
struct HashTableObject {
108
120
        ObjectHeader object;
109
121
        HashItem items[];
110
 
};
111
 
 
112
 
_packed_ struct EntryArrayObject {
113
 
        ObjectHeader object;
114
 
        uint64_t next_entry_array_offset;
115
 
        uint64_t items[];
116
 
};
 
122
} _packed_;
 
123
 
 
124
struct EntryArrayObject {
 
125
        ObjectHeader object;
 
126
        le64_t next_entry_array_offset;
 
127
        le64_t items[];
 
128
} _packed_;
 
129
 
 
130
#define TAG_LENGTH (256/8)
 
131
 
 
132
struct TagObject {
 
133
        ObjectHeader object;
 
134
        le64_t seqnum;
 
135
        le64_t epoch;
 
136
        uint8_t tag[TAG_LENGTH]; /* SHA-256 HMAC */
 
137
} _packed_;
117
138
 
118
139
union Object {
119
140
        ObjectHeader object;
122
143
        EntryObject entry;
123
144
        HashTableObject hash_table;
124
145
        EntryArrayObject entry_array;
 
146
        TagObject tag;
125
147
};
126
148
 
127
149
enum {
128
 
        STATE_OFFLINE,
129
 
        STATE_ONLINE,
130
 
        STATE_ARCHIVED
 
150
        STATE_OFFLINE = 0,
 
151
        STATE_ONLINE = 1,
 
152
        STATE_ARCHIVED = 2,
 
153
        _STATE_MAX
131
154
};
132
155
 
133
156
/* Header flags */
135
158
        HEADER_INCOMPATIBLE_COMPRESSED = 1
136
159
};
137
160
 
138
 
_packed_ struct Header {
 
161
enum {
 
162
        HEADER_COMPATIBLE_SEALED = 1
 
163
};
 
164
 
 
165
#define HEADER_SIGNATURE ((char[]) { 'L', 'P', 'K', 'S', 'H', 'H', 'R', 'H' })
 
166
 
 
167
struct Header {
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;
142
171
        uint8_t state;
143
172
        uint8_t reserved[7];
144
173
        sd_id128_t file_id;
145
174
        sd_id128_t machine_id;
146
 
        sd_id128_t boot_id;
 
175
        sd_id128_t boot_id;    /* last writer */
147
176
        sd_id128_t seqnum_id;
148
 
        uint64_t arena_offset;
149
 
        uint64_t arena_size;
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;
155
 
        uint64_t n_objects;
156
 
        uint64_t n_entries;
157
 
        uint64_t seqnum;
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;
163
 
};
164
 
 
165
 
#endif
 
177
        le64_t header_size;
 
178
        le64_t arena_size;
 
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;
 
184
        le64_t n_objects;
 
185
        le64_t n_entries;
 
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;
 
192
        /* Added in 187 */
 
193
        le64_t n_data;
 
194
        le64_t n_fields;
 
195
        /* Added in 189 */
 
196
        le64_t n_tags;
 
197
        le64_t n_entry_arrays;
 
198
 
 
199
        /* Size: 224 */
 
200
} _packed_;
 
201
 
 
202
#define FSS_HEADER_SIGNATURE ((char[]) { 'K', 'S', 'H', 'H', 'R', 'H', 'L', 'P' })
 
203
 
 
204
struct FSSHeader {
 
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 */
 
210
        le64_t header_size;
 
211
        le64_t start_usec;
 
212
        le64_t interval_usec;
 
213
        le16_t fsprg_secpar;
 
214
        le16_t reserved[3];
 
215
        le64_t fsprg_state_size;
 
216
} _packed_;