1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 Copyright 2011 Lennart Poettering
10 #include <sys/types.h>
13 #include "sd-journal.h"
16 #include "journal-def.h"
17 #include "journal-file.h"
21 typedef struct Match Match
;
22 typedef struct Location Location
;
23 typedef struct Directory Directory
;
25 typedef enum MatchType
{
34 LIST_FIELDS(Match
, matches
);
36 /* For concrete matches */
42 LIST_HEAD(Match
, matches
);
68 unsigned last_seen_generation
;
77 OrderedHashmap
*files
;
78 IteratedCache
*files_cache
;
81 Location current_location
;
83 JournalFile
*current_file
;
84 uint64_t current_field
;
86 Match
*level0
, *level1
, *level2
;
91 unsigned current_invalidate_counter
, last_invalidate_counter
;
92 usec_t last_process_usec
;
95 /* Iterating through unique fields and their data values */
97 JournalFile
*unique_file
;
98 uint64_t unique_offset
;
100 /* Iterating through known fields */
101 JournalFile
*fields_file
;
102 uint64_t fields_offset
;
103 uint64_t fields_hash_table_index
;
105 size_t fields_buffer_allocated
;
112 bool unique_file_lost
:1; /* File we were iterating over got
113 removed, and there were no more
114 files, so sd_j_enumerate_unique
115 will return a value equal to 0. */
116 bool fields_file_lost
:1;
117 bool has_runtime_files
:1;
118 bool has_persistent_files
:1;
120 size_t data_threshold
;
122 Hashmap
*directories_by_path
;
123 Hashmap
*directories_by_wd
;
128 char *journal_make_match_string(sd_journal
*j
);
129 void journal_print_header(sd_journal
*j
);
131 #define JOURNAL_FOREACH_DATA_RETVAL(j, data, l, retval) \
132 for (sd_journal_restart_data(j); ((retval) = sd_journal_enumerate_data((j), &(data), &(l))) > 0; )