The current offset is sufficient information.
int journal_file_next_entry(
JournalFile *f,
int journal_file_next_entry(
JournalFile *f,
direction_t direction,
Object **ret, uint64_t *offset) {
direction_t direction,
Object **ret, uint64_t *offset) {
n = le64toh(f->header->n_entries);
if (n <= 0)
return 0;
n = le64toh(f->header->n_entries);
if (n <= 0)
return 0;
i = direction == DIRECTION_DOWN ? 0 : n - 1;
else {
i = direction == DIRECTION_DOWN ? 0 : n - 1;
else {
- if (o->object.type != OBJECT_ENTRY)
- return -EINVAL;
-
r = generic_array_bisect(f,
le64toh(f->header->entry_array_offset),
le64toh(f->header->n_entries),
r = generic_array_bisect(f,
le64toh(f->header->entry_array_offset),
le64toh(f->header->n_entries),
void journal_file_reset_location(JournalFile *f);
void journal_file_save_location(JournalFile *f, direction_t direction, Object *o, uint64_t offset);
int journal_file_compare_locations(JournalFile *af, JournalFile *bf);
void journal_file_reset_location(JournalFile *f);
void journal_file_save_location(JournalFile *f, direction_t direction, Object *o, uint64_t offset);
int journal_file_compare_locations(JournalFile *af, JournalFile *bf);
-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(JournalFile *f, 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);
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);
/* No matches is simple */
if (j->current_location.type == LOCATION_HEAD)
/* No matches is simple */
if (j->current_location.type == LOCATION_HEAD)
- return journal_file_next_entry(f, NULL, 0, DIRECTION_DOWN, ret, offset);
+ return journal_file_next_entry(f, 0, DIRECTION_DOWN, ret, offset);
if (j->current_location.type == LOCATION_TAIL)
if (j->current_location.type == LOCATION_TAIL)
- return journal_file_next_entry(f, NULL, 0, DIRECTION_UP, ret, offset);
+ return journal_file_next_entry(f, 0, DIRECTION_UP, ret, offset);
if (j->current_location.seqnum_set && sd_id128_equal(j->current_location.seqnum_id, f->header->seqnum_id))
return journal_file_move_to_entry_by_seqnum(f, j->current_location.seqnum, direction, ret, offset);
if (j->current_location.monotonic_set) {
if (j->current_location.seqnum_set && sd_id128_equal(j->current_location.seqnum_id, f->header->seqnum_id))
return journal_file_move_to_entry_by_seqnum(f, j->current_location.seqnum, direction, ret, offset);
if (j->current_location.monotonic_set) {
if (j->current_location.realtime_set)
return journal_file_move_to_entry_by_realtime(f, j->current_location.realtime, direction, ret, offset);
if (j->current_location.realtime_set)
return journal_file_move_to_entry_by_realtime(f, j->current_location.realtime, direction, ret, offset);
- return journal_file_next_entry(f, NULL, 0, direction, ret, offset);
+ return journal_file_next_entry(f, 0, direction, ret, offset);
} else
return find_location_for_match(j, j->level0, f, direction, ret, offset);
}
} else
return find_location_for_match(j, j->level0, f, direction, ret, offset);
}
Object **ret,
uint64_t *offset) {
Object **ret,
uint64_t *offset) {
assert(ret);
assert(offset);
assert(ret);
assert(offset);
cp = *offset;
/* No matches is easy. We simple advance the file
* pointer by one. */
if (!j->level0)
cp = *offset;
/* No matches is easy. We simple advance the file
* pointer by one. */
if (!j->level0)
- return journal_file_next_entry(f, c, cp, direction, ret, offset);
+ return journal_file_next_entry(f, cp, direction, ret, offset);
/* If we have a match then we look for the next matching entry
* with an offset at least one step larger */
/* If we have a match then we look for the next matching entry
* with an offset at least one step larger */
#endif
journal_file_dump(f);
#endif
journal_file_dump(f);
- assert_se(journal_file_next_entry(f, NULL, 0, DIRECTION_DOWN, &o, &p) == 1);
+ assert_se(journal_file_next_entry(f, 0, DIRECTION_DOWN, &o, &p) == 1);
assert_se(le64toh(o->entry.seqnum) == 1);
assert_se(le64toh(o->entry.seqnum) == 1);
- assert_se(journal_file_next_entry(f, o, p, DIRECTION_DOWN, &o, &p) == 1);
+ assert_se(journal_file_next_entry(f, p, DIRECTION_DOWN, &o, &p) == 1);
assert_se(le64toh(o->entry.seqnum) == 2);
assert_se(le64toh(o->entry.seqnum) == 2);
- assert_se(journal_file_next_entry(f, o, p, DIRECTION_DOWN, &o, &p) == 1);
+ assert_se(journal_file_next_entry(f, p, DIRECTION_DOWN, &o, &p) == 1);
assert_se(le64toh(o->entry.seqnum) == 3);
assert_se(le64toh(o->entry.seqnum) == 3);
- assert_se(journal_file_next_entry(f, o, p, DIRECTION_DOWN, &o, &p) == 0);
+ assert_se(journal_file_next_entry(f, p, DIRECTION_DOWN, &o, &p) == 0);
- assert_se(journal_file_next_entry(f, NULL, 0, DIRECTION_DOWN, &o, &p) == 1);
+ assert_se(journal_file_next_entry(f, 0, DIRECTION_DOWN, &o, &p) == 1);
assert_se(le64toh(o->entry.seqnum) == 1);
assert_se(journal_file_find_data_object(f, test, strlen(test), NULL, &p) == 1);
assert_se(le64toh(o->entry.seqnum) == 1);
assert_se(journal_file_find_data_object(f, test, strlen(test), NULL, &p) == 1);