]>
Commit | Line | Data |
---|---|---|
f39e126e LP |
1 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ |
2 | ||
3 | #ifndef foojournalinternalhfoo | |
4 | #define foojournalinternalhfoo | |
5 | ||
6 | /*** | |
7 | This file is part of systemd. | |
8 | ||
9 | Copyright 2011 Lennart Poettering | |
10 | ||
11 | systemd is free software; you can redistribute it and/or modify it | |
5430f7f2 LP |
12 | under the terms of the GNU Lesser General Public License as published by |
13 | the Free Software Foundation; either version 2.1 of the License, or | |
f39e126e LP |
14 | (at your option) any later version. |
15 | ||
16 | systemd is distributed in the hope that it will be useful, but | |
17 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
5430f7f2 | 19 | Lesser General Public License for more details. |
f39e126e | 20 | |
5430f7f2 | 21 | You should have received a copy of the GNU Lesser General Public License |
f39e126e LP |
22 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
23 | ***/ | |
24 | ||
25 | #include <sys/types.h> | |
26 | #include <inttypes.h> | |
27 | #include <stdbool.h> | |
28 | ||
81527be1 LP |
29 | #include <systemd/sd-id128.h> |
30 | ||
cbdca852 | 31 | #include "journal-def.h" |
f39e126e | 32 | #include "list.h" |
cbdca852 LP |
33 | #include "hashmap.h" |
34 | #include "journal-file.h" | |
35 | ||
f39e126e | 36 | typedef struct Match Match; |
a963990f LP |
37 | typedef struct Location Location; |
38 | typedef struct Directory Directory; | |
39 | ||
cbdca852 LP |
40 | typedef enum MatchType { |
41 | MATCH_DISCRETE, | |
42 | MATCH_OR_TERM, | |
43 | MATCH_AND_TERM | |
44 | } MatchType; | |
f39e126e LP |
45 | |
46 | struct Match { | |
cbdca852 LP |
47 | MatchType type; |
48 | Match *parent; | |
49 | LIST_FIELDS(Match, matches); | |
50 | ||
51 | /* For concrete matches */ | |
f39e126e LP |
52 | char *data; |
53 | size_t size; | |
4fd052ae | 54 | le64_t le_hash; |
f39e126e | 55 | |
cbdca852 LP |
56 | /* For terms */ |
57 | LIST_HEAD(Match, matches); | |
f39e126e LP |
58 | }; |
59 | ||
cbdca852 LP |
60 | typedef enum LocationType { |
61 | LOCATION_HEAD, | |
62 | LOCATION_TAIL, | |
63 | LOCATION_DISCRETE | |
64 | } LocationType; | |
65 | ||
a963990f | 66 | struct Location { |
cbdca852 | 67 | LocationType type; |
f39e126e LP |
68 | |
69 | uint64_t seqnum; | |
70 | sd_id128_t seqnum_id; | |
71 | bool seqnum_set; | |
72 | ||
73 | uint64_t realtime; | |
74 | bool realtime_set; | |
75 | ||
76 | uint64_t monotonic; | |
77 | sd_id128_t boot_id; | |
78 | bool monotonic_set; | |
79 | ||
80 | uint64_t xor_hash; | |
81 | bool xor_hash_set; | |
a963990f LP |
82 | }; |
83 | ||
84 | struct Directory { | |
85 | char *path; | |
86 | int wd; | |
87 | bool is_root; | |
88 | }; | |
f39e126e LP |
89 | |
90 | struct sd_journal { | |
91 | int flags; | |
92 | ||
93 | Hashmap *files; | |
94 | ||
95 | Location current_location; | |
cbdca852 | 96 | |
f39e126e LP |
97 | JournalFile *current_file; |
98 | uint64_t current_field; | |
99 | ||
a963990f LP |
100 | Hashmap *directories_by_path; |
101 | Hashmap *directories_by_wd; | |
102 | ||
f39e126e | 103 | int inotify_fd; |
f39e126e | 104 | |
cbdca852 | 105 | Match *level0, *level1; |
a963990f LP |
106 | |
107 | unsigned current_invalidate_counter, last_invalidate_counter; | |
f39e126e LP |
108 | }; |
109 | ||
cbdca852 LP |
110 | char *journal_make_match_string(sd_journal *j); |
111 | ||
f39e126e | 112 | #endif |