4 This file is part of systemd.
6 Copyright 2011 Lennart Poettering
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 #include <sys/types.h>
27 #include "sd-journal.h"
30 #include "journal-def.h"
31 #include "journal-file.h"
35 typedef struct Match Match
;
36 typedef struct Location Location
;
37 typedef struct Directory Directory
;
39 typedef enum MatchType
{
48 LIST_FIELDS(Match
, matches
);
50 /* For concrete matches */
56 LIST_HEAD(Match
, matches
);
90 OrderedHashmap
*files
;
93 Location current_location
;
95 JournalFile
*current_file
;
96 uint64_t current_field
;
98 Match
*level0
, *level1
, *level2
;
103 unsigned current_invalidate_counter
, last_invalidate_counter
;
104 usec_t last_process_usec
;
106 /* Iterating through unique fields and their data values */
108 JournalFile
*unique_file
;
109 uint64_t unique_offset
;
111 /* Iterating through known fields */
112 JournalFile
*fields_file
;
113 uint64_t fields_offset
;
114 uint64_t fields_hash_table_index
;
116 size_t fields_buffer_allocated
;
123 bool unique_file_lost
:1; /* File we were iterating over got
124 removed, and there were no more
125 files, so sd_j_enumerate_unique
126 will return a value equal to 0. */
127 bool fields_file_lost
:1;
128 bool has_runtime_files
:1;
129 bool has_persistent_files
:1;
131 size_t data_threshold
;
133 Hashmap
*directories_by_path
;
134 Hashmap
*directories_by_wd
;
139 char *journal_make_match_string(sd_journal
*j
);
140 void journal_print_header(sd_journal
*j
);
142 #define JOURNAL_FOREACH_DATA_RETVAL(j, data, l, retval) \
143 for (sd_journal_restart_data(j); ((retval) = sd_journal_enumerate_data((j), &(data), &(l))) > 0; )