X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal%2Fjournal-def.h;h=82210bfc461990fc6a479c039d61c160cafc55fc;hb=96342de68d0d6de71a062d984dafd2a0905ed9fe;hp=9cb80510822a2a89771de9fdc6ddf40406461536;hpb=4fd052aede13eb3041277c54ac2f5dee6e6c29cf;p=elogind.git diff --git a/src/journal/journal-def.h b/src/journal/journal-def.h index 9cb805108..82210bfc4 100644 --- a/src/journal/journal-def.h +++ b/src/journal/journal-def.h @@ -1,7 +1,6 @@ /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ -#ifndef foojournaldefhfoo -#define foojournaldefhfoo +#pragma once /*** This file is part of systemd. @@ -9,16 +8,16 @@ Copyright 2011 Lennart Poettering systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. systemd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with systemd; If not, see . ***/ @@ -29,16 +28,22 @@ #include "macro.h" typedef struct Header Header; + typedef struct ObjectHeader ObjectHeader; typedef union Object Object; + typedef struct DataObject DataObject; typedef struct FieldObject FieldObject; typedef struct EntryObject EntryObject; typedef struct HashTableObject HashTableObject; typedef struct EntryArrayObject EntryArrayObject; +typedef struct TagObject TagObject; + typedef struct EntryItem EntryItem; typedef struct HashItem HashItem; +typedef struct FSPRGHeader FSPRGHeader; + /* Object types */ enum { OBJECT_UNUSED, @@ -48,6 +53,7 @@ enum { OBJECT_DATA_HASH_TABLE, OBJECT_FIELD_HASH_TABLE, OBJECT_ENTRY_ARRAY, + OBJECT_TAG, _OBJECT_TYPE_MAX }; @@ -80,7 +86,6 @@ _packed_ struct FieldObject { le64_t hash; le64_t next_hash_offset; le64_t head_data_offset; - le64_t tail_data_offset; uint8_t payload[]; }; @@ -115,6 +120,14 @@ _packed_ struct EntryArrayObject { le64_t items[]; }; +#define TAG_LENGTH (256/8) + +_packed_ struct TagObject { + ObjectHeader object; + uint64_t seqnum; + uint8_t tag[TAG_LENGTH]; /* SHA-256 HMAC */ +}; + union Object { ObjectHeader object; DataObject data; @@ -122,6 +135,7 @@ union Object { EntryObject entry; HashTableObject hash_table; EntryArrayObject entry_array; + TagObject tag; }; enum { @@ -135,17 +149,23 @@ enum { HEADER_INCOMPATIBLE_COMPRESSED = 1 }; +enum { + HEADER_COMPATIBLE_AUTHENTICATED = 1 +}; + +#define HEADER_SIGNATURE ((char[]) { 'L', 'P', 'K', 'S', 'H', 'H', 'R', 'H' }) + _packed_ struct Header { uint8_t signature[8]; /* "LPKSHHRH" */ - uint32_t compatible_flags; - uint32_t incompatible_flags; + le32_t compatible_flags; + le32_t incompatible_flags; uint8_t state; uint8_t reserved[7]; sd_id128_t file_id; sd_id128_t machine_id; - sd_id128_t boot_id; + sd_id128_t boot_id; /* last writer */ sd_id128_t seqnum_id; - le64_t arena_offset; + le64_t header_size; le64_t arena_size; le64_t data_hash_table_offset; /* for looking up data objects */ le64_t data_hash_table_size; @@ -154,12 +174,31 @@ _packed_ struct Header { le64_t tail_object_offset; le64_t n_objects; le64_t n_entries; - le64_t seqnum; - le64_t first_seqnum; + le64_t tail_seqnum; + le64_t head_seqnum; le64_t entry_array_offset; le64_t head_entry_realtime; le64_t tail_entry_realtime; le64_t tail_entry_monotonic; + /* Added in 187 */ + le64_t n_data; + le64_t n_fields; + /* Added in 189 */ + le64_t n_tags; }; -#endif +#define FSPRG_HEADER_SIGNATURE ((char[]) { 'K', 'S', 'H', 'H', 'R', 'H', 'L', 'P' }) + +_packed_ struct FSPRGHeader { + uint8_t signature[8]; /* "KSHHRHLP" */ + le32_t compatible_flags; + le32_t incompatible_flags; + sd_id128_t machine_id; + sd_id128_t boot_id; /* last writer */ + le64_t header_size; + le64_t fsprg_start_usec; + le64_t fsprg_interval_usec; + le16_t secpar; + le16_t reserved[3]; + le64_t state_size; +};