journal-def.h revision 0ac38b707212e9aa40e25d65ffbae648cc9116f5
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering#ifndef foojournaldefhfoo
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering#define foojournaldefhfoo
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering/***
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering This file is part of systemd.
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering Copyright 2011 Lennart Poettering
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering systemd is free software; you can redistribute it and/or modify it
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering under the terms of the GNU General Public License as published by
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering the Free Software Foundation; either version 2 of the License, or
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering (at your option) any later version.
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering systemd is distributed in the hope that it will be useful, but
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering General Public License for more details.
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering You should have received a copy of the GNU General Public License
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering***/
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering#include <inttypes.h>
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering
0591220f339c313761f9a208e88fb719db566993Zbigniew Jędrzejewski-Szmek#include "macro.h"
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poettering#include "sd-id128.h"
6482f6269c87d2249e52e889a63adbdd50f2d691Ronny Chevalier
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poetteringtypedef struct Header Header;
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poetteringtypedef struct ObjectHeader ObjectHeader;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poetteringtypedef union Object Object;
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poetteringtypedef struct DataObject DataObject;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poetteringtypedef struct EntryObject EntryObject;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poetteringtypedef struct HashTableObject HashTableObject;
7410616cd9dbbec97cf98d75324da5cda2b2f7a2Lennart Poetteringtypedef struct BisectTableObject BisectTableObject;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poetteringtypedef struct EntryItem EntryItem;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poetteringtypedef struct HashItem HashItem;
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering/* Object types */
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poetteringenum {
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering OBJECT_UNUSED,
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering OBJECT_DATA,
7410616cd9dbbec97cf98d75324da5cda2b2f7a2Lennart Poettering OBJECT_ENTRY,
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering OBJECT_HASH_TABLE,
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering OBJECT_BISECT_TABLE
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering};
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering
7410616cd9dbbec97cf98d75324da5cda2b2f7a2Lennart Poettering_packed_ struct ObjectHeader {
7410616cd9dbbec97cf98d75324da5cda2b2f7a2Lennart Poettering uint8_t type;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering uint8_t reserved[7];
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering uint64_t size;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering uint8_t payload[];
7410616cd9dbbec97cf98d75324da5cda2b2f7a2Lennart Poettering};
7410616cd9dbbec97cf98d75324da5cda2b2f7a2Lennart Poettering
7410616cd9dbbec97cf98d75324da5cda2b2f7a2Lennart Poettering_packed_ struct DataObject {
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering ObjectHeader object;
7410616cd9dbbec97cf98d75324da5cda2b2f7a2Lennart Poettering uint64_t hash;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering uint64_t head_entry_offset;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering uint64_t tail_entry_offset;
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering uint64_t prev_hash_offset;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering uint64_t next_hash_offset;
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering uint8_t payload[];
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering};
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering
2cfbd749af308bdbe56edcfed7f3eea0fc2b93d2Lennart Poettering_packed_ struct EntryItem {
7410616cd9dbbec97cf98d75324da5cda2b2f7a2Lennart Poettering uint64_t object_offset;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering uint64_t prev_entry_offset;
7410616cd9dbbec97cf98d75324da5cda2b2f7a2Lennart Poettering uint64_t next_entry_offset;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering};
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering_packed_ struct EntryObject {
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering ObjectHeader object;
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering uint64_t seqnum;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering uint64_t realtime;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering uint64_t monotonic;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering sd_id128_t boot_id;
7410616cd9dbbec97cf98d75324da5cda2b2f7a2Lennart Poettering uint64_t xor_hash;
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering uint64_t prev_entry_offset;
7410616cd9dbbec97cf98d75324da5cda2b2f7a2Lennart Poettering uint64_t next_entry_offset;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering EntryItem items[];
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering};
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering_packed_ struct HashItem {
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering uint64_t head_hash_offset;
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering uint64_t tail_hash_offset;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering};
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering
2cfbd749af308bdbe56edcfed7f3eea0fc2b93d2Lennart Poettering_packed_ struct HashTableObject {
2cfbd749af308bdbe56edcfed7f3eea0fc2b93d2Lennart Poettering ObjectHeader object;
2cfbd749af308bdbe56edcfed7f3eea0fc2b93d2Lennart Poettering HashItem table[];
2cfbd749af308bdbe56edcfed7f3eea0fc2b93d2Lennart Poettering};
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering_packed_ struct BisectTableObject {
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering ObjectHeader object;
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering uint64_t table[];
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering};
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poetteringunion Object {
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering ObjectHeader object;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering DataObject data;
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering EntryObject entry;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering HashTableObject hash_table;
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poettering BisectTableObject bisect_table;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering};
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poetteringenum {
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering STATE_OFFLINE,
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering STATE_ONLINE,
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering STATE_ARCHIVED
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering};
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering_packed_ struct Header {
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering uint8_t signature[8]; /* "LPKSHHRH" */
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering uint32_t compatible_flags;
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering uint32_t incompatible_flags;
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering uint32_t state;
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering uint8_t reserved[4];
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering sd_id128_t file_id;
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering sd_id128_t machine_id;
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering sd_id128_t boot_id;
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering sd_id128_t seqnum_id;
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering uint64_t arena_offset;
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering uint64_t arena_size;
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering uint64_t arena_max_size;
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering uint64_t arena_min_size;
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering uint64_t arena_keep_free;
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering uint64_t hash_table_offset; /* for looking up data objects */
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering uint64_t hash_table_size;
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering uint64_t bisect_table_offset; /* for looking up entry objects */
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering uint64_t bisect_table_size;
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering uint64_t head_object_offset;
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering uint64_t tail_object_offset;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering uint64_t head_entry_offset;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering uint64_t tail_entry_offset;
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering uint64_t last_bisect_offset;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering uint64_t n_objects;
2cfbd749af308bdbe56edcfed7f3eea0fc2b93d2Lennart Poettering uint64_t seqnum;
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering uint64_t head_entry_realtime;
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering uint64_t tail_entry_realtime;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering};
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering
2cfbd749af308bdbe56edcfed7f3eea0fc2b93d2Lennart Poettering#endif
2cfbd749af308bdbe56edcfed7f3eea0fc2b93d2Lennart Poettering