sd-journal: rename offset -> ret_offset

This commit is contained in:
Yu Watanabe
2024-08-15 04:43:32 +09:00
parent 1e59254ac2
commit 4b509053ec
+27 -31
View File
@@ -672,7 +672,7 @@ static int next_for_match(
uint64_t after_offset,
direction_t direction,
Object **ret,
uint64_t *offset) {
uint64_t *ret_offset) {
int r;
uint64_t np = 0;
@@ -696,7 +696,7 @@ static int next_for_match(
if (r <= 0)
return r;
return journal_file_move_to_entry_by_offset_for_data(f, d, after_offset, direction, ret, offset);
return journal_file_move_to_entry_by_offset_for_data(f, d, after_offset, direction, ret, ret_offset);
} else if (m->type == MATCH_OR_TERM) {
@@ -757,8 +757,8 @@ static int next_for_match(
return r;
}
if (offset)
*offset = np;
if (ret_offset)
*ret_offset = np;
return 1;
}
@@ -818,7 +818,7 @@ static int find_location_for_match(
JournalFile *f,
direction_t direction,
Object **ret,
uint64_t *offset) {
uint64_t *ret_offset) {
int r;
@@ -840,13 +840,13 @@ static int find_location_for_match(
return r;
if (j->current_location.type == LOCATION_HEAD)
return direction == DIRECTION_DOWN ? journal_file_move_to_entry_for_data(f, d, DIRECTION_DOWN, ret, offset) : 0;
return direction == DIRECTION_DOWN ? journal_file_move_to_entry_for_data(f, d, DIRECTION_DOWN, ret, ret_offset) : 0;
if (j->current_location.type == LOCATION_TAIL)
return direction == DIRECTION_UP ? journal_file_move_to_entry_for_data(f, d, DIRECTION_UP, ret, offset) : 0;
return direction == DIRECTION_UP ? journal_file_move_to_entry_for_data(f, d, DIRECTION_UP, ret, ret_offset) : 0;
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_for_data(f, d, j->current_location.seqnum, direction, ret, offset);
return journal_file_move_to_entry_by_seqnum_for_data(f, d, j->current_location.seqnum, direction, ret, ret_offset);
if (j->current_location.monotonic_set) {
r = journal_file_move_to_entry_by_monotonic_for_data(f, d, j->current_location.boot_id, j->current_location.monotonic, direction, ret, offset);
r = journal_file_move_to_entry_by_monotonic_for_data(f, d, j->current_location.boot_id, j->current_location.monotonic, direction, ret, ret_offset);
if (r != 0)
return r;
@@ -859,12 +859,12 @@ static int find_location_for_match(
* (or the last entry of the previous boot when DIRECTION_UP). */
}
if (j->current_location.realtime_set)
return journal_file_move_to_entry_by_realtime_for_data(f, d, j->current_location.realtime, direction, ret, offset);
return journal_file_move_to_entry_by_realtime_for_data(f, d, j->current_location.realtime, direction, ret, ret_offset);
if (j->current_location.monotonic_set)
return move_by_boot_for_data(j, f, direction, j->current_location.boot_id, dp, ret, offset);
return move_by_boot_for_data(j, f, direction, j->current_location.boot_id, dp, ret, ret_offset);
return journal_file_move_to_entry_for_data(f, d, direction, ret, offset);
return journal_file_move_to_entry_for_data(f, d, direction, ret, ret_offset);
} else if (m->type == MATCH_OR_TERM) {
uint64_t np = 0;
@@ -892,8 +892,8 @@ static int find_location_for_match(
return r;
}
if (offset)
*offset = np;
if (ret_offset)
*ret_offset = np;
return 1;
@@ -919,7 +919,7 @@ static int find_location_for_match(
np = cp;
}
return next_for_match(j, m, f, np, direction, ret, offset);
return next_for_match(j, m, f, np, direction, ret, ret_offset);
}
}
@@ -928,28 +928,26 @@ static int find_location_with_matches(
JournalFile *f,
direction_t direction,
Object **ret,
uint64_t *offset) {
uint64_t *ret_offset) {
int r;
assert(j);
assert(f);
assert(ret);
assert(offset);
if (j->level0)
return find_location_for_match(j, j->level0, f, direction, ret, offset);
return find_location_for_match(j, j->level0, f, direction, ret, ret_offset);
/* No matches is simple */
if (j->current_location.type == LOCATION_HEAD)
return direction == DIRECTION_DOWN ? journal_file_next_entry(f, 0, DIRECTION_DOWN, ret, offset) : 0;
return direction == DIRECTION_DOWN ? journal_file_next_entry(f, 0, DIRECTION_DOWN, ret, ret_offset) : 0;
if (j->current_location.type == LOCATION_TAIL)
return direction == DIRECTION_UP ? journal_file_next_entry(f, 0, DIRECTION_UP, ret, offset) : 0;
return direction == DIRECTION_UP ? journal_file_next_entry(f, 0, DIRECTION_UP, ret, ret_offset) : 0;
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);
return journal_file_move_to_entry_by_seqnum(f, j->current_location.seqnum, direction, ret, ret_offset);
if (j->current_location.monotonic_set) {
r = journal_file_move_to_entry_by_monotonic(f, j->current_location.boot_id, j->current_location.monotonic, direction, ret, offset);
r = journal_file_move_to_entry_by_monotonic(f, j->current_location.boot_id, j->current_location.monotonic, direction, ret, ret_offset);
if (r != 0)
return r;
@@ -957,7 +955,7 @@ static int find_location_with_matches(
* (or the last entry of the previous boot when DIRECTION_UP). */
}
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_move_to_entry_by_realtime(f, j->current_location.realtime, direction, ret, ret_offset);
if (j->current_location.monotonic_set) {
uint64_t p = 0;
@@ -971,10 +969,10 @@ static int find_location_with_matches(
return r;
/* Then, move to the next or previous boot. */
return journal_file_next_entry(f, p, direction, ret, offset);
return journal_file_next_entry(f, p, direction, ret, ret_offset);
}
return journal_file_next_entry(f, 0, direction, ret, offset);
return journal_file_next_entry(f, 0, direction, ret, ret_offset);
}
static int next_with_matches(
@@ -982,24 +980,22 @@ static int next_with_matches(
JournalFile *f,
direction_t direction,
Object **ret,
uint64_t *offset) {
uint64_t *ret_offset) {
assert(j);
assert(f);
assert(ret);
assert(offset);
/* No matches is easy. We simple advance the file
* pointer by one. */
if (!j->level0)
return journal_file_next_entry(f, f->current_offset, direction, ret, offset);
return journal_file_next_entry(f, f->current_offset, direction, ret, ret_offset);
/* If we have a match then we look for the next matching entry
* with an offset at least one step larger */
return next_for_match(j, j->level0, f,
direction == DIRECTION_DOWN ? f->current_offset + 1
: f->current_offset - 1,
direction, ret, offset);
direction, ret, ret_offset);
}
static int next_beyond_location(sd_journal *j, JournalFile *f, direction_t direction) {