chiark / gitweb /
journal: abstract the resetting of JournalFile's location
authorMichal Schmidt <mschmidt@redhat.com>
Tue, 16 Dec 2014 19:54:56 +0000 (20:54 +0100)
committerMichal Schmidt <mschmidt@redhat.com>
Thu, 18 Dec 2014 10:56:19 +0000 (11:56 +0100)
src/journal/journal-file.c
src/journal/journal-file.h
src/journal/sd-journal.c

index efe14b0..8cbdbb9 100644 (file)
@@ -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,
index b14d0fc..3a19827 100644 (file)
@@ -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);
index 72c9770..adaf402 100644 (file)
@@ -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) {