X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fjournal%2Fjournal-def.h;h=d1174456cbdeebb9ca3630305283233e05419291;hp=5cb1e6d9c849fce693ef281889f1eab9b7e347c7;hb=5430f7f2bc7330f3088b894166bf3524a067e3d8;hpb=de7b95cdc3228131498021c2fdcf6647004c3920 diff --git a/src/journal/journal-def.h b/src/journal/journal-def.h index 5cb1e6d9c..d1174456c 100644 --- a/src/journal/journal-def.h +++ b/src/journal/journal-def.h @@ -9,31 +9,33 @@ 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 . ***/ -#include +#include "sparse-endian.h" + +#include #include "macro.h" -#include "sd-id128.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 BisectTableObject BisectTableObject; +typedef struct EntryArrayObject EntryArrayObject; typedef struct EntryItem EntryItem; typedef struct HashItem HashItem; @@ -41,68 +43,85 @@ typedef struct HashItem HashItem; enum { OBJECT_UNUSED, OBJECT_DATA, + OBJECT_FIELD, OBJECT_ENTRY, - OBJECT_HASH_TABLE, - OBJECT_BISECT_TABLE + OBJECT_DATA_HASH_TABLE, + OBJECT_FIELD_HASH_TABLE, + OBJECT_ENTRY_ARRAY, + _OBJECT_TYPE_MAX +}; + +/* Object flags */ +enum { + OBJECT_COMPRESSED = 1 }; _packed_ struct ObjectHeader { uint8_t type; - uint8_t reserved[7]; - uint64_t size; + uint8_t flags; + uint8_t reserved[6]; + le64_t size; uint8_t payload[]; }; _packed_ struct DataObject { ObjectHeader object; - uint64_t hash; - uint64_t head_entry_offset; - uint64_t tail_entry_offset; - uint64_t prev_hash_offset; - uint64_t next_hash_offset; + le64_t hash; + le64_t next_hash_offset; + le64_t next_field_offset; + le64_t entry_offset; /* the first array entry we store inline */ + le64_t entry_array_offset; + le64_t n_entries; + uint8_t payload[]; +}; + +_packed_ struct FieldObject { + ObjectHeader object; + le64_t hash; + le64_t next_hash_offset; + le64_t head_data_offset; + le64_t tail_data_offset; uint8_t payload[]; }; _packed_ struct EntryItem { - uint64_t object_offset; - uint64_t hash; - uint64_t prev_entry_offset; - uint64_t next_entry_offset; + le64_t object_offset; + le64_t hash; }; _packed_ struct EntryObject { ObjectHeader object; - uint64_t seqnum; - uint64_t realtime; - uint64_t monotonic; + le64_t seqnum; + le64_t realtime; + le64_t monotonic; sd_id128_t boot_id; - uint64_t xor_hash; - uint64_t prev_entry_offset; - uint64_t next_entry_offset; + le64_t xor_hash; EntryItem items[]; }; _packed_ struct HashItem { - uint64_t head_hash_offset; - uint64_t tail_hash_offset; + le64_t head_hash_offset; + le64_t tail_hash_offset; }; _packed_ struct HashTableObject { ObjectHeader object; - HashItem table[]; + HashItem items[]; }; -_packed_ struct BisectTableObject { +_packed_ struct EntryArrayObject { ObjectHeader object; - uint64_t table[]; + le64_t next_entry_array_offset; + le64_t items[]; }; union Object { ObjectHeader object; DataObject data; + FieldObject field; EntryObject entry; HashTableObject hash_table; - BisectTableObject bisect_table; + EntryArrayObject entry_array; }; enum { @@ -111,34 +130,36 @@ enum { STATE_ARCHIVED }; +/* Header flags */ +enum { + HEADER_INCOMPATIBLE_COMPRESSED = 1 +}; + _packed_ struct Header { uint8_t signature[8]; /* "LPKSHHRH" */ uint32_t compatible_flags; uint32_t incompatible_flags; - uint32_t state; - uint8_t reserved[4]; + 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 seqnum_id; - uint64_t arena_offset; - uint64_t arena_size; - uint64_t arena_max_size; - uint64_t arena_min_size; - uint64_t arena_keep_free; - uint64_t hash_table_offset; /* for looking up data objects */ - uint64_t hash_table_size; - uint64_t bisect_table_offset; /* for looking up entry objects */ - uint64_t bisect_table_size; - uint64_t head_object_offset; - uint64_t tail_object_offset; - uint64_t head_entry_offset; - uint64_t tail_entry_offset; - uint64_t last_bisect_offset; - uint64_t n_objects; - uint64_t seqnum; - uint64_t head_entry_realtime; - uint64_t tail_entry_realtime; + le64_t arena_offset; + le64_t arena_size; + le64_t data_hash_table_offset; /* for looking up data objects */ + le64_t data_hash_table_size; + le64_t field_hash_table_offset; /* for looking up field objects */ + le64_t field_hash_table_size; + le64_t tail_object_offset; + le64_t n_objects; + le64_t n_entries; + le64_t seqnum; + le64_t first_seqnum; + le64_t entry_array_offset; + le64_t head_entry_realtime; + le64_t tail_entry_realtime; + le64_t tail_entry_monotonic; }; #endif