diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-12-16 20:54:56 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2014-12-18 11:56:19 +0100 |
commit | 1fc605b0e130149a44abfa38c33f4535cfe548ea (patch) | |
tree | 4341b3adfd057df42d3d1d529cf22472784b89f1 /src/journal | |
parent | 99cc7653a83af6647f28ac0cbedf6f6062e92b72 (diff) |
journal: abstract the resetting of JournalFile's location
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journal-file.c | 4 | ||||
-rw-r--r-- | src/journal/journal-file.h | 1 | ||||
-rw-r--r-- | src/journal/sd-journal.c | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index efe14b0d92..8cbdbb9f96 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -1928,6 +1928,10 @@ int journal_file_move_to_entry_by_monotonic( ret, offset, NULL); } +void journal_file_reset_location(JournalFile *f) { + f->current_offset = 0; +} + int journal_file_next_entry( JournalFile *f, Object *o, uint64_t p, diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h index b14d0fc3e3..3a19827fb7 100644 --- a/src/journal/journal-file.h +++ b/src/journal/journal-file.h @@ -189,6 +189,7 @@ int journal_file_find_data_object_with_hash(JournalFile *f, const void *data, ui int journal_file_find_field_object(JournalFile *f, const void *field, uint64_t size, Object **ret, uint64_t *offset); int journal_file_find_field_object_with_hash(JournalFile *f, const void *field, uint64_t size, uint64_t hash, Object **ret, uint64_t *offset); +void journal_file_reset_location(JournalFile *f); int journal_file_next_entry(JournalFile *f, Object *o, uint64_t p, direction_t direction, Object **ret, uint64_t *offset); int journal_file_next_entry_for_data(JournalFile *f, Object *o, uint64_t p, uint64_t data_offset, direction_t direction, Object **ret, uint64_t *offset); diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index 72c9770a99..adaf402f46 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -87,7 +87,7 @@ static void detach_location(sd_journal *j) { j->current_field = 0; ORDERED_HASHMAP_FOREACH(f, j->files, i) - f->current_offset = 0; + journal_file_reset_location(f); } static void reset_location(sd_journal *j) { |