zero(j->current_location);
}
-static void init_location(Location *l, JournalFile *f, Object *o) {
+static void init_location(Location *l, LocationType type, JournalFile *f, Object *o) {
assert(l);
+ assert(type == LOCATION_DISCRETE || type == LOCATION_SEEK);
assert(f);
assert(o->object.type == OBJECT_ENTRY);
- l->type = LOCATION_DISCRETE;
+ l->type = type;
l->seqnum = le64toh(o->entry.seqnum);
l->seqnum_id = f->header->seqnum_id;
l->realtime = le64toh(o->entry.realtime);
l->seqnum_set = l->realtime_set = l->monotonic_set = l->xor_hash_set = true;
}
-static void set_location(sd_journal *j, JournalFile *f, Object *o, uint64_t offset) {
+static void set_location(sd_journal *j, LocationType type, JournalFile *f, Object *o, uint64_t offset) {
assert(j);
+ assert(type == LOCATION_DISCRETE || type == LOCATION_SEEK);
assert(f);
assert(o);
- init_location(&j->current_location, f, o);
+ init_location(&j->current_location, type, f, o);
j->current_file = f;
j->current_field = 0;
assert(af);
assert(ao);
assert(l);
- assert(l->type == LOCATION_DISCRETE);
+ assert(l->type == LOCATION_DISCRETE || l->type == LOCATION_SEEK);
if (l->monotonic_set &&
sd_id128_equal(ao->entry.boot_id, l->boot_id) &&
if (r < 0)
return r;
- set_location(j, new_file, o, new_offset);
+ set_location(j, LOCATION_DISCRETE, new_file, o, new_offset);
return 1;
}
reset_location(j);
- j->current_location.type = LOCATION_DISCRETE;
+ j->current_location.type = LOCATION_SEEK;
if (realtime_set) {
j->current_location.realtime = (uint64_t) realtime;
return -EINVAL;
reset_location(j);
- j->current_location.type = LOCATION_DISCRETE;
+ j->current_location.type = LOCATION_SEEK;
j->current_location.boot_id = boot_id;
j->current_location.monotonic = usec;
j->current_location.monotonic_set = true;
return -EINVAL;
reset_location(j);
- j->current_location.type = LOCATION_DISCRETE;
+ j->current_location.type = LOCATION_SEEK;
j->current_location.realtime = usec;
j->current_location.realtime_set = true;